2016-11-26 21:30:44 +01:00
|
|
|
cmake_minimum_required(VERSION 3.6)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2015-12-17 09:55:41 +01:00
|
|
|
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}")
|
2010-09-12 21:09:39 +02:00
|
|
|
|
|
|
|
project(CosmoToolbox)
|
|
|
|
|
2011-05-31 16:08:44 +02:00
|
|
|
include(GetGitRevisionDescription)
|
2012-11-10 17:10:04 +01:00
|
|
|
include(ExternalProject)
|
2015-01-19 17:00:16 +01:00
|
|
|
include(FindPkgConfig)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2017-05-05 09:09:51 +02:00
|
|
|
include(color_msg)
|
2011-05-31 16:08:44 +02:00
|
|
|
|
2010-09-15 20:51:18 +02:00
|
|
|
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
|
2011-06-28 15:08:14 +02:00
|
|
|
option(BUILD_STATIC_LIBS "Build static libraries." ON)
|
2015-01-19 17:00:16 +01:00
|
|
|
option(ENABLE_SHARP "Enable SHARP support." ON)
|
|
|
|
option(INTERNAL_HDF5 "Build internal version of HDF5" OFF)
|
2017-05-05 09:09:51 +02:00
|
|
|
option(INTERNAL_EIGEN "Build internal version of Eigen" ON)
|
2015-01-19 17:00:16 +01:00
|
|
|
option(INTERNAL_NETCDF "Build internal version of NETCDF" OFF)
|
|
|
|
option(INTERNAL_BOOST "Build internal version of BOOST" OFF)
|
2015-04-07 14:36:47 +02:00
|
|
|
option(USE_GIT_VERSION "Use GIT version to pad version number" OFF)
|
2015-04-07 14:45:38 +02:00
|
|
|
option(YORICK_SUPPORT "Add for pleasant yorick support" ON)
|
2015-04-07 14:49:49 +02:00
|
|
|
option(BUILD_PYTHON "Build the python modules" ON)
|
2019-08-15 12:12:57 +02:00
|
|
|
option(COSMOTOOL_PYTHON_PACKAGING "Flag set to on if we only want the python package to be installed" OFF)
|
2015-04-07 14:36:47 +02:00
|
|
|
IF(USE_GIT_VERSION)
|
|
|
|
get_git_head_revision(HEAD GIT_VER)
|
|
|
|
SET(EXTRA_VERSION "-${GIT_VER}")
|
|
|
|
ENDIF(USE_GIT_VERSION)
|
|
|
|
|
2016-04-26 13:10:24 +02:00
|
|
|
IF(BUILD_PYTHON)
|
|
|
|
include(FindPythonInterp)
|
|
|
|
set(NumPy_FIND_REQUIRED TRUE)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/FindPyLibs.cmake)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/FindNumPy.cmake)
|
|
|
|
ENDIF(BUILD_PYTHON)
|
|
|
|
|
2010-09-15 20:51:18 +02:00
|
|
|
|
2015-02-10 14:00:55 +01:00
|
|
|
#IF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
|
|
|
# SET(CosmoTool_local CosmoTool_static)
|
|
|
|
#ELSE(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
2014-05-25 10:43:06 +02:00
|
|
|
SET(CosmoTool_local CosmoTool)
|
2015-02-10 14:00:55 +01:00
|
|
|
#ENDIF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
2015-02-10 13:43:05 +01:00
|
|
|
|
|
|
|
MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module")
|
2014-05-25 10:43:06 +02:00
|
|
|
|
2015-01-19 17:00:16 +01:00
|
|
|
include(${CMAKE_SOURCE_DIR}/external/external_build.cmake)
|
2010-09-12 21:09:39 +02:00
|
|
|
|
2015-04-07 14:45:38 +02:00
|
|
|
IF(YORICK_SUPPORT)
|
2015-06-03 14:57:54 +02:00
|
|
|
IF((EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") OR (INTERNAL_NETCDF))
|
2015-04-07 14:45:38 +02:00
|
|
|
SET(FOUND_NETCDF4 1)
|
|
|
|
FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#define NETCDFCPP4 1")
|
2015-06-03 14:57:54 +02:00
|
|
|
ELSE((EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") OR (INTERNAL_NETCDF))
|
2015-04-07 14:45:38 +02:00
|
|
|
SET(FOUND_NETCDF3 1)
|
|
|
|
FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#undef NETCDFCPP4")
|
2015-06-03 14:57:54 +02:00
|
|
|
ENDIF((EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4") OR (INTERNAL_NETCDF))
|
2015-04-07 14:45:38 +02:00
|
|
|
ENDIF(YORICK_SUPPORT)
|
2012-09-16 00:53:47 +02:00
|
|
|
|
2020-09-29 15:56:52 +02:00
|
|
|
find_program(CYTHON NAMES cython3 cython)
|
2020-02-10 08:40:17 +01:00
|
|
|
find_library(ZLIB_LIBRARY z)
|
2015-10-28 13:57:24 +01:00
|
|
|
find_library(DL_LIBRARY dl)
|
2016-11-22 06:56:12 +01:00
|
|
|
find_library(MATH_LIBRARY m)
|
2014-05-25 10:43:06 +02:00
|
|
|
|
2015-04-07 14:45:38 +02:00
|
|
|
set(NETCDF_FIND_REQUIRED ${YORICK_SUPPORT})
|
2010-09-12 21:36:37 +02:00
|
|
|
set(GSL_FIND_REQUIRED TRUE)
|
2010-09-12 21:09:39 +02:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NetCDF DEFAULT_MSG NETCDF_LIBRARY NETCDFCPP_LIBRARY NETCDF_INCLUDE_PATH)
|
2010-09-12 21:36:37 +02:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARY GSLCBLAS_LIBRARY GSL_INCLUDE_PATH)
|
2010-09-12 21:09:39 +02:00
|
|
|
|
2011-12-03 16:00:38 +01:00
|
|
|
|
2010-09-12 21:22:20 +02:00
|
|
|
# CPACK Configuration
|
|
|
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A toolbox for impatient cosmologists")
|
|
|
|
SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux")
|
|
|
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2")
|
|
|
|
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
|
|
|
|
SET(CPACK_PACKAGE_VERSION_MINOR "0")
|
2015-04-07 14:36:47 +02:00
|
|
|
SET(CPACK_PACKAGE_VERSION_PATCH "0${EXTRA_VERSION}")
|
|
|
|
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
2010-09-12 21:22:20 +02:00
|
|
|
SET(CPACK_STRIP_FILES "lib/libCosmoTool.so")
|
|
|
|
SET(CPACK_SOURCE_IGNORE_FILES
|
|
|
|
"/CVS/;/\\\\.git/;/\\\\.svn/;\\\\.swp$;\\\\.#;/#;.*~;cscope.*;/CMakeFiles/;.*\\\\.cmake;Makefile")
|
|
|
|
|
2010-09-12 21:09:39 +02:00
|
|
|
add_subdirectory(src)
|
2010-09-12 21:36:37 +02:00
|
|
|
add_subdirectory(sample)
|
2015-04-07 14:49:49 +02:00
|
|
|
if(BUILD_PYTHON)
|
|
|
|
add_subdirectory(python)
|
|
|
|
endif(BUILD_PYTHON)
|
2010-09-12 21:22:20 +02:00
|
|
|
|
|
|
|
include(CPack)
|