-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
284 lines (255 loc) · 11.3 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
cmake_minimum_required (VERSION 3.1)
project (intrphysycom)
if (EXISTS "$ENV{WORKSPACE}/sysconfig/cmake/physycom_config.cmake")
message(STATUS "Enabling physycom settings")
include("$ENV{WORKSPACE}/sysconfig/cmake/physycom_config.cmake")
else()
message(STATUS "Unable to find physycom settings file")
endif()
set (INTERNET_DISABLED OFF CACHE BOOL "DO NOT USE INTERNET CONNECTION")
find_package(Boost REQUIRED)
find_package(OpenGL REQUIRED)
find_package(FLTK REQUIRED)
find_package(JPEG REQUIRED)
find_package(GLUT REQUIRED)
set (NR3_FOUND FALSE)
# if not found, download from http://www.astro.umd.edu/~ricotti/NEWWEB/teaching/ASTR415/InClassExamples/NR3/ only required files
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/patch/nr.h" AND NOT INTERNET_DISABLED)
file(DOWNLOAD "http://www.astro.umd.edu/~ricotti/NEWWEB/teaching/ASTR415/InClassExamples/NR3/code/nr3.h"
${CMAKE_SOURCE_DIR}/patch/nr.h
TIMEOUT 3
STATUS download_status
)
set (NRH_FOUND TRUE)
endif()
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/patch/ran.h" AND NOT INTERNET_DISABLED)
file(DOWNLOAD "http://www.astro.umd.edu/~ricotti/NEWWEB/teaching/ASTR415/InClassExamples/NR3/code/ran.h"
${CMAKE_SOURCE_DIR}/patch/ran.h
TIMEOUT 3
STATUS download_status
)
set (RANH_FOUND TRUE)
endif()
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/patch/realft.cpp" AND NOT INTERNET_DISABLED)
file(DOWNLOAD "http://www.astro.umd.edu/~ricotti/NEWWEB/teaching/ASTR415/InClassExamples/NR3/legacy/nr2/CPP_211/recipes/realft.cpp"
${CMAKE_SOURCE_DIR}/patch/realft.cpp
TIMEOUT 3
STATUS download_status
)
execute_process(
COMMAND git --work-tree=. --git-dir=.git apply ${CMAKE_SOURCE_DIR}/patch/realft.patch --ignore-whitespace --whitespace=nowarn --verbose
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
)
set (REALFTCPP_FOUND TRUE)
endif()
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/patch/four1.cpp" AND NOT INTERNET_DISABLED)
file(DOWNLOAD "http://www.astro.umd.edu/~ricotti/NEWWEB/teaching/ASTR415/InClassExamples/NR3/legacy/nr2/CPP_211/recipes/four1.cpp"
${CMAKE_SOURCE_DIR}/patch/four1.cpp
TIMEOUT 3
STATUS download_status
)
execute_process(
COMMAND git --work-tree=. --git-dir=.git apply ${CMAKE_SOURCE_DIR}/patch/four1.patch --ignore-whitespace --whitespace=nowarn --verbose
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
)
set (FOUR1CPP_FOUND TRUE)
endif()
if(NRH_FOUND AND RANH_FOUND AND REALFTCPP_FOUND AND REALFTCPP_FOUND AND FOUR1CPP_FOUND)
set(NR3_FOUND TRUE)
else()
error("Unable to obtain necessary files! Please check your internet connection")
endif()
set(NR3_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/patch)
include_directories(${OPENGL_INCLUDE_DIRS} ${FLTK_INCLUDE_DIR} ${NR3_INCLUDE_DIR} ${GLUT_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
add_executable(FrameLight
${CMAKE_SOURCE_DIR}/src/FrameLight/draw.cpp
${CMAKE_SOURCE_DIR}/src/FrameLight/draw.h
${CMAKE_SOURCE_DIR}/src/FrameLight/form.cpp
${CMAKE_SOURCE_DIR}/src/FrameLight/form.h
${CMAKE_SOURCE_DIR}/src/FrameLight/Frame_1.cpp
${CMAKE_SOURCE_DIR}/src/FrameLight/Frame_1.h
${CMAKE_SOURCE_DIR}/src/FrameLight/Main.cpp
)
add_executable(FrameVuoto
${CMAKE_SOURCE_DIR}/src/FrameVuoto/draw.cpp
${CMAKE_SOURCE_DIR}/src/FrameVuoto/draw.h
${CMAKE_SOURCE_DIR}/src/FrameVuoto/form.cpp
${CMAKE_SOURCE_DIR}/src/FrameVuoto/form.h
${CMAKE_SOURCE_DIR}/src/FrameVuoto/Frame.cpp
${CMAKE_SOURCE_DIR}/src/FrameVuoto/Frame.h
${CMAKE_SOURCE_DIR}/src/FrameVuoto/includes.h
${CMAKE_SOURCE_DIR}/src/FrameVuoto/Main.cpp
)
add_executable(NPuntiSfera
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/avanza.cpp
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/avanza.h
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/def.h
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/draw.cpp
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/draw.h
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/form.cpp
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/form.h
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/Frame_1.cpp
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/Frame_1.h
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/Main.cpp
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/Main.h
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/messaggi.cpp
${CMAKE_SOURCE_DIR}/src/NPuntiSfera/texture_jpg.cpp
)
add_executable(ODE_esponenziale
${CMAKE_SOURCE_DIR}/src/ODE_esponenziale/exp.cpp
${CMAKE_SOURCE_DIR}/src/ODE_esponenziale/includes.h
)
add_executable(ODE_oscillatore
${CMAKE_SOURCE_DIR}/src/ODE_oscillatore/main.cpp
)
add_executable(ODE_oscillatore_3D
${CMAKE_SOURCE_DIR}/src/ODE_oscillatore_3D/classi.cpp
${CMAKE_SOURCE_DIR}/src/ODE_oscillatore_3D/classi.h
${CMAKE_SOURCE_DIR}/src/ODE_oscillatore_3D/includes.h
${CMAKE_SOURCE_DIR}/src/ODE_oscillatore_3D/main.cpp
)
add_executable(PDE_EqCalore
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/draw.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/draw.h
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/EqCalore.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/form.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/form.h
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/Frame.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/Frame.h
${CMAKE_SOURCE_DIR}/src/PDE_EqCalore/Main.cpp
)
add_executable(PDE_EqLaplace_Console
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/dati.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/draw.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/draw.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/EqLaplace.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/EqLaplace.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/form.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/form.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/Frame.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/Frame.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/MainConsole.cpp
)
add_executable(PDE_EqLaplace_Grafica
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/dati.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/draw.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/draw.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/EqLaplace.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/EqLaplace.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/form.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/form.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/Frame.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/Frame.h
${CMAKE_SOURCE_DIR}/src/PDE_EqLaplace/MainGrafica.cpp
)
add_executable(PDE_EqOnde
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/draw.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/draw.h
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/EqOnde.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/form.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/form.h
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/Frame_1.cpp
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/Frame_1.h
${CMAKE_SOURCE_DIR}/src/PDE_EqOnde/Main.cpp
)
add_executable(PDE_Gottlieb
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/dati.h
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/draw.cpp
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/draw.h
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/EqOnde.cpp
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/form.cpp
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/form.h
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/Frame_1.cpp
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/Frame_1.h
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/Main.cpp
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/utili.cpp
${CMAKE_SOURCE_DIR}/src/PDE_Gottlieb/utili.h
)
if (NR3_FOUND)
add_executable(PDE_KDV
${CMAKE_SOURCE_DIR}/src/PDE_KDV/draw.cpp
${CMAKE_SOURCE_DIR}/src/PDE_KDV/draw.h
${CMAKE_SOURCE_DIR}/src/PDE_KDV/form.cpp
${CMAKE_SOURCE_DIR}/src/PDE_KDV/form.h
${CMAKE_SOURCE_DIR}/src/PDE_KDV/Frame_1.cpp
${CMAKE_SOURCE_DIR}/src/PDE_KDV/Frame_1.h
#${CMAKE_SOURCE_DIR}/src/PDE_KDV/guicon.cpp
#${CMAKE_SOURCE_DIR}/src/PDE_KDV/guicon.h
${CMAKE_SOURCE_DIR}/src/PDE_KDV/KDV.cpp
${CMAKE_SOURCE_DIR}/src/PDE_KDV/Main.cpp
${CMAKE_SOURCE_DIR}/patch/nr.h
${CMAKE_SOURCE_DIR}/patch/realft.cpp
${CMAKE_SOURCE_DIR}/patch/four1.cpp
)
add_executable(Robby
${CMAKE_SOURCE_DIR}/src/Robby/draw.cpp
${CMAKE_SOURCE_DIR}/src/Robby/draw.h
${CMAKE_SOURCE_DIR}/src/Robby/form.cpp
${CMAKE_SOURCE_DIR}/src/Robby/form.h
${CMAKE_SOURCE_DIR}/src/Robby/frame.cpp
${CMAKE_SOURCE_DIR}/src/Robby/frame.h
${CMAKE_SOURCE_DIR}/src/Robby/includes.h
${CMAKE_SOURCE_DIR}/src/Robby/main_grafica.cpp
${CMAKE_SOURCE_DIR}/src/Robby/robby.cpp
${CMAKE_SOURCE_DIR}/src/Robby/robby.h
${CMAKE_SOURCE_DIR}/patch/nr.h
${CMAKE_SOURCE_DIR}/patch/ran.h
)
endif()
target_link_libraries(FrameLight ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(FrameVuoto ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(NPuntiSfera ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(ODE_esponenziale ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(ODE_oscillatore ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(ODE_oscillatore_3D ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(PDE_EqCalore ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(PDE_EqLaplace_Console ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(PDE_EqLaplace_Grafica ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(PDE_EqOnde ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(PDE_Gottlieb ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
if (NR3_FOUND)
target_link_libraries(PDE_KDV ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
target_link_libraries(Robby ${FLTK_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLUT_LIBRARIES} ${JPEG_LIBRARIES})
endif()
if(UNIX)
target_link_libraries(FrameLight ${CMAKE_DL_LIBS} )
target_link_libraries(FrameVuoto ${CMAKE_DL_LIBS} )
target_link_libraries(NPuntiSfera ${CMAKE_DL_LIBS} )
target_link_libraries(ODE_esponenziale ${CMAKE_DL_LIBS} )
target_link_libraries(ODE_oscillatore ${CMAKE_DL_LIBS} )
target_link_libraries(ODE_oscillatore_3D ${CMAKE_DL_LIBS} )
target_link_libraries(PDE_EqCalore ${CMAKE_DL_LIBS} )
target_link_libraries(PDE_EqLaplace_Console ${CMAKE_DL_LIBS} )
target_link_libraries(PDE_EqLaplace_Grafica ${CMAKE_DL_LIBS} )
target_link_libraries(PDE_EqOnde ${CMAKE_DL_LIBS} )
target_link_libraries(PDE_Gottlieb ${CMAKE_DL_LIBS} )
if (NR3_FOUND)
target_link_libraries(PDE_KDV ${CMAKE_DL_LIBS} )
target_link_libraries(Robby ${CMAKE_DL_LIBS} )
endif()
endif()
install (TARGETS
FrameLight
FrameVuoto
NPuntiSfera
ODE_esponenziale
ODE_oscillatore
ODE_oscillatore_3D
PDE_EqCalore
PDE_EqLaplace_Console
PDE_EqLaplace_Grafica
PDE_EqOnde
PDE_Gottlieb
DESTINATION
${CMAKE_SOURCE_DIR}/bin/
)
if (NR3_FOUND)
install (TARGETS
PDE_KDV
Robby
DESTINATION
${CMAKE_SOURCE_DIR}/bin/
)
endif()