-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
102 lines (85 loc) · 2.04 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
cmake_minimum_required (VERSION 3.9)
# Use new policies on versions of CMake that have been tested
cmake_policy(VERSION 3.9.3...3.15.4)
# Let us use, e.g., PNG_ROOT=/path/to/libpng, in the environment to
# tell find_package() where to look. Usefull on clusters.
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
project (rescal-snow
DESCRIPTION "Simulating snow self-organization with cellular automata"
LANGUAGES C
)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
find_package(Sanitizers)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(PNG 1.6 REQUIRED)
find_package(Threads REQUIRED)
set(COMMON_SOURCES
src/cells.c
src/lgca.c
src/doublets.c
src/format.c
src/models.c
src/param.c
src/simul.c
src/surface.c
src/space.c
src/trace.c
src/transitions.c
src/view.c
)
add_executable(rescal
${COMMON_SOURCES}
src/callbacks.c
src/drand48.c
src/entry.c
src/rescal.c
)
add_executable(genesis
src/format.c
src/param.c
src/genesis.c
)
add_executable(regenesis
src/format.c
src/regenesis.c
)
add_executable(bin2png
${COMMON_SOURCES}
src/bin2png.c
)
add_executable(csp2png
${COMMON_SOURCES}
src/csp2png.c
)
add_executable(cspinfo
src/format.c
src/cspinfo.c
)
add_executable(csp2bin
src/format.c
src/csp2bin.c
)
function(setup_target target)
set_property(TARGET ${target} PROPERTY C_STANDARD 99)
target_include_directories(${target} PRIVATE src)
if(MSVC)
target_compile_options(${target} PRIVATE /W4 /WX)
else()
target_compile_options(${target} PRIVATE -Wall -Wextra -pedantic -Werror)
endif()
add_sanitizers(${target})
endfunction(setup_target)
target_link_libraries(rescal PRIVATE PNG::PNG Threads::Threads m)
target_link_libraries(genesis PRIVATE PNG::PNG m)
target_link_libraries(regenesis PRIVATE m)
target_link_libraries(bin2png PRIVATE PNG::PNG m)
target_link_libraries(csp2png PRIVATE PNG::PNG m)
setup_target(rescal)
setup_target(genesis)
setup_target(regenesis)
setup_target(bin2png)
setup_target(csp2png)
setup_target(cspinfo)
setup_target(csp2bin)