-
-
Notifications
You must be signed in to change notification settings - Fork 369
/
CMakeLists.txt
51 lines (43 loc) · 1.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
if(WIN32 AND (${CMAKE_VERSION} EQUAL "3.12.0") OR (${CMAKE_VERSION} EQUAL "3.12.1") OR (${CMAKE_VERSION} EQUAL "3.12.2") OR (${CMAKE_VERSION} EQUAL "3.12.3"))
message(FATAL_ERROR "Building with CMAKE ${CMAKE_VERSION} will not work. Please downgrade to 3.11.x or update to a higher version than 3.12.3")
endif()
if(WIN32)
FIND_PACKAGE(SWIG 3.0.11 REQUIRED)
if(WITH_THREAD_SAFETY)
FIND_PACKAGE(SWIG 4.0.0 REQUIRED)
endif(WITH_THREAD_SAFETY)
endif(WIN32)
FIND_PACKAGE(PHP7 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
if(WIN32)
add_definitions(/DWIN32 /DZEND_WIN32 /DPHP_WIN32 /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 /DWIN32 /DZEND_WIN32 /DPHP_WIN32 /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 "")
if(NOT WIN32)
install(TARGETS php_mapscriptng DESTINATION ${PHP7_EXTENSION_DIR})
endif()