MapServer教程3

Compiling on Unix

Compiling on Win32

PHP MapScript Installation

.NET MapScript Compilation

IIS Setup for MapServer

Oracle Installation

V8 MapScript Support

 

 

1. Compiling on Unix

Introduction
Obtaining the necessary software
Anti-Grain Geometry Support
OGC Support
Spatial Warehousing
Compiling
Installation
明尼苏达大学的地图服务器是一个开放源码和免费可用的地图绘制引擎的网络。由于其开源特性,它可以在各种平台和操作系统上编译。我们将重点讨论如何在类Unix平台上获取、编译和安装MapServer。

注意:详细的配置选项保存在源目录根目录下打包的install.cmake文件中:

INSTALL.CMAKE

 

CMAKE构建说明
==============

从6.4版开始,mapserver是用cmake构建工具而不是以前的自动工具链。cmake是开源的,免费的,通常包含在分发包中,或者可以下载和编译第三方依赖关系。
cmake本身不执行mapserver源代码的实际编译,它主要创建平台特定的构建文件,然后标准可以使用这些文件构建实用程序(在Unix上make、在Windows上创建Visual Studio、在OSX上生成Xcode等)

安装CMAKE
------------


MapServer至少需要CMAKe2.6.0版,尽管如此旧版本的构建过程还没有经过仔细的测试。建议使用2.8.0及以上版本。


发行版打包版本
…………………
Linux发行版通常包含cmake,可以使用常用的包管理器:apt-get,yum,yast,等等…

也可以自己安装

...................

前往cmake官网下载源tarball(用于unixes)或二进制安装程序(用于windows)。

如果您是从源代码构建的,那么构建过程将在tarball自述文件中详细说明,并且仅包含在

 $ tar xzf cmake-x.y.z.tar.gz
 $ cd cmake-x.y.z
 $ ./bootstrap
 $ make
 # make install

使用cmake创建特定于MapServer平台的项目

-----------------------------------------------------------

虽然您可以通过下载tarball或使用git克隆从mapserver的源目录运行和构建,**强烈**建议运行“源代码不足”的构建,也就是说,将所有构建文件编译并创建在与实际MapServer源不同的目录中。这允许不同的配置彼此同时运行(例如,发布和调试构建、交叉编译、启用的功能等)。

从命令行运行cmake

...................................

mkdir build
cd build
cmake ..
## fix dependency issues
make

运行cmake的GUI版本

………………………………

CMAKE可以在图形模式下运行,在这种情况下,可用选项列表以更用户友好的方式显示。

mkdir build
cd build
ccmake ..
## follow instructions, fix dependency issues
make

选项和依赖项

…………………

根据系统默认位置中可用的软件包,前面的“cmake…”步骤很可能失败,并显示缺少依赖项的消息(默认情况下,mapserver有*多个*依赖项)。CMAKE打印出来的错误消息应该让您对下一步应该采取什么步骤有一个相当好的了解,这取决于失败的依赖性是否是构建中需要的一个特性。

-或者通过使用-dwith_dependency=0重新运行cmake来禁用依赖项,例如

  $ cmake .. -DWITH_CAIRO=0

-或者如果失败的依赖与你想要植入的特征有关,而且cmake没有能发现它的安装位置,有3种可能的原因:

1. 您尚未安装第三方软件包和/或第三方开发头文件。使用标准包管理器安装失败的包,以及它的开发头文件。Linux上的开发包通常以“-dev”或“-devel”结尾,例如libcairo2-devel、libpng-dev等…

   $ (sudo) apt-get install libcairo-dev
   $ cmake ..

2. 您已将第三方软件包安装在非标准位置,必须将其提供给cmake,以便它能够找到所需的头和库。

   $ cmake .. -DCMAKE_PREFIX_PATH=/opt/cairo-1.18.2

