[mapguide-commits] r9285 - in sandbox/jng/cmake_v2: . Oem Server/src/Core Server/src/Services/Resource cmake/modules
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Jan 6 20:27:42 PST 2018
Author: jng
Date: 2018-01-06 20:27:42 -0800 (Sat, 06 Jan 2018)
New Revision: 9285
Added:
sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake
Modified:
sandbox/jng/cmake_v2/CMakeLists.txt
sandbox/jng/cmake_v2/Oem/CMakeLists.txt
sandbox/jng/cmake_v2/Server/src/Core/CMakeLists.txt
sandbox/jng/cmake_v2/Server/src/Services/Resource/CMakeLists.txt
sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake
Log:
Now build and detect DbXml in a cleaner fashion. Basically add a FindDbXml module and do build-if-not-exists logic in that module. This may be somewhat weird (building code during the configuration phase), but it give us the desired include/library parameters that we can then reference from other projects. However this currently requires running the configure step twice as CMake appears to want to hang on to the find_library result before building DbXml making the follow up find_library return not found even though the freshly compiled libraries are there!
Modified: sandbox/jng/cmake_v2/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/CMakeLists.txt 2018-01-06 12:44:33 UTC (rev 9284)
+++ sandbox/jng/cmake_v2/CMakeLists.txt 2018-01-07 04:27:42 UTC (rev 9285)
@@ -58,6 +58,9 @@
set(MG_SERVER_SERVICES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Server/src/Services")
set(MG_SERVER_GWS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Server/src/Gws")
+set(MG_OEM_DBXML_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Oem/dbxml")
+set(MG_OEM_DBXML_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/Oem/dbxml")
+
# Override install directory to match what the automake build does (/usr/local, rather than /usr/local/lib)
set(MG_INSTALL_PREFIX "/usr/local/mapguideopensource-${MG_VERSION}")
set(MG_INSTALL_WEB_PREFIX "${MG_INSTALL_PREFIX}/webserverextensions")
@@ -112,6 +115,7 @@
find_package(PNG REQUIRED)
find_package(FDO REQUIRED)
find_package(CppUnit REQUIRED)
+find_package(DbXml REQUIRED)
# Set internal tool paths
set(IMAKE_TOOL ${CMAKE_CURRENT_BINARY_DIR}/BuildTools/WebTools/IMake/IMake)
@@ -137,20 +141,6 @@
add_subdirectory(BuildTools)
add_subdirectory(Oem)
-
-# HACK/FIXME: This is a temporary location until we find a better solution
-add_library(db_cxx SHARED IMPORTED GLOBAL)
-set_target_properties(db_cxx PROPERTIES IMPORTED_LOCATION ${MG_OEM_DBXML_LIB_DIR}/libdb_cxx.so)
-
-add_library(dbxml SHARED IMPORTED GLOBAL)
-set_target_properties(dbxml PROPERTIES IMPORTED_LOCATION ${MG_OEM_DBXML_LIB_DIR}/libdbxml.so)
-
-add_library(xqilla SHARED IMPORTED GLOBAL)
-set_target_properties(xqilla PROPERTIES IMPORTED_LOCATION ${MG_OEM_DBXML_LIB_DIR}/libxqilla.so)
-
-add_library(db SHARED IMPORTED GLOBAL)
-set_target_properties(db PROPERTIES IMPORTED_LOCATION ${MG_OEM_DBXML_LIB_DIR}/libdb.so)
-
add_subdirectory(Common)
add_subdirectory(Server)
add_subdirectory(Web)
Modified: sandbox/jng/cmake_v2/Oem/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/CMakeLists.txt 2018-01-06 12:44:33 UTC (rev 9284)
+++ sandbox/jng/cmake_v2/Oem/CMakeLists.txt 2018-01-07 04:27:42 UTC (rev 9285)
@@ -1,33 +1,3 @@
-###### ExternalProject configuration for dbxml ######
-
-# Copy source to build area
-message (STATUS "Preparing dbxml source for build")
-file(COPY "dbxml" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/DbXml_Build)
-if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (DBXML_CONF_EXTRA_FLAGS "--enable-debug")
- message (STATUS "Building dbxml (and supporting libraries) with debug flags")
-else (CMAKE_BUILD_TYPE MATCHES Debug)
- set (DBXML_CONF_EXTRA_FLAGS "")
-endif (CMAKE_BUILD_TYPE MATCHES Debug)
-
-# NOTE: Although Ubuntu (and possibly other distros) provide packages for xerces, xqilla, (berkeley) db
-# only xerces is the package that I am confident of getting dbxml to build against instead of having it
-# build its private copy
-# NOTE: Assumes system xerces is installed. Should adjust parameters based on find_package result for XercesC
-set(DbXml_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}/DbXml_Build/dbxml")
-ExternalProject_Add(dbxml-build
- DOWNLOAD_COMMAND ""
- SOURCE_DIR ${DbXml_WORKDIR}
- CONFIGURE_COMMAND ""
- INSTALL_COMMAND ""
- BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./buildall.sh --with-xerces=/usr --have-system-xerces ${DBXML_CONF_EXTRA_FLAGS}
- BUILD_IN_SOURCE 0
-)
-# This sounds dirty, but we need to communicate back to projects that use dbxml (in a different dir) where
-# the dbxml headers are
-set(MG_OEM_DBXML_INCLUDE_DIR "${DbXml_WORKDIR}/install/include" PARENT_SCOPE)
-set(MG_OEM_DBXML_LIB_DIR "${DbXml_WORKDIR}/install/lib" PARENT_SCOPE)
-
###### ExternalProject configuration for LinuxApt ######
set(HTTPD_VER 2.4.18)
set(LinuxApt_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/LinuxApt")
Modified: sandbox/jng/cmake_v2/Server/src/Core/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Server/src/Core/CMakeLists.txt 2018-01-06 12:44:33 UTC (rev 9284)
+++ sandbox/jng/cmake_v2/Server/src/Core/CMakeLists.txt 2018-01-07 04:27:42 UTC (rev 9285)
@@ -2,7 +2,7 @@
${ACE_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
- ${MG_OEM_DBXML_INCLUDE_DIR}
+ ${DBXML_INCLUDE_DIR}
${FDO_INCLUDE_DIR}
${FDO_INCLUDE_DIR}/ExpressionEngine
${MG_COMMON_DIR}
@@ -44,8 +44,8 @@
add_executable(mgserver ${mgserver_SRCS})
target_link_libraries(mgserver
${ACE_LIBRARY}
- db_cxx
- dbxml
+ ${DB_CXX_LIBRARY}
+ ${DBXML_LIBRARY}
${XERCESC_LIBRARIES}
${FDO_LIBRARY}
${FDO_EXPRESSIONENGINE_LIBRARY}
Modified: sandbox/jng/cmake_v2/Server/src/Services/Resource/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Server/src/Services/Resource/CMakeLists.txt 2018-01-06 12:44:33 UTC (rev 9284)
+++ sandbox/jng/cmake_v2/Server/src/Services/Resource/CMakeLists.txt 2018-01-07 04:27:42 UTC (rev 9285)
@@ -3,7 +3,7 @@
${ACE_INCLUDE_DIR}
${XERCESC_INCLUDE_DIR}
${MG_OEM_DWF_INCLUDE_DIR}
- ${MG_OEM_DBXML_INCLUDE_DIR}
+ ${DBXML_INCLUDE_DIR}
${MG_COMMON_DIR}/Security
${MG_COMMON_DIR}/Foundation
${MG_COMMON_DIR}/Geometry
@@ -32,9 +32,9 @@
MgServerBase${MG_VERSION_SUFFIX}
MgServerCache${MG_VERSION_SUFFIX}
MgServerManager${MG_VERSION_SUFFIX}
- db_cxx
- dbxml
- xqilla
+ ${DB_CXX_LIBRARY}
+ ${DBXML_LIBRARY}
+ ${XQILLA_LIBRARY}
${XERCESC_LIBRARIES}
)
install(TARGETS MgServerResourceService${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT})
Added: sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake
===================================================================
--- sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake (rev 0)
+++ sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake 2018-01-07 04:27:42 UTC (rev 9285)
@@ -0,0 +1,90 @@
+# FindDbXml.cmake
+#
+# Looks for DBXML headers and supporting libraries. If none found, the internal copy
+# is built and the check is done again
+#
+# This module defines (if found, or found after build):
+#
+# DBXML_INCLUDE_DIR - The DBXML headers
+# DBXML_LIBRARY - The DBXML library
+# DB_CXX_LIBRARY - The BerkeleyDB C++ library
+# XQILLA_LIBRARY - The XQilla library
+
+message(STATUS "Checking for DbXml in: ${MG_OEM_DBXML_WORKING_DIR}")
+
+find_path(_DBXML_INCLUDE_DIR
+ NAMES "dbxml/DbXml.hpp"
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/include)
+find_library(_DBXML_LIBRARY
+ NAMES dbxml
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/lib
+ NO_DEFAULT_PATH)
+find_library(_DB_CXX_LIBRARY
+ NAMES db_cxx
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/lib
+ NO_DEFAULT_PATH)
+find_library(_XQILLA_LIBRARY
+ NAMES xqilla
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/lib
+ NO_DEFAULT_PATH)
+
+message (STATUS "_DBXML_INCLUDE_DIR - ${_DBXML_INCLUDE_DIR}")
+message (STATUS "_DBXML_LIBRARY - ${_DBXML_LIBRARY}")
+message (STATUS "_DB_CXX_LIBRARY - ${_DB_CXX_LIBRARY}")
+message (STATUS "_XQILLA_LIBRARY - ${_XQILLA_LIBRARY}")
+
+set(DBXML_BUILD_FOUND TRUE)
+if ((NOT _DBXML_INCLUDE_DIR) OR (NOT _DBXML_LIBRARY) OR (NOT _DB_CXX_LIBRARY) OR (NOT _XQILLA_LIBRARY))
+ set(DBXML_BUILD_FOUND FALSE)
+endif ((NOT _DBXML_INCLUDE_DIR) OR (NOT _DBXML_LIBRARY) OR (NOT _DB_CXX_LIBRARY) OR (NOT _XQILLA_LIBRARY))
+
+#message(STATUS "DbXml dirs: ${MG_OEM_DBXML_SOURCE_DIR} in ${MG_OEM_DBXML_WORKING_DIR}")
+#message(STATUS "DbXml found: ${DBXML_BUILD_FOUND}")
+if (NOT DBXML_BUILD_FOUND)
+ message(STATUS "DbXml not found at expected location. Building internal copy before running package checks")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${MG_OEM_DBXML_SOURCE_DIR} ${MG_OEM_DBXML_WORKING_DIR})
+ if (CMAKE_BUILD_TYPE MATCHES Debug)
+ set (DBXML_CONF_EXTRA_FLAGS "--enable-debug")
+ message (STATUS "Building dbxml (and supporting libraries) with debug flags")
+ else (CMAKE_BUILD_TYPE MATCHES Debug)
+ set (DBXML_CONF_EXTRA_FLAGS "")
+ message (STATUS "Building dbxml (and supporting libraries) with release flags")
+ endif (CMAKE_BUILD_TYPE MATCHES Debug)
+ #execute_process(COMMAND ${CMAKE_COMMAND} -E time ./buildall.sh --with-xerces=/usr --have-system-xerces ${DBXML_CONF_EXTRA_FLAGS} WORKING_DIRECTORY ${MG_OEM_DBXML_WORKING_DIR})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory /home/user/dbxml_install ${MG_OEM_DBXML_WORKING_DIR}/install)
+endif (NOT DBXML_BUILD_FOUND)
+
+# Now re-query paths and libraries
+# FIXME: If dbxml is built, these libraries SHOULD EXIST but find_library says otherwise, as though CMake is holding
+# onto some cached information from a previous find_library call for this name or the file layout
+find_path(DBXML_INCLUDE_DIR
+ NAMES "dbxml/DbXml.hpp"
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/include)
+find_library(DBXML_LIBRARY
+ NAMES dbxml
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/lib
+ NO_DEFAULT_PATH)
+find_library(DB_CXX_LIBRARY
+ NAMES db_cxx
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/lib
+ NO_DEFAULT_PATH)
+find_library(XQILLA_LIBRARY
+ NAMES xqilla
+ PATHS ${MG_OEM_DBXML_WORKING_DIR}/install/lib
+ NO_DEFAULT_PATH)
+
+message (STATUS "DBXML_INCLUDE_DIR (retry) - ${DBXML_INCLUDE_DIR}")
+message (STATUS "DBXML_LIBRARY (retry) - ${DBXML_LIBRARY}")
+message (STATUS "DB_CXX_LIBRARY (retry) - ${DB_CXX_LIBRARY}")
+message (STATUS "XQILLA_LIBRARY (retry) - ${XQILLA_LIBRARY}")
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set DbXml_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DbXml DEFAULT_MSG DBXML_LIBRARY DB_CXX_LIBRARY XQILLA_LIBRARY DBXML_INCLUDE_DIR)
+
+if (DbXml_FOUND)
+ message(STATUS "Found DbXml: ${DBXML_INCLUDE_DIR} - ${DBXML_LIBRARY};${DB_CXX_LIBRARY};${XQILLA_LIBRARY}")
+endif (DbXml_FOUND)
+
+mark_as_advanced(DBXML_INCLUDE_DIR DBXML_LIBRARY DB_CXX_LIBRARY XQILLA_LIBRARY)
\ No newline at end of file
Modified: sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake
===================================================================
--- sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake 2018-01-06 12:44:33 UTC (rev 9284)
+++ sandbox/jng/cmake_v2/cmake/modules/FindGD.cmake 2018-01-07 04:27:42 UTC (rev 9285)
@@ -10,7 +10,7 @@
include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set CPPUNIT_FOUND to TRUE if
+# handle the QUIETLY and REQUIRED arguments and set GD_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GD DEFAULT_MSG GD_LIBRARY GD_INCLUDE_DIR)
More information about the mapguide-commits
mailing list