forked from GollyGang/ready
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
521 lines (475 loc) · 21.8 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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# Copyright 2011-2015 The Ready Bunch
#
# This file is part of Ready.
#
# Ready is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ready is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ready. If not, see <http://www.gnu.org/licenses/>.
#
#--------------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6 )
cmake_policy( SET CMP0003 NEW )
if(POLICY CMP0043)
# policy not known to older versions ...
cmake_policy(SET CMP0043 NEW)
endif(POLICY CMP0043)
project( Ready )
set( READY_VERSION 0.7.2 ) # check matches Help/about.html
add_definitions( -D READY_VERSION=${READY_VERSION} )
if( APPLE OR WIN32 )
# app names are usually capitalized on Mac OS X and Windows
set( APP_NAME Ready )
else()
# Linux binaries are usually all lowercase
set( APP_NAME ready )
endif()
set( CMD_NAME rdy ) # command-line version
#-------------------------------------------source files----------------------------------------------
set( BASE_SOURCES # low-level code used in all executables
src/readybase/AbstractRD.hpp src/readybase/AbstractRD.cpp
src/readybase/ImageRD.hpp src/readybase/ImageRD.cpp
src/readybase/GrayScottImageRD.hpp src/readybase/GrayScottImageRD.cpp
src/readybase/OpenCLImageRD.hpp src/readybase/OpenCLImageRD.cpp
src/readybase/FormulaOpenCLImageRD.hpp src/readybase/FormulaOpenCLImageRD.cpp
src/readybase/FullKernelOpenCLImageRD.hpp src/readybase/FullKernelOpenCLImageRD.cpp
src/readybase/MeshRD.hpp src/readybase/MeshRD.cpp
src/readybase/GrayScottMeshRD.hpp src/readybase/GrayScottMeshRD.cpp
src/readybase/OpenCLMeshRD.hpp src/readybase/OpenCLMeshRD.cpp
src/readybase/FormulaOpenCLMeshRD.hpp src/readybase/FormulaOpenCLMeshRD.cpp
src/readybase/FullKernelOpenCLMeshRD.hpp src/readybase/FullKernelOpenCLMeshRD.cpp
src/readybase/OpenCL_MixIn.hpp src/readybase/OpenCL_MixIn.cpp
src/readybase/OpenCL_utils.hpp src/readybase/OpenCL_utils.cpp
src/readybase/IO_XML.hpp src/readybase/IO_XML.cpp
src/readybase/overlays.hpp src/readybase/overlays.cpp
src/readybase/Properties.hpp src/readybase/Properties.cpp
src/readybase/utils.hpp src/readybase/utils.cpp
src/readybase/OpenCL_Dyn_Load.h src/readybase/OpenCL_Dyn_Load.c
src/readybase/MeshGenerators.hpp src/readybase/MeshGenerators.cpp
src/readybase/SystemFactory.hpp src/readybase/SystemFactory.cpp
src/readybase/scene_items.hpp src/readybase/scene_items.cpp
)
include_directories( src/readybase )
set( GUI_SOURCES # high-level GUI code used only in Ready
src/gui/IDs.hpp
src/gui/wxutils.hpp src/gui/wxutils.cpp
src/gui/dialogs.hpp src/gui/dialogs.cpp
src/gui/prefs.hpp src/gui/prefs.cpp
src/gui/app.hpp src/gui/app.cpp
src/gui/frame.hpp src/gui/frame.cpp
src/gui/HelpPanel.hpp src/gui/HelpPanel.cpp
src/gui/InfoPanel.hpp src/gui/InfoPanel.cpp
src/gui/PatternsPanel.hpp src/gui/PatternsPanel.cpp
src/gui/vtk_pipeline.hpp src/gui/vtk_pipeline.cpp
src/gui/InteractorStylePainter.hpp src/gui/InteractorStylePainter.cpp
src/gui/wxVTKRenderWindowInteractor.h src/gui/wxVTKRenderWindowInteractor.cxx
src/gui/RecordingDialog.hpp src/gui/RecordingDialog.cpp
src/gui/ImportImageDialog.hpp src/gui/ImportImageDialog.cpp
)
include_directories( src/gui )
set( CMD_SOURCES # code used for the command-line version
src/cmd/main.cpp
)
set( RESOURCES
resources/ready.rc
resources/appicon.ico
resources/appicon16.ico
resources/appicon32.ico
resources/appicon48.ico
resources/appicon.xpm
resources/Info.plist.in
resources/app.icns
resources/file.icns
)
include_directories( resources )
set( PATTERN_FILES
Patterns/Meinhardt1982/stripes.vti Patterns/Meinhardt1982/zebra.vtu
Patterns/advection.vti
Patterns/bilaplacian_interpolation.vti
Patterns/Schlogl.vti
Patterns/heat_equation.vti
Patterns/Turing1952/spots.vti Patterns/Turing1952/spots_noisy.vti
Patterns/kernel_test.vti
Patterns/parameter_modulation_demo.vti
Patterns/parameter_modulation_demo2.vti
Patterns/bunny.vtu
Patterns/lion.vtu
Patterns/heat_equation_interpolation.vti
Patterns/Ginzburg-Landau/complex_Ginzburg-Landau.vti
Patterns/Ginzburg-Landau/complex_Ginzburg-Landau_magnitude.vti
Patterns/wave_equation.vti
Patterns/oregonator.vti
Patterns/Brusselator.vti
Patterns/SmoothLife2011/smoothglider.vti Patterns/SmoothLife2011/smoothlifeL.vti Patterns/SmoothLife2011/glider_3D.vti
Patterns/SmoothLife2011/gaussian-smoothlife.vti
Patterns/Purwins1999/glider.vti Patterns/Purwins1999/glider_3D.vti Patterns/Purwins1999/multiGlider.vti
Patterns/CPU-only/grayscott_1D.vti
Patterns/CPU-only/grayscott_2D.vti
Patterns/CPU-only/grayscott_3D.vti
Patterns/FitzHugh-Nagumo/tip-splitting.vti
Patterns/FitzHugh-Nagumo/tip-splitting_3D.vti
Patterns/FitzHugh-Nagumo/spiral_turbulence.vti
Patterns/FitzHugh-Nagumo/pulsate.vti
Patterns/FitzHugh-Nagumo/squid_axon.vti
Patterns/FitzHugh-Nagumo/Ising_regime.vti
Patterns/Gray-Scott/Lesmes_noisy.vti
Patterns/Gray-Scott/noisy_solitons_mitosis.vti
Patterns/Gray-Scott/parameter-map.vti
Patterns/Gray-Scott/Pearson1993.vti
Patterns/Gray-Scott/self-replicating_spots.vti
Patterns/Gray-Scott/U-Skate/Hutton-and-helix-gliders.vti
Patterns/Gray-Scott/U-Skate/Munafo_glider.vti
Patterns/Gray-Scott/U-Skate/o-ring_2D.vti
Patterns/CellularAutomata/Bays_3D.vti
Patterns/CellularAutomata/Conway_life.vti
Patterns/CellularAutomata/life_torus.vtu
Patterns/CellularAutomata/larger-than-life.vti
Patterns/CellularAutomata/Buss_hex.vtu
Patterns/CellularAutomata/tri_life.vtu
Patterns/CellularAutomata/hex_B2oS2m34_gliders.vtu
Patterns/CellularAutomata/PenroseTilings/life.vtu
Patterns/CellularAutomata/PenroseTilings/life_oscillators.vtu
Patterns/CellularAutomata/PenroseTilings/Goucher_glider.vtu
Patterns/CellularAutomata/PenroseTilings/Imai_glider_B2SC4.vtu
Patterns/CellularAutomata/PenroseTilings/Goucher_loops.vtu
Patterns/CellularAutomata/Salt/salt2D_demo.vti
Patterns/CellularAutomata/Salt/salt3D_circular330.vti
Patterns/Yang2002/Yang_1.vti Patterns/Yang2002/Yang_2b.vti Patterns/Yang2002/Yang_2c.vti
Patterns/Yang2002/Yang_2d.vti Patterns/Yang2002/Yang_3a.vti Patterns/Yang2002/Yang_3b.vti
Patterns/Yang2002/Yang_3c.vti Patterns/Yang2002/Yang_3d.vti Patterns/Yang2002/Yang_4.vti
Patterns/Yang2003/Fig2.vti
Patterns/Yang2003/Fig3a.vti Patterns/Yang2003/Fig3b.vti Patterns/Yang2003/Fig3c.vti
Patterns/McCabe2010/McCabe.vti Patterns/McCabe2010/McCabe_simple.vti
Patterns/McCabe2010/McCabe_additive2b.vti Patterns/McCabe2010/McCabe_additive2a.vti
Patterns/McCabe2010/fast-mccabe.vti
Patterns/Kytta2007/Fig5.7a.vti Patterns/Kytta2007/Fig5.7c.vti
Patterns/Kytta2007/Fig5.8c.vti Patterns/Kytta2007/Fig5.8d.vti Patterns/Kytta2007/Fig5.8e.vti
Patterns/Kytta2007/Fig5.8f.vti Patterns/Kytta2007/Fig5.8g.vti
Patterns/Yang2006/jumping.vti Patterns/Yang2006/jumping_cGL.vti
Patterns/Schrodinger1926/packet.vti Patterns/Schrodinger1926/packet_reflect.vti
Patterns/Schrodinger1926/packet_pass.vti Patterns/Schrodinger1926/quantum_tunnelling.vti
Patterns/Schrodinger1926/packet_reflect2D.vti
Patterns/Froese2014/Froese2014_Fig3.vti
Patterns/Pennybacker2013/phyllotaxis_fibonacci.vti Patterns/Pennybacker2013/phyllotaxis_hexagons.vti
Patterns/Pennybacker2013/spots.vti Patterns/Pennybacker2013/stripes.vti
Patterns/Pennybacker2013/parameter_map.vti
Patterns/Experiments/TimHutton/mutually-catalytic_spots.vti
Patterns/Experiments/DanWills/cglrd_ramps_example.vti
Patterns/Experiments/DanWills/grayscott-historyWave_fuseWorms.vti
Patterns/Experiments/DanWills/grayscott-historyWave_moreLifelike.vti
Patterns/Experiments/DanWills/grayscott-historyWaveDC_solitonsAndWorms_init.vti
Patterns/Experiments/DanWills/orbits_explodey_init.vti
Patterns/Experiments/DanWills/orbits_sharpWaves-init.vti
Patterns/Experiments/DanWills/grayscott-historyWave_coralGrow.vti
Patterns/Experiments/DanWills/grayscott-historyWaveDC_movingWormsAndSolitons.vti
Patterns/Experiments/DanWills/orbitsNova_buildAndDestroyBlobs.vti
Patterns/Experiments/DanWills/orbits_epochs.vti
Patterns/Experiments/DanWills/grayscott-historyWaveDC_dualPhaseSolitonWormFlow.vti
Patterns/Experiments/DanWills/heat-equation-boiling-history-wave_glidersUnstable.vti
Patterns/Experiments/SimonGladman/vermiformSolitons.vti
Patterns/Experiments/TimHutton/LifeBlur.vti
Patterns/Experiments/CornusAmmonis/MandelbrotWorms.vti
Patterns/Experiments/CornusAmmonis/mutually-catalytic-pinwheels.vti
Patterns/Experiments/CornusAmmonis/mutually-catalytic-spots-second-order-sobel.vti
Patterns/Experiments/CornusAmmonis/pearson-chained-edge-detectors.vti
Patterns/Experiments/CornusAmmonis/surfing-solitons.vti
Patterns/Experiments/CornusAmmonis/tip-splitting-web.vti
Patterns/Experiments/CornusAmmonis/worms2.vti
Patterns/Experiments/CornusAmmonis/bz-warpsharp.vti
Patterns/Experiments/CornusAmmonis/smoke.vti
Patterns/Experiments/CornusAmmonis/smoke-ising.vti
Patterns/Experiments/CornusAmmonis/splats.vti
Patterns/Experiments/DaveMann/smiley_faces.vti
Patterns/Agmon2014/cells.vti Patterns/Agmon2014/cells_double.vti
Patterns/Agmon2014/oil-water.vti
Patterns/NumericalMethods/advection_forwardEuler.vti
Patterns/NumericalMethods/advection_2stepAdamsBashforth.vti
Patterns/NumericalMethods/advection_3stepAdamsBashforth.vti
Patterns/NumericalMethods/advection_modifiedEuler.vti
Patterns/NumericalMethods/advection_midpointMethod.vti
Patterns/NumericalMethods/advection_HeunsMethod.vti
Patterns/NumericalMethods/advection_LaxFriedrichs.vti
Patterns/NumericalMethods/advection_LaxWendroff.vti
Patterns/NumericalMethods/advection_RungeKutta4.vti
Patterns/NumericalMethods/advection_staggeredLeapfrog.vti
Patterns/NumericalMethods/advection_forwardEuler_double.vti
Patterns/NumericalMethods/advection_2stepAdamsBashforth_double.vti
Patterns/NumericalMethods/advection_3stepAdamsBashforth_double.vti
Patterns/NumericalMethods/advection_modifiedEuler_double.vti
Patterns/NumericalMethods/advection_midpointMethod_double.vti
Patterns/NumericalMethods/advection_HeunsMethod_double.vti
Patterns/NumericalMethods/advection_LaxFriedrichs_double.vti
Patterns/NumericalMethods/advection_LaxWendroff_double.vti
Patterns/NumericalMethods/advection_RungeKutta4_double.vti
Patterns/NumericalMethods/advection_staggeredLeapfrog_double.vti
Patterns/Guo2014/guo.vti
)
set( HELP_FILES
Help/about.gif Help/about.html
Help/action.html Help/credits.html
Help/file.html Help/help.html
Help/mouse.html Help/quickstart.html
Help/tips.html Help/changes.html
Help/edit.html Help/formats.html
Help/index.html Help/problems.html
Help/view.html Help/introduction.html
)
set( OTHER_FILES
./README.txt
./COPYING.txt
./TODO.txt
./BUILD.txt
./CMakeLists.txt
src/FindOpenCL.cmake
src/Doxyfile.in
resources/logo.png
resources/Icons/22px/icon-pointer.png
resources/Icons/22px/draw-freehand.png
resources/Icons/22px/draw-brush.png
resources/Icons/22px/color-picker.png
resources/Icons/22px/document-new.png
resources/Icons/22px/document-open.png
resources/Icons/22px/document-save.png
resources/Icons/22px/document-revert.png
resources/Icons/22px/media-playback-start_green.png
resources/Icons/22px/media-playback-pause_red.png
resources/Icons/22px/media-seek-forward.png
resources/Icons/22px/media-seek-backward.png
resources/Icons/22px/media-skip-backward_modified.png
resources/Icons/22px/media-record.png
resources/Icons/22px/system-run.png
resources/Icons/22px/list-add_gray.png
resources/Icons/22px/camera-photo.png
resources/Icons/32px/icon-pointer.png
resources/Icons/32px/draw-freehand.png
resources/Icons/32px/draw-brush.png
resources/Icons/32px/color-picker.png
resources/Icons/32px/document-new.png
resources/Icons/32px/document-open.png
resources/Icons/32px/document-save.png
resources/Icons/32px/document-revert.png
resources/Icons/32px/media-playback-start_green.png
resources/Icons/32px/media-playback-pause_red.png
resources/Icons/32px/media-seek-forward.png
resources/Icons/32px/media-seek-backward.png
resources/Icons/32px/media-skip-backward_modified.png
resources/Icons/32px/media-record.png
resources/Icons/32px/system-run.png
resources/Icons/32px/list-add_gray.png
resources/Icons/32px/camera-photo.png
resources/Cursors/pencil-cursor.png
resources/Cursors/brush-cursor.png
resources/Cursors/picker-cursor.png
Scripts/Blender/import_obj_sequence.py
)
#-------------------------------------------VTK----------------------------------------------
find_package( VTK )
if( VTK_FOUND )
include( ${VTK_USE_FILE} )
else()
message(FATAL_ERROR "Cannot build the executable without VTK. Please set the VTK variables.")
endif()
#-------------------------------------------wxVTK----------------------------------------------
# The following allows you to access wxGLCanvas for GTK
IF(WIN32)
SET(GUI_EXECUTABLE WIN32)
ELSE(WIN32)
IF(APPLE)
SET(GUI_EXECUTABLE MACOSX_BUNDLE)
IF(VTK_USE_COCOA)
SET_SOURCE_FILES_PROPERTIES(
src/gui/wxVTKRenderWindowInteractor.cxx
PROPERTIES COMPILE_FLAGS "-ObjC++")
ENDIF(VTK_USE_COCOA)
ELSE(APPLE)
# CMake 2.6:
FIND_PACKAGE(PkgConfig)
pkg_check_modules (GTK2 gtk+-2.0)
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
LINK_LIBRARIES(${GTK2_LIBRARIES})
SET(WXGLCANVASLIBS "gl")
ENDIF(APPLE)
ENDIF(WIN32)
#-------------------------------------------wxWidgets----------------------------------------------
if( APPLE )
# on Mac OS X it's better to use locally installed wxWidgets headers and libs
# (the pre-installed stuff tends to be out of date; eg. 10.6 has wxMac 2.8.8 and it's a 32-bit debug build)
set( wxWidgets_CONFIG_EXECUTABLE /usr/local/bin/wx-config )
set( wxWidgets_wxrc_EXECUTABLE /usr/local/bin/wxrc ) # not used, but no harm leaving it in
elseif(UNIX)
# remove -rdynamic from link options on Linux to reduce size by about 1.2MB
set( CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "" )
endif()
# wxWidgets is required to build the project
FIND_PACKAGE( wxWidgets COMPONENTS html aui ${WXGLCANVASLIBS} core adv base )
IF( wxWidgets_FOUND )
INCLUDE( ${wxWidgets_USE_FILE} )
ELSE()
MESSAGE( FATAL_ERROR "Cannot build the executable without wxWidgets. Please set the wxWidgets variables." )
ENDIF()
if( WIN32 )
# prevent link errors with wxMSW 2.9.x
add_definitions( -DwxDEBUG_LEVEL=0 )
endif()
#-------------------------------------------OpenCL----------------------------------------------
set( CMAKE_MODULE_PATH ${Ready_SOURCE_DIR}/src )
# (we include our own FindOpenCL.cmake until the time that CMake comes with its own)
# we need to build against OpenCL
find_package( OpenCL REQUIRED )
include_directories( ${OPENCL_INCLUDE_DIRS} )
if( APPLE )
link_libraries( ${OPENCL_LIBRARIES} ) # on MacOSX we assume that OpenCL is available (might need to rethink for versions before 10.6)
endif()
#---------------copy installation files to build folder (helps with testing)--------------------
foreach( file ${PATTERN_FILES} ${HELP_FILES} ${RESOURCES} ${OTHER_FILES} )
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${file}"
COMMAND cmake -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${file}" "${CMAKE_CURRENT_BINARY_DIR}/${file}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${file}"
)
list( APPEND files_dest "${CMAKE_CURRENT_BINARY_DIR}/${file}" )
endforeach()
add_custom_target( CopyFiles ALL DEPENDS ${files_dest} )
#-------------------------------- build ------------------------------------------------------
# ensure we link the C runtime statically (N.B. still appears as /MD in the CMake gui but ignore this)
# see: http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace
foreach( var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO )
string( REGEX REPLACE "/MD" "/MT" ${var} "${${var}}" )
endforeach()
set( USE_SSE "YES" CACHE BOOL "Set to false if your CPU doesn't have SSE support.")
if( USE_SSE )
# enable SSE to allow us to set flags to avoid denormals, and relax the floating-point accuracy for speed
if( MSVC )
if( CMAKE_CL_64 )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast" )
else() # avoid warning on x64, which always comes with SSE2
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 /fp:fast" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /fp:fast" )
endif()
else()
add_definitions( -msse2 -ffast-math )
endif()
add_definitions( -DUSE_SSE )
endif()
if( APPLE )
# support Mac OS 10.5 or later
add_definitions( -mmacosx-version-min=10.5 )
endif()
if( APPLE OR UNIX )
# use same settings as in makefiles
add_definitions( -D_LARGE_FILES )
endif()
# create base library used by all executables
add_library( readybase STATIC ${BASE_SOURCES} )
if( ${VTK_MAJOR_VERSION} GREATER 5 AND ${VTK_MINOR_VERSION} GREATER 2)
target_link_libraries(
readybase
vtkCommonCore
vtkFiltersExtraction
vtkFiltersGeometry
vtkFiltersModeling
vtkFiltersTexture
vtkInteractionStyle
vtkIOImage
vtkIOXML
vtkRenderingCore
vtkRenderingAnnotation
vtkRenderingFreeType
vtkRenderingOpenGL
)
elseif( ${VTK_MAJOR_VERSION} GREATER 5 )
target_link_libraries(
readybase
vtkCommonCore
vtkFiltersExtraction
vtkFiltersGeometry
vtkFiltersModeling
vtkFiltersTexture
vtkInteractionStyle
vtkIOImage
vtkIOXML
vtkRenderingCore
vtkRenderingAnnotation
vtkRenderingFreeType
vtkRenderingFreeTypeOpenGL
)
else()
target_link_libraries( readybase vtkCommon vtkGraphics vtkIO vtkRendering vtkHybrid )
endif()
# create command-line utility
add_executable( ${CMD_NAME} ${CMD_SOURCES} )
target_link_libraries( ${CMD_NAME} readybase )
# create GUI application
add_executable( ${APP_NAME} ${GUI_EXECUTABLE} ${GUI_SOURCES} ${RESOURCES} )
target_link_libraries( ${APP_NAME} readybase ${wxWidgets_LIBRARIES} )
if( APPLE )
# create Info.plist (using Info.plist.in) and PkgInfo files inside .app bundle
add_custom_target( app_bundle
COMMAND sed -e "s/VERSION/${READY_VERSION}/" ${CMAKE_SOURCE_DIR}/resources/Info.plist.in >Ready.app/Contents/Info.plist
COMMAND echo -n "APPLReDy" >Ready.app/Contents/PkgInfo
)
add_dependencies( ${APP_NAME} app_bundle )
# copy *.icns files into Resources directory inside .app bundle
set_source_files_properties( ${CMAKE_SOURCE_DIR}/resources/app.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
set_source_files_properties( ${CMAKE_SOURCE_DIR}/resources/file.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
# remove unreachable functions and data, and don't add debug info (reduces app size by about 12MB)
target_link_libraries( ${APP_NAME} -Wl,-dead_strip -Wl,-S )
endif()
# avoid security warnings
if( MSVC )
add_definitions( /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS )
endif()
if( CMAKE_COMPILER_IS_GNUCXX )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s" ) # strip release binary, for smaller file size
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ldl" ) # allow dynamic linking (found needed on Gentoo)
endif()
#----------------------------------------doxygen------------------------------------------------
find_package( Doxygen )
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
# (if doxygen is found then 'make doc' should produce html documentation of the source code)
#----------------------------------------install------------------------------------------------
# put Ready in the root of the installation folder instead of in "bin"
install( TARGETS ${APP_NAME} DESTINATION "." ) # (add ${CMD_NAME} if we want to distribute the command-line version too)
# install our source files, resource files, pattern files, help files and text files
foreach( source_file ${BASE_SOURCES} ${GUI_SOURCES} ${CMD_SOURCES} ${RESOURCES} ${PATTERN_FILES} ${HELP_FILES} ${OTHER_FILES} )
get_filename_component( path_name "${source_file}" PATH )
install( FILES "${source_file}" DESTINATION ${path_name} )
endforeach()
#----------------------------------------package----------------------------------------------
if( APPLE )
set( CPACK_SYSTEM_NAME "Mac" ) # nicer than "Darwin"
elseif( UNIX )
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( CPACK_SYSTEM_NAME "Linux-64bit" )
else()
set( CPACK_SYSTEM_NAME "Linux-32bit" )
endif()
elseif( WIN32)
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( CPACK_SYSTEM_NAME "Windows-64bit" )
else()
set( CPACK_SYSTEM_NAME "Windows-32bit" )
endif()
endif()
if( NOT USE_SSE )
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-noSSE" )
endif()
set( CPACK_GENERATOR "ZIP" )
set( CPACK_PACKAGE_VERSION "${READY_VERSION}" )
set( CPACK_SOURCE_GENERATOR "ZIP" )
include( CPack )