[mapguide-commits] r9262 - in sandbox/jng/cmake_v2: . Common Oem/DWFTK/develop/global/src Oem/DWFTK/develop/global/src/dwf Oem/DWFTK/develop/global/src/dwfcore

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 25 05:32:47 PST 2017


Author: jng
Date: 2017-12-25 05:32:47 -0800 (Mon, 25 Dec 2017)
New Revision: 9262

Added:
   sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/config.h.in
   sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/config.h.in
Modified:
   sandbox/jng/cmake_v2/CMakeLists.txt
   sandbox/jng/cmake_v2/Common/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt
   sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt
Log:
Fix the atomic.h situation with DWFCore. Basically we need cmake to behave like a configure script so that it will generate a config.h header for dwfcore and dwftk. With this change, Renderers is now included in the CMake fold which builds and can properly link against dwfcore/dwftk

Modified: sandbox/jng/cmake_v2/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/CMakeLists.txt	2017-12-25 01:12:07 UTC (rev 9261)
+++ sandbox/jng/cmake_v2/CMakeLists.txt	2017-12-25 13:32:47 UTC (rev 9262)
@@ -13,6 +13,11 @@
 # Make CPack available to easy generate binary packages
 include(CPack)
 
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+include(CheckCXXSourceCompiles)
+include(CheckLibraryExists)
+
 set(MG_VERSION_MAJOR 3)
 set(MG_VERSION_MINOR 3)
 set(MG_VERSION_RELEASE 0)
@@ -49,4 +54,4 @@
 add_subdirectory(Oem)
 add_subdirectory(Common)
 #add_subdirectory(Server)
-#add_subdirectory(Web)
\ No newline at end of file
+#add_subdirectory(Web)

Modified: sandbox/jng/cmake_v2/Common/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Common/CMakeLists.txt	2017-12-25 01:12:07 UTC (rev 9261)
+++ sandbox/jng/cmake_v2/Common/CMakeLists.txt	2017-12-25 13:32:47 UTC (rev 9262)
@@ -15,6 +15,6 @@
 add_subdirectory(MdfModel)
 add_subdirectory(MdfParser)
 #add_subdirectory(PlatformBase)
-#add_subdirectory(Renderers)
+add_subdirectory(Renderers)
 add_subdirectory(Security)
-add_subdirectory(Stylization)
\ No newline at end of file
+add_subdirectory(Stylization)

Modified: sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/CMakeLists.txt	2017-12-25 01:12:07 UTC (rev 9261)
+++ sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/CMakeLists.txt	2017-12-25 13:32:47 UTC (rev 9262)
@@ -1,7 +1,86 @@
 project(dwftk)
 
-add_definitions(-DHAVE_MEMMOVE -DHAVE_ASM_ATOMIC_H -DDWFCORE_BUILD_ZLIB -DDWFCORE_BUILD_EXPAT -D_DWFCORE_USE_ASM_ATOMIC_H)
+add_definitions(-DDWFCORE_BUILD_ZLIB -DDWFCORE_BUILD_EXPAT)
 
