preparing public version

This commit is contained in:
P.M. Sutter 2014-04-21 23:58:17 -04:00
parent c57359197c
commit ad3e5d1577
25 changed files with 934 additions and 1500 deletions

86
external/cosmotool/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 2.6)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
project(CosmoToolbox)
include(GetGitRevisionDescription)
include(ExternalProject)
include(FindOpenMP)
get_git_head_revision(HEAD GIT_VER)
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
option(BUILD_STATIC_LIBS "Build static libraries." ON)
option(ENABLE_OPENMP "Enable OpenMP support." OFF)
option(ENABLE_SHARP "Enable SPHT support." ON)
find_path(NETCDF_INCLUDE_PATH NAMES netcdf.h)
find_path(NETCDFCPP_INCLUDE_PATH NAMES netcdfcpp.h netcdf)
find_path(GSL_INCLUDE_PATH NAMES gsl/gsl_blas.h)
IF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf)
SET(FOUND_NETCDF4 1)
FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#define NETCDFCPP4 1")
ELSE(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf)
SET(FOUND_NETCDF3 1)
FILE(WRITE ${CMAKE_BINARY_DIR}/src/ctool_netcdf_ver.hpp "#undef NETCDFCPP4")
ENDIF(EXISTS ${NETCDFCPP_INCLUDE_PATH}/netcdf)
find_library(NETCDF_LIBRARY netcdf)
find_library(NETCDFCPP_LIBRARY NAMES netcdf_c++ netcdf_c++4)
find_library(GSL_LIBRARY gsl)
find_library(GSLCBLAS_LIBRARY gslcblas)
if (ENABLE_SHARP)
SET(SHARP_SOURCE ${CMAKE_SOURCE_DIR}/external/sharp)
SET(DEP_BUILD ${CMAKE_SOURCE_DIR}/external/sharp/auto)
ExternalProject_Add(sharp
SOURCE_DIR ${SHARP_SOURCE}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${SHARP_SOURCE}/configure --prefix=${DEP_BUILD}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
INSTALL_COMMAND echo "No install"
)
SET(SHARP_LIBRARY ${DEP_BUILD}/lib/libsharp.a)
SET(SHARP_LIBRARIES ${SHARP_LIBRARY})
SET(SHARP_INCLUDE_PATH ${DEP_BUILD}/include)
endif (ENABLE_SHARP)
set(HDF5_FIND_COMPONENTS HL CXX)
if(HDF5_ROOTDIR)
SET(ENV{HDF5_ROOT} ${HDF5_ROOTDIR})
endif(HDF5_ROOTDIR)
include(FindHDF5)
include(FindPkgConfig)
pkg_check_modules(FFTW3 fftw3>=3.3)
pkg_check_modules(FFTW3F fftw3f>=3.3)
pkg_check_modules(EIGEN3 eigen3)
include(FindPackageHandleStandardArgs)
set(NETCDF_FIND_REQUIRED TRUE)
set(GSL_FIND_REQUIRED TRUE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NetCDF DEFAULT_MSG NETCDF_LIBRARY NETCDFCPP_LIBRARY NETCDF_INCLUDE_PATH)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARY GSLCBLAS_LIBRARY GSL_INCLUDE_PATH)
set(GSL_LIBRARIES ${GSL_LIBRARY} ${GSLCBLAS_LIBRARY})
# 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")
SET(CPACK_PACKAGE_VERSION_PATCH "0-${GIT_VER}")
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")
add_subdirectory(src)
add_subdirectory(sample)
include(CPack)

View file