cmake希望这些非标准前缀包含标准子目录,即/opt/cairo-1.18.2/include/cairo.h和/opt/cairo-1.18.2/lib/libcairo.so。您可以在cmake命令行上指定多个前缀,方法是使用特定于平台的分隔符(例如unixes上的“:”分隔这些前缀),例如。

  $ cmake .. -DCMAKE_PREFIX_PATH=/opt/cairo-1.18.2:/opt/freeware

3. 如果您确定软件包开发头已安装,并且/或者您指向了有效的安装前缀,但cmake仍失败,那么MapServer的cmake安装程序存在问题,您可以在邮件列表或问题跟踪程序中显示此问题。

可用选项

-------------

以下是一系列的选项,从MapServer的CMakeLists.txt的配置文件中取得的。在选项的描述之后,打开/关闭标志将说明默认情况下是否启用了该选项(在这种情况下,如果找不到依赖项,则cmake步骤将失败)。所有这些都可以通过将“-dwith to xxx=0”或“-dwith to xxx=1”传递到“cmake..”调用来启用或禁用,以覆盖默认选择。

此自述文件可能与实际提供的CMakeList文件不同步。

有关最新选项,请参阅cmakelists.txt文件。

-选项(使用“选择是否应内置重新投影支持”选项)

-选项(在“启用本机kml输出支持(需要libxml2支持)”关闭的情况下)

-选项(关闭“启用SoS服务器支持(需要proj和libxml2支持)”时)

-选项(打开“启用WMS服务器支持(需要项目支持)”时)

-选项(使用_fribidi“选择是否应启用fribidi glyph重新排序(适用于从左到右的语言)(需要harfbuzz)”打开)

-选项(使用_HarfBuzz“选择是否应内置HarfBuzz复杂脚本glyph形状支持(需要fribidi)”on)

-选项(使用_ICONV“选择是否应内置ICONV国际化支持”on)

-选项(使用“cairo”选择是否应内置cairo渲染支持(SVG和PDF输出需要)“on”

-选项(使用“svg cairo”选择是否应内置svg符号支持(通过libsvgcairo)(需要cairo、libsvg、libsvg cairo)。与librsvg不兼容)“关)

-选项(使用“rsvg”选择是否应内置SVG符号支持(通过librsvg)(需要cairo、librsvg)。与libsvg cairo不兼容)“关)

-选项(使用“mysql”选择是否应内置“off”mysql连接支持)

-选项(使用“fcgi”选择是否应内置fastcgi支持)

-选项(使用“选择是否应内置地理几何操作支持”选项)

-选项(使用“Postgis”选择是否应在“on”中内置Postgis输入支持)

-选项(使用“选择是否应内置gdal输入光栅支持”on)

-选项(使用“ogr”选择是否应内置“ogr/gdal输入矢量支持”)。

-选项(关闭“启用curl HTTP支持(WMS/WFS客户端、远程SLD和pixmap符号需要)”选项)

-选项(关闭“启用客户端WMS层支持(需要CURL和GDAL支持)”时)

-选项(在“启用客户端WMS层支持(需要CURL和OGR支持)”关闭的情况下)

-选项(在“启用WFS服务器支持(需要PROJ和OGR支持)”打开的情况下)

-选项(在“启用WCS服务器支持(需要proj和gdal支持)”打开的情况下)

-选项(使用“libxml2”选择是否应内置libxml2支持(用于SoS、WCS 1.12.0和WFS 1.1)”on)

