-
Notifications
You must be signed in to change notification settings - Fork 21
/
CMakeLists.txt
117 lines (90 loc) · 4.05 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.10)
############################################################
# set the project name
############################################################
project(ChIMES_LSQ
VERSION 1.0.0
DESCRIPTION "Utilities to generate ChIMES models"
LANGUAGES CXX)
# Set default build type and build flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "") # Can be updated if we want to adde extra flags
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_VERBOSE_MAKEFILE on) # Uncomment if you want to see compiler flags
# set default preprocessor flag values
set(DEBUG_CHEBY "0" CACHE STRING "Debug verbosity level")
set(VERBOSITY "1" CACHE STRING "General verbosity level")
set(USE_MPI "1" CACHE STRING "Use MPI")
# Set preprocessor flags to user-specified values, if available
add_definitions(-DDEBUG=${DEBUG})
add_definitions(-DVERBOSITY=${VERBOSITY})
# Add support for MPI
if (USE_MPI)
add_definitions(-DUSE_MPI=${USE_MPI})
find_package(MPI REQUIRED)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
endif (USE_MPI)
include_directories(imports/chimes_calculator/chimesFF/src)
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
############################################################
# Executables for chimes_lsq
############################################################
# Define an executable target
add_executable(chimes_lsq
${CMAKE_CURRENT_SOURCE_DIR}/src/chimes_lsq.C
${CMAKE_CURRENT_SOURCE_DIR}/src/functions.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Ewald.C
${CMAKE_CURRENT_SOURCE_DIR}/src/ClassDefs.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Fcut.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Cluster.C
${CMAKE_CURRENT_SOURCE_DIR}/src/util.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Cheby.C
${CMAKE_CURRENT_SOURCE_DIR}/src/io_styles.C
${CMAKE_CURRENT_SOURCE_DIR}/src/feexcept.C
${CMAKE_CURRENT_SOURCE_DIR}/src/A_Matrix.C
${CMAKE_CURRENT_SOURCE_DIR}/src/input.C
)
# Define properties for the executable target
target_include_directories(chimes_lsq PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/)
target_compile_features (chimes_lsq PRIVATE cxx_std_11)
if (USE_MPI)
target_link_libraries (chimes_lsq ${MPI_LIBRARIES})
endif (USE_MPI)
target_link_directories (chimes_lsq PUBLIC imports/chimes_calculator/build)
target_link_libraries (chimes_lsq libchimescalc.so)
set_target_properties(chimes_lsq PROPERTIES INSTALL_RPATH ${CMAKE_CURRENT_SOURCE_DIR}/imports/chimes_calculator/build/)
IF (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
install(TARGETS chimes_lsq DESTINATION ${CMAKE_INSTALL_PREFIX} OPTIONAL)
ENDIF (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
############################################################
# Executables for chimes_md
############################################################
# Define an executable target
add_executable(chimes_md
${CMAKE_CURRENT_SOURCE_DIR}/src/chimes_md.C
${CMAKE_CURRENT_SOURCE_DIR}/src/functions.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Ewald.C
${CMAKE_CURRENT_SOURCE_DIR}/src/ClassDefs.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Fcut.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Cluster.C
${CMAKE_CURRENT_SOURCE_DIR}/src/util.C
${CMAKE_CURRENT_SOURCE_DIR}/src/Cheby.C
${CMAKE_CURRENT_SOURCE_DIR}/src/io_styles.C
${CMAKE_CURRENT_SOURCE_DIR}/src/feexcept.C
${CMAKE_CURRENT_SOURCE_DIR}/src/input.C
)
# Define properties for the executable target
target_include_directories(chimes_md PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/)
target_compile_features (chimes_md PRIVATE cxx_std_11)
if (USE_MPI)
target_link_libraries (chimes_md ${MPI_LIBRARIES})
endif (USE_MPI)
target_link_directories (chimes_md PUBLIC imports/chimes_calculator/build)
target_link_libraries (chimes_md libchimescalc.so)
set_target_properties(chimes_md PROPERTIES INSTALL_RPATH ${CMAKE_CURRENT_SOURCE_DIR}/imports/chimes_calculator/build/)
IF (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
install(TARGETS chimes_md DESTINATION ${CMAKE_INSTALL_PREFIX} OPTIONAL)
ENDIF (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)