[mapguide-commits] r9964 - in sandbox/jng/vanilla_swig: . Bindings/src/Bindings Bindings/src/Bindings/DotNet Bindings/src/Bindings/DotNet/Foundation Bindings/src/Bindings/DotNet/Geometry Bindings/src/Bindings/DotNet/MapGuideCommon Bindings/src/Bindings/DotNet/PlatformBase Bindings/src/Bindings/DotNet/Web Bindings/src/Bindings/Java Bindings/src/Bindings/Php Web/src

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Aug 31 09:19:45 PDT 2022


Author: jng
Date: 2022-08-31 09:19:44 -0700 (Wed, 31 Aug 2022)
New Revision: 9964

Modified:
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/MapGuideCommon/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Web/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/Java/CMakeLists.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/CMakeLists.txt
   sandbox/jng/vanilla_swig/CMakeLists.txt
   sandbox/jng/vanilla_swig/Web/src/CMakeLists.txt
   sandbox/jng/vanilla_swig/cmake_linuxapt.sh
Log:
Fix up the Linux build some more:
 - Don't search for internal SWIG. This tool is now assumed to be externally available
 - Remove more invalid params in PHP ./configure call in cmake_linuxapt.sh
 - Don't add_subdirectory the "legacy" Java and PHP binding directires in WebTier. These directories will be removed eventually
 - CMake changes/fixes for binding targets:
   - Fix up IMake/SWIG invocation to now assume external SWIG (that we assume will be SWIG 4.1+). Primarily, the invocations should be done in the context of the original *source* directory and not the active cmake binary dir because the relative header paths in the *Constants and *ApiGen xml files are relative the the *source* directory, not the active cmake binary dir
   - Remove hack PHP swig workarounds
   - Streamline expected include directories

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -1,7 +1,19 @@
+# These include dirs will be common for all language binding C++ glue being built, so define it here
+include_directories(
+    ${MG_COMMON_DIR}/MdfModel
+    ${MG_COMMON_DIR}/Foundation
+    ${MG_COMMON_DIR}/Geometry
+    ${MG_COMMON_DIR}/PlatformBase
+    ${MG_COMMON_DIR}/MapGuideCommon
+    ${ACE_INCLUDE_DIR}
+    ${MG_WEB_DIR}/src/HttpHandler
+    ${MG_WEB_DIR}/src/WebSupport
+    ${MG_WEB_DIR}/src/WebApp
+    ${XERCESC_INCLUDE_DIR}
+)
+
 add_subdirectory(DotNet)
-#if (WITH_JAVA)
-#    add_subdirectory(Java)
-#endif (WITH_JAVA)
-#if (WITH_PHP)
-#    add_subdirectory(Php)
-#endif (WITH_PHP)
\ No newline at end of file
+if (WITH_JAVA)
+    add_subdirectory(Java)
+endif (WITH_JAVA)
+add_subdirectory(Php)
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -1,16 +1,3 @@
-include_directories(
-    ${MG_COMMON_DIR}/MdfModel
-    ${MG_COMMON_DIR}/Foundation
-    ${MG_COMMON_DIR}/Geometry
-    ${MG_COMMON_DIR}/PlatformBase
-    ${MG_COMMON_DIR}/MapGuideCommon
-    ${ACE_INCLUDE_DIR}
-    ${MG_WEB_DIR}/src/HttpHandler
-    ${MG_WEB_DIR}/src/WebSupport
-    ${MG_WEB_DIR}/src/WebApp
-    ${XERCESC_INCLUDE_DIR}
-)
-
 add_subdirectory(Foundation)
 add_subdirectory(Geometry)
 add_subdirectory(PlatformBase)

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -51,6 +51,13 @@
             -x "FoundationApi"
             ${IMAKE_RELATIVE_RESOLUTION}
             -o ${CMAKE_CURRENT_BINARY_DIR}
