Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

scaffolding for drivers.soci.reader/drivers.soci.writer

  • Loading branch information...
commit e40a1466396b25797e25e7a76304f5ede5a606c0 1 parent 724b1a7
@hobu hobu authored
View
10 CMakeLists.txt
@@ -304,6 +304,16 @@ if(WITH_GDAL)
endif()
endif()
+set(WITH_SOCI FALSE CACHE BOOL "Choose if SOCI database support should be built")
+if (WITH_SOCI)
+find_package(Soci 3.1.0)
+if (SOCI_FOUND)
+ mark_as_advanced(CLEAR SOCI_INCLUDE_DIRS)
+ mark_as_advanced(CLEAR SOCI_LIBRARY)
+ include_directories(${SOCI_INCLUDE_DIRS})
+ set(PDAL_HAVE_SOCI 1)
+endif()
+endif()
#------------------------------------------------------------------------------
View
100 cmake/modules/FindSoci.cmake
@@ -0,0 +1,100 @@
+###############################################################################
+# CMake module to search for SOCI library
+#
+# WARNING: This module is experimental work in progress.
+#
+# This module defines:
+# SOCI_INCLUDE_DIRS = include dirs to be used when using the soci library
+# SOCI_LIBRARY = full path to the soci library
+# SOCI_VERSION = the soci version found (not yet. soci does not provide that info.)
+# SOCI_FOUND = true if soci was found
+#
+# This module respects:
+# LIB_SUFFIX = (64|32|"") Specifies the suffix for the lib directory
+#
+# For each component you specify in find_package(), the following variables are set.
+#
+# SOCI_${COMPONENT}_PLUGIN = full path to the soci plugin
+# SOCI_${COMPONENT}_FOUND
+#
+# Copyright (c) 2011 Michael Jansen <info@michael-jansen.biz>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+###############################################################################
+#
+### Global Configuration Section
+#
+SET(_SOCI_ALL_PLUGINS mysql odbc postgresql sqlite3)
+SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIR SOCI_LIBRARY)
+
+#
+### FIRST STEP: Find the soci headers.
+#
+FIND_PATH(
+ SOCI_INCLUDE_DIR soci.h
+ PATH "/usr/local"
+ PATH_SUFFIXES "" "soci"
+ DOC "Soci (http://soci.sourceforge.net) include directory")
+MARK_AS_ADVANCED(SOCI_INCLUDE_DIR)
+
+SET(SOCI_INCLUDE_DIRS ${SOCI_INCLUDE_DIR})
+
+#
+### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX
+#
+FIND_LIBRARY(
+ SOCI_LIBRARY
+ NAMES soci_core
+ HINTS ${SOCI_INCLUDE_DIR}/..
+ PATH_SUFFIXES lib${LIB_SUFFIX})
+MARK_AS_ADVANCED(SOCI_LIBRARY)
+
+GET_FILENAME_COMPONENT(SOCI_LIBRARY_DIR ${SOCI_LIBRARY} PATH)
+MARK_AS_ADVANCED(SOCI_LIBRARY_DIR)
+
+#
+### THIRD STEP: Find all installed plugins if the library was found
+#
+IF(SOCI_INCLUDE_DIR AND SOCI_LIBRARY)
+
+ MESSAGE(STATUS "Soci found: Looking for plugins")
+ FOREACH(plugin IN LISTS _SOCI_ALL_PLUGINS)
+
+ FIND_LIBRARY(
+ SOCI_${plugin}_PLUGIN
+ NAMES soci_${plugin}
+ HINTS ${SOCI_INCLUDE_DIR}/..
+ PATH_SUFFIXES lib${LIB_SUFFIX})
+ MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
+
+ IF(SOCI_${plugin}_PLUGIN)
+ MESSAGE(STATUS " * Plugin ${plugin} found ${SOCI_${plugin}_LIBRARY}.")
+ SET(SOCI_${plugin}_FOUND True)
+ ELSE()
+ MESSAGE(STATUS " * Plugin ${plugin} not found.")
+ SET(SOCI_${plugin}_FOUND False)
+ ENDIF()
+
+ ENDFOREACH()
+
+ #
+ ### FOURTH CHECK: Check if the required components were all found
+ #
+ FOREACH(component ${Soci_FIND_COMPONENTS})
+ IF(${SOCI_${component}_FOUND})
+ # Does not work with NOT ... . No idea why.
+ ELSE()
+ MESSAGE(SEND_ERROR "Required component ${component} not found.")
+ ENDIF()
+ ENDFOREACH()
+
+ENDIF()
+
+#
+### ADHERE TO STANDARDS
+#
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Soci DEFAULT_MSG ${_SOCI_REQUIRED_VARS})
+
View
1  hobu-config.sh
@@ -21,6 +21,7 @@ cmake -G "Unix Makefiles" \
-DWITH_LIBXML2=ON \
-DWITH_PYTHON=ON \
-DWITH_FLANN=ON \
+ -DWITH_SOCI=ON \
-DGEOTIFF_INCLUDE_DIR=${GEOTIFF_HOME}/include/ \
-DGEOTIFF_LIBRARY=${GEOTIFF_HOME}/lib/libgeotiff.${SO_EXT} \
-DICONV_INCLUDE_DIR=/usr/include \
View
1  pdal_defines.h.in
@@ -36,6 +36,7 @@
#cmakedefine PDAL_HAVE_ORACLE
#cmakedefine PDAL_HAVE_P2G
#cmakedefine PDAL_HAVE_PYTHON
+#cmakedefine PDAL_HAVE_SOCI
/*
View
27 src/CMakeLists.txt
@@ -391,6 +391,27 @@ set (PDAL_DRIVERS_PCD_CPP
list (APPEND PDAL_CPP ${PDAL_DRIVERS_PCD_CPP} )
list (APPEND PDAL_HPP ${PDAL_DRIVERS_PCD_HPP} )
+#
+# drivers/soci
+#
+set(PDAL_SOCI_PATH drivers/soci)
+set(PDAL_SOCI_HEADERS ${PDAL_HEADERS_DIR}/${PDAL_SOCI_PATH})
+set(PDAL_SOCI_SRC ${PROJECT_SOURCE_DIR}/src/${PDAL_SOCI_PATH})
+
+set(PDAL_DRIVERS_SOCI_HPP
+ ${PDAL_SOCI_HEADERS}/Writer.hpp
+)
+
+set (PDAL_DRIVERS_SOCI_CPP
+ ${PDAL_SOCI_SRC}/Writer.cpp
+)
+
+if (SOCI_FOUND)
+ list (APPEND PDAL_CPP ${PDAL_DRIVERS_SOCI_CPP} )
+ list (APPEND PDAL_HPP ${PDAL_DRIVERS_SOCI_HPP} )
+endif()
+
+
#
# filters
@@ -567,7 +588,8 @@ if (WIN32)
${PYTHON_LIBRARY}
${P2G_LIBRARY}
${GEOS_LIBRARY}
- ${FLANN_LIBRARIES})
+ ${FLANN_LIBRARIES}
+ ${SOCI_LIBRARY})
else()
target_link_libraries(${APPS_CPP_DEPENDENCIES}
${PDAL_LIB_NAME}
@@ -581,7 +603,8 @@ else()
${PYTHON_LIBRARY}
${P2G_LIBRARY}
${GEOS_LIBRARY}
- ${FLANN_LIBRARIES})
+ ${FLANN_LIBRARIES}
+ ${SOCI_LIBRARY})
endif()
message(STATUS "Using boost lib: ${Boost_LIBRARIES}")
View
14 src/StageFactory.cpp
@@ -66,6 +66,12 @@
#include <pdal/drivers/p2g/Writer.hpp>
#endif
+
+#ifdef PDAL_HAVE_SOCI
+#include <pdal/drivers/soci/Writer.hpp>
+#endif
+
+
#include <pdal/filters/ByteSwap.hpp>
#include <pdal/filters/Cache.hpp>
#include <pdal/filters/Chipper.hpp>
@@ -188,6 +194,10 @@ MAKE_WRITER_CREATOR(OciWriter, pdal::drivers::oci::Writer)
MAKE_WRITER_CREATOR(P2GWriter, pdal::drivers::p2g::Writer)
#endif
+#ifdef PDAL_HAVE_SOCI
+MAKE_WRITER_CREATOR(SociWriter, pdal::drivers::soci::Writer)
+#endif
+
StageFactory::StageFactory()
{
@@ -447,6 +457,10 @@ void StageFactory::registerKnownWriters()
REGISTER_WRITER(P2GWriter, pdal::drivers::p2g::Writer);
#endif
+#ifdef PDAL_HAVE_SOCI
+ REGISTER_WRITER(SociWriter, pdal::drivers::soci::Writer);
+#endif
+
}
void StageFactory::loadPlugins()
Please sign in to comment.
Something went wrong with that request. Please try again.