-选项(使用“线程安全”选择是否应构建libmapserver的线程安全版本(仅建议用于某些mapscripts)“关闭”

-选项(打开“启用GIF支持(用于PixMap加载)”)

-选项(关闭“启用python mapscript支持”后)

-选项(关闭“启用php-mapscript支持”时)

-选项(在关闭“启用Perl MapScript支持”的情况下)

-选项(关闭“启用Ruby MapScript支持”时)

-选项(使用Java)使JavaMaScript支持“关闭”

-选项(关闭“启用c mapscript支持”时)

-选项(关闭“包括Oracle空间数据库输入支持”选项)

-选项(使用“Oracle插件”时,将“Oracle空间数据库输入支持作为插件”关闭)

-选项(当_MSSQL2008“包括MSSQL2008数据库输入支持作为插件”关闭时)

-选项(使用_sde_plugin“包含ArcSDE支持作为插件(必须指定sde_include_dir和sde_library_dir)。”关闭)

-选项(带“U SDE”包括ArcSDE支持。添加-dsde_version=91以使用9.1 Arcsde version“关闭)

-选项(在“include xmp output metadata support”关闭的情况下)

-选项(在“include native xml mapfile support(requires libxslt/libexslt)”关闭的情况下)

-选项(在关闭“include javascript v8 scripting”的情况下)

以下选项适用于高级用户,即,除非您知道自己在做什么,否则不应启用它们:

-选项(build_static“也构建静态版本的mapserver”off)

-选项(link_static_libmapserver“link to static version of libmapserver(also for mapscripts)”off)

-选项(带有“Apache模块”的选项包括(实验性的)对Apache模块的支持“关闭”

-选项(关闭“通用舍入”后)

-选项(在点结构中包含Z和M坐标的情况下)(高级,不推荐)“关闭”

以下是一些不特定于MapServer本身的常见CMAKE选项:

-cmake_install_prefix:安装MapServer二进制文件和库的路径。在Unix上默认为/usr/local。

-cmake_prefix_path:特定于平台的分隔符分隔前缀列表,其中将查找依赖项,例如

“-dcmake_prefix_path=/opt/freeware:/opt/jdk-1.5.6-cmake_build_type:指定生成类型。通常是“调试”或“发布”之一,例如

“-dcmake_build_type=release”“-dcmake_build_type=debug”

 

您可以在以下位置找到更广泛的cmake变量列表:http://www.cmake.org/wiki/cmake_Useful_Variables。

 

您还可以查看MapServerCompilation wiki页面以获取其他信息。

获取必要的软件

您可以从下载部分获得mapserver源代码和演示包。
您还可以从git获取最新的mapserver源代码。

所需的外部库

•libpng:默认情况下,libpng应该在您的系统上。回到1.2.7版本应该可以工作。
•freetype:需要2.x或更高版本。
•libjpeg:libjpeg允许mapserver以jpeg格式呈现图像。默认情况下,应在系统上安装足够的版本(可能是1998年的6B版本)

•zlib:zlib默认应该在您的系统上。虽然mapserver没有直接使用,但它是libpng的强制依赖项。

高度推荐的库

•libproj:libproj为mapserver提供投影支持。需要4.4.6或更高版本。
•libCurl:libCURL是OGC(WFS/WMS/WCS)客户端和服务器支持的基础。需要7.10或更高版本。
•ogr:ogr提供了对许多矢量格式的访问。
•gdal:gdal提供对许多光栅格式的访问。

可选外部库

•geos:geos允许mapserver执行空间谓词和代数操作(内部、接触等以及联合、差异、交叉)。
4.10版新增。
•libxml:libxml需要在mapserver中使用ogc sos支持
4.10版新增。
•Oracle空间OCI:您平台的客户端库可从Oracle_a_zs网站下载。理想情况下,您的客户机库与您查询的数据库相匹配,但这不是一个困难的需求。

•libpq:libpq需要支持在PostgreSQL数据库中使用PostGIS几何。理想情况下,您的客户机库与您正在查询的数据库相匹配。
•giflib:libgif/libgif用于读取用作像素地图符号的gif文件。
•fastcgi:fastcgi是一种流行的协议,用于将mapserver与各种Web服务器连接起来。您需要安装开发包。有关如何在MapServer中使用此功能的更多详细信息,请参阅fastcgi。在Ubuntu上,这是:

$ apt-get -y install libfcgi-dev

•cairo(svg,pdf)支持:此库需要生成pdf和svg输出。如果在Ubuntu系统上安装了a zre,它可以与aijapt get install-y libcairo2 dev_ a i一起安装。
•KML支持:此渲染器没有外部依赖关系。
•harfbuzz:支持复杂的脚本变形(简化:在字符之间插入连接符的工具)。harfbuzz算法将应用于已确定为非拉丁语的文本字符串(即,harfbuzz导致的速度减慢仅限于实际需要的语言)成形)。需要fribidi。

另请参见:
RFC98型
7.0版的新增功能。
•mysql:支持加入mysql(with_mysql选项)。

可选功能

•cairo SVG Parser支持:with_svgcairo选项是改进SVG支持的建议的一部分。使用此功能需要安装libsvg cairo库,该库位于:http://cairographics.org/snapshots/。您需要编译和安装cairo、libsvg和libsvg cairo。
•SVG支持可以通过未维护的libsvg/libsvg cairo组合或通过librsvg(with_rsvg选项)启用,代价是增加依赖性。如果您的发行版为librsvg提供了一个包,请使用librsvg;如果编译librsvg依赖项的成本太重要,请返回libsvgcairo。

防颗粒几何支撑

由于5.0版MapServer支持agg渲染后端。MapServer5.6+将它直接嵌入到源树中,您不必做任何特殊的事情来支持它。

OGC支持

MapServer为许多OGC规范提供支持。有关概述,请参阅MapServer OGC规范支持。

WMS支持
WMS服务器

自动启用对WMS服务器的支持。
您可以通过在配置输出中查找以下内容来检查它:

-- * WMS SERVER: ENABLED

如果出于某种原因,您不希望得到WMS支持,您可以使用aij-dwith wms=off a i将其强制关闭。
有关使用此功能的详细信息,请参阅WMS服务器。

WMS客户端

还支持级联。这使得MapServer可以透明地通过WMS获取远程层,基本上就像客户机一样,并将它们与其他层结合以生成最终的地图。

要启用此功能,您需要将with_client_wms选项传递到配置脚本。MapServer将自动查找libcurl,这也是必需的。

要验证此功能是否已启用,请检查配置输出:

-- * WMS CLIENT: ENABLED

注意:此功能在默认情况下是禁用的,您必须特别请求它。

有关使用此功能的详细信息,请参阅WMS客户端。

WFS支持
WFS服务器

默认情况下启用对WFS服务器的支持。需要OGR和项目4支持。
要验证此功能是否已启用,请检查配置输出:

-- * WFS SERVER: ENABLED

如果出于某种原因,你不想得到WFS的支持,你可以使用aij-dwith wfs=off a i强制退出。
有关使用此功能的详细信息,请参阅WFS服务器。

WFS客户端

MapServer还可以充当WFS客户机。这实际上意味着,map server从远程服务器的zs wfs输出读取它的zs数据,并将其呈现为地图,就像从shapefile读取数据时一样。

为了启用此功能,您需要确保您有OGR(用Xerces支持构建)和Proj.4支持,并将with_client_wfs选项传递给您的配置脚本。MapServer将自动查找libcurl,这也是必需的。

要验证此功能是否已启用,请检查配置输出:

-- * WFS CLIENT: ENABLED

注意:此功能在默认情况下是禁用的,您必须特别请求它。

有关使用此功能的详细信息,请参阅WFS客户端。

WCS服务器

默认情况下启用了对WCS服务器的支持。必须针对某些库编译WCS。有关此服务的详细信息,请参阅WCS服务器。

要验证此功能是否已启用,请检查配置输出:

-- * WCS SERVER: ENABLED

如果出于某种原因,您不想让ZT支持WCS,您可以使用aij-dwith wcs=off a i将其强制关闭。

SoS服务器

通过使用WITH_SOS选项启用对SOS的支持。SOS服务器中提供了有关此服务的更多信息。

要验证此功能是否已启用,请检查配置输出:

-- * SOS SERVER: ENABLED

注意:默认情况下,此功能被禁用,您必须特别请求它。

空间仓储

MapServer可以使用各种数据输入源。越来越受欢迎的解决方案之一是使用支持空间的数据库来存储数据,并直接使用它们来为Web绘制地图。

在这里,您将了解如何使MapServer能够与这些产品之一进行对话。有关如何使用这些文件的详细信息,请参阅mapfile参考。本节仅详细介绍如何编译MapServer以供使用。

PostGIS

PostGIS为PostgreSQL对象关系数据库添加了对地理对象的支持。实际上,postgis aijs-耐心地启用了a i PostgreSQL服务器,允许它用作地理信息系统(gis)的后端空间数据库,与esri a zs sde或oracle a zs空间扩展非常相似。Postgis包含在许多a z包装系统中,但如果需要,您也可以自己滚动。

MapServer可以使用PostGIS作为数据源。Postgis支持在默认情况下启用。
要验证此功能是否已启用,请检查配置输出:

-- * POSTGIS: /usr/local/pgsql/lib/libpq.so

如果出于某种原因您不想获得Postgis支持,您可以使用aij-dwith postgis=off a i将其强制关闭。为了帮助cmake找到Postgis安装,您可以使用cmake_prefix_path选项(例如aij-dcmake_prefix_path=/usr/local/pgsql_a i)。

Oracle空间数据库

MapServer还支持Oracle_a_zs Spatial。要连接到它,您需要使用WITH“OracleSpace”选项针对Oracle库编译mapserver。您很可能需要设置一个Oracle_HOME环境变量,以使其正确配置。

要验证此功能是否已启用,请检查配置输出:

-- * Oracle Spatial: <path to oracle spatial shared library>

编译

在尝试编译MapServer之前,首先要确保安装了所有必需的和/或推荐的库,从而做好准备。这会使你的生活不那么复杂;)。这是我通常使用的顺序:

