Permalink
Browse files

refactor SDE detection in cmake files (#4512,#4700)

- add a specific plugin configuration
- checks for sde,sg and pe libs, adds pthread,socketi and dl if found
- adds #define SDE64 on 64 bit platforms
  • Loading branch information...
1 parent e94a025 commit b677cf34e17686e74f763cad07a6147265efbcac @tbonfort tbonfort committed Aug 6, 2013
Showing with 43 additions and 27 deletions.
  1. +40 −26 CMakeLists.txt
  2. +2 −0 mapserver-config.h.in
  3. +1 −1 msautotest
View
@@ -128,7 +128,6 @@ option(WITH_XMLMAPFILE "include native xml mapfile support (requires libxslt/lib
option(BUILD_STATIC "Also build a static version of mapserver" OFF)
option(LINK_STATIC_LIBMAPSERVER "Link to static version of libmapserver (also for mapscripts)" OFF)
-option(WITH_FLEX_BISON "Regenerate parser" OFF)
option(WITH_APACHE_MODULE "include (experimental) support for apache module" OFF)
option(WITH_GENERIC_NINT "generic rounding" OFF)
@@ -401,29 +400,41 @@ if(WITH_MSSQL2008)
endif(ODBC_FOUND)
endif(WITH_MSSQL2008)
-if(WITH_SDE91)
+if(WITH_SDE_PLUGIN)
+ if(WITH_SDE)
+ MESSAGE( SEND_ERROR "WITH_SDE and WITH_SDE_PLUGIN cannot be used simultaneously")
+ endif(WITH_SDE)
if(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
include_directories(${SDE_INCLUDE_DIR})
- add_library(msplugin_sde91 MODULE mapsde.c mapthread.c)
- target_link_libraries(msplugin_sde91 ${SDE_LIBRARY_DIR}/pe91.lib ${SDE_LIBRARY_DIR}/sg91.lib ${SDE_LIBRARY_DIR}/sde91.lib ${MAPSERVER_LIBMAPSERVER})
- set_target_properties(msplugin_sde91 PROPERTIES COMPILE_FLAGS "-DUSE_SDE")
- set (USE_SDE91 1)
+ if(SDE_VERSION STREQUAL "91")
+ add_library(msplugin_sde91 MODULE mapsde.c mapthread.c)
+ target_link_libraries(msplugin_sde91 ${SDE_LIBRARY_DIR}/pe91.lib ${SDE_LIBRARY_DIR}/sg91.lib ${SDE_LIBRARY_DIR}/sde91.lib ${MAPSERVER_LIBMAPSERVER})
+ set_target_properties(msplugin_sde91 PROPERTIES COMPILE_FLAGS "-DUSE_SDE")
+ else(SDE_VERSION STREQUAL "91")
+ add_library(msplugin_sde92 MODULE mapsde.c mapthread.c)
+ target_link_libraries(msplugin_sde92 ${SDE_LIBRARY_DIR}/pe.lib ${SDE_LIBRARY_DIR}/sg.lib ${SDE_LIBRARY_DIR}/sde.lib ${MAPSERVER_LIBMAPSERVER})
+ set_target_properties(msplugin_sde92 PROPERTIES COMPILE_FLAGS "-DUSE_SDE")
+ endif(SDE_VERSION STREQUAL "91")
+ set(USE_SDE_PLUGIN 1)
else(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
- MESSAGE( SEND_ERROR "Must specify SDE_INCLUDE_DIR and SDE_LIBRARY_DIR")
+ MESSAGE( SEND_ERROR "Must specify SDE_INCLUDE_DIR and SDE_LIBRARY_DIR for WITH_SDE_PLUGIN")
endif(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
-endif(WITH_SDE91)
-
-if(WITH_SDE92)
- if(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
- include_directories(${SDE_INCLUDE_DIR})
- add_library(msplugin_sde92 MODULE mapsde.c mapthread.c)
- target_link_libraries(msplugin_sde92 ${SDE_LIBRARY_DIR}/pe.lib ${SDE_LIBRARY_DIR}/sg.lib ${SDE_LIBRARY_DIR}/sde.lib ${MAPSERVER_LIBMAPSERVER})
- set_target_properties(msplugin_sde92 PROPERTIES COMPILE_FLAGS "-DUSE_SDE")
- set (USE_SDE92 1)
- else(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
- MESSAGE( SEND_ERROR "Must specify SDE_INCLUDE_DIR and SDE_LIBRARY_DIR")
- endif(SDE_INCLUDE_DIR AND SDE_LIBRARY_DIR)
-endif(WITH_SDE92)
+endif(WITH_SDE_PLUGIN)
+
+if(WITH_SDE)
+ find_package(SDE)
+ if(SDE_FOUND)
+ include_directories(${SDE_INCLUDE_DIRS})
+ target_link_libraries(mapserv ${SDE_LIBRARIES})
+ set (USE_SDE 1)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(SDE64 1)
+ endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ else(SDE_FOUND)
+ MESSAGE(WARNING "Could not find (all?) sde files. Try setting -DSDE_DIR=/path/to/sde and/or -DSDE_VERSION=91|92")
+ report_optional_not_found(SDE)
+ endif(SDE_FOUND)
+endif(WITH_SDE)
if(WITH_FCGI)
find_package(FCGI)
@@ -809,12 +820,15 @@ endif(USE_ORACLESPATIAL OR USE_ORACLE_PLUGIN)
if(USE_MSSQL2008)
status_optional_component("MSSQL 2008 (Built as plugin)" "${USE_MSSQL2008}" "${ODBC_LIBRARY}")
endif(USE_MSSQL2008)
-if(USE_SDE91)
- status_optional_component("SDE 91 (Built as plugin)" "${USE_SDE91}" "${SDE_LIBRARY_DIR}")
-endif(USE_SDE91)
-if(USE_SDE92)
- status_optional_component("SDE 92 (Built as plugin)" "${USE_SDE92}" "${SDE_LIBRARY_DIR}")
-endif(USE_SDE92)
+if(USE_SDE_PLUGIN)
+ if(SDE_VERSION STREQUAL "91")
+ status_optional_component("SDE 9.1 (Built as plugin)" "${USE_SDE_PLUGIN}" "${SDE_LIBRARY_DIR}")
+ else(SDE_VERSION STREQUAL "91")
+ status_optional_component("SDE 9.2 (Built as plugin)" "${USE_SDE_PLUGIN}" "${SDE_LIBRARY_DIR}")
+ endif(SDE_VERSION STREQUAL "91")
+else(USE_SDE_PLUGIN)
+ status_optional_component("SDE" "${USE_SDE}" "${SDE_LIBRARIES}")
+endif(USE_SDE_PLUGIN)
status_optional_component("Exempi XMP" "${USE_EXEMPI}" "${LIBEXEMPI_LIBRARY}")
message(STATUS " * Optional features")
status_optional_feature("WMS SERVER" "${USE_WMS_SVR}")
@@ -37,6 +37,8 @@
#cmakedefine POSTGIS_HAS_SERVER_VERSION 1
#cmakedefine USE_SVG_CAIRO 1
#cmakedefine USE_RSVG 1
+#cmakedefine USE_SDE 1
+#cmakedefine SDE64 1
/*windows specific hacks*/
#if defined(_WIN32)

0 comments on commit b677cf3

Please sign in to comment.