Permalink
Browse files

fix issues when compiling PHP-MapScript with VS2012 Express (#5346)

  • Loading branch information...
1 parent 2f240de commit 54d645c18d0293f7e5821e9d740542408083f955 @AlexanderGabriel AlexanderGabriel committed with tbonfort Nov 7, 2016
Showing with 28 additions and 11 deletions.
  1. +19 −10 cmake/FindPHP5.cmake
  2. +9 −1 mapscript/php/CMakeLists.txt
View
@@ -17,22 +17,31 @@ SET(PHP5_POSSIBLE_INCLUDE_PATHS
/usr/include/php
/usr/local/include/php
/usr/local/apache/php
+ ${PHP5_INCLUDES}
)
SET(PHP5_POSSIBLE_LIB_PATHS
/usr/lib
+if(WIN32)
+ ${PHP5_INCLUDES}/Release_TS
+endif(WIN32)
)
-#FIND_PATH(PHP5_FOUND_INCLUDE_PATH main/php.h
-# ${PHP5_POSSIBLE_INCLUDE_PATHS})
-#
-#IF(PHP5_FOUND_INCLUDE_PATH)
-# SET(php5_paths "${PHP5_POSSIBLE_INCLUDE_PATHS}")
-# FOREACH(php5_path Zend main TSRM)
-# SET(php5_paths ${php5_paths} "${PHP5_FOUND_INCLUDE_PATH}/${php5_path}")
-# ENDFOREACH(php5_path Zend main TSRM)
-# SET(PHP5_INCLUDE_PATH "${php5_paths}" INTERNAL "PHP5 include paths")
-#ENDIF(PHP5_FOUND_INCLUDE_PATH)
+find_library(PHP5_LIBRARY
+ NAMES php5ts.lib
+ PATHS /sw /opt/local ${PHP5_INCLUDES}/Release_TS
+)
+
+FIND_PATH(PHP5_FOUND_INCLUDE_PATH main/php.h
+ ${PHP5_POSSIBLE_INCLUDE_PATHS})
+
+IF(PHP5_FOUND_INCLUDE_PATH)
+ SET(php5_paths "${PHP5_POSSIBLE_INCLUDE_PATHS}")
+ FOREACH(php5_path Zend main TSRM)
+ SET(php5_paths ${php5_paths} "${PHP5_FOUND_INCLUDE_PATH}/${php5_path}")
+ ENDFOREACH(php5_path Zend main TSRM)
+ SET(PHP5_INCLUDE_PATH "${php5_paths}" INTERNAL "PHP5 include paths")
+ENDIF(PHP5_FOUND_INCLUDE_PATH)
FIND_PROGRAM(PHP5_EXECUTABLE
NAMES php5 php
@@ -1,5 +1,9 @@
FIND_PACKAGE(PHP5 REQUIRED)
-INCLUDE_DIRECTORIES(${PHP5_INCLUDES})
+INCLUDE_DIRECTORIES(${PHP5_INCLUDE_PATH})
+
+if(WIN32)
+add_definitions(/DZEND_WIN32 /DPHP_WIN32 /DPHP5 /DZTS /DZEND_DEBUG=0 -DWIN32 -D_WIN32 -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
+ENDIF(WIN32)
IF(APPLE)
if(XCODE)
@@ -25,7 +29,11 @@ add_library(php_mapscript MODULE
)
+if(WIN32)
+target_link_libraries(php_mapscript ${MAPSERVER_LIBMAPSERVER} ${PHP5_LIBRARY})
+ELSE(WIN32)
target_link_libraries(php_mapscript ${MAPSERVER_LIBMAPSERVER})
+ENDIF(WIN32)
set_target_properties(php_mapscript PROPERTIES PREFIX "")
install(TARGETS php_mapscript DESTINATION ${PHP5_EXTENSION_DIR})

0 comments on commit 54d645c

Please sign in to comment.