+    COMMAND ${CMAKE_COMMAND} -E remove -f
+            ${CMAKE_CURRENT_BINARY_DIR}/FoundationApi_Properties.i
+    COMMAND ${CMAKE_COMMAND} -E copy
+            ${CMAKE_CURRENT_SOURCE_DIR}/FoundationApi_Properties.i
+            ${CMAKE_CURRENT_BINARY_DIR}/FoundationApi_Properties.i
+    COMMAND ${CMAKE_COMMAND} -E remove -f
+            ${CMAKE_CURRENT_SOURCE_DIR}/FoundationApi_Properties.i
     COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [DotNet]. Output Dir: ${MG_DOTNET_PROJECT_DIR}
     COMMAND ${SWIG_EXECUTABLE} -c++ -csharp 
             ${SWIG_DOTNET_DEFS} -DDOTNETCORE -DSWIG_CSHARP_NO_EXCEPTION_HELPER
@@ -61,18 +68,15 @@
             -o "${CMAKE_CURRENT_BINARY_DIR}/FoundationUnmanagedApi_wrap.cpp"
             -outdir "${MG_DOTNET_PROJECT_DIR}" 
             "${CMAKE_CURRENT_BINARY_DIR}/FoundationApi.i"
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 target_link_libraries(FoundationUnmanagedApi
     ${ACE_LIBRARY}
     MgFoundation${MG_VERSION_SUFFIX}
-    #MgGeometry${MG_VERSION_SUFFIX}
-    #MgPlatformBase${MG_VERSION_SUFFIX}
-    #MgMapGuideCommon${MG_VERSION_SUFFIX}
-    #MgHttpHandler${MG_VERSION_SUFFIX}
-    #MgMdfModel${MG_VERSION_SUFFIX}
-    #MgMdfParser${MG_VERSION_SUFFIX}
-    #MgWebApp${MG_VERSION_SUFFIX}
     ${XERCESC_LIBRARIES}
 )
 

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Geometry/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -49,6 +49,13 @@
             -x "GeometryApi"
             ${IMAKE_RELATIVE_RESOLUTION}
             -o ${CMAKE_CURRENT_BINARY_DIR}
+    COMMAND ${CMAKE_COMMAND} -E remove -f
+            ${CMAKE_CURRENT_BINARY_DIR}/GeometryApi_Properties.i
+    COMMAND ${CMAKE_COMMAND} -E copy
+            ${CMAKE_CURRENT_SOURCE_DIR}/GeometryApi_Properties.i
+            ${CMAKE_CURRENT_BINARY_DIR}/GeometryApi_Properties.i
+    COMMAND ${CMAKE_COMMAND} -E remove -f
+            ${CMAKE_CURRENT_SOURCE_DIR}/GeometryApi_Properties.i
     COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [DotNet]. Output Dir: ${MG_DOTNET_PROJECT_DIR}
     COMMAND ${SWIG_EXECUTABLE} -c++ -csharp 
             ${SWIG_DOTNET_DEFS} -DDOTNETCORE -DSWIG_CSHARP_NO_EXCEPTION_HELPER