1. 编译gdal/ogr。描述如何编译gdal/ogr超出了本文档的范围。如果您有许多不同格式的需求,请确保首先安装这些库。我经常发现编译gdal/ogr库通常需要编译mapserver本身的时间!

2. 编译PROJ4。PROJ4是一个直接配置/生成/生成安装库。

3. 编译libcurl。libcurl是一个直接配置/生成/生成安装库。此库仅与其他功能一起使用,因此“aij–with curl config a i won a zt做任何事情,除非类似“aij–with-wmsclient a i”或“aij–with wfsclient a i”。

注意:如果要在访问WMS/WFS服务器时将MAPServer配置为使用SSL,则必须使用_aij–with ssl_a_i选项配置/编译libcurl。有关如何设置此设置的详细信息,请参阅How to set mapserver as a client to access a service over https。

4. 编译/安装可选库。这些可能包括Postgis、Oracle Spatial、Agg、Ming、Pdflib或Mygis。根据需要混合搭配

5. 将mapserver tarball和cd解包到mapserver目录中:

$ tar -zxvf mapserver-X.Y.Z.tar.gz

6. 创建构建目录并配置环境。

创建生成目录:

$ cd mapserver-X.Y.Z
$ mkdir build
$ cd build

使用_aijcmake_a_i配置您的环境(这是一个示例):

