Skip to content
Snippets Groups Projects
Commit 059cb4e0 authored by Lars Bilke's avatar Lars Bilke
Browse files

Added CMake options to specify third-party library searching.

Boost, VTK, Eigen
Closes #892.
parent 9f3add48
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
### Infrastructure
- Added CMake option `OGS_CPU_ARCHITECTURE`, #858, [donwloadable binaries](http://docs.opengeosys.org/download) build by Jenkins should now run on more CPUs
- Added CMake options for Boost, VTK and Eigen (`OGS_LIB_BOOST`, ...) to specify if libs are searched on the system first, then build them locally (`Default`), or you can specify to just use system libs (`System`) or force a local build (`Local`)
# 6.0.3
......
......@@ -20,7 +20,6 @@ list(APPEND CMAKE_PREFIX_PATH
###########################
### Preliminary Options ###
###########################
option(OGS_NO_BOOST_DOWNLOAD "Always use the system installed Boost?" OFF)
set(CMAKE_LIBRARY_SEARCH_PATH "" CACHE PATH
"Additional library installation path, e.g. /opt/local or C:/libs")
set(OGS_CPU_ARCHITECTURE "native" CACHE STRING "Processor architecture, defaults to native.")
......@@ -94,6 +93,17 @@ option(OGS_COVERAGE "Enables code coverage measurements with gcov/lcov." OFF)
option(OGS_DOWNLOAD_ADDITIONAL_CONTENT "Should addional content such as manuals be downloaded and packaged?" OFF)
include(scripts/cmake/packaging/Pack.cmake)
# Third-party libraries
# Default checks for system first, then builds locally
set(OGS_LIB_VTK "Default" CACHE STRING "Which VTK library should be used?")
set(OGS_LIB_BOOST "Default" CACHE STRING "Which Boost library should be used?")
set(OGS_LIB_EIGEN "Default" CACHE STRING "Which Eigen library should be used?")
set_property(CACHE
OGS_LIB_VTK
OGS_LIB_BOOST
OGS_LIB_EIGEN
PROPERTY STRINGS "Default" "System" "Local")
######################
### Subdirectories ###
######################
......@@ -101,7 +111,6 @@ include(scripts/cmake/packaging/Pack.cmake)
# External projects
option(Boost_USE_STATIC_LIBS "This option has to be set from the command line (before boost gets found)!" OFF)
include(scripts/cmake/ExternalProjectBoost.cmake)
option(OGS_SYSTEM_VTK_ONLY "If On VTK / ParaView will be searched if installed and will not be build locally." OFF)
include(VtkModules)
if(OGS_INSITU)
include(ExternalProjectCatalyst)
......
......@@ -64,12 +64,9 @@ if(NOT Boost_INCLUDE_DIRS)
if(WIN32 AND COMPILER_IS_GCC)
set(BOOST_INCLUDEDIR "$ENV{CMAKE_LIBRARY_SEARCH_PATH}/include/boost*")
endif()
if(OGS_NO_BOOST_DOWNLOAD)
if(OGS_LIB_BOOST STREQUAL "System")
find_package(Boost 1.46.0 COMPONENTS ${BOOST_LIBS_TO_BUILD} REQUIRED)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Aborting CMake because Boost was not found!.")
endif()
else()
elseif(OGS_LIB_BOOST STREQUAL "Default")
find_package(Boost 1.46.0 COMPONENTS ${BOOST_LIBS_TO_BUILD})
endif()
if(Boost_FOUND)
......@@ -82,11 +79,6 @@ if(NOT Boost_INCLUDE_DIRS)
endif()
endif()
# Check required gcc
if(COMPILER_IS_GCC AND GCC_VERSION VERSION_LESS "4.4")
message(FATAL_ERROR "GCC version >= 4.4 is required for building Boost ${Boost_Version}!")
endif()
# Prefix with --with- for bjam (b2) build command
foreach(LIB_TO_BUILD ${BOOST_LIBS_TO_BUILD})
set(BOOST_LIBS_TO_BUILD_CMD ${BOOST_LIBS_TO_BUILD_CMD} --with-${LIB_TO_BUILD})
......
if(EIGEN3_FOUND)
return()
if(OGS_LIB_EIGEN STREQUAL "System")
find_package(Eigen3 3.2.5 REQUIRED)
elseif(OGS_LIB_EIGEN STREQUAL "Default")
find_package(Eigen3 3.2.5)
endif()
# First check for system Eigen
if(NOT EIGEN3_INCLUDE_DIR)
find_package(Eigen3 3.2.5)
if(EIGEN3_FOUND)
set(EIGEN3_FOUND TRUE CACHE BOOL "Was Eigen found?" FORCE)
set(EIGEN3_INCLUDE_DIR "${EIGEN3_INCLUDE_DIR}" CACHE STRING "Eigen include dir" FORCE)
return()
else()
set(EIGEN3_INCLUDE_DIR "")
endif()
endif()
......@@ -34,7 +33,6 @@ ExternalProject_Add(Eigen
ExternalProject_Get_Property( Eigen source_dir )
if(NOT EIGEN3_INCLUDE_DIR)
#set(EIGEN3_FOUND TRUE CACHE BOOL "Was Eigen found?" FORCE)
set( EIGEN3_INCLUDE_DIR ${source_dir} CACHE INTERNAL "Eigen include dir" FORCE)
message(STATUS "Downloading Eigen automatically.")
endif()
......@@ -12,7 +12,11 @@ if(OGS_BUILD_GUI)
list(APPEND VTK_LIBRARIES vtkNetCDF vtkNetCDF_cxx)
endif()
find_package(VTK 6.1 COMPONENTS ${VTK_MODULES} NO_MODULE QUIET)
if(OGS_LIB_VTK STREQUAL "System")
find_package(VTK 6.1 COMPONENTS ${VTK_MODULES} NO_MODULE REQUIRED)
elseif(OGS_LIB_VTK STREQUAL "Default")
find_package(VTK 6.1 COMPONENTS ${VTK_MODULES} NO_MODULE QUIET)
endif()
if(VTK_FOUND)
message(STATUS "Using VTK in ${VTK_DIR}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment