diff --git a/CMakeLists.txt b/CMakeLists.txt index e04a42b..6568ea4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") project(CosmoToolbox) include(GetGitRevisionDescription) +include(ExternalProject) get_git_head_revision(HEAD GIT_VER) @@ -27,8 +28,18 @@ find_library(NETCDFCPP_LIBRARY NAMES netcdf_c++ netcdf_c++4) find_library(GSL_LIBRARY gsl) find_library(GSLCBLAS_LIBRARY gslcblas) -find_library(SHARP_LIBRARY sharp) -find_path(SHARP_INCLUDE_PATH sharp.h) +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 make + INSTALL_COMMAND echo "No install" +) + +SET(SHARP_LIBRARY ${DEP_BUILD}/lib/libsharp.a) +SET(SHARP_INCLUDE_PATH ${DEP_BUILD}/include) set(HDF5_FIND_COMPONENTS HL CXX) if(HDF5_ROOTDIR) diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index a437ff9..52b5ba2 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -49,7 +49,7 @@ if (FFTW3_FOUND AND EIGEN3_FOUND) target_link_libraries(test_fft_calls ${tolink} ${FFTW3_LIBRARIES}) endif (FFTW3_FOUND AND EIGEN3_FOUND) -if (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND) - add_executable(test_sharp_calls test_sharp_calls.cpp) - target_link_libraries(test_sharp_calls ${tolink} ${SHARP_LIBRARY}) -endif (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND) \ No newline at end of file +#if (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND) +# add_executable(test_sharp_calls test_sharp_calls.cpp) +# target_link_libraries(test_sharp_calls ${tolink} ${SHARP_LIBRARY}) +#endif (SHARP_LIBRARY AND SHARP_INCLUDE_PATH AND EIGEN3_FOUND) diff --git a/sample/test_fft_calls.cpp b/sample/test_fft_calls.cpp index d633c14..06c1c9a 100644 --- a/sample/test_fft_calls.cpp +++ b/sample/test_fft_calls.cpp @@ -13,5 +13,8 @@ int main() dft.analysis(); cout << "Map dot-product = " << dft.realSpace().dot_product(dft.realSpace()) << endl; cout << "Fourier dot-product = " << dft.fourierSpace().dot_product(dft.fourierSpace()).real()*volume << endl; + dft.synthesis(); + cout << "Resynthesis dot-product = " << dft.realSpace().dot_product(dft.realSpace()) << endl; return 0; + }