cosmotool/CMakeLists.txt

74 lines
2.7 KiB
CMake
Raw Normal View History

2010-09-12 21:09:39 +02:00
cmake_minimum_required(VERSION 2.6)
2011-05-31 16:08:44 +02:00
list(APPEND CMAKE_MODULE_PATH "${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)
2011-05-31 16:08:44 +02:00
2014-05-30 17:26:44 +02:00
include(FindPythonInterp)
2014-05-25 10:43:06 +02:00
set(NumPy_FIND_REQUIRED TRUE)
2014-05-30 17:26:44 +02:00
include(${CMAKE_SOURCE_DIR}/FindPyLibs.cmake)
2014-05-25 10:43:06 +02:00
include(${CMAKE_SOURCE_DIR}/FindNumPy.cmake)
2011-05-31 16:08:44 +02:00
get_git_head_revision(HEAD GIT_VER)
2010-09-15 20:51:18 +02:00
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
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)
option(INTERNAL_NETCDF "Build internal version of NETCDF" OFF)
option(INTERNAL_BOOST "Build internal version of BOOST" OFF)
2010-09-15 20:51:18 +02: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)
#ENDIF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
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
2014-02-21 09:34:15 +01:00
IF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4")
2012-09-19 15:15:09 +02:00
SET(FOUND_NETCDF4 1)
2012-09-16 00:53:47 +02:00
FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#define NETCDFCPP4 1")
2014-02-21 09:34:15 +01:00
ELSE(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4")
2012-09-19 15:15:09 +02:00
SET(FOUND_NETCDF3 1)
2012-09-16 00:53:47 +02:00
FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#undef NETCDFCPP4")
2014-02-21 09:34:15 +01:00
ENDIF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf AND ${NETCDFCPP_LIBRARY} MATCHES "netcdf_c\\+\\+4")
2012-09-16 00:53:47 +02:00
2014-05-25 10:43:06 +02:00
find_program(CYTHON cython)
if(HDF5_ROOTDIR)
SET(ENV{HDF5_ROOT} ${HDF5_ROOTDIR})
endif(HDF5_ROOTDIR)
find_package(HDF5 COMPONENTS HL CXX)
2010-09-12 21:09:39 +02:00
2010-09-12 21:09:39 +02:00
set(NETCDF_FIND_REQUIRED TRUE)
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")
2011-05-31 16:08:44 +02:00
SET(CPACK_PACKAGE_VERSION_PATCH "0-${GIT_VER}")
2010-09-12 21:22:20 +02:00
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${GalaxExplorer_VERSION_MAJOR}.${GalaxExplorer_VERSION_MINOR}")
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)
2014-05-25 10:43:06 +02:00
add_subdirectory(python)
2010-09-12 21:22:20 +02:00
include(CPack)