$ cmake -DCMAKE_INSTALL_PREFIX=/opt \
-DCMAKE_PREFIX_PATH=/usr/local/pgsql/91:/usr/local:/opt \
-DWITH_CLIENT_WFS=ON \
-DWITH_CLIENT_WMS=ON \
-DWITH_CURL=ON \
-DWITH_SOS=ON \
-DWITH_PHP=ON \
-DWITH_PERL=ON \
-DWITH_RUBY=ON \
-DWITH_JAVA=ON \
-DWITH_CSHARP=ON \
-DWITH_PYTHON=ON \
-DWITH_SVGCAIRO=ON \
-DWITH_ORACLESPATIAL=ON \
-DWITH_MSSQL2008=ON \
../ >../configure.out.txt

默认情况下启用以下选项(7.0版:WITH_-proj,WITH_-wms,WITH_-fribidi,WITH_-harfbuzz,WITH_-iconv,WITH_-cairo,WITH_-fcgi,WITH_-geos,WITH_-postgis,WITH_-gdal,WITH_-ogr,WITH_-wfs,WITH_-wcs,WITH_-libxml2,WITH_-gif。

如果还想构建库的静态版本,可以使用build_static和link_static_libmapserver选项,还可以使用许多其他选项。有关可用cmake选项的最新列表,请参阅cmakeLists.txt。

最好将配置命令放在一个文件中,并将其模式更改为可执行(+X),以保存键入内容并记录MapServer的配置方式。

7. 既然已经配置了构建选项并选择了希望MapServer使用的所有库,那么就可以准备好编译源代码了。

这实际上很简单,只需执行aijmake a i:

$ make

8. 安装MapServer库:

# make install

要确保一切正常,请查找名为mapserv的文件:

$ ls -al mapserv
-rwxr-xr-x 1 user user 13745 mars 11 17:45 mapserv

一个简单的测试是尝试并运行它:

$ ./mapserv
This script can only be used to decode form results and
should be initiated as a CGI process via a httpd server.

上面的信息是完全正常的,并且准确地表达了它所说的意思。如果你还有别的事,事情就大错特错了

安装
MapServer二进制

mapserver程序本身只包含一个文件,即aijmapserver a i二进制可执行文件。这是一个CGI可执行文件,打算由Web服务器调用和运行。

 

2. Compiling on Win32
Introduction
Compiling
Set up a Project Directory
Download MapServer Source Code and Supporting Libraries
The MapServer source code
Set Compilation Options
Compile the Libraries
Compile MapServer
Compiling MapServer with PostGIS support
Common Compiling Errors
Installation
Other Helpful Information
Acknowledgements

–简介
–编译
–建立项目目录
–下载MapServer源代码和支持库
–mapserver源代码
–设置编译选项
–编译库
–编译MapServer
–使用PostGIS支持编译MapServer
–常见的编译错误
–安装
–其他有用信息
–确认

警告:此部分文档已过时。不再使用nmake。cmake也用于win32。cmake指令可以在https://github.com/mapserver/mapserver/blob/master/readme.win32上找到。另请参见https://github.com/mapserver/mapserver/blob/master/appveyor.yml。

--------------------------------------------------------------------
README.WIN32 - Microsoft Visual C++ Build instructions for MapServer
--------------------------------------------------------------------

IMPORTANT - READ THIS FIRST:
----------------------------
The Win32 build process is not very friendly for unexperienced users.
So it is strongly recommended that you use one of the precompiled 
 binaries available on the MapServer site:
 http://www.mapserver.org/download.html#windows

  There are precompiled Win32 binaries available for the last stable
  release and the latest nightly build and they include the most common
  options... so you shouldn't have to compile your own executables.

 
      

  If for some reason you still decide to compile Win32 binaries yourself,
  then don't do it unless you really know what you're doing... and
  hopefully the rest of this file contains some hints that may help
  you. Good Luck!

 --------------------------------------------------------------------

  The easyest way to build Mapserver on Windows on your own is to use the
  build-system from http://gisinternals.com/.
  GISInternals provide a complete set of sources and dependencies and even
  makefiles for the full version of Visual Studio (not Express oder Community).
  You don't have to download and compile them all by your own.

  If you are not using full version of Visual Studio you can not use the makefiles from GISInternals but you can still use the downloads to make your life easier.

  Building with the full version of Visual Studio is easy.
  Download the SDK for you version and follow the readme inside the packages.

  This Readme will cover the compilation with Visual Studio 2012 Express on
  Windows with CMake and the GISInternals-Packages for the following reasons:

  

  - not everybody wants to buy Visual Studio and there is no reason to force
  you to buy it just tu build Mapserver on Windows
  - CMake is the configuration-system for Linux. Why should you use something
  else which needs to be maintainerd?
  - as of today, PHP-Mapscript is not suppored for PHP-7. PHP-5.6 is build
  with VC11. To make PHP-Mapscript compatible with the downloadable
  PHP-Version you need to build with VC11 wich is Visual Studio 2012.
  - GISInternals Downloads contain most dependencies. it's way easier

  

  If you want to compile Mapserver with any other version of Visual Studio you
  can for sure use this documentation as help but maybe, some things here won't
  work for you.

 

  --------------------------------------------------------------------
  Prerequisites
  --------------------------------------------------------------------

  

  To build Mapserver on Windows with Visual Studio 2012 Express you need
  Visual Studio 2012 Express installed.
  Install CMake (https://cmake.org/) and add CMake bin-directory to your PATH
  environment variable. You can even to this after opening VS2012 x86 Native
  Tools Command Prompt by entering:
  set PATH=%PATH%;"C:\Program Files\CMake\bin"
  ... if CMake is installed to "C:\Program Files\CMake" ;)

  

  --------------------------------------------------------------------
  Downloading dependencies
  --------------------------------------------------------------------

  For our first build, we will use stable releases to build mapserver.
  Download MSVC 2012 win32 Packages for GDAL-2.1.2 and Mapserver-7.0.2 from http://gisinternals.com/release.php.
  We need "Compiled binaries in a single .zip package", "GDAL and MapServer sources" and "Compiled libraries and headers".
  Download the MSVC 2012 win32 Developement Kit from http://gisinternals.com/sdk.php.
  Extract everything to C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2.
  There should be the directories inside now: bin, doc, gdal, include, lib, regex-0.12, relase-1700, ...
  After you got this done, feel free to use other packages which fit your needs better.

 

  --------------------------------------------------------------------
  Mapserver-sources
  -------------------------------------------------------------------- 

  Download at least Mapserver-7.0.3 or current 7.0-Branch from github
  and extract or clone from github to C:\dev\work\mapserver.

  --------------------------------------------------------------------
  Building Mapserver
  --------------------------------------------------------------------

  After downloading and extracting everything, to build Mapserver, follow this steps:
  1. Open VS2012 x86 Native Tools Command Prompt (i'm german, hope it is translated
  correctly).
  2. Add CMake-bin to your PATH:
  set PATH=%PATH%;"C:\Program Files\CMake\bin"
  3. Create build-Directory:
  mkdir C:\dev\work\mapserver\build
  cd C:\dev\work\mapserver\build
  4. Configure:
  cmake .. -G "NMake Makefiles" -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -Wno-dev
  cmake .. -DCMAKE_PREFIX_PATH=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2;C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\bin;C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib;C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\include
  cmake .. -DREGEX_DIR=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\regex-0.12
  cmake .. -DWITH_POSTGIS=0 -DWITH_SOS=1 -DWITH_KML=1
  cmake .. -DWITH_CLIENT_WMS=1 -DWITH_CLIENT_WFS=1
  cmake .. -DWITH_THREAD_SAFETY=1 -DWITH_FCGI=1
  cmake .. -DWITH_CAIRO=1 -DCAIRO_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\cairo.lib
  cmake .. -DWITH_SVGCAIRO=1 -DSVGCAIRO_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\libsvg-cairo.lib
  cmake .. -DSVG_LIBRARY=1 -DSVG_LIBRARY=C:\dev\work\release-1700-gdal-2-1-2-mapserver-7-0-2\lib\libsvg.lib
5. build
  nmake

Thats it.
You can use all CMake parameters and options as you are used from CMake to fit mapserver to your needs from here.
Enjoy!

--------------------------------------------------------------------
MapScript
--------------------------------------------------------------------

To compile the various versions of MapScript (Perl, PHP, etc) first compile
the main mapserver directory and then see the README files in the
mapscript/perl, mapscript/php or mapscript/python directory for specific
instructions.

--------------------------------------------------------------------
Dependencies Part 2
--------------------------------------------------------------------

The following sections descripe how to get mapserver dependencies when not
downloading GISInternals packages.

--------------------------------------------------------------------
GD library
--------------------------------------------------------------------

- MapServer uses the GD library from http://boutell.com/ and the Win32
makefiles are set by default to work with the pre-built GD version 2.0.33
provided by Boutell.com. These predefine "gdwin32" binaries include
freetype2, libpng, libjpeg, libz, and libgif built-in. This is very
convenient to get a mapserver build going quickly.

If you are building GD and it's supporting libraries (libpng, libjpeg,
libgif, and freetype) from source then it is very important to make sure
that you update the -DUSE_GD_* flags and various subcomponent paths in the
nmake.opt. You will also have to take great care to build the various
components in a way that is compatible with MapServer. For instance, if
the various components are statically linked into MapServer you will need
to use the same build options (ie. /MT or /MT) for all components.

