2013-01-17 06:33:59 -06:00
|
|
|
cmake_minimum_required( VERSION 2.6 )
|
|
|
|
project( ERT C CXX )
|
2013-01-31 08:39:40 -06:00
|
|
|
|
|
|
|
set( ERT_VERSION_MAJOR 1 )
|
|
|
|
set( ERT_VERSION_MINOR 0 )
|
|
|
|
|
2013-04-04 01:24:40 -05:00
|
|
|
option( BUILD_ERT "Build the full ERT application - Linux only" OFF)
|
|
|
|
option( BUILD_ENS_PLOT "Build small Eclipse plotting program - no" OFF)
|
|
|
|
option( BUILD_TESTS "Should the tests be built" OFF)
|
|
|
|
option( BUILD_APPLICATIONS "Should we build small utility applications" OFF)
|
|
|
|
option( BUILD_ECL_SUMMARY "Build the commandline application ecl_summary" OFF)
|
|
|
|
option( BUILD_PYTHON "Run py_compile on the python wrappers" OFF)
|
|
|
|
option( INSTALL_ERT "Should anything be installed when issuing make install?" ON)
|
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
|
2013-01-17 06:33:59 -06:00
|
|
|
include( CheckFunctionExists )
|
2013-01-18 01:53:37 -06:00
|
|
|
ENABLE_TESTING()
|
2013-01-17 06:33:59 -06:00
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set(ERT_LINUX TRUE )
|
|
|
|
add_definitions( -DERT_LINUX )
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
set(ERT_WINDOWS TRUE)
|
|
|
|
add_definitions( -DERT_WINDOWS )
|
2013-08-26 07:44:03 -05:00
|
|
|
# This symbol must be defined to support large (> 2GB) files on windows.
|
|
|
|
add_definitions( -DWINDOWS_LFS )
|
2013-05-10 03:25:46 -05:00
|
|
|
endif()
|
|
|
|
|
2013-08-26 07:44:03 -05:00
|
|
|
# Treat warnings as errors if not on Windows
|
2013-05-10 03:25:46 -05:00
|
|
|
if (ERT_WINDOWS)
|
2013-04-29 06:21:36 -05:00
|
|
|
set( CMAKE_C_FLAGS "-O2" )
|
|
|
|
set( CMAKE_CXX_FLAGS "-O2" )
|
2013-05-10 03:25:46 -05:00
|
|
|
else()
|
2013-08-26 07:44:03 -05:00
|
|
|
set( CMAKE_C_FLAGS "-std=gnu99 -g -O2 -Wall -Wno-unknown-pragmas " )
|
|
|
|
set( CMAKE_CXX_FLAGS "-g -Wall -O2 ")
|
2013-04-29 06:21:36 -05:00
|
|
|
endif()
|
2013-01-17 06:33:59 -06:00
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
include(cmake/ert_check.cmake)
|
|
|
|
include(cmake/ert_find.cmake)
|
|
|
|
include(cmake/Modules/UseMultiArch.cmake)
|
2013-08-26 07:44:03 -05:00
|
|
|
include(cmake/ert_link.cmake)
|
|
|
|
|
2013-01-17 06:33:59 -06:00
|
|
|
|
|
|
|
set( INSTALL_GROUP "" CACHE STRING "Group to install as - blank to install as current group")
|
2013-01-31 08:39:40 -06:00
|
|
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
|
|
|
|
2013-01-17 06:33:59 -06:00
|
|
|
if (MSVC)
|
2013-04-04 01:24:40 -05:00
|
|
|
set( LIBRARY_TYPE STATIC )
|
|
|
|
set( SHARED_LIB OFF )
|
2013-01-17 06:33:59 -06:00
|
|
|
else()
|
2013-08-29 04:50:03 -05:00
|
|
|
if (INSTALL_ERT)
|
|
|
|
set( LIBRARY_TYPE SHARED )
|
|
|
|
set( SHARED_LIB ON )
|
|
|
|
else()
|
|
|
|
set( LIBRARY_TYPE STATIC )
|
|
|
|
set( SHARED_LIB OFF )
|
|
|
|
endif(INSTALL_ERT)
|
2013-08-26 07:44:03 -05:00
|
|
|
endif()
|
2013-01-17 06:33:59 -06:00
|
|
|
|
2013-01-18 01:53:37 -06:00
|
|
|
|
2013-01-17 06:33:59 -06:00
|
|
|
if (MSVC)
|
|
|
|
add_definitions( -D__func__="\\"????\\"")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
if (ERT_LINUX)
|
|
|
|
set( NEED_LIBM TRUE )
|
|
|
|
set( LINK_STATIC FALSE )
|
2013-04-04 01:24:40 -05:00
|
|
|
set( NEED_LIBDL ON )
|
2013-04-29 06:13:42 -05:00
|
|
|
add_definitions( -DHAVE_PROC )
|
2013-01-17 06:33:59 -06:00
|
|
|
else()
|
|
|
|
set( NEED_LIBM FALSE )
|
|
|
|
set( LINK_STATIC TRUE )
|
2013-04-04 01:24:40 -05:00
|
|
|
set( NEED_LIBDL OFF )
|
2013-01-17 06:33:59 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config/ert_build_config.h.in
|
2013-01-17 06:33:59 -06:00
|
|
|
${PROJECT_BINARY_DIR}/ert_build_config.h )
|
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libert_util/include )
|
|
|
|
include_directories( ${PROJECT_BINARY_DIR}/libert_util/include )
|
|
|
|
if (MSVC)
|
|
|
|
include_directories( ${PROJECT_BINARY_DIR}/libert_util/include/ert/util )
|
|
|
|
endif()
|
|
|
|
add_subdirectory( libert_util )
|
2013-01-17 06:33:59 -06:00
|
|
|
|
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libgeometry/include )
|
2013-01-17 06:33:59 -06:00
|
|
|
add_subdirectory( libgeometry )
|
2013-01-31 08:39:40 -06:00
|
|
|
|
|
|
|
if (BUILD_ERT OR BUILD_ENS_PLOT)
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libplot/include )
|
|
|
|
add_subdirectory( libplot )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libecl/include )
|
2013-01-17 06:33:59 -06:00
|
|
|
add_subdirectory( libecl )
|
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libecl_well/include )
|
|
|
|
add_subdirectory( libecl_well )
|
|
|
|
|
2013-01-18 01:53:37 -06:00
|
|
|
|
2013-01-17 06:33:59 -06:00
|
|
|
#-----------------------------------------------------------------
|
|
|
|
if (BUILD_ERT)
|
|
|
|
#-----------------------------------------------------------------
|
|
|
|
option(USE_LSF "Include support for LSF" ON)
|
|
|
|
|
2013-01-31 08:39:40 -06:00
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libconfig/include )
|
2013-01-17 06:33:59 -06:00
|
|
|
add_subdirectory( libconfig )
|
2013-01-31 08:39:40 -06:00
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libsched/include )
|
2013-01-17 06:33:59 -06:00
|
|
|
add_subdirectory( libsched )
|
2013-01-31 08:39:40 -06:00
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/librms/include )
|
|
|
|
add_subdirectory( librms )
|
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libanalysis/include )
|
|
|
|
add_subdirectory( libanalysis )
|
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libjob_queue/include )
|
2013-01-17 06:33:59 -06:00
|
|
|
add_subdirectory( libjob_queue )
|
2013-01-31 08:39:40 -06:00
|
|
|
|
|
|
|
include_directories( ${PROJECT_SOURCE_DIR}/libenkf/include )
|
|
|
|
add_subdirectory( libenkf )
|
2013-04-29 06:13:42 -05:00
|
|
|
|
|
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/share DESTINATION ${CMAKE_INSTALL_PREFIX})
|
2013-01-31 08:39:40 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
if (BUILD_PYTHON)
|
2013-04-29 06:13:42 -05:00
|
|
|
include(cmake/python.cmake2)
|
2013-01-31 08:39:40 -06:00
|
|
|
add_subdirectory( python )
|
2013-01-17 06:33:59 -06:00
|
|
|
endif()
|
|
|
|
|