Build the sharp dependency

This commit is contained in:
Guilhem Lavaux 2012-11-10 11:10:04 -05:00
parent 72f658c7cf
commit 707a25bda3
3 changed files with 20 additions and 6 deletions

View File

@ -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)

View File

@ -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)
#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)

View File

@ -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;
}