Permalink
Browse files

try building oracle support as a plugin

  • Loading branch information...
1 parent 67f48df commit ccaaf6073c90142667a04fb32b5a1f0c19077a48 @tbonfort tbonfort committed Apr 1, 2013
Showing with 38 additions and 27 deletions.
  1. +33 −20 CMakeLists.txt
  2. +5 −6 maporaclespatial.c
  3. +0 −1 mapserver-config.h.in
View
@@ -121,9 +121,7 @@ option(WITH_JAVA "Enable Java mapscript support" OFF)
option(WITH_CSHARP "Enable C# mapscript support" OFF)
option(WITH_POINT_Z_M "include Z and M coordinates in point structure (advanced, not recommended)" OFF)
option(WITH_ORACLESPATIAL "include oracle spatial database input support" OFF)
-if(WIN32)
- option(WITH_ORACLE_PLUGIN "include oracle spatial database input support as plugin" OFF)
-endif()
+option(WITH_ORACLE_PLUGIN "include oracle spatial database input support as plugin" OFF)
option(WITH_EXEMPI "include xmp output metadata support" OFF)
option(WITH_XMLMAPFILE "include native xml mapfile support (requires libxslt/libexslt)" OFF)
@@ -335,29 +333,35 @@ if(WITH_MYSQL)
endif(MYSQL_FOUND)
endif (WITH_MYSQL)
-if(WITH_ORACLESPATIAL)
+if(WITH_ORACLE_PLUGIN AND WITH_ORACLESPATIAL)
+ message(SEND_ERROR "WITH_ORACLESPATIAL and WITH_ORACLE_PLUGIN cannot be used simultaneously")
+endif(WITH_ORACLE_PLUGIN AND WITH_ORACLESPATIAL)
+
+if(WITH_ORACLESPATIAL OR WITH_ORACLE_PLUGIN)
if(NOT DEFINED ENV{ORACLE_HOME})
MESSAGE( SEND_ERROR "ORACLE_HOME environment variable not set, needed for detection")
endif()
find_package(Oracle)
if(ORACLE_FOUND)
include_directories(${ORACLE_INCLUDE_DIR})
- ms_link_libraries( ${ORACLE_LIBRARY})
- set (USE_ORACLESPATIAL 1)
else(ORACLE_FOUND)
report_optional_not_found(ORACLESPATIAL)
+ #FIXME: error message here could be misleading, only states ORACLESPATIAL whereas
+ #the request could have been for ORACLE_PLUGIN
endif(ORACLE_FOUND)
-endif (WITH_ORACLESPATIAL)
+endif(WITH_ORACLESPATIAL OR WITH_ORACLE_PLUGIN)
-if(WIN32)
- if(WITH_ORACLE_PLUGIN)
- if(USE_ORACLESPATIAL)
- set(USE_ORACLE_PLUGIN 1)
- else(USE_ORACLESPATIAL)
- report_dependency_error(ORACLE_PLUGIN ORACLESPATIAL)
- endif(USE_ORACLESPATIAL)
- endif(WITH_ORACLE_PLUGIN)
-endif(WIN32)
+if(ORACLE_FOUND AND WITH_ORACLESPATIAL)
+ ms_link_libraries( ${ORACLE_LIBRARY})
+ set (USE_ORACLESPATIAL 1)
+endif(ORACLE_FOUND AND WITH_ORACLESPATIAL)
+
+if(ORACLE_FOUND AND WITH_ORACLE_PLUGIN)
+ add_library(maporacleplugin MODULE maporaclespatial.c mapstring.c)
+ target_link_libraries(maporacleplugin ${ORACLE_LIBRARY} ${MAPSERVER_LIBMAPSERVER})
+ set_target_properties(maporacleplugin PROPERTIES COMPILE_FLAGS -DUSE_ORACLE_PLUGIN)
+ set (USE_ORACLE_PLUGIN 1)
+endif(ORACLE_FOUND AND WITH_ORACLE_PLUGIN)
if(WITH_FCGI)
find_package(FCGI)
@@ -688,7 +692,15 @@ status_optional_component("LIBXML2" "${USE_LIBXML2}" "${LIBXML2_LIBRARY}")
status_optional_component("POSTGIS" "${USE_POSTGIS}" "${POSTGRESQL_LIBRARY}")
status_optional_component("GEOS" "${USE_GEOS}" "${GEOS_LIBRARY}")
status_optional_component("FastCGI" "${USE_FASTCGI}" "${FCGI_LIBRARY}")
-status_optional_component("Oracle Spatial" "${USE_ORACLESPATIAL}" "${ORACLE_LIBRARY}")
+if(USE_ORACLESPATIAL OR USE_ORACLE_PLUGIN)
+ if(USE_ORACLESPATIAL)
+ status_optional_component("Oracle Spatial" "${USE_ORACLESPATIAL}" "${ORACLE_LIBRARY}")
+ else(USE_ORACLESPATIAL)
+ status_optional_component("Oracle Spatial (Built as plugin)" "${USE_ORACLE_PLUGIN}" "${ORACLE_LIBRARY}")
+ endif(USE_ORACLESPATIAL)
+else(USE_ORACLESPATIAL OR USE_ORACLE_PLUGIN)
+ status_optional_component("Oracle Spatial" "" "${ORACLE_LIBRARY}")
+endif(USE_ORACLESPATIAL OR USE_ORACLE_PLUGIN)
status_optional_component("Exempi XMP" "${USE_EXEMPI}" "${LIBEXEMPI_LIBRARY}")
message(STATUS " * Optional features")
status_optional_feature("WMS SERVER" "${USE_WMS_SVR}")
@@ -702,9 +714,6 @@ status_optional_feature("Thread-safety support" "${USE_THREAD}")
status_optional_feature("KML output" "${USE_KML}")
status_optional_feature("Z+M point coordinate support" "${USE_POINT_Z_M}")
status_optional_feature("XML Mapfile support" "${USE_XMLMAPFILE}")
-if(WIN32)
-status_optional_feature("Oracle Spatial as Plugin" "${USE_ORACLE_PLUGIN}")
-endif(WIN32)
message(STATUS " * Mapscripts")
status_optional_feature("Python" "${USE_PYTHON_MAPSCRIPT}")
@@ -723,6 +732,10 @@ set(USE_GENERIC_MS_NINT 1)
endif(WIN32)
#INSTALL(FILES mapserver-api.h ${PROJECT_BINARY_DIR}/mapserver-version.h DESTINATION include)
+if(USE_ORACLE_PLUGIN)
+ INSTALL(TARGETS maporacleplugin DESTINATION lib)
+endif(USE_ORACLE_PLUGIN)
+
INSTALL(TARGETS shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
if(BUILD_STATIC)
INSTALL(TARGETS mapserver_static DESTINATION lib)
View
@@ -41,7 +41,7 @@
-#ifdef USE_ORACLESPATIAL
+#if defined(USE_ORACLESPATIAL) || defined(USE_ORACLE_PLUGIN)
#include <oci.h>
#include <ctype.h>
@@ -3384,8 +3384,7 @@ int msOracleSpatialGetPaging(layerObj *layer)
#endif
-#ifdef USE_ORACLE_PLUGIN
-#ifdef USE_ORACLESPATIAL
+#if defined USE_ORACLE_PLUGIN
MS_DLL_EXPORT int
PluginInitializeVirtualTable(layerVTableObj* vtable, layerObj *layer)
{
@@ -3415,9 +3414,9 @@ PluginInitializeVirtualTable(layerVTableObj* vtable, layerObj *layer)
return MS_SUCCESS;
}
-#endif
-#endif
+#else /*if ORACLE_PLUGIN is defined, then this file is not used by libmapserver
+ and therefre there is no need to include this function */
int msOracleSpatialLayerInitializeVirtualTable(layerObj *layer)
{
assert(layer != NULL);
@@ -3445,4 +3444,4 @@ int msOracleSpatialLayerInitializeVirtualTable(layerObj *layer)
return MS_SUCCESS;
}
-
+#endif
@@ -31,7 +31,6 @@
#cmakedefine USE_KML 1
#cmakedefine USE_POINT_Z_M 1
#cmakedefine USE_ORACLESPATIAL 1
-#cmakedefine USE_ORACLE_PLUGIN 1
#cmakedefine USE_EXEMPI 1
#cmakedefine USE_XMLMAPFILE 1
#cmakedefine USE_GENERIC_MS_NINT 1

0 comments on commit ccaaf60

Please sign in to comment.