Here are some useful pointers:
- The original GD library: http://boutell.com/gd/
- libpng: http://www.libpng.org/pub/png/libpng.html
- zlib: http://www.info-zip.org/pub/infozip/zlib/
- libjpeg: ftp://ftp.uu.net/graphics/jpeg/
- Freetype: http://www.freetype.org/download.html

--------------------------------------------------------------------
REGEX library
--------------------------------------------------------------------

- MapServer uses the REGEX library which is standard on all the Unix
systems that I know of, but does not come with VC++.
If the MapServer distribution did not include a copy of the REGEX
library, then you can get a copy from:

 ftp://ftp.gnu.org/pub/gnu/regex/regex-0.12.tar.gz

The default in the nmake.opt is set to compile with GNU
regex-0.12 located in the "regex-0.12" directory.

- If you are planning to compile the PHP3_MAPSCRIPT.DLL module, then it
is important to make sure that the main Makefile.vc creates MAPSERVER.LIB
with the same version of REGEX that PHP uses.
See the notes in the main Makefile.vc about that.

--------------------------------------------------------------------
Notes on Freetype build.
--------------------------------------------------------------------

- You can use the Visual Workspace in freetype/lib/arch/win32 to build
the library.

--------------------------------------------------------------------
Notes on the proj module
--------------------------------------------------------------------

