[mapguide-commits] r9287 - in sandbox/jng/cmake_v2: . cmake/modules
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Jan 7 00:17:39 PST 2018
Author: jng
Date: 2018-01-07 00:17:38 -0800 (Sun, 07 Jan 2018)
New Revision: 9287
Added:
sandbox/jng/cmake_v2/cmake/modules/FindDbXmlInternal.cmake
sandbox/jng/cmake_v2/cmake_build.sh
Removed:
sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake
Modified:
sandbox/jng/cmake_v2/CMakeLists.txt
Log:
Give up trying to build and find DbXml from within CMake. Instead do this externally through a new cmake_build.sh which is basically the (build everything) driver script
Modified: sandbox/jng/cmake_v2/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/CMakeLists.txt 2018-01-07 06:35:46 UTC (rev 9286)
+++ sandbox/jng/cmake_v2/CMakeLists.txt 2018-01-07 08:17:38 UTC (rev 9287)
@@ -58,8 +58,6 @@
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")
-
# 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")
@@ -114,7 +112,7 @@
find_package(PNG REQUIRED)
find_package(FDO REQUIRED)
find_package(CppUnit REQUIRED)
-find_package(DbXml REQUIRED)
+find_package(DbXmlInternal REQUIRED)
# Set internal tool paths
set(IMAKE_TOOL ${CMAKE_CURRENT_BINARY_DIR}/BuildTools/WebTools/IMake/IMake)
Deleted: sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake
===================================================================
--- sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake 2018-01-07 06:35:46 UTC (rev 9286)
+++ sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake 2018-01-07 08:17:38 UTC (rev 9287)
@@ -1,90 +0,0 @@
-# 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
Copied: sandbox/jng/cmake_v2/cmake/modules/FindDbXmlInternal.cmake (from rev 9285, sandbox/jng/cmake_v2/cmake/modules/FindDbXml.cmake)
===================================================================
--- sandbox/jng/cmake_v2/cmake/modules/FindDbXmlInternal.cmake (rev 0)
+++ sandbox/jng/cmake_v2/cmake/modules/FindDbXmlInternal.cmake 2018-01-07 08:17:38 UTC (rev 9287)
@@ -0,0 +1,37 @@
+# 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_WORK_DIR}")
+
+find_path(DBXML_INCLUDE_DIR
+ NAMES "dbxml/DbXml.hpp"
+ PATHS ${MG_OEM_WORK_DIR}/dbxml/install/include)
+find_library(DBXML_LIBRARY
+ NAMES dbxml
+ PATHS ${MG_OEM_WORK_DIR}/dbxml/install/lib)
+find_library(DB_CXX_LIBRARY
+ NAMES db_cxx
+ PATHS ${MG_OEM_WORK_DIR}/dbxml/install/lib)
+find_library(XQILLA_LIBRARY
+ NAMES xqilla
+ PATHS ${MG_OEM_WORK_DIR}/dbxml/install/lib)
+
+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(DbXmlInternal DEFAULT_MSG DBXML_LIBRARY DB_CXX_LIBRARY XQILLA_LIBRARY DBXML_INCLUDE_DIR)
+
+if (DbXmlInternal_FOUND)
+ message(STATUS "Found DbXml: ${DBXML_INCLUDE_DIR}, ${DBXML_LIBRARY}, ${DB_CXX_LIBRARY}, ${XQILLA_LIBRARY}")
+endif (DbXmlInternal_FOUND)
+
+mark_as_advanced(DBXML_INCLUDE_DIR DBXML_LIBRARY DB_CXX_LIBRARY XQILLA_LIBRARY)
\ No newline at end of file
Added: sandbox/jng/cmake_v2/cmake_build.sh
===================================================================
--- sandbox/jng/cmake_v2/cmake_build.sh (rev 0)
+++ sandbox/jng/cmake_v2/cmake_build.sh 2018-01-07 08:17:38 UTC (rev 9287)
@@ -0,0 +1,153 @@
+#!/bin/sh
+
+CMAKE_BUILD_DIR=~/mapguide_build_area
+OEM_WORK_DIR=~/mapguide_oem_build
+BUILD_CPU=32
+BUILD_CONFIG=Release
+BUILD_DBXML=0
+BUILD_LINUXAPT=0
+HAVE_SYSTEM_XERCES=0
+USE_NINJA=0
+while [ $# -gt 0 ]; do # Until you run out of parameters...
+ case "$1" in
+ --cmake_build_dir)
+ CMAKE_BUILD_DIR="$2"
+ shift
+ ;;
+ --oem_working_dir)
+ OEM_WORK_DIR="$2"
+ shift
+ ;;
+ --build)
+ BUILD_CPU=$2
+ shift
+ ;;
+ --config)
+ BUILD_CONFIG=$2
+ shift
+ ;;
+ --ninja)
+ USE_NINJA=1
+ ;;
+ --have-system-xerces)
+ HAVE_SYSTEM_XERCES=1
+ ;;
+ --help)
+ echo "Usage: $0 (options)"
+ echo "Options:"
+ echo " --oem_working_dir [installation directory]"
+ echo " --build [32(default)|64]"
+ echo " --config [Release(default)|Debug]"
+ echo " --ninja [Use ninja build system]"
+ echo " --have-system-xerces [Use system-installed xerces]"
+ echo " --help [Display usage]"
+ exit
+ ;;
+ esac
+ shift # Check next set of parameters.
+done
+
+SOURCE_DIR=`pwd`
+
+check_build()
+{
+ error=$?
+ if [ $error -ne 0 ]; then
+ echo "$LIB_NAME: Error build failed ($error)................."
+ # Return back to this dir before bailing
+ cd $SOURCE_DIR
+ exit $error
+ fi
+}
+
+# Validate
+if test "$BUILD_CPU" != "32" -a "$BUILD_CPU" != "64"; then
+ echo "--build must be 32 or 64"
+ exit 1;
+fi
+if test "$BUILD_CONFIG" != "Release" -a "$BUILD_CONFIG" != "Debug"; then
+ echo "--config must be Release or Debug"
+ exit 1;
+fi
+
+echo "Current source dir is: $SOURCE_DIR"
+echo "Building for: $BUILD_CPU-bit"
+echo "Building in: $BUILD_CONFIG"
+echo "Using Ninja build: $USE_NINJA"
+echo "CMake build directory is: $CMAKE_BUILD_DIR"
+echo "OEM Working Directory is: $OEM_WORK_DIR"
+
+echo "Creating CMake build directory"
+mkdir -p $CMAKE_BUILD_DIR
+
+echo "Checking if OEM working dir exists"
+if [ ! -d $OEM_WORK_DIR ]; then
+ mkdir -p $OEM_WORK_DIR
+ echo "Created OEM working dir at: $OEM_WORK_DIR"
+fi
+
+echo "Checking if we need to build DBXML"
+# Basically perform the same checks as FindDbXml.cmake
+HAS_DBXML_HEADERS=0
+HAS_DBXML_LIB=0
+HAS_DBCXX_LIB=0
+HAS_XQILLA_LIB=0
+if [ -f "${OEM_WORK_DIR}/dbxml/install/include/dbxml/DbXml.hpp" ]; then
+ HAS_DBXML_HEADERS=1
+fi
+if [ -f "${OEM_WORK_DIR}/dbxml/install/lib/libdb_cxx.so" ]; then
+ HAS_DBCXX_LIB=1
+fi
+if [ -f "${OEM_WORK_DIR}/dbxml/install/lib/libdbxml.so" ]; then
+ HAS_DBXML_LIB=1
+fi
+if [ -f "${OEM_WORK_DIR}/dbxml/install/lib/libxqilla.so" ]; then
+ HAS_XQILLA_LIB=1
+fi
+echo "Has DBXML headers: $HAS_DBXML_HEADERS"
+echo "Has DB C++ Library: $HAS_DBCXX_LIB"
+echo "Has DBXML Library: $HAS_DBXML_LIB"
+echo "Has XQilla Library: $HAS_XQILLA_LIB"
+
+# (Re)build DBXML if any of the above is false
+if test $HAS_DBXML_HEADERS -eq 0 -o $HAS_DBCXX_LIB -eq 0 -o $HAS_DBXML_LIB -eq 0 -o $HAS_XQILLA_LIB -eq 0; then
+ echo "Re-building DBXML (${BUILD_CONFIG})"
+ cp -Rf Oem/dbxml ${OEM_WORK_DIR}/dbxml
+ cd ${OEM_WORK_DIR}/dbxml
+ if test $HAVE_SYSTEM_XERCES -eq 1; then
+ echo "Building DBXML with system-installed xerces"
+ if test $BUILD_CONFIG == "Debug"; then
+ ./buildall.sh --enable-debug --with-xerces=/usr --have-system-xerces
+ check_build
+ else
+ ./buildall.sh --with-xerces=/usr --have-system-xerces
+ check_build
+ fi
+ else
+ echo "Building DBXML with internal copy of xerces"
+ if test $BUILD_CONFIG == "Debug"; then
+ ./buildall.sh --enable-debug
+ check_build
+ else
+ ./buildall.sh
+ check_build
+ fi
+ fi
+fi
+
+# TODO: LinuxApt should probably be built here too
+
+# Now for the main event
+echo "Setting up CMake in: $CMAKE_BUILD_DIR"
+cd $CMAKE_BUILD_DIR
+if test $USE_NINJA -eq 1; then
+ cmake -G Ninja $SOURCE_DIR -DMG_CPU=$BUILD_CPU -DWITH_JAVA=TRUE -DCMAKE_BUILD_TYPE=$BUILD_CONFIG -DMG_OEM_WORK_DIR=$OEM_WORK_DIR
+ check_build
+ ninja
+ check_build
+else
+ cmake $SOURCE_DIR -DMG_CPU=$BUILD_CPU -DWITH_JAVA=TRUE -DCMAKE_BUILD_TYPE=$BUILD_CONFIG
+ check_build
+ make
+ check_build
+fi
\ No newline at end of file
Property changes on: sandbox/jng/cmake_v2/cmake_build.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the mapguide-commits
mailing list