+find_library(pthread REQUIRED)
+find_library(uuid REQUIRED)
+if (NOT uuid-NOTFOUND)
+    #add_definitions(-DHAVE_LIBUUID)
+    set (HAVE_LIBUUID 1)
+else (NOT uuid-NOTFOUND)
+    message(STATUS "Could not find libuuid")
+endif (NOT uuid-NOTFOUND)
+
+check_include_file(bits/stl_algobase.h HAVE_ALGOBASE_H)
+check_include_file(asm/atomic.h HAVE_ATOMIC_H)
+check_include_file(alsa/iatomic.h HAVE_IATOMIC_H)
+check_include_file(netinet/ether.h HAVE_NETINET_ETHER_H)
+
+#if (HAVE_NETINET_ETHER_H)
+#    add_definitions(-DHAVE_NETINET_ETHER_H)
+#endif (HAVE_NETINET_ETHER_H)
+
+if (HAVE_ATOMIC_H)
+    check_cxx_source_compiles(
+        "#include <asm/atomic.h>
+        int main() {
+            int i = 0;
+            atomic_t tValue;
+            atomic_set( &tValue, i );
+            atomic_inc( &tValue );
+            atomic_dec( &tValue );
+            i = atomic_read( &tValue );
+        }" 
+        CAN_COMPILE_WITH_ATOMIC_H)
+    if (CAN_COMPILE_WITH_ATOMIC_H)
+        #add_definitions(-D_DWFCORE_USE_ASM_ATOMIC_H)
+        set (_DWFCORE_USE_ASM_ATOMIC_H 1)
+    else (CAN_COMPILE_WITH_ATOMIC_H)
+        message(WARNING "Found asm/atomic.h but could not compile with it")
+    endif (CAN_COMPILE_WITH_ATOMIC_H)
+endif (HAVE_ATOMIC_H)
+
+if (HAVE_IATOMIC_H)
+check_cxx_source_compiles(
+    "#include <alsa/iatomic.h>
+    int main() {
+        int i = 0;
+        atomic_t tValue;
+        atomic_set( &tValue, i );
+        atomic_inc( &tValue );
+        atomic_dec( &tValue );
+        i = atomic_read( &tValue );
+    }" 
+    CAN_COMPILE_WITH_IATOMIC_H)
+    if (CAN_COMPILE_WITH_IATOMIC_H)
+        #add_definitions(-D_DWFCORE_USE_ALSA_IATOMIC_H)
+        set (_DWFCORE_USE_ALSA_IATOMIC_H 1)
+    else (CAN_COMPILE_WITH_IATOMIC_H)
+    message(WARNING "Found alsa/atomic.h but could not compile with it")
+    endif (CAN_COMPILE_WITH_IATOMIC_H)
+endif (HAVE_IATOMIC_H)
+
+check_function_exists(max HAVE_MAX)
+check_function_exists(min HAVE_MIN)
+check_function_exists(memmove HAVE_MEMMOVE)
+
+#if (HAVE_MEMMOVE)
+#   add_definitions(-DHAVE_MEMMOVE)
+#else (HAVE_MEMMOVE)
+#   message(ERROR "Could not find required function memmove")
+#endif (HAVE_MEMMOVE)
+
+if (NOT HAVE_MEMMOVE)
+    message(ERROR "Could not find required function memmove")
+endif (NOT HAVE_MEMMOVE)
+
+# DWFCore's CMakeLists.txt will generate a config.h for us
+add_definitions(-DHAVE_CONFIG_H)
+
+# This is to ensure dwfcore/config.h will properly resolve not only for
+# DWFCore, but DWFToolkit and downstream dependencies
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
 set (DWF_VERSION_MAJOR 7)
 set (DWF_VERSION_MINOR 7)
 set (DWF_VERSION_REV 0)

Modified: sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt	2017-12-25 01:12:07 UTC (rev 9261)
+++ sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt	2017-12-25 13:32:47 UTC (rev 9262)
@@ -151,4 +151,6 @@
 )
 
 add_library(dwftk STATIC ${dwftk_SRCS})
-target_link_libraries(dwftk dwfcore)
\ No newline at end of file
+target_link_libraries(dwftk dwfcore)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
\ No newline at end of file

Added: sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/config.h.in
===================================================================
--- sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/config.h.in	                        (rev 0)
+++ sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwf/config.h.in	2017-12-25 13:32:47 UTC (rev 9262)
@@ -0,0 +1,6 @@
+#ifndef DWF_CONFIG_H
+#define DWF_CONFIG_H
+
+// This is a config.h template used by CMake
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt
===================================================================
--- sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt	2017-12-25 01:12:07 UTC (rev 9261)
+++ sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt	2017-12-25 13:32:47 UTC (rev 9262)
@@ -105,7 +105,18 @@
 )
 
 add_library(dwfcore STATIC ${dwfcore_SRCS})
-target_link_libraries(dwfcore
-    dl
-    pthread
-)
\ No newline at end of file
+
+if (NOT uuid-NOTFOUND)
+    target_link_libraries(dwfcore
+        dl
+        pthread
+        uuid
+    )
+else (NOT uuid-NOTFOUND)
+    target_link_libraries(dwfcore
+        dl
+        pthread
+    )
+endif (NOT uuid-NOTFOUND)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
\ No newline at end of file

Added: sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/config.h.in
===================================================================
--- sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/config.h.in	                        (rev 0)
+++ sandbox/jng/cmake_v2/Oem/DWFTK/develop/global/src/dwfcore/config.h.in	2017-12-25 13:32:47 UTC (rev 9262)
@@ -0,0 +1,12 @@
+#ifndef DWFCORE_CONFIG_H
+#define DWFCORE_CONFIG_H
+
+// This is a config.h template used by CMake
+
+#cmakedefine _DWFCORE_USE_ASM_ATOMIC_H @_DWFCORE_USE_ASM_ATOMIC_H@
+#cmakedefine _DWFCORE_USE_ALSA_IATOMIC_H @_DWFCORE_USE_ALSA_IATOMIC_H@
+#cmakedefine HAVE_MEMMOVE @HAVE_MEMMOVE@
+#cmakedefine HAVE_NETINET_ETHER_H @HAVE_NETINET_ETHER_H@
+#cmakedefine HAVE_LIBUUID @HAVE_LIBUUID@
+
+#endif
\ No newline at end of file



More information about the mapguide-commits mailing list