-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
87 lines (74 loc) · 2.32 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
cmake_minimum_required(VERSION 3.11.0)
project(curvedSpaceSimulation LANGUAGES CXX)
#note: CGAL (which I will get rid of someday) needs at least c++14; some advanced gcc compilers will throw errors if you don't set the cpp standard to 17, though
set(CMAKE_CXX_STANDARD 17)
#Release by default
set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
#set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# If on MacOS, assume that pthreads in built-in
IF(APPLE)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
ENDIF()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128 -fopenmp -frounding-math -Wall -Wshadow -Wno-unused-function -Wno-sign-compare")
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_definitions(-DDEBUGFLAGUP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g")
else()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pg") #for gprof profiling
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -march=native")
add_definitions(-DNDEBUG)
endif()
message("cxx flags = " "${CMAKE_CXX_FLAGS}")
find_package(CGAL REQUIRED)
find_package(Boost REQUIRED)
find_package(MPI REQUIRED)
include_directories(
${CMAKE_SOURCE_DIR}/inc
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/utility
${CMAKE_SOURCE_DIR}/src/forces
${CMAKE_SOURCE_DIR}/src/updaters
${CMAKE_SOURCE_DIR}/src/simulation
${CMAKE_SOURCE_DIR}/src/models
${CMAKE_SOURCE_DIR}/src/analysis
${CMAKE_SOURCE_DIR}/src/databases
${MPI_INCLUDE_PATH}
)
add_subdirectory(src)
set(myLibs
model
updaters
databases
simulation
utility
forces
)
link_directories($ENV{LD_LIBRARY_PATH})
set(SOURCES
)
set(HEADERS
)
# list the names of cpp files corresponding to linked executables you'd like...
foreach(ARG
meshTesting
flatSpaceSimulation
curvedSpaceSimulation
multirankSimulation
curvedSpaceNVTSim
)
add_executable("${ARG}.out" "${ARG}.cpp" )
target_link_libraries("${ARG}.out"
${myLibs}
netcdf
netcdf_c++
#OpenMP::OpenMP_CXX
CGAL::CGAL
${MPI_LIBRARIES}
)
endforeach()