@@ -59,6 +66,10 @@
             -o "${CMAKE_CURRENT_BINARY_DIR}/GeometryUnmanagedApi_wrap.cpp"
             -outdir "${MG_DOTNET_PROJECT_DIR}" 
             "${CMAKE_CURRENT_BINARY_DIR}/GeometryApi.i"
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 target_link_libraries(GeometryUnmanagedApi

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/MapGuideCommon/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/MapGuideCommon/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/MapGuideCommon/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -49,6 +49,17 @@
             -x "MapGuideCommonApi"
             ${IMAKE_RELATIVE_RESOLUTION}
             -o ${CMAKE_CURRENT_BINARY_DIR}
+    # Nothing in the MapGuideCommon API surface currently declares .net property wrapper annotations so
+    # no _Properties.i file is generated at the moment. If/when that changes, uncomment the lines below to
+    # ensure this generated file is "moved" to the proper location
+
+    # COMMAND ${CMAKE_COMMAND} -E remove -f
+    #         ${CMAKE_CURRENT_BINARY_DIR}/MapGuideCommonApi_Properties.i
+    # COMMAND ${CMAKE_COMMAND} -E copy
+    #         ${CMAKE_CURRENT_SOURCE_DIR}/MapGuideCommonApi_Properties.i
+    #         ${CMAKE_CURRENT_BINARY_DIR}/MapGuideCommonApi_Properties.i
+    # COMMAND ${CMAKE_COMMAND} -E remove -f
+    #         ${CMAKE_CURRENT_SOURCE_DIR}/MapGuideCommonApi_Properties.i
     COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [DotNet]. Output Dir: ${MG_DOTNET_PROJECT_DIR}
     COMMAND ${SWIG_EXECUTABLE} -c++ -csharp 
             ${SWIG_DOTNET_DEFS} -DDOTNETCORE -DSWIG_CSHARP_NO_EXCEPTION_HELPER
@@ -59,6 +70,10 @@
             -o "${CMAKE_CURRENT_BINARY_DIR}/MapGuideCommonUnmanagedApi_wrap.cpp"
             -outdir "${MG_DOTNET_PROJECT_DIR}" 
             "${CMAKE_CURRENT_BINARY_DIR}/MapGuideCommonApi.i"
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 target_link_libraries(MapGuideCommonUnmanagedApi

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/PlatformBase/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -49,6 +49,13 @@
             -x "PlatformBaseApi"
             ${IMAKE_RELATIVE_RESOLUTION}
             -o ${CMAKE_CURRENT_BINARY_DIR}
+    COMMAND ${CMAKE_COMMAND} -E remove -f
+            ${CMAKE_CURRENT_BINARY_DIR}/PlatformBaseApi_Properties.i
+    COMMAND ${CMAKE_COMMAND} -E copy
+            ${CMAKE_CURRENT_SOURCE_DIR}/PlatformBaseApi_Properties.i
+            ${CMAKE_CURRENT_BINARY_DIR}/PlatformBaseApi_Properties.i
+    COMMAND ${CMAKE_COMMAND} -E remove -f
+            ${CMAKE_CURRENT_SOURCE_DIR}/PlatformBaseApi_Properties.i
     COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [DotNet]. Output Dir: ${MG_DOTNET_PROJECT_DIR}
     COMMAND ${SWIG_EXECUTABLE} -c++ -csharp 
             ${SWIG_DOTNET_DEFS} -DDOTNETCORE -DSWIG_CSHARP_NO_EXCEPTION_HELPER
@@ -59,6 +66,10 @@
             -o "${CMAKE_CURRENT_BINARY_DIR}/PlatformBaseUnmanagedApi_wrap.cpp"
             -outdir "${MG_DOTNET_PROJECT_DIR}" 
             "${CMAKE_CURRENT_BINARY_DIR}/PlatformBaseApi.i"
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 target_link_libraries(PlatformBaseUnmanagedApi

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Web/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Web/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Web/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -52,6 +52,13 @@
             -x "WebApi"
             ${IMAKE_RELATIVE_RESOLUTION}
             -o ${CMAKE_CURRENT_BINARY_DIR}
+    # COMMAND ${CMAKE_COMMAND} -E remove -f
+    #         ${CMAKE_CURRENT_BINARY_DIR}/WebApi_Properties.i
+    # COMMAND ${CMAKE_COMMAND} -E copy
+    #         ${CMAKE_CURRENT_SOURCE_DIR}/WebApi_Properties.i
+    #         ${CMAKE_CURRENT_BINARY_DIR}/WebApi_Properties.i
+    # COMMAND ${CMAKE_COMMAND} -E remove -f
+    #         ${CMAKE_CURRENT_SOURCE_DIR}/WebApi_Properties.i
     COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [DotNet]. Output Dir: ${MG_DOTNET_PROJECT_DIR}
     COMMAND ${SWIG_EXECUTABLE} -c++ -csharp 
             ${SWIG_DOTNET_DEFS} -DDOTNETCORE -DSWIG_CSHARP_NO_EXCEPTION_HELPER
@@ -62,6 +69,10 @@
             -o "${CMAKE_CURRENT_BINARY_DIR}/WebUnmanagedApi_wrap.cpp"
             -outdir "${MG_DOTNET_PROJECT_DIR}" 
             "${CMAKE_CURRENT_BINARY_DIR}/WebApi.i"
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 target_link_libraries(WebUnmanagedApi

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Java/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Java/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Java/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -1,17 +1,6 @@
 project(MapGuideJavaApi)
 
-include_directories(${JNI_INCLUDE_DIRS}
-    ${MG_COMMON_DIR}/MdfModel
-    ${MG_COMMON_DIR}/Foundation
-    ${MG_COMMON_DIR}/Geometry
-    ${MG_COMMON_DIR}/PlatformBase
-    ${MG_COMMON_DIR}/MapGuideCommon
-    ${ACE_INCLUDE_DIR}
-    ${MG_WEB_DIR}/HttpHandler
-    ${MG_WEB_DIR}/WebSupport
-    ${MG_WEB_DIR}/WebApp
-    ${XERCESC_INCLUDE_DIR}
-)
+include_directories(${JNI_INCLUDE_DIRS})
 
 set(SWIG_JAVA_DEFS "")
 if (WIN32)
@@ -31,17 +20,17 @@
 
 message(STATUS "Using IMake at: ${IMAKE_TOOL}")
 add_custom_command(OUTPUT ${MapGuideJavaApi_SRCS}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${MG_JAVA_OUTPUT_DIR}
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/org/osgeo/mapguide
     COMMAND ${CMAKE_COMMAND} -E echo Regenerating constant classes
-    COMMAND ${IMAKE_TOOL} -p ${CMAKE_CURRENT_BINARY_DIR}/../MapGuideApi/Constants.xml 
+    COMMAND ${IMAKE_TOOL} -p ${CMAKE_CURRENT_SOURCE_DIR}/../MapGuideApi/Constants.xml 
             -l Java 
             ${IMAKE_RELATIVE_RESOLUTION}
-            -o ${MG_JAVA_PROJECT_DIR}/org/osgeo/mapguide
+            -o ${CMAKE_CURRENT_BINARY_DIR}/org/osgeo/mapguide
             -t
     COMMAND ${CMAKE_COMMAND} -E copy
             ${CMAKE_CURRENT_BINARY_DIR}/java.i
             ${CMAKE_CURRENT_BINARY_DIR}/language.i
-    COMMAND ${IMAKE_TOOL} -p ../MapGuideApi/MapGuideApiGen.xml
+    COMMAND ${IMAKE_TOOL} -p ${CMAKE_CURRENT_SOURCE_DIR}/../MapGuideApi/MapGuideApiGen.xml
             -l Java
             ${IMAKE_RELATIVE_RESOLUTION}
             -o ${CMAKE_CURRENT_BINARY_DIR}
@@ -54,10 +43,14 @@
             -o "${CMAKE_CURRENT_BINARY_DIR}/MgApi_wrap.cpp" 
             ${CMAKE_CURRENT_BINARY_DIR}/MapGuideApi.i
     COMMAND ${CMAKE_COMMAND} -E remove -f 
-            ${MG_JAVA_PROJECT_DIR}/org/osgeo/mapguide/*.class 
+            ${CMAKE_CURRENT_BINARY_DIR}/org/osgeo/mapguide/*.class 
     COMMAND ${MOVE_COMMAND} ${MOVE_ARGS}
-            *.java
-            ${MG_JAVA_PROJECT_DIR}/org/osgeo/mapguide
+            ${CMAKE_CURRENT_BINARY_DIR}/*.java
+            ${CMAKE_CURRENT_BINARY_DIR}/org/osgeo/mapguide
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 add_library(MapGuideJavaApi${MG_VERSION_SUFFIX} SHARED ${MapGuideJavaApi_SRCS})
@@ -85,24 +78,16 @@
 target_link_libraries(MapGuideJavaApi${MG_VERSION_SUFFIX}
     ${ACE_LIBRARY}
     #${JNI_LIBRARIES}
-    ${MG_FOUNDATION_LIBRARY}
-    ${MG_GEOMETRY_LIBRARY}
-    ${MG_PLATFORMBASE_LIBRARY}
-    ${MG_COMMON_LIBRARY}
-    ${MG_HTTPHANDLER_LIBRARY}
-    ${MG_WEBAPP_LIBRARY}
-    ${MG_MDFMODEL_LIBRARY}
-    ${MG_MDFPARSER_LIBRARY}
-    ${MG_WEBSUPPORT_LIBRARY}
-    #MgFoundation${MG_VERSION_SUFFIX}
-    #MgGeometry${MG_VERSION_SUFFIX}
-    #MgPlatformBase${MG_VERSION_SUFFIX}
-    #MgMapGuideCommon${MG_VERSION_SUFFIX}
-    #MgHttpHandler${MG_VERSION_SUFFIX}
-    #MgMdfModel${MG_VERSION_SUFFIX}
-    #MgMdfParser${MG_VERSION_SUFFIX}
+    MgFoundation${MG_VERSION_SUFFIX}
+    MgGeometry${MG_VERSION_SUFFIX}
+    MgPlatformBase${MG_VERSION_SUFFIX}
+    MgMapGuideCommon${MG_VERSION_SUFFIX}
+    MgHttpHandler${MG_VERSION_SUFFIX}
+    MgMdfModel${MG_VERSION_SUFFIX}
+    MgMdfParser${MG_VERSION_SUFFIX}
     ${XERCESC_LIBRARIES}
-    #MgWebApp${MG_VERSION_SUFFIX}
+    MgWebApp${MG_VERSION_SUFFIX}
+    MgWebSupport${MG_VERSION_SUFFIX}
 )
 
 # Only needed for Linux

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -5,25 +5,21 @@
     set ( CMAKE_SHARED_LINKER_FLAGS "${WEB_CMAKE_SHARED_LINKER_FLAGS}")
 endif (CMAKE_COMPILER_IS_GNUCXX)
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}
-    ${MG_COMMON_DIR}/MdfModel
-    ${MG_COMMON_DIR}/Foundation
-    ${MG_COMMON_DIR}/Geometry
-    ${MG_COMMON_DIR}/PlatformBase
-    ${MG_COMMON_DIR}/MapGuideCommon
-    ${PHP_INCLUDE_DIR}/TSRM
+include_directories(${PHP_INCLUDE_DIR}/TSRM
     ${PHP_INCLUDE_DIR}/Zend
     ${PHP_INCLUDE_DIR}/main
-    ${PHP_INCLUDE_DIR}
-    ${ACE_INCLUDE_DIR}
-    ${MG_WEB_DIR}/HttpHandler
-    ${MG_WEB_DIR}/WebSupport
-    ${MG_WEB_DIR}/WebApp
-    ${XERCESC_INCLUDE_DIR}
-)
+    ${PHP_INCLUDE_DIR})
 
-set(MG_PHP_OUTPUT_DIR "${MG_PACKAGE_OUTPUT_DIR}/Php/${CMAKE_BUILD_TYPE}/${MG_ARCH}")
+set(SWIG_PHP_DEFS "")
+if (WIN32)
+    set(SWIG_PHP_DEFS "-DWIN32")
+endif (WIN32)
 
+# These 2 files will be #included in the MgApi_wrap translation unit so they need
+# to be present on the current binary dir where MgApi_wrap.cpp will be generated in
+file(COPY "PhpClassMap.cpp" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY "PhpLocalizer.cpp" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
 set(php_MapGuideApi_SRCS
     ${CMAKE_CURRENT_BINARY_DIR}/MgApi_wrap.cpp
 )
@@ -52,32 +48,28 @@
 
 message(STATUS "Using IMake at: ${IMAKE_TOOL}")
 add_custom_command(OUTPUT ${php_MapGuideApi_SRCS}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${MG_PHP_OUTPUT_DIR}
-    COMMAND ${CMAKE_COMMAND} -E echo Regenerating: ${CMAKE_CURRENT_BINARY_DIR}/constants.php
-    COMMAND ${IMAKE_TOOL} -p ${CMAKE_CURRENT_BINARY_DIR}/../MapGuideApi/Constants.xml 
+    COMMAND ${IMAKE_TOOL} -p ${CMAKE_CURRENT_SOURCE_DIR}/../MapGuideApi/Constants.xml 
         -l PHP 
         ${IMAKE_RELATIVE_RESOLUTION}
-        -o ${MG_PHP_OUTPUT_DIR}/constants.php
+        -o ${CMAKE_CURRENT_BINARY_DIR}/constants.i
         -t
     COMMAND ${CMAKE_COMMAND} -E copy
         ${CMAKE_CURRENT_BINARY_DIR}/php.i
         ${CMAKE_CURRENT_BINARY_DIR}/language.i
-    COMMAND ${IMAKE_TOOL} -p ../MapGuideApi/MapGuideApiGen.xml
+    COMMAND ${IMAKE_TOOL} -p ${CMAKE_CURRENT_SOURCE_DIR}/../MapGuideApi/MapGuideApiGen.xml
         -l PHP
         ${IMAKE_RELATIVE_RESOLUTION}
         -o ${CMAKE_CURRENT_BINARY_DIR}
-    COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [PHP7]
-    COMMAND ${SWIG_TOOL} -c++ -php7 
-        -DWIN32 -DPHPSWIG
+    COMMAND ${CMAKE_COMMAND} -E echo Running SWIG [PHP]
+    COMMAND ${SWIG_TOOL} -c++ -php 
+        -DPHPSWIG ${SWIG_PHP_DEFS}
         -nodefaultctor -nodefaultdtor 
         -o "${CMAKE_CURRENT_BINARY_DIR}/MgApi_wrap.cpp"
         ${CMAKE_CURRENT_BINARY_DIR}/MapGuideApi.i
-    COMMAND ${CMAKE_COMMAND} -E echo Applying PHP7 swig workaround patch
-    COMMAND ${SED_COMMAND} ${SED_ARGS} "s#(MapGuideApi_globals.error_msg)#ZEND_MODULE_GLOBALS_ACCESSOR(MapGuideApi, error_msg)#g; s#(MapGuideApi_globals.error_code)#ZEND_MODULE_GLOBALS_ACCESSOR(MapGuideApi, error_code)#g"
-        "${CMAKE_CURRENT_BINARY_DIR}/MgApi_wrap.cpp"
-    COMMAND ${MOVE_COMMAND} ${MOVE_ARGS}
-        MapGuideApi.php
-        ${MG_PHP_OUTPUT_DIR}
+    # These commands need to be run in the context of the source directory so that the relative header references
+    # in the Constants and ApiGen xml files will resolve propertly (because these headers won't exist in the cmake
+    # binary dir)
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
 # if (UNIX)

Modified: sandbox/jng/vanilla_swig/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -194,10 +194,8 @@
 find_package(Sanitizers)
 find_package(MapGuideThirdparty REQUIRED)
 
-# Set internal tool paths
-set(IMAKE_TOOL ${CMAKE_CURRENT_BINARY_DIR}/BuildTools/WebTools/IMake/IMake)
-set(SWIG_TOOL ${MG_OEM_ROOT_BUILD_DIR}/SWIGEx/swig)
-set(SWIG_LIB_PATH ${MG_OEM_ROOT_BUILD_DIR}/SWIGEx/Lib)
+# We no longer use internal SWIG, we expect this to be found externally
+find_program(SWIG_TOOL swig)
 
 # Set common commands.
 set(MOVE_COMMAND "mv")

Modified: sandbox/jng/vanilla_swig/Web/src/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Web/src/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/Web/src/CMakeLists.txt	2022-08-31 16:19:44 UTC (rev 9964)
@@ -9,15 +9,7 @@
 if (NOT MG_COMMON_SUBSET_ONLY)
     add_subdirectory(DevHttpServer)
     #add_subdirectory(CgiAgent)
-    add_subdirectory(PhpApi)
-    if (WITH_JAVA)
-        # For preview 3 until new vanilla SWIG wrapper in place, only build/ship MapGuideJavaApiEx.jar
-        #add_subdirectory(JavaApi)
-        add_subdirectory(JavaApiEx)
-    endif (WITH_JAVA)
 
-    # Needed for api binding generation
-    file(COPY "MapGuideApi" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
     file(COPY "WEB-INF" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
 
     install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/localized DESTINATION ${MG_WWWROOT} COMPONENT ${MG_COMPONENT})

Modified: sandbox/jng/vanilla_swig/cmake_linuxapt.sh
===================================================================
--- sandbox/jng/vanilla_swig/cmake_linuxapt.sh	2022-08-26 20:50:46 UTC (rev 9963)
+++ sandbox/jng/vanilla_swig/cmake_linuxapt.sh	2022-08-31 16:19:44 UTC (rev 9964)
@@ -204,7 +204,7 @@
     cd "${PHP_WORKDIR}" || exit
     # TODO: Patch out the use of meta_ccld so ccache can work: https://bugs.php.net/bug.php?id=75940
     # if/when we finally move to PHP 7, this patch is already applied
-    ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" --with-apxs2="${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" --with-openssl --enable-mbstring --enable-gd --with-jpeg --with-png --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
+    ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" --with-apxs2="${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" --with-openssl --enable-mbstring --enable-gd --with-jpeg --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
     check_build
     echo "Building PHP. Please wait"
     make 2>&1 | tee "$LINUXAPT_WORK_DIR/make_php.log"



More information about the mapguide-commits mailing list