-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (84 loc) · 3.69 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 2.6)
# XXX remove `cmake_policy set old` later
cmake_policy(SET CMP0048 OLD)
project(greens_functions)
set (CPP_FILES
GreensFunction1DAbsAbs.cpp GreensFunction1DAbsSinkAbs.cpp GreensFunction1DRadAbs.cpp
GreensFunction2DAbsSym.cpp GreensFunction2DRadAbs.cpp GreensFunction2DAbs.cpp
GreensFunction2DRefWedgeAbs.cpp
GreensFunction3D.cpp GreensFunction3DAbs.cpp GreensFunction3DAbsSym.cpp
GreensFunction3DRadAbs.cpp GreensFunction3DRadAbsBase.cpp GreensFunction3DRadInf.cpp
GreensFunction3DSym.cpp SphericalBesselGenerator.cpp
findRoot.cpp funcSum.cpp freeFunctions.cpp
)
set (HPP_FILES
compat.h
factorial.hpp Defs.hpp GreensFunction.hpp GreensFunction1DAbsAbs.hpp
GreensFunction1DAbsSinkAbs.hpp GreensFunction1DRadAbs.hpp
GreensFunction2DAbsSym.hpp GreensFunction2DRadAbs.hpp GreensFunction2DAbs.hpp
GreensFunction2DRefWedgeAbs.cpp
GreensFunction3D.hpp GreensFunction3DAbs.hpp GreensFunction3DAbsSym.hpp
GreensFunction3DRadAbs.hpp GreensFunction3DRadAbsBase.hpp
GreensFunction3DRadInf.hpp GreensFunction3DSym.hpp SphericalBesselGenerator.hpp
findRoot.hpp funcSum.hpp freeFunctions.hpp PairGreensFunction.hpp
)
if(WIN32) # This includes Win64.
add_definitions(-DNOMINMAX)
add_definitions(-DGSL_DLL)
endif()
add_definitions(-DHAVE_CONFIG_H)
# check some functions are supported or not...
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <cmath>
int main() {
double a, b;
sincos(0., &a, &b);
return 0;
}" ECELL_GREENS_FUNCTIONS_HAVE_SINCOS)
configure_file(${PROJECT_SOURCE_DIR}/config.h.in
${CMAKE_BINARY_DIR}/greens_functions/config.h)
install(FILES ${CMAKE_BINARY_DIR}/greens_functions/config.h DESTINATION "include/greens_functions")
message(STATUS "config.h was generated: ${CMAKE_BINARY_DIR}/greens_functions/config.h")
include_directories(${PROJECT_BINARY_DIR})
# include_directories(${PROJECT_BINARY_DIR}/greens_functions)
option(GREENS_FUNCTIONS_LINK_BOOST_LIBRARY "link boost.unit_test_framework library" OFF)
if(GREENS_FUNCTIONS_LINK_BOOST_LIBRARY)
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
else()
find_package(Boost REQUIRED)
endif()
include_directories(${Boost_INCLUDE_DIRS})
find_package(GSL REQUIRED)
include_directories(${GSL_INCLUDE_DIRS})
add_library(greens_functions STATIC
${CPP_FILES} ${HPP_FILES} "${CMAKE_BINARY_DIR}/greens_functions/config.h")
target_link_libraries(greens_functions GSL::gsl GSL::gslcblas)
if (NOT NO_BESSEL_TABLE)
message(STATUS "prepairing to generate BesselTable.")
add_subdirectory("${PROJECT_SOURCE_DIR}/tablegen")
message(STATUS "adding dependency to BesselTable.")
add_dependencies(greens_functions BesselTables)
install(
FILES
"${CMAKE_BINARY_DIR}/greens_functions/SphericalBesselTable.hpp"
"${CMAKE_BINARY_DIR}/greens_functions/CylindricalBesselTable.hpp"
DESTINATION "include/greens_functions")
else()
message(STATUS "NO_BESSEL_TABLE is defined. stop generating BesselTable.")
endif()
install(TARGETS greens_functions DESTINATION lib)
install(FILES ${HPP_FILES} DESTINATION "include/greens_functions")
# # python wrapper
#
# find_library(BOOST_PYTHON boost_python)
# include_directories("/usr/include/python2.7")
#
# add_library( _greens_functions SHARED
# python/greens_functions.cpp ${CPP_FILES} ${HPP_FILES} "${CMAKE_CURRENT_BINARY_DIR}/config.h")
# target_link_libraries( _greens_functions
# ${GSL_LIBRARIES} ${GSL_CBLAS_LIBRARIES} ${BOOST_PYTHON})
# Test this project, if and only if this is the root project.
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/tests")
endif()