This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
648 lines (590 loc) · 24 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
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
#/*
#For more information, please see: http://software.sci.utah.edu
#
#The MIT License
#
#Copyright (c) 2014 Scientific Computing and Imaging Institute,
#University of Utah.
#
#
#Permission is hereby granted, free of charge, to any person obtaining a
#copy of this software and associated documentation files (the "Software"),
#to deal in the Software without restriction, including without limitation
#the rights to use, copy, modify, merge, publish, distribute, sublicense,
#and/or sell copies of the Software, and to permit persons to whom the
#Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included
#in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
#OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
#DEALINGS IN THE SOFTWARE.
#*/
#This is an CMake configuration file for VVDViewer
cmake_minimum_required ( VERSION 2.8.8 )
#for MSVC builds
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(MSVC)
SET(MSVC_INCREMENTAL_DEFAULT OFF)
endif()
endif()
project ( VVDViewer )
IF((COMMAND cmake_policy) AND NOT (CMAKE_MAJOR_VERSION LESS 3))
CMAKE_POLICY(SET CMP0040 NEW)
CMAKE_POLICY(SET CMP0043 NEW)
ENDIF()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X
set(ARCHITECTURE 64)
else()
# Windows
if(${CMAKE_SIZEOF_VOID_P} MATCHES "8")
set(ARCHITECTURE 64)
else()
set(ARCHITECTURE 32)
endif()
endif()
if(${ARCHITECTURE} MATCHES "64")
add_definitions(-DFLUORENDER_ARCH="64bit")
else()
add_definitions(-DFLUORENDER_ARCH="32bit")
endif()
add_definitions(-DFLUORENDER_TITLE="VVDViewer")
add_definitions(-DVERSION_MAJOR=2) #Be sure to update the Versions and Date for each release!!!!
add_definitions(-DVERSION_MINOR=19) #
add_definitions(-DVERSION_MAJOR_TAG="2") #
add_definitions(-DVERSION_MINOR_TAG="19") #
add_definitions(-DVERSION_COPYRIGHT="November 2015") # Up to here!
#static compile
add_definitions(-DSTATIC_COMPILE)
#teem required definitions
add_definitions(-DTEEM_DIO=0)
add_definitions(-DTEEM_ENDIAN=1234)
add_definitions(-DTEEM_QNANHIBIT=1)
#output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BUILD_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BUILD_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#wxWidgets
add_definitions(-DwxSYSTEM_ZLIB_LIB)
add_definitions(-DwxSYSTEM_JPEG_LIB)
set(wxWidgets_USE_REL_AND_DBG ON)
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
set(wxWidgets_CONFIGURATION mswu)
elseif(${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(wxWidgets_CONFIGURATION mswud)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(wxWidgets_EXCLUDE_COMMON_LIBRARIES TRUE)
find_package(wxWidgets COMPONENTS core base aui html xml net adv stc scintilla png tiff regex expat zlib REQUIRED)
else()
find_package(wxWidgets COMPONENTS core base aui html xml net adv stc REQUIRED)
endif()
include(${wxWidgets_USE_FILE})
set(wxWidgets_USE_STATIC ON)
if (APPLE)
find_package(TIFF REQUIRED)
include_directories(${TIFF_INCLUDE_DIR})
else()
include_directories(${wxWidgets_ROOT_DIR}/src/tiff/libtiff)
endif()
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
#solution for wxWidgets linking "ambiguous" errors
add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
#fix the library names for OSX if needed.
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
foreach(arg ${wxWidgets_LIBRARIES})
set(wxlib_out "${wxlib_out} ${arg}")
endforeach()
string(STRIP ${wxlib_out} wxWidgets_LIBRARIES)
string(REGEX REPLACE "libwx_osx_cocoau_scintilla" "libwxscintilla"
wxWidgets_LIBRARIES ${wxWidgets_LIBRARIES})
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
endif()
#OpenGL
#find_package(OpenGL REQUIRED)
#Boost
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost COMPONENTS system chrono REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
#teem
# add zlib
mark_as_advanced(CLEAR ZLIB_INCLUDE_DIR)
mark_as_advanced(CLEAR ZLIB_LIBRARY)
find_package(ZLIB REQUIRED)
add_definitions(-DTEEM_ZLIB=1)
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/teem)
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/teem/Biff)
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/teem/Air)
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/teem/Hest)
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/teem/Nrrd)
file(GLOB airsrc fluorender/teem/Air/*.c)
file(GLOB airhdr fluorender/teem/Air/*.h)
file(GLOB hestsrc fluorender/teem/Hest/*.c)
file(GLOB hesthdr fluorender/teem/Hest/*.h)
file(GLOB biffsrc fluorender/teem/Biff/*.c)
file(GLOB biffhdr fluorender/teem/Biff/*.h)
file(GLOB nrrdsrc fluorender/teem/Nrrd/*.c)
file(GLOB nrrdhdr fluorender/teem/Nrrd/*.h)
add_library(TEEM_OBJ OBJECT
${airsrc} ${hestsrc} ${nrrdsrc} ${biffsrc}
${airhdr} ${hesthdr} ${nrrdhdr} ${biffhdr})
#pole
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/pole)
file(GLOB pole_srcs fluorender/pole/pole.cpp)
file(GLOB pole_hdrs fluorender/pole/pole.h)
add_library(POLE_OBJ OBJECT ${pole_srcs} ${pole_hdrs})
#ffmpeg
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/ffmpeg/Win64/include)
file(GLOB ffmpeg_LIBS_D ${VVDViewer_SOURCE_DIR}/fluorender/ffmpeg/Win64/lib/Debug/*.lib)
file(GLOB ffmpeg_LIBS_R ${VVDViewer_SOURCE_DIR}/fluorender/ffmpeg/Win64/lib/Release/*.lib)
set(ffmpeg_LIBRARIES)
foreach (f ${ffmpeg_LIBS_D})
set(ffmpeg_LIBRARIES ${ffmpeg_LIBRARIES} debug ${f})
endforeach()
foreach (f ${ffmpeg_LIBS_R})
set(ffmpeg_LIBRARIES ${ffmpeg_LIBRARIES} optimized ${f})
endforeach()
add_definitions(-D__STDC_CONSTANT_MACROS)
else()
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/ffmpeg/OSX/include)
file(GLOB ffmpeg_LIBRARIES ${VVDViewer_SOURCE_DIR}/fluorender/ffmpeg/OSX/lib/*.a)
endif()
#curl
add_definitions(-DCURL_STATICLIB)
mark_as_advanced(CLEAR CURL_INCLUDE_DIR)
mark_as_advanced(CLEAR CURL_LIBRARY)
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})
#openssl
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB SSL_DEP_LIBRARIES ${VVDViewer_SOURCE_DIR}/fluorender/libcurl/OSX/*.a)
endif()
#libjpeg
mark_as_advanced(CLEAR JPEG_INCLUDE_DIR)
mark_as_advanced(CLEAR JPEG_LIBRARY)
find_package(JPEG REQUIRED)
include_directories(${JPEG_INCLUDE_DIR})
#FluoRender
include_directories(${VVDViewer_SOURCE_DIR}/fluorender)
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender)
#Formats
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Formats)
file(GLOB fmt_src fluorender/FluoRender/Formats/*.cpp)
file(GLOB fmt_hdr fluorender/FluoRender/Formats/*.h)
add_library(FORMATS_OBJ OBJECT
${fmt_src} ${fmt_hdr})
#Tracking
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Tracking)
file(GLOB trk_src fluorender/FluoRender/Tracking/*.cpp)
file(GLOB trk_hdr fluorender/FluoRender/Tracking/*.h)
add_library(TRACKING_OBJ OBJECT
${trk_src} ${trk_hdr})
#Animators
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Animators)
file(GLOB ani_src fluorender/FluoRender/Animator/*.cpp)
file(GLOB ani_hdr fluorender/FluoRender/Animator/*.h)
add_library(ANIMATORS_OBJ OBJECT
${ani_src} ${ani_hdr})
#NV
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/NV)
file(GLOB nv_src fluorender/FluoRender/NV/*.cpp)
file(GLOB nv_hdr fluorender/FluoRender/NV/*.h)
add_library(NV_OBJ OBJECT
${nv_src} ${nv_hdr})
#FLIVR
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/FLIVR)
file(GLOB fli_src fluorender/FluoRender/FLIVR/*.cpp)
file(GLOB fli_hdr fluorender/FluoRender/FLIVR/*.h)
add_library(FLIVR_OBJ OBJECT
${fli_src} ${fli_hdr})
#Converters
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Converters)
file(GLOB cvt_src fluorender/FluoRender/Converters/*.cpp)
file(GLOB cvt_hdr fluorender/FluoRender/Converters/*.h)
add_library(CONVERTERS_OBJ OBJECT
${cvt_src} ${cvt_hdr})
#images
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/img)
file(GLOB pngs_hdr fluorender/FluoRender/img/*.h)
file(GLOB pngs_src fluorender/FluoRender/img/*.cpp)
add_library(IMAGES_OBJ OBJECT ${pngs_hdr} ${pngs_src})
#plugins
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/PluginController)
set(PLUGIN_DIR ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/PluginController)
add_library(PLUGINS_OBJ OBJECT ${PLUGIN_DIR}/stdwx.h
${PLUGIN_DIR}/PluginControllerBase.h
${PLUGIN_DIR}/PluginControllerBaseSettings.h
${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/DLLExport.h
${PLUGIN_DIR}/stdwx.cpp
${PLUGIN_DIR}/PluginControllerBase.cpp
${PLUGIN_DIR}/PluginControllerBaseSettings.cpp)
#hdf5
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/hdf5/win/include)
file(GLOB hdf5_LIBS_DR ${VVDViewer_SOURCE_DIR}/fluorender/hdf5/win/lib/*.lib)
set(hdf5_LIBRARIES)
foreach(f ${hdf5_LIBS_DR})
if(f MATCHES "_D.lib$")
set(hdf5_LIBRARIES ${hdf5_LIBRARIES} debug ${f})
elseif(f MATCHES ".lib$")
set(hdf5_LIBRARIES ${hdf5_LIBRARIES} optimized ${f})
endif()
endforeach()
else()
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/hdf5/mac/include)
file(GLOB hdf5_LIBRARIES ${VVDViewer_SOURCE_DIR}/fluorender/hdf5/mac/lib/*.a)
endif()
#freetype
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/freetype/include)
if (WIN32)
file(GLOB FREETYPE_LIBRARIES ${VVDViewer_SOURCE_DIR}/fluorender/freetype/lib/*.lib)
else()
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
endif()
#Vulkan
file(GLOB vsrc ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Vulkan/*.cpp)
file(GLOB vhdr ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Vulkan/*.h ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Vulkan/*.hpp)
file(GLOB imgui_src ${VVDViewer_SOURCE_DIR}/external/imgui/*.cpp)
file(GLOB imgui_hdr ${VVDViewer_SOURCE_DIR}/external/imgui/*.h )
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Vulkan)
include_directories(${VVDViewer_SOURCE_DIR}/external)
include_directories(${VVDViewer_SOURCE_DIR}/external/assimp)
include_directories(${VVDViewer_SOURCE_DIR}/external/gli)
#include_directories(${VVDViewer_SOURCE_DIR}/external/glm)
include_directories(${VVDViewer_SOURCE_DIR}/external/imgui)
find_package(vulkan REQUIRED)
include_directories(${Vulkan_INCLUDE_DIR})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK)
get_filename_component(VULKAN_LIB_DIR ${Vulkan_LIBRARY} DIRECTORY)
file(GLOB SPIRV_LIBRARIES ${VULKAN_LIB_DIR}/*.a)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
file(GLOB SPIRV_LIBRARIES_R "$ENV{VULKAN_SDK}/glslang/lib/*.lib")
file(GLOB SPIRV_LIBRARIES_D "$ENV{VULKAN_SDK}/glslang/lib/Debug/*.lib")
foreach(f ${SPIRV_LIBRARIES_R})
if( NOT f MATCHES "SPIRV-Tools-shared.lib$" )
set(SPIRV_LIBRARIES ${SPIRV_LIBRARIES} optimized ${f})
endif()
endforeach()
foreach(f ${SPIRV_LIBRARIES_D})
if( NOT f MATCHES "SPIRV-Tools-sharedd.lib$" )
set(SPIRV_LIBRARIES ${SPIRV_LIBRARIES} debug ${f})
endif()
endforeach()
include_directories("$ENV{VULKAN_SDK}/glslang/include")
endif()
add_definitions(-DGLM_FORCE_DEPTH_ZERO_TO_ONE)
#other sources
file(GLOB srcall ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/*.cpp)
set(src)
foreach(f ${srcall})
if( (NOT f MATCHES "Main.cpp$") AND (f MATCHES ".cpp$") )
set(src ${src} ${f})
endif()
endforeach()
file(GLOB hdrall ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/*.h)
set(hdr)
foreach(f ${hdrall})
if( (NOT f MATCHES "Main.h$") AND (f MATCHES ".h$") )
set(hdr ${hdr} ${f})
endif()
endforeach()
file(GLOB rsc ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/img/*.xpm)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(GLOB mac_src ${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/*.m)
set(src ${src} ${mac_src})
endif()
set(src ${src} ${vsrc} ${imgui_src})
set(hdr ${hdr} ${vhdr} ${imgui_hdr})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(VVDMainFrame SHARED
${src} ${hdr} ${rsc}
$<TARGET_OBJECTS:IMAGES_OBJ>
$<TARGET_OBJECTS:CONVERTERS_OBJ>
$<TARGET_OBJECTS:FLIVR_OBJ>
$<TARGET_OBJECTS:ANIMATORS_OBJ>
$<TARGET_OBJECTS:NV_OBJ>
$<TARGET_OBJECTS:FORMATS_OBJ>
$<TARGET_OBJECTS:TRACKING_OBJ>
$<TARGET_OBJECTS:POLE_OBJ>
$<TARGET_OBJECTS:TEEM_OBJ>
$<TARGET_OBJECTS:PLUGINS_OBJ>)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/WacUtils)
include_directories(${VVDViewer_SOURCE_DIR}/fluorender/Wacom/Include)
file(GLOB wac_src fluorender/FluoRender/WacUtils/*.cpp)
file(GLOB wac_hdr fluorender/FluoRender/WacUtils/*.h)
add_library(WACUTILS_OBJ OBJECT
${wac_src} ${wac_hdr})
add_library(VVDMainFrame SHARED
${src} ${hdr} ${rsc}
$<TARGET_OBJECTS:IMAGES_OBJ>
$<TARGET_OBJECTS:CONVERTERS_OBJ>
$<TARGET_OBJECTS:FLIVR_OBJ>
$<TARGET_OBJECTS:ANIMATORS_OBJ>
$<TARGET_OBJECTS:NV_OBJ>
$<TARGET_OBJECTS:FORMATS_OBJ>
$<TARGET_OBJECTS:TRACKING_OBJ>
$<TARGET_OBJECTS:POLE_OBJ>
$<TARGET_OBJECTS:TEEM_OBJ>
$<TARGET_OBJECTS:PLUGINS_OBJ>
$<TARGET_OBJECTS:WACUTILS_OBJ>)
endif()
#platform specific rules
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X
if(NOT OPEN_GL_HEADER_LOC)
add_definitions(-DOPEN_GL_HEADER_LOC=<OpenGL/gl.h>)
endif()
if(NOT OPEN_GLU_HEADER_LOC)
add_definitions(-DOPEN_GLU_HEADER_LOC=<OpenGL/glu.h>)
endif()
add_definitions(-D_DARWIN)
set(CFLAGS "-fPIC")
set(CXXFLAGS "-fPIC ")
include(BundleUtilities)
#icon file for Apple, bundle properties
set(ICON_FILE_PATH "FluoRender_icon")
SET( MACOSX_BUNDLE_ICON_FILE ${ICON_FILE_PATH} )
SET_SOURCE_FILES_PROPERTIES(${ICON_FILE_PATH} PROPERTIES
MACOSX_BUNDLE_LOCATION Resources)
add_executable(VVDViewer MACOSX_BUNDLE
${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Main.h
${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Main.cpp)
elseif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#Windows
if(NOT OPEN_GL_HEADER_LOC)
add_definitions(-DOPEN_GL_HEADER_LOC=<GL/gl.h>)
endif()
if(NOT OPEN_GLU_HEADER_LOC)
add_definitions(-DOPEN_GLU_HEADER_LOC=<GL/glu.h>)
endif()
# windows
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(-DWIN32)
add_definitions(-D_WIN32)
set_target_properties(VVDMainFrame
IMAGES_OBJ
CONVERTERS_OBJ
FLIVR_OBJ
ANIMATORS_OBJ
NV_OBJ
FORMATS_OBJ
TRACKING_OBJ
POLE_OBJ
TEEM_OBJ
PLUGINS_OBJ
PROPERTIES
COMPILE_DEFINITIONS
nrrd_EXPORTS
COMPILE_DEFINITIONS
teem_EXPORTS
COMPILE_DEFINITIONS
VVD_DLL_EXPORTS)
if(MSVC)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-Dinline=__inline)
add_definitions("/wd4273")
add_definitions(-D_XKEYCHECK_H)
add_definitions(-DNOMINMAX)
add_definitions("/MP")
set(CFLAGS "")
set(CXXFLAGS "/EHsc")
#make sure the reference option is turned off and not incremental build linking
STRING(REPLACE "INCREMENTAL" "INCREMENTAL:NO" replacementFlags ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
STRING(REPLACE "INCREMENTAL:NO:NO" "INCREMENTAL:NO" replacementFlags1 ${replacementFlags})
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO /OPT:NOREF ${replacementFlags1}" )
STRING(REPLACE "INCREMENTAL" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
STRING(REPLACE "INCREMENTAL:NO:NO" "INCREMENTAL:NO" replacementFlags3 ${replacementFlags2})
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/INCREMENTAL:NO /OPT:NOREF ${replacementFlags3}" )
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /OPT:NOREF /FORCE:MULTIPLE")
SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /FORCE:MULTIPLE")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -MDd")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -MDd")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -MT /O2 /Ob2 /Oi /Ot /Oy /GT /GL /Qpar")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -MT /O2 /Ob2 /Oi /Ot /Oy /GT /GL /Qpar")
endif()
add_executable(VVDViewer WIN32
${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Main.h
${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/Main.cpp)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
endif()
#architecture specific rules
if(${ARCHITECTURE} MATCHES 64)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(ARCH_FLAGS "-m64 -arch x86_64")
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(-DTEEM_32BIT=0)
set(CMAKE_C_FLAGS "${ARCH_FLAGS} ${CFLAGS}")
set(CMAKE_CXX_FLAGS "${ARCH_FLAGS} ${CXXFLAGS} ${CXX_11_FLAG}")
set(CMAKE_EXE_LINKER_FLAGS "${ARCH_FLAGS} ${CXX_11_FLAG}")
else()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(ARCH_FLAGS "-m32 -arch i386")
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_definitions(-DTEEM_32BIT=1)
set(CMAKE_C_FLAGS "${ARCH_FLAGS} ${CFLAGS}" )
set(CMAKE_CXX_FLAGS "${ARCH_FLAGS} ${CXXFLAGS} ${CXX_11_FLAG}")
set(CMAKE_EXE_LINKER_FLAGS "${ARCH_FLAGS} ${CXX_11_FLAG}")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib -L/usr/lib ${CMAKE_EXE_LINKER_FLAGS} -lpng -lbz2 -framework IOSurface -framework Metal -framework VideoToolbox -framework CoreMedia -framework Security -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration -framework QuartzCore")
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.9 -DWX_PRECOMP -std=c++14 -stdlib=libc++")
#make sure png is static linked
string(REGEX REPLACE "-lpng" "/usr/local/lib/libpng.a"
wxWidgets_LIBRARIES ${wxWidgets_LIBRARIES})
string(REGEX REPLACE "-lpng" "/usr/local/lib/libpng.a"
CMAKE_MAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
string(REGEX REPLACE "/usr/local/lib/libfreetype.dylib" "/usr/local/lib/libfreetype.a;/usr/local/lib/libpng.a"
FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES})
message(STATUS "${FREETYPE_LIBRARIES}")
endif()
#link the libraries
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(VVDMainFrame
${CURL_LIBRARIES}
${JPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${TIFF_LIBRARIES}
${OPENSSL_LIBRARIES} ws2_32.lib Wldap32.lib
${ffmpeg_LIBRARIES} Secur32.lib Normaliz.lib crypt32.lib Bcrypt.lib
${Boost_LIBRARIES}
${FREETYPE_LIBRARIES}
${wxWidgets_LIBRARIES}
${hdf5_LIBRARIES}
${Vulkan_LIBRARY}
${SPIRV_LIBRARIES})
target_link_libraries(VVDViewer
VVDMainFrame
ws2_32.lib Wldap32.lib
${wxWidgets_LIBRARIES})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(VVDMainFrame
${CURL_LIBRARIES}
${JPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${TIFF_LIBRARIES}
${OPENSSL_LIBRARIES}
${SSL_DEP_LIBRARIES}
${ffmpeg_LIBRARIES}
${Boost_LIBRARIES}
${FREETYPE_LIBRARIES}
${wxWidgets_LIBRARIES}
${hdf5_LIBRARIES}
${Vulkan_LIBRARY}
${SPIRV_LIBRARIES})
target_link_libraries(VVDViewer
VVDMainFrame
${wxWidgets_LIBRARIES})
endif()
set(PLUGINBASE ${PLUGIN_DIR}/stdwx.h
${PLUGIN_DIR}/Declarations.h
${PLUGIN_DIR}/wxGuiPluginBase.h
${PLUGIN_DIR}/wxGuiPluginWindowBase.h
${VVDViewer_SOURCE_DIR}/fluorender/FluoRender/DLLExport.h
${PLUGIN_DIR}/stdwx.cpp
${PLUGIN_DIR}/wxGuiPluginBase.cpp
${PLUGIN_DIR}/wxGuiPluginWindowBase.cpp)
add_library(wxGuiPluginBase SHARED ${PLUGINBASE})
target_link_libraries(wxGuiPluginBase ${wxWidgets_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set_target_properties(wxGuiPluginBase PROPERTIES COMPILE_DEFINITIONS DEMO_PLUGIN_EXPORTS)
endif()
file(GLOB fi_src ${VVDViewer_SOURCE_DIR}/plugin_fiji/vvd/*.cpp)
file(GLOB fi_hdr ${VVDViewer_SOURCE_DIR}/plugin_fiji/vvd/*.h)
set(fi_ext ${PLUGIN_DIR}/stdwx.h ${PLUGIN_DIR}/stdwx.cpp)
add_library(FijiInterfacePlugin SHARED ${fi_src} ${fi_hdr} ${fi_ext})
target_link_libraries(FijiInterfacePlugin VVDMainFrame wxGuiPluginBase ${wxWidgets_LIBRARIES})
file(GLOB nb_src ${VVDViewer_SOURCE_DIR}/plugin_nblast/vvd/*.cpp)
file(GLOB nb_hdr ${VVDViewer_SOURCE_DIR}/plugin_nblast/vvd/*.h)
set(nb_ext ${PLUGIN_DIR}/stdwx.h ${PLUGIN_DIR}/stdwx.cpp)
add_library(NBLASTGuiPlugin SHARED ${nb_src} ${nb_hdr} ${nb_ext})
target_link_libraries(NBLASTGuiPlugin VVDMainFrame wxGuiPluginBase ${wxWidgets_LIBRARIES})
file(GLOB na_src ${VVDViewer_SOURCE_DIR}/plugin_NA/vvd/*.cpp)
file(GLOB na_hdr ${VVDViewer_SOURCE_DIR}/plugin_NA/vvd/*.h)
set(na_ext ${PLUGIN_DIR}/stdwx.h ${PLUGIN_DIR}/stdwx.cpp)
add_library(NeuronAnnotatorPlugin SHARED ${na_src} ${na_hdr} ${na_ext})
target_link_libraries(NeuronAnnotatorPlugin VVDMainFrame wxGuiPluginBase ${wxWidgets_LIBRARIES})
#build OpenCL examples copies.
#copy openCL examples to the binary directory
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/CL_code"
"$<TARGET_FILE_DIR:VVDViewer>/CL_code")
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/CL_code"
"${CMAKE_BINARY_DIR}/CL_code")
#copy font dir to the binary directory
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/Fonts"
"$<TARGET_FILE_DIR:VVDViewer>/Fonts")
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/Fonts"
"${CMAKE_BINARY_DIR}/Fonts")
#copy script dir to the binary directory
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/Scripts"
"$<TARGET_FILE_DIR:VVDViewer>/Scripts")
#copy executables (Windows)
#[[
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/Executables"
"$<TARGET_FILE_DIR:VVDViewer>/Executables")
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/Executables"
"${CMAKE_BINARY_DIR}/Executables")
endif()
]]
#build DLL copy
#[[
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
file(GLOB ffmpeg_DLLS fluorender/bin/*.dll)
foreach (f ${ffmpeg_DLLS})
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${f}
$<TARGET_FILE_DIR:VVDViewer>)
endforeach()
endif()
]]
#post build setting files copy
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
file(GLOB settings_files Settings/*)
foreach (f ${settings_files})
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${f}
$<TARGET_FILE_DIR:VVDViewer>)
endforeach()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_custom_command(TARGET VVDViewer PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${VVDViewer_SOURCE_DIR}/Settings"
"$<TARGET_FILE_DIR:VVDViewer>/../Resources")
endif()