-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Support for PHP-NG MapScript (via SWIG) but don't yet build with …
…AppVeyor
- Loading branch information
1 parent
3d24954
commit 7de2cd9
Showing
12 changed files
with
257 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# - Find PHP7 | ||
# This module finds if PHP7 is installed and determines where the include files | ||
# and libraries are. It also determines what the name of the library is. This | ||
# code sets the following variables: | ||
# | ||
# PHP7_INCLUDE_PATH = path to where php.h can be found | ||
# PHP7_EXECUTABLE = full path to the php4 binary | ||
# | ||
# file is derived from FindPHP5.cmake | ||
# | ||
|
||
SET(PHP7_FOUND "NO") | ||
|
||
SET(PHP7_POSSIBLE_INCLUDE_PATHS | ||
/usr/include/php/* | ||
/usr/local/include/php/* | ||
/usr/include/php | ||
/usr/local/include/php | ||
/usr/local/apache/php | ||
${PHP7_INCLUDES} | ||
) | ||
|
||
if(WIN32) | ||
string(SUBSTRING $ENV{VSCMD_VER} 0 2 VSCMD_VER) | ||
FOREACH(PHP7_POSSIBLE_INCLUDE_PATH ../../../php-sdk C:/php-sdk "$ENV{APPVEYOR_BUILD_FOLDER}") | ||
SET(PHP7_POSSIBLE_INCLUDE_PATHS ${PHP7_POSSIBLE_INCLUDE_PATHS} "${PHP7_POSSIBLE_INCLUDE_PATH}/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src") | ||
ENDFOREACH() | ||
endif(WIN32) | ||
|
||
FIND_PATH(PHP7_FOUND_INCLUDE_PATH main/php.h ${PHP7_POSSIBLE_INCLUDE_PATHS}) | ||
|
||
find_library(PHP7_LIBRARY NAMES php7ts PATHS /sw /opt/local) | ||
if(WIN32) | ||
find_library(PHP7_LIBRARY NAMES php7 php7ts PATHS ${PHP7_FOUND_INCLUDE_PATH}/Release ${PHP7_FOUND_INCLUDE_PATH}/Release_TS) | ||
if(CMAKE_CL_64) | ||
find_library(PHP7_LIBRARY NAMES php7 php7ts PATHS ${PHP7_FOUND_INCLUDE_PATH}/$ENV{VSCMD_ARG_TGT_ARCH}/Release ${PHP7_FOUND_INCLUDE_PATH}/$ENV{VSCMD_ARG_TGT_ARCH}/Release_TS) | ||
endif(CMAKE_CL_64) | ||
endif(WIN32) | ||
|
||
IF(PHP7_FOUND_INCLUDE_PATH) | ||
SET(php7_paths "${PHP7_POSSIBLE_INCLUDE_PATHS}") | ||
FOREACH(php7_path Zend main TSRM) | ||
SET(php7_paths ${php7_paths} "${PHP7_FOUND_INCLUDE_PATH}/${php7_path}") | ||
ENDFOREACH(php7_path Zend main TSRM) | ||
SET(PHP7_INCLUDE_PATH "${php7_paths}" INTERNAL "PHP7 include paths") | ||
ENDIF(PHP7_FOUND_INCLUDE_PATH) | ||
|
||
FIND_PROGRAM(PHP7_EXECUTABLE | ||
NAMES php7 php | ||
PATHS | ||
/usr/local/bin | ||
) | ||
|
||
MARK_AS_ADVANCED( | ||
PHP7_EXECUTABLE | ||
PHP7_FOUND_INCLUDE_PATH | ||
) | ||
|
||
IF( NOT PHP7_CONFIG_EXECUTABLE ) | ||
FIND_PROGRAM(PHP7_CONFIG_EXECUTABLE | ||
NAMES php7-config php-config | ||
) | ||
ENDIF( NOT PHP7_CONFIG_EXECUTABLE ) | ||
|
||
IF(PHP7_CONFIG_EXECUTABLE) | ||
EXECUTE_PROCESS(COMMAND ${PHP7_CONFIG_EXECUTABLE} --version | ||
OUTPUT_VARIABLE PHP7_VERSION) | ||
STRING(REPLACE "\n" "" PHP7_VERSION "${PHP7_VERSION}") | ||
|
||
EXECUTE_PROCESS(COMMAND ${PHP7_CONFIG_EXECUTABLE} --extension-dir | ||
OUTPUT_VARIABLE PHP7_EXTENSION_DIR) | ||
STRING(REPLACE "\n" "" PHP7_EXTENSION_DIR "${PHP7_EXTENSION_DIR}") | ||
|
||
EXECUTE_PROCESS(COMMAND ${PHP7_CONFIG_EXECUTABLE} --includes | ||
OUTPUT_VARIABLE PHP7_INCLUDES) | ||
STRING(REPLACE "-I" "" PHP7_INCLUDES "${PHP7_INCLUDES}") | ||
STRING(REPLACE " " ";" PHP7_INCLUDES "${PHP7_INCLUDES}") | ||
STRING(REPLACE "\n" "" PHP7_INCLUDES "${PHP7_INCLUDES}") | ||
LIST(GET PHP7_INCLUDES 0 PHP7_INCLUDE_DIR) | ||
|
||
set(PHP7_MAIN_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/main) | ||
set(PHP7_TSRM_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/TSRM) | ||
set(PHP7_ZEND_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/Zend) | ||
set(PHP7_REGEX_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/regex) | ||
set(PHP7_EXT_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/ext) | ||
set(PHP7_DATE_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/ext/date/lib) | ||
set(PHP7_STANDARD_INCLUDE_DIR ${PHP7_INCLUDE_DIR}/ext/standard) | ||
|
||
MESSAGE(STATUS ${PHP7_MAIN_INCLUDE_DIR}) | ||
|
||
IF(NOT PHP7_INCLUDE_PATH) | ||
set(PHP7_INCLUDE_PATH ${PHP7_INCLUDES}) | ||
ENDIF(NOT PHP7_INCLUDE_PATH) | ||
|
||
IF(PHP7_VERSION LESS 5) | ||
MESSAGE(FATAL_ERROR "PHP version is not 5 or later") | ||
ENDIF(PHP7_VERSION LESS 5) | ||
|
||
IF(PHP7_EXECUTABLE AND PHP7_INCLUDES) | ||
set(PHP7_FOUND "yes") | ||
MESSAGE(STATUS "Found PHP7-Version ${PHP7_VERSION} (using ${PHP7_CONFIG_EXECUTABLE})") | ||
ENDIF(PHP7_EXECUTABLE AND PHP7_INCLUDES) | ||
|
||
FIND_PROGRAM(PHPUNIT_EXECUTABLE | ||
NAMES phpunit phpunit2 | ||
PATHS | ||
/usr/local/bin | ||
) | ||
|
||
IF(PHPUNIT_EXECUTABLE) | ||
MESSAGE(STATUS "Found phpunit: ${PHPUNIT_EXECUTABLE}") | ||
ENDIF(PHPUNIT_EXECUTABLE) | ||
|
||
ENDIF(PHP7_CONFIG_EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FIND_PACKAGE(PHP7 REQUIRED) | ||
FIND_PACKAGE(SWIG 3.0.11 REQUIRED) | ||
INCLUDE(${SWIG_USE_FILE}) | ||
|
||
if(WIN32) | ||
add_definitions(-D_WIN32 -D_WINDOWS -DWINDOWS=1 -DZEND_WIN32=1 -DPHP_WIN32=1 -DWIN32 -DNDebug -DNDEBUG -DZEND_DEBUG=0) | ||
if(NOT CMAKE_CL_64) | ||
add_definitions(-D_USE_32BIT_TIME_T) | ||
endif(NOT CMAKE_CL_64) | ||
if(WITH_THREAD_SAFETY) | ||
add_definitions(-DZTS=1) | ||
endif(WITH_THREAD_SAFETY) | ||
endif(WIN32) | ||
|
||
include_directories(${PHP7_FOUND_INCLUDE_PATH}) | ||
include_directories(${PHP7_FOUND_INCLUDE_PATH}/main) | ||
include_directories(${PHP7_FOUND_INCLUDE_PATH}/Zend) | ||
include_directories(${PHP7_FOUND_INCLUDE_PATH}/TSRM) | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}/mapscript/swiginc) | ||
include_directories(${PROJECT_SOURCE_DIR}/mapscript/) | ||
include_directories(${PROJECT_SOURCE_DIR}/mapscript/phpng) | ||
|
||
if(WIN32) | ||
include_directories(${PHP7_FOUND_INCLUDE_PATH}/win32) | ||
endif(WIN32) | ||
SWIG_ADD_MODULE(php_mapscriptng php7 ../mapscript.i) | ||
|
||
if(WIN32) | ||
target_compile_options(php_mapscriptng PRIVATE /D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DWIN32 /DNDebug /DNDEBUG /DZEND_DEBUG=0) | ||
if(WITH_THREAD_SAFETY) | ||
target_compile_options(php_mapscriptng PRIVATE /DZTS=1) | ||
endif(WITH_THREAD_SAFETY) | ||
SWIG_LINK_LIBRARIES(php_mapscriptng ${PHP7_LIBRARY}) | ||
endif(WIN32) | ||
target_link_libraries(php_mapscriptng mapserver) | ||
|
||
set_target_properties(${SWIG_MODULE_mapscript_REAL_NAME} PROPERTIES PREFIX "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
This readme covers building Mapserver from scatch on Windows. | ||
We will download current development state of php. | ||
If you need MapscriptNG for a different version of php, you have to fit the commands below. | ||
For the first time, it is a good idea to build as shown below and after you have a working state, you can change whatever you want, knowing there is a working state you can return to. | ||
|
||
All you need is Visual Studio 2017 Express (latest Version, check for updates) and GIT installed. | ||
|
||
To begin, start x64 or x86 Native Tools Command Prompt for VS 2017 and just execute all Commands listed below. | ||
Please always stay inside PHP-SDK-Shell to have wget and unzip available. | ||
|
||
rem -------------------------------------------------------------------- | ||
rem Step 1: Create Directories | ||
rem -------------------------------------------------------------------- | ||
mkdir C:\projects | ||
mkdir C:\projects\mapserver%VSCMD_ARG_TGT_ARCH% | ||
|
||
rem -------------------------------------------------------------------- | ||
rem Step 2: Build PHP | ||
rem -------------------------------------------------------------------- | ||
cd C:\projects\mapserver%VSCMD_ARG_TGT_ARCH% | ||
git clone https://github.com/Microsoft/php-sdk-binary-tools.git php-sdk | ||
cd C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\php-sdk | ||
set VS_VERSION=%VSCMD_VER:~0,2% | ||
phpsdk-vc%VS_VERSION%-%VSCMD_ARG_TGT_ARCH%.bat | ||
phpsdk_buildtree phpmaster | ||
git clone https://github.com/php/php-src.git | ||
cd php-src | ||
phpsdk_deps --update --branch master | ||
buildconf | ||
configure --enable-snapshot-build | ||
nmake snap | ||
|
||
rem -------------------------------------------------------------------- | ||
rem Step 3: Get GISInternals SDK | ||
rem -------------------------------------------------------------------- | ||
cd C:\projects\mapserver%VSCMD_ARG_TGT_ARCH% | ||
mkdir packages | ||
mkdir packages\gisinternals%VSCMD_ARG_TGT_ARCH%\ | ||
mkdir gisinternals%VSCMD_ARG_TGT_ARCH% | ||
set GISInternalsArchitecture=- | ||
if %VSCMD_ARG_TGT_ARCH% == x64 set GISInternalsArchitecture=-%VSCMD_ARG_TGT_ARCH%- | ||
wget -O packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%dev.zip http://download.gisinternals.com/sdk/downloads/release-1911%GISInternalsArchitecture%dev.zip | ||
unzip -q -o packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%dev.zip -d gisinternals%VSCMD_ARG_TGT_ARCH% | ||
wget -O packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%gdal-mapserver-src.zip http://download.gisinternals.com/sdk/downloads/release-1911%GISInternalsArchitecture%gdal-mapserver-src.zip | ||
unzip -q -o packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%gdal-mapserver-src.zip -d gisinternals%VSCMD_ARG_TGT_ARCH% | ||
wget -O packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%gdal-mapserver-libs.zip http://download.gisinternals.com/sdk/downloads/release-1911%GISInternalsArchitecture%gdal-mapserver-libs.zip | ||
unzip -q -o packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%gdal-mapserver-libs.zip -d gisinternals%VSCMD_ARG_TGT_ARCH% | ||
wget -O packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%gdal-mapserver.zip http://download.gisinternals.com/sdk/downloads/release-1911%GISInternalsArchitecture%gdal-mapserver.zip | ||
unzip -q -o packages\gisinternals%VSCMD_ARG_TGT_ARCH%\release-1911%GISInternalsArchitecture%gdal-mapserver.zip -d gisinternals%VSCMD_ARG_TGT_ARCH% | ||
|
||
rem -------------------------------------------------------------------- | ||
rem Step 4: Other Dependencies | ||
rem -------------------------------------------------------------------- | ||
rem ### SWIG ### | ||
cd C:\projects\mapserver%VSCMD_ARG_TGT_ARCH% | ||
git clone https://github.com/AlexanderGabriel/swig | ||
mkdir swig\build | ||
cd swig\build | ||
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release | ||
cmake --build . | ||
move swig.exe .. | ||
rem ### gnulib ### | ||
cd C:\projects\mapserver%VSCMD_ARG_TGT_ARCH% | ||
git clone git://git.savannah.gnu.org/gnulib.git | ||
|
||
-------------------------------------------------------------------- | ||
Step 5: Build Mapserver with php_mapscriptng | ||
-------------------------------------------------------------------- | ||
cd C:\projects\mapserver%VSCMD_ARG_TGT_ARCH% | ||
git clone https://github.com/mapserver/mapserver | ||
cd mapserver | ||
mkdir build | ||
cd build | ||
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_PREFIX_PATH=C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\gisinternals%VSCMD_ARG_TGT_ARCH%;C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\gnulib\lib;C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\gnulib\include;C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\gisinternals%VSCMD_ARG_TGT_ARCH%\lib;C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\gisinternals%VSCMD_ARG_TGT_ARCH%\include -DREGEX_DIR=C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\gisinternals%VSCMD_ARG_TGT_ARCH%\regex-0.12 | ||
cmake .. -DWITH_POSTGIS=0 -DWITH_PROTOBUFC=0 -DWITH_THREAD_SAFETY=1 | ||
cmake .. -DWITH_PHPNG=1 -DSWIG_EXECUTABLE=C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\swig\swig.exe -DSWIG_DIR=C:\projects\mapserver%VSCMD_ARG_TGT_ARCH%\swig | ||
cmake --build . | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters