Skip to content

Commit

Permalink
Merge pull request #168 from c42f/pdal-static-build
Browse files Browse the repository at this point in the history
Build system option for static PDAL build
  • Loading branch information
c42f committed Aug 1, 2013
2 parents 69708ec + 8f8a22a commit 8f77618
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Expand Up @@ -97,6 +97,8 @@ set(ENABLE_CTEST FALSE CACHE BOOL
# General build settings
#------------------------------------------------------------------------------

option(PDAL_BUILD_STATIC "Build PDAL as a static library" OFF)

if(WIN32)
if(MSVC)
option(PDAL_USE_STATIC_RUNTIME "Use the static runtime" OFF)
Expand Down Expand Up @@ -196,7 +198,7 @@ else()
# Recommended C++ compilation flags
# -Weffc++
set(PDAL_COMMON_CXX_FLAGS
"-Wextra -Wall -Wno-unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long -fPIC")
"-Wextra -Wall -Wno-unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long")

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)

Expand Down Expand Up @@ -589,6 +591,12 @@ set (USE_PDAL_PLUGIN_MRSID FALSE CACHE BOOL "Build the MrSID driver as a plugin
set (USE_PDAL_PLUGIN_CARIS FALSE CACHE BOOL "Build the Caris driver as a plugin rather than embedding")
set (USE_PDAL_PLUGIN_NITRO FALSE CACHE BOOL "Build the NITF writer as a plugin rather than embedding")

if (USE_PDAL_PLUGIN_TEXT OR USE_PDAL_PLUGIN_SOCI OR USE_PDAL_PLUGIN_OCI OR
USE_PDAL_PLUGIN_MRSID OR USE_PDAL_PLUGIN_CARIS OR USE_PDAL_PLUGIN_NITRO)
if (PDAL_BUILD_STATIC)
message(SEND_ERROR "Cannot build separate plugins with statically compiled PDAL")
endif()
endif()

#------------------------------------------------------------------------------
# installation commands
Expand Down
4 changes: 4 additions & 0 deletions boost/CMakeLists.txt
Expand Up @@ -141,3 +141,7 @@ endif(WIN32)

add_library(${PDALBOOST_LIB_NAME} STATIC ${PDALBOOST_SOURCES})

if (UNIX AND NOT PDAL_BUILD_STATIC)
# Must use position independent code to link static libs into dynamic ones
set_target_properties(${PDALBOOST_LIB_NAME} PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Expand Up @@ -629,7 +629,12 @@ if (NOT WITH_STATIC_LASZIP)
endif()
endif()

add_library(${PDAL_LIB_NAME} SHARED ${PDAL_SOURCES})
if (PDAL_BUILD_STATIC)
set(PDAL_LIB_TYPE STATIC)
else()
set(PDAL_LIB_TYPE SHARED)
endif()
add_library(${PDAL_LIB_NAME} ${PDAL_LIB_TYPE} ${PDAL_SOURCES})

set (SOCI_LIBRARIES ${SOCI_LIBRARY} ${SOCI_postgresql_PLUGIN})

Expand Down

0 comments on commit 8f77618

Please sign in to comment.