- The Proj.4 (cartographic projection routines) is located at
http://www.remotesensing.org/proj/

 Note on the epsg files location and the nad directory :

* there is an environnemnt variable PROJ_LIB_DIR that can be set to locate
the directory where the epsg file is located
* if you build this module, at the top of the makefile (./src/makefile.vc), you
can set the PROJ_LIB variable and this setting will be used to
locate the proj support files.

----------------------------------------------------------------------
Notes on libcurl
----------------------------------------------------------------------

Notes libcurl : used to support WMS client connection
Mapserver 5.x is using libcurl instead of libwww for WMS client
support.

- the library is located at http://curl.haxx.se/download.html

 Quick notes on how to build the library using MSVC++:

- Download and extract the library (at this time it is known to work
with version 7.10.2 or more recent)
- Open the workspace curlib.dsw located under curl-XXX/lib
- Build libcurl.dll. Note that the default active configuraion of the project
is Win32 Debug. You can modify the configuarion to Release version
(Build/Set Active Configuration)

Notes on mapserver's nmake.opt modifications :

- uncomment the flag WMSCLIENT= -DUSE_WMS_LYR
- uncomment and modify according to your installation the flags
related to libcurl :

* CURL_INC = -I../curl-7.10.2/include
* CURL_LIB = ../curl-7.10.2/lib/Relase/libcurl.lib
* WINSOCK_LIB = "C:\Program Files\Microsoft Visual Studio\VC98\Lib\WSOCK32.LIB"

You also need to install the libcurl.dll in your system directory. (The dll will
be located in libc-XXX/lib/Relase abfter your build of the library)

------------------------------------------------------------
Notes on GDAL
------------------------------------------------------------

- If you are compiling the GDAL library (http://www.gdal.org/)
with the PNG support, make sure that the libpng that you use in mapserver
is the same as the one used in GDAL.

 

$Id$

 
     

 

转载于:https://www.cnblogs.com/2008nmj/p/11194508.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值