Made SHARP building optional

This commit is contained in:
Guilhem Lavaux 2013-03-19 09:25:45 -04:00
parent 6296f4c8cf
commit 848f557626
2 changed files with 17 additions and 16 deletions

View File

@ -12,6 +12,7 @@ get_git_head_revision(HEAD GIT_VER)
option(BUILD_SHARED_LIBS "Build shared libraries." OFF) option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
option(BUILD_STATIC_LIBS "Build static libraries." ON) option(BUILD_STATIC_LIBS "Build static libraries." ON)
option(ENABLE_OPENMP "Enable OpenMP support." OFF) option(ENABLE_OPENMP "Enable OpenMP support." OFF)
option(ENABLE_SHARP "Enable SPHT support." ON)
find_path(NETCDF_INCLUDE_PATH NAMES netcdf.h) find_path(NETCDF_INCLUDE_PATH NAMES netcdf.h)
find_path(NETCDFCPP_INCLUDE_PATH NAMES netcdfcpp.h netcdf) find_path(NETCDFCPP_INCLUDE_PATH NAMES netcdfcpp.h netcdf)
@ -30,6 +31,7 @@ find_library(NETCDFCPP_LIBRARY NAMES netcdf_c++ netcdf_c++4)
find_library(GSL_LIBRARY gsl) find_library(GSL_LIBRARY gsl)
find_library(GSLCBLAS_LIBRARY gslcblas) find_library(GSLCBLAS_LIBRARY gslcblas)
if (ENABLE_SHARP)
SET(SHARP_SOURCE ${CMAKE_SOURCE_DIR}/external/sharp) SET(SHARP_SOURCE ${CMAKE_SOURCE_DIR}/external/sharp)
SET(DEP_BUILD ${CMAKE_SOURCE_DIR}/external/sharp/auto) SET(DEP_BUILD ${CMAKE_SOURCE_DIR}/external/sharp/auto)
ExternalProject_Add(sharp ExternalProject_Add(sharp
@ -39,12 +41,11 @@ ExternalProject_Add(sharp
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
INSTALL_COMMAND echo "No install" INSTALL_COMMAND echo "No install"
) )
SET(SHARP_LIBRARY ${DEP_BUILD}/lib/libsharp.a) SET(SHARP_LIBRARY ${DEP_BUILD}/lib/libsharp.a)
SET(FFTPACK_LIBRARY ${DEP_BUILD}/lib/libfftpack.a) SET(SHARP_LIBRARIES ${SHARP_LIBRARY})
SET(CUTILS_LIBRARY ${DEP_BUILD}/lib/libc_utils.a)
SET(SHARP_LIBRARIES ${SHARP_LIBRARY} ${FFTPACK_LIBRARY} ${CUTILS_LIBRARY})
SET(SHARP_INCLUDE_PATH ${DEP_BUILD}/include) SET(SHARP_INCLUDE_PATH ${DEP_BUILD}/include)
endif (ENABLE_SHARP)
set(HDF5_FIND_COMPONENTS HL CXX) set(HDF5_FIND_COMPONENTS HL CXX)
if(HDF5_ROOTDIR) if(HDF5_ROOTDIR)

View File

@ -52,13 +52,13 @@ if (FFTW3_FOUND AND FFTW3F_FOUND AND EIGEN3_FOUND)
target_link_libraries(test_fft_calls ${tolink} ${FFTW3_LIBRARIES} ${FFTW3F_LIBRARIES}) target_link_libraries(test_fft_calls ${tolink} ${FFTW3_LIBRARIES} ${FFTW3F_LIBRARIES})
endif (FFTW3_FOUND AND FFTW3F_FOUND AND EIGEN3_FOUND) endif (FFTW3_FOUND AND FFTW3F_FOUND AND EIGEN3_FOUND)
if (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND) if (ENABLE_SHARP AND SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
include_directories(${SHARP_INCLUDE_PATH}) include_directories(${SHARP_INCLUDE_PATH})
add_executable(test_healpix_calls test_healpix_calls.cpp) add_executable(test_healpix_calls test_healpix_calls.cpp)
target_link_libraries(test_healpix_calls ${tolink} ${SHARP_LIBRARIES}) 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}) set_target_properties(test_healpix_calls PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS} LINK_FLAGS ${OpenMP_CXX_FLAGS})
add_dependencies(test_healpix_calls sharp) add_dependencies(test_healpix_calls sharp)
endif (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND) endif (ENABLE_SHARP AND SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND)
add_executable(test_cosmopower test_cosmopower.cpp) add_executable(test_cosmopower test_cosmopower.cpp)
target_link_libraries(test_cosmopower ${tolink}) target_link_libraries(test_cosmopower ${tolink})