@ -0,0 +1,65 @@
SET(tolink ${GSL_LIBRARIES} CosmoTool ${CosmoTool_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/src ${FFTW3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${NETCDF_INCLUDE_PATH} ${GSL_INCLUDE_PATH})
IF(SHARP_INCLUDE_PATH)
include_directories(BEFORE ${SHARP_INCLUDE_PATH})
ENDIF(SHARP_INCLUDE_PATH)
add_executable(testBQueue testBQueue.cpp)
target_link_libraries(testBQueue ${tolink})
add_executable(testInterpolate testInterpolate.cpp)
target_link_libraries(testInterpolate ${tolink})
add_executable(testSmooth testSmooth.cpp)
target_link_libraries(testSmooth ${tolink})
add_executable(testkd testkd.cpp)
target_link_libraries(testkd ${tolink})
add_executable(testkd2 testkd2.cpp)
target_link_libraries(testkd2 ${tolink})
add_executable(testkd3 testkd3.cpp)
target_link_libraries(testkd3 ${tolink})
add_executable(testDelaunay testDelaunay.cpp)
target_link_libraries(testDelaunay ${tolink})
add_executable(testNewton testNewton.cpp)
target_link_libraries(testNewton ${tolink})
add_executable(testPool testPool.cpp)
target_link_libraries(testPool ${tolink})
if (HDF5_FOUND)
add_executable(testReadFlash testReadFlash.cpp)
target_link_libraries(testReadFlash ${tolink})
endif (HDF5_FOUND)
add_executable(testEskow testEskow.cpp)
target_link_libraries(testEskow ${tolink})
add_executable(testAlgo testAlgo.cpp)
target_link_libraries(testAlgo ${tolink})
add_executable(testBSP testBSP.cpp)
target_link_libraries(testBSP ${tolink})
if (FFTW3_FOUND AND FFTW3F_FOUND AND EIGEN3_FOUND)
add_executable(test_fft_calls test_fft_calls.cpp)
target_link_libraries(test_fft_calls ${tolink} ${FFTW3_LIBRARIES} ${FFTW3F_LIBRARIES})
endif (FFTW3_FOUND AND FFTW3F_FOUND AND EIGEN3_FOUND)
if (ENABLE_SHARP AND SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
include_directories(${SHARP_INCLUDE_PATH})
add_executable(test_healpix_calls test_healpix_calls.cpp)
target_link_libraries(test_healpix_calls ${tolink} ${SHARP_LIBRARIES})
set_target_properties(test_healpix_calls PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS} LINK_FLAGS ${OpenMP_CXX_FLAGS})
add_dependencies(test_healpix_calls sharp)
endif (ENABLE_SHARP AND SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
add_executable(test_cosmopower test_cosmopower.cpp)
target_link_libraries(test_cosmopower ${tolink})

92
external/cosmotool/src/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,92 @@
SET(CosmoTool_SRCS
fortran.cpp
interpolate.cpp
load_data.cpp
loadGadget.cpp
loadRamses.cpp
octTree.cpp
powerSpectrum.cpp
miniargs.cpp
growthFactor.cpp
cosmopower.cpp
)
IF(FOUND_NETCDF3)
SET(CosmoTool_SRCS ${CosmoTool_SRCS} yorick_nc3.cpp)
ELSE(FOUND_NETCDF3)
IF(FOUND_NETCDF4)
SET(CosmoTool_SRCS ${CosmoTool_SRCS} yorick_nc4.cpp)
ENDIF(FOUND_NETCDF4)
ENDIF(FOUND_NETCDF3)
if (HDF5_FOUND)
set(CosmoTool_SRCS ${CosmoTool_SRCS}
h5_readFlash.cpp
loadFlash.cpp
)
else(HDF5_FOUND)
set(CosmoTool_SRCS ${CosmoTool_SRCS}
loadFlash_dummy.cpp
)
endif (HDF5_FOUND)
SET(CosmoTool_SRCS ${CosmoTool_SRCS}
bqueue.hpp
config.hpp
dinterpolate.hpp
field.hpp
fixArray.hpp
fortran.hpp
interpolate3d.hpp
interpolate.hpp
kdtree_leaf.hpp
load_data.hpp
loadGadget.hpp
loadRamses.hpp
loadSimu.hpp
miniargs.hpp
mykdtree.hpp
octTree.hpp
powerSpectrum.hpp
sparseGrid.hpp
sphSmooth.hpp
yorick.hpp
growthFactor.hpp
)
include_directories(${GSL_INCLUDE_PATH} ${NETCDF_INCLUDE_PATH} ${NETCDFCPP_INCLUDE_PATH} ${CMAKE_BINARY_DIR}/src)
set(CosmoTool_LIBS ${NETCDFCPP_LIBRARY} ${NETCDF_LIBRARY} ${GSL_LIBRARIES})
if (HDF5_FOUND)
set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES})
include_directories(${HDF5_INCLUDE_DIRS})
endif (HDF5_FOUND)
set(CosmoTool_LIBS ${CosmoTool_LIBS} PARENT_SCOPE)
if (BUILD_SHARED_LIBS)
add_library(CosmoTool SHARED ${CosmoTool_SRCS})
target_link_libraries(CosmoTool ${CosmoTool_LIBS})
if (BUILD_STATIC_LIBS)
add_library(CosmoTool_static STATIC ${CosmoTool_SRCS})
endif(BUILD_STATIC_LIBS)
else (BUILD_SHARED_LIBS)
add_library(CosmoTool STATIC ${CosmoTool_SRCS})
endif (BUILD_SHARED_LIBS)
install(TARGETS CosmoTool
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if (BUILD_SHARED_LIBS)
install(TARGETS CosmoTool_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (BUILD_SHARED_LIBS)
install(DIRECTORY . DESTINATION include/CosmoTool
FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY . DESTINATION include/CosmoTool
FILES_MATCHING PATTERN "*.tcc")