-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
547 lines (457 loc) · 20.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
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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
PROJECT( IGSTK )
# version
SET(IGSTK_VERSION_MAJOR "5")
SET(IGSTK_VERSION_MINOR "2")
SET(IGSTK_VERSION_PATCH "0")
SET (LIBRARY_OUTPUT_PATH ${IGSTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries." FORCE)
SET (EXECUTABLE_OUTPUT_PATH ${IGSTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables." FORCE)
# Append the library version information to the library target properties.
OPTION(IGSTK_WITH_LIBRARY_VERSION "Build with library version information" OFF)
IF(IGSTK_WITH_LIBRARY_VERSION)
SET(IGSTK_LIBRARY_PROPERTIES ${IGSTK_LIBRARY_PROPERTIES}
# BUILD_WITH_INSTALL_RPATH OFF
# INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
# INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib
VERSION ${IGSTK_VERSION_MAJOR}.${IGSTK_VERSION_MINOR}.${IGSTK_VERSION_PATCH}
SOVERSION ${IGSTK_VERSION_MAJOR}
)
ENDIF(IGSTK_WITH_LIBRARY_VERSION)
# Build with shared libraries
OPTION(BUILD_SHARED_LIBS "Build with shared libraries" OFF)
ENABLE_TESTING()
INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
#
# FIND ITK
#
find_package(ITK REQUIRED)
set( ITK_MIN_VERSION 4.2.0 )
set( ITK_VERSION ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH} )
if( ${ITK_VERSION} VERSION_LESS ${ITK_MIN_VERSION} )
message( FATAL_ERROR "This application requires ITK version ${ITK_MIN_VERSION} or later. Provided version is ${ITK_VERSION}.")
else()
INCLUDE (${USE_ITK_FILE})
endif()
#
# FIND VTK
#
find_package(VTK REQUIRED)
set( VTK_MIN_VERSION 5.10.0 )
set( VTK_VERSION ${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR}.${VTK_VERSION_PATCH} )
if( ${VTK_VERSION} VERSION_LESS ${VTK_MIN_VERSION} )
message( FATAL_ERROR "This application requires VTK version ${VTK_MIN_VERSION} or later. Provided version is ${VTK_VERSION}.")
else()
INCLUDE (${USE_VTK_FILE})
endif()
#
# FIND FLTK
#
OPTION(IGSTK_USE_FLTK "Use FLTK (The Fast Light Toolkit) for GUI" OFF)
IF(IGSTK_USE_FLTK)
find_package(FLTK)
IF (FLTK_FOUND)
INCLUDE_DIRECTORIES (${FLTK_INCLUDE_DIR})
IF(WIN32)
ADD_DEFINITIONS(-DWIN32)
ENDIF(WIN32)
LINK_LIBRARIES( ${FLTK_LIBRARIES} ${OPENGL_LIBRARIES} )
IF(CYGWIN)
LINK_LIBRARIES( ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32)
ENDIF(CYGWIN)
ELSE (FLTK_FOUND)
MESSAGE( FATAL_ERROR "This application requires FLTK. One of these components is missing. Please verify configuration")
ENDIF (FLTK_FOUND)
ENDIF(IGSTK_USE_FLTK)
#
# FIND Qt
#
OPTION(IGSTK_USE_Qt "Use Qt for GUI" OFF)
IF(IGSTK_USE_Qt)
# Check if VTK was built with GUISupport on
IF( NOT VTK_USE_GUISUPPORT )
MESSAGE(FATAL_ERROR "To build IGSTK with Qt support, you will need to use a VTK
build with GUI support i.e VTK_USE_GUISUPPORT turned on in VTK configuration")
ENDIF( NOT VTK_USE_GUISUPPORT )
# Check if VTK was built with Qt on
IF( NOT VTK_USE_QVTK )
MESSAGE(FATAL_ERROR "To build IGSTK with Qt support, you will need to use a VTK
build with Qt support i.e VTK_USE_QVTK turned on in VTK configuration")
ENDIF( NOT VTK_USE_QVTK )
# use what QVTK built with
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
SET(DESIRED_QT_VERSION ${VTK_DESIRED_QT_VERSION} CACHE STRING "")
IF( DESIRED_QT_VERSION MATCHES 3 )
MESSAGE( FATAL_ERROR " VTK built using Qt 3. Please use Qt4" )
ENDIF( DESIRED_QT_VERSION MATCHES 3)
find_package(Qt4 REQUIRED)
IF(QT_USE_FILE)
INCLUDE(${QT_USE_FILE})
ELSE(QT_USE_FILE)
SET(QT_LIBRARIES ${QT_QT_LIBRARY})
ENDIF(QT_USE_FILE)
INCLUDE_DIRECTORIES (${QT_INCLUDE_DIR})
ENDIF(IGSTK_USE_Qt)
# The IGSTK Library
SUBDIRS(Source)
# Add the testing directories
IF(BUILD_TESTING)
SUBDIRS(Testing)
ENDIF(BUILD_TESTING)
# Add the examples directories
OPTION(BUILD_EXAMPLES "Examples of the project" ON)
IF(BUILD_EXAMPLES)
SUBDIRS(Examples)
ENDIF(BUILD_EXAMPLES)
#
#User wants to use the Micron tracker. We force the user to
#manually select the directory containing the Micron tracker header
#file and the library. This way there is no chance that our
#automatic selection chooses a 32 bit distribution when the rest of
#the user code is 64bit. The installer from Claron installs both 32
#and 64 and if the Cmake code doesn't select the correct version
#the user will have a tedious debug session until realizing the
#cause of the problem. We choose to force the user to explicitly
#set two variables during Cmake configuration vs. several hours of
#debugging code that has no bugs.
#
OPTION(IGSTK_USE_MicronTracker "Enable the use of the Micron tracker" OFF)
if(IGSTK_USE_MicronTracker)
set(MTC_INCLUDE_DIRECTORY "" CACHE PATH "Directory where the MTC.h file is located")
if(MTC_INCLUDE_DIRECTORY STREQUAL "")
message( FATAL_ERROR "Please set the MTC_INCLUDE_DIRECTORY variable value.")
else()
include(${IGSTK_SOURCE_DIR}/CMake/ExtractMTCVersion.cmake)
if( ${MTCMajorVersion}.${MTCMinorVersion} LESS 3.6.1 )
message( FATAL_ERROR " Your MTC version is ${MTCMajorVersion}.${MTCMinorVersion}. Version 3.6.1 or later should be used")
endif()
include_directories( ${MTC_INCLUDE_DIRECTORY} )
include_directories( ${IGSTK_SOURCE_DIR}/Utilities/MicronTracker/src )
endif()
set(MTC_LIBRARY "" CACHE FILEPATH "Full path to the MTC library (e.g. on win MTC.lib, on linux libMTC.a)")
if(MTC_LIBRARY STREQUAL "")
message( FATAL_ERROR "Please set the MTC_LIBRARY variable value.")
else()
get_filename_component( MTC_LIBRARY_DIRS ${MTC_LIBRARY} PATH )
link_directories( ${MTC_LIBRARY_DIRS} )
endif()
endif()
# Connect InfiniTrack
OPTION(IGSTK_USE_InfiniTrack "Connect InfiniTrack " OFF)
IF(IGSTK_USE_InfiniTrack)
IF(WIN32)
FIND_PATH(InfiniTrack_INCLUDE_DIRECTORY itkInterface.h
"C:/Program Files/Atracsys/infiniTrack/include"
DOC "Directory where the itkInterface.h file is located")
INCLUDE_DIRECTORIES( ${InfiniTrack_INCLUDE_DIRECTORY} )
FIND_LIBRARY( InfiniTrack_LIBRARY
NAMES v9ITK.dll v9ITK
PATHS "C:/Program Files/Atracsys/infiniTrack/lib"
DOC "Full path to the InfiniTrack library file"
)
IF(InfiniTrack_INCLUDE_DIRECTORY)
GET_FILENAME_COMPONENT( InfiniTrack_LIBRARY_DIRS ${InfiniTrack_LIBRARY} PATH )
LINK_DIRECTORIES( ${InfiniTrack_LIBRARY_DIRS} )
ENDIF(InfiniTrack_INCLUDE_DIRECTORY)
ELSE(WIN32)
MESSAGE(FATAL_ERROR " Please turn off InfiniTrack option. Only windows operating system is currently supported for InfiniTrack")
ENDIF(WIN32)
ENDIF(IGSTK_USE_InfiniTrack)
# Connect Ascension 3DG tracker
OPTION(IGSTK_USE_Ascension3DGTracker "Connect Ascension 3D Guidance Tracker" OFF)
IF(IGSTK_USE_Ascension3DGTracker)
OPTION(Ascension3DG_MedSafe "Use MedSafe version of the tracker" OFF)
IF(Ascension3DG_MedSafe) # Use MedSafe version
FIND_PATH(ATC_INCLUDE_DIRECTORY ATC3DGm.h
"C:/Program Files/Ascension/3D Guidance medSAFE (Rev F)/3D Guidance API"
DOC "Directory where the ATC3DGm.h file is located")
INCLUDE_DIRECTORIES( ${ATC_INCLUDE_DIRECTORY} )
FIND_LIBRARY( ATC_LIBRARY
NAMES ATC3DGm ATC3DGm.dll
PATHS "C:/Program Files/Ascension/3D Guidance medSAFE (Rev F)/3D Guidance API"
DOC "Full path to the ATC3DG.dll file"
)
ELSE(Ascension3DG_MedSafe) # Use non MedSafe version
FIND_PATH(ATC_INCLUDE_DIRECTORY ATC3DG.h
"C:/Program Files/Ascension/3D Guidance (Rev D)/3D Guidance API"
DOC "Directory where the ATC3DG.h file is located")
INCLUDE_DIRECTORIES( ${ATC_INCLUDE_DIRECTORY} )
FIND_LIBRARY( ATC_LIBRARY
NAMES ATC3DG ATC3DG.dll
PATHS "C:/Program Files/Ascension/3D Guidance (Rev D)/3D Guidance API"
DOC "Full path to the ATC3DG.dll file"
)
ENDIF(Ascension3DG_MedSafe)
GET_FILENAME_COMPONENT( ATC_LIBRARY_DIRS ${ATC_LIBRARY} PATH )
LINK_DIRECTORIES( ${ATC_LIBRARY_DIRS} )
ENDIF(IGSTK_USE_Ascension3DGTracker)
#
# Atracsys Easytrack500
#
OPTION(IGSTK_USE_AtracsysEasyTrack500 "Atracsys EasyTrack500 Tracker" OFF)
IF( IGSTK_USE_AtracsysEasyTrack500 )
SET(ETK_INCLUDE_DIR CACHE PATH "")
SET(ETK_LIBRARY_DIR CACHE PATH "" )
INCLUDE_DIRECTORIES( ${ETK_INCLUDE_DIR} )
LINK_DIRECTORIES( ${ETK_LIBRARY_DIR} )
ENDIF( IGSTK_USE_AtracsysEasyTrack500 )
# FIND AXIOS3D CAMBAR B2
#
IF(WIN32)
OPTION(IGSTK_USE_AXIOS3D "Use Axios3D Cambar B2 Tracker" OFF)
IF(IGSTK_USE_AXIOS3D)
SET(Axios3D_INCLUDE_DIR CACHE PATH "")
SET(Axios3D_LIBRARY_DIR CACHE PATH "" )
INCLUDE_DIRECTORIES( ${Axios3D_INCLUDE_DIR} )
LINK_DIRECTORIES( ${Axios3D_LIBRARY_DIR} )
ENDIF(IGSTK_USE_AXIOS3D)
ENDIF(WIN32)
# Connect NDI Certus Tracker
OPTION(IGSTK_USE_NDICertusTracker "Connect NDI Certus Tracker" OFF)
IF(IGSTK_USE_NDICertusTracker)
# The headers defined in this directory must match the NDI API library
INCLUDE_DIRECTORIES( ${IGSTK_SOURCE_DIR}/Utilities/NDICertus )
FIND_LIBRARY( CERTUS_LIBRARY
NAMES NDItb NDItb.lib oapi oapi.lib
PATHS "C:/NDIoapi/ndlib/msvc"
DOC "Full path to the NDItb.lib (Linux) of oapi.lib (Windows) file"
)
GET_FILENAME_COMPONENT( CERTUS_LIBRARY_DIRS ${CERTUS_LIBRARY} PATH )
LINK_DIRECTORIES( ${CERTUS_LIBRARY_DIRS} )
ENDIF(IGSTK_USE_NDICertusTracker)
#
# Use OpenIGTLink protocol
#
OPTION(IGSTK_USE_OpenIGTLink "Use the OpenIGTLink protocol" OFF)
IF(IGSTK_USE_OpenIGTLink)
#
# FIND OpenIGTLink
#
find_package(OpenIGTLink)
IF (OpenIGTLink_USE_FILE)
INCLUDE (${OpenIGTLink_USE_FILE})
ELSE (OpenIGTLink_USE_FILE)
MESSAGE( FATAL_ERROR "This application requires OpenIGTLink. One of these components is missing. Please verify configuration")
ENDIF (OpenIGTLink_USE_FILE)
ENDIF(IGSTK_USE_OpenIGTLink)
#
# Use OpenCV
#
OPTION(IGSTK_USE_OpenCV "Use the OpenCV library" OFF)
IF(IGSTK_USE_OpenCV)
#
# FIND OpenCV
find_package( OpenCV REQUIRED )
ENDIF(IGSTK_USE_OpenCV)
# Use ArucoTracker
OPTION(IGSTK_USE_ArucoTracker "Connect ArucoTracker" OFF)
IF( IGSTK_USE_ArucoTracker )
IF(NOT IGSTK_USE_OpenCV)
MESSAGE( FATAL_ERROR "In order to use ArucoTracker, OpenCV is required. Turn the IGSTK_USE_OpenCV flag to on.")
ELSE(NOT IGSTK_USE_OpenCV)
INCLUDE_DIRECTORIES( ${IGSTK_SOURCE_DIR}/Utilities/Aruco/aruco-1.1.0_SRC )
ENDIF(NOT IGSTK_USE_OpenCV)
ENDIF( IGSTK_USE_ArucoTracker )
#
# This option enables the scene graph observer to collect relavant events to constuct the scene graph tree
#
OPTION(IGSTK_USE_SceneGraphVisualization "Enable scene graph visualization by allowing the observer to listen to relevant events" ON)
IF(IGSTK_USE_SceneGraphVisualization)
INCLUDE_DIRECTORIES( ${IGSTK_SOURCE_DIR}/Utilities/SceneGraphVisualization )
ENDIF(IGSTK_USE_SceneGraphVisualization)
#-----------------------------------------------------------------------------
# IGSTK build video imager classes
OPTION(IGSTK_USE_VideoImager "Enable video support" OFF)
#-----------------------------------------------------------------------------
# Configure the default IGSTK_DATA_ROOT for the location of IGSTK Data.
FIND_PATH(IGSTK_DATA_ROOT igstkDataReadMe.txt ${IGSTK_SOURCE_DIR}/Testing/Data $ENV{IGSTK_DATA_ROOT})
MARK_AS_ADVANCED(IGSTK_DATA_ROOT)
#-----------------------------------------------------------------------------
# The entire IGSTK tree should use the same include path, except for the
# Wrapping directory.
# Create the list of include directories needed for IGSTK header files.
INCLUDE(${IGSTK_SOURCE_DIR}/igstkIncludeDirectories.cmake)
# This should be the only INCLUDE_DIRECTORIES command in the entire
# tree, except for the Utilities and Wrapping directories. We need to
# do this in one place to make sure the order is correct.
INCLUDE_DIRECTORIES(
${ITK_DIR}/Utilities/zlib
${IGSTK_INCLUDE_DIRS_BUILD_TREE}
${IGSTK_INCLUDE_DIRS_BUILD_TREE_CXX}
${IGSTK_INCLUDE_DIRS_SYSTEM}
)
#-----------------------------------------------------------------------------
# check for header files that we need
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
# for serial communication: termio.h or termios.h?
CHECK_INCLUDE_FILE("termios.h" HAVE_TERMIOS_H)
CHECK_INCLUDE_FILE("termio.h" HAVE_TERMIO_H)
# Configure a header needed by igstkSystemInformation.
CONFIGURE_FILE("${IGSTK_SOURCE_DIR}/igstkConfigure.h.in"
"${IGSTK_BINARY_DIR}/igstkConfigure.h")
#-----------------------------------------------------------------------------
# Help other projects use IGSTK.
SET(IGSTK_LIBRARY_PATH ${LIBRARY_OUTPUT_PATH})
# Copy the UseIGSTK.cmake file to the binary tree for backward compatability.
CONFIGURE_FILE(${IGSTK_SOURCE_DIR}/UseIGSTK.cmake.in
${IGSTK_BINARY_DIR}/UseIGSTK.cmake COPYONLY IMMEDIATE)
#-----------------------------------------------------------------------------
# Installation vars.
# IGSTK_INSTALL_BIN_DIR - binary dir (executables)
# IGSTK_INSTALL_LIB_DIR - library dir (libs)
# IGSTK_INSTALL_DATA_DIR - share dir (say, examples, data, etc)
# IGSTK_INSTALL_INCLUDE_DIR - include dir (headers)
# IGSTK_INSTALL_PACKAGE_DIR - package/export configuration files
IF(NOT IGSTK_INSTALL_BIN_DIR)
SET(IGSTK_INSTALL_BIN_DIR
${CMAKE_INSTALL_PREFIX}/bin
)
ENDIF(NOT IGSTK_INSTALL_BIN_DIR)
IF(NOT IGSTK_INSTALL_LIB_DIR)
SET(IGSTK_INSTALL_LIB_DIR
${CMAKE_INSTALL_PREFIX}/lib/IGSTK
)
ENDIF(NOT IGSTK_INSTALL_LIB_DIR)
IF(NOT IGSTK_INSTALL_DATA_DIR)
SET(IGSTK_INSTALL_DATA_DIR
${CMAKE_INSTALL_PREFIX}/share/IGSTK
)
ENDIF(NOT IGSTK_INSTALL_DATA_DIR)
IF(NOT IGSTK_INSTALL_INCLUDE_DIR)
SET(IGSTK_INSTALL_INCLUDE_DIR
${CMAKE_INSTALL_PREFIX}/include/IGSTK
)
ENDIF(NOT IGSTK_INSTALL_INCLUDE_DIR)
IF(NOT IGSTK_INSTALL_PACKAGE_DIR)
SET(IGSTK_INSTALL_PACKAGE_DIR
${IGSTK_INSTALL_LIB_DIR}
# CACHE INTERNAL ""
)
ENDIF(NOT IGSTK_INSTALL_PACKAGE_DIR)
# Save library dependencies.
EXPORT_LIBRARY_DEPENDENCIES(${IGSTK_BINARY_DIR}/IGSTKLibraryDepends.cmake)
# Create the IGSTKConfig.cmake file containing the IGSTK configuration.
INCLUDE (${IGSTK_SOURCE_DIR}/igstkGenerateIGSTKConfig.cmake)
# Install some files.
INSTALL(FILES
${IGSTK_BINARY_DIR}/igstkConfigure.h
DESTINATION ${IGSTK_INSTALL_INCLUDE_DIR}
)
INSTALL(FILES
${IGSTK_BINARY_DIR}/IGSTKBuildSettings.cmake
${IGSTK_BINARY_DIR}/IGSTKLibraryDepends.cmake
${IGSTK_BINARY_DIR}/UseIGSTK.cmake
DESTINATION ${IGSTK_INSTALL_PACKAGE_DIR}
)
#-----------------------------------------------------------------------------
# Set up CPack support, to be able to distribute IGSTK
#
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IGSTK ")
SET(CPACK_PACKAGE_VENDOR "ISC")
SET(CPACK_PACKAGE_VERSION_MAJOR "${IGSTK_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${IGSTK_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${IGSTK_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "IGSTK-${IGSTK_VERSION_MAJOR}.${IGSTK_VERSION_MINOR}")
INCLUDE(CPack)
#-----------------------------------------------------------------------------
# Add compiler flags IGSTK needs to work on this platform. This must be
# done AFTER the call to CMAKE_EXPORT_BUILD_SETTINGS.
#-----------------------------------------------------------------------------
# ITK requires special compiler flags on some platforms.
if(CMAKE_COMPILER_IS_GNUCXX)
set(IGSTK_REQUIRED_C_FLAGS "${IGSTK_REQUIRED_C_FLAGS} -Wall -Wno-uninitialized -Wno-unused-parameter")
set(IGSTK_REQUIRED_CXX_FLAGS "${IGSTK_REQUIRED_CXX_FLAGS} -ftemplate-depth-50 -Wall")
include(${IGSTK_SOURCE_DIR}/CMake/itkCheckCXXAcceptsFlags.cmake)
itkCHECK_CXX_ACCEPTS_FLAGS("-Wno-deprecated" CXX_HAS_DEPRECATED_FLAG)
if(CXX_HAS_DEPRECATED_FLAG)
set(IGSTK_REQUIRED_CXX_FLAGS "${IGSTK_REQUIRED_CXX_FLAGS} -Wno-deprecated")
endif(CXX_HAS_DEPRECATED_FLAG)
endif(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IGSTK_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IGSTK_REQUIRED_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${IGSTK_REQUIRED_LINK_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${IGSTK_REQUIRED_LINK_FLAGS}")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${IGSTK_REQUIRED_LINK_FLAGS}")
IF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
ENDIF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
SUBDIRS(Utilities)
OPTION(BUILD_DOCUMENTATION "Build IGSTK Documentation" OFF)
IF(BUILD_DOCUMENTATION)
find_package(VTK)
IF (USE_VTK_FILE)
INCLUDE (${USE_VTK_FILE})
ELSE (USE_VTK_FILE)
MESSAGE( FATAL_ERROR "This application requires VTK. One of these components is missing. Please verify configuration")
ENDIF (USE_VTK_FILE)
SUBDIRS(Utilities/Doxygen)
ENDIF(BUILD_DOCUMENTATION)
#-----------------------------------------------------------------------------
# IGSTK uses KWStyle for checking the coding style
OPTION(IGSTK_USE_KWSTYLE "Run KWStyle in order to check for violations of the coding standard." OFF)
MARK_AS_ADVANCED(IGSTK_USE_KWSTYLE)
IF(IGSTK_USE_KWSTYLE)
FIND_PROGRAM(KWSTYLE_EXECUTABLE
NAMES KWStyle
PATHS
/usr/local/bin
)
MARK_AS_ADVANCED(KWSTYLE_EXECUTABLE)
OPTION(KWSTYLE_USE_VIM_FORMAT "Set KWStyle to generate errors with a VIM-compatible format." OFF)
OPTION(KWSTYLE_USE_MSVC_FORMAT "Set KWStyle to generate errors with a VisualStudio-compatible format." OFF)
CONFIGURE_FILE(${IGSTK_SOURCE_DIR}/Utilities/KWStyle/IGSTK.kws.xml.in
${IGSTK_BINARY_DIR}/Utilities/KWStyle/IGSTK.kws.xml)
CONFIGURE_FILE(${IGSTK_SOURCE_DIR}/Utilities/KWStyle/IGSTKFiles.txt.in
${IGSTK_BINARY_DIR}/Utilities/KWStyle/IGSTKFiles.txt)
SET(KWSTYLE_ARGUMENTS -xml ${IGSTK_BINARY_DIR}/Utilities/KWStyle/IGSTK.kws.xml
-o ${IGSTK_SOURCE_DIR}/Utilities/KWStyle/IGSTKOverwrite.txt
-v
-D ${IGSTK_BINARY_DIR}/Utilities/KWStyle/IGSTKFiles.txt
)
IF(KWSTYLE_USE_VIM_FORMAT)
SET(KWSTYLE_ARGUMENTS -vim ${KWSTYLE_ARGUMENTS})
ENDIF(KWSTYLE_USE_VIM_FORMAT)
IF(KWSTYLE_USE_MSVC_FORMAT)
SET(KWSTYLE_ARGUMENTS -msvc ${KWSTYLE_ARGUMENTS})
ENDIF(KWSTYLE_USE_MSVC_FORMAT)
ADD_CUSTOM_COMMAND(
OUTPUT ${IGSTK_BINARY_DIR}/KWStyleReport.txt
COMMAND ${KWSTYLE_EXECUTABLE}
ARGS ${KWSTYLE_ARGUMENTS}
COMMENT "Coding Style Checker"
)
ADD_CUSTOM_TARGET(StyleCheck DEPENDS ${IGSTK_BINARY_DIR}/KWStyleReport.txt)
ENDIF(IGSTK_USE_KWSTYLE)
# Microsoft Visual Studio 10 needs additional flag in order to compile in
# 64 Bit mode
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 10 Win64")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 10 Win64")
IF( WIN32 )
SET( IGSTK_SERIAL_PORT_0 "COM1:" CACHE STRING "First serial port device name (Default COM1)")
SET( IGSTK_SERIAL_PORT_1 "COM2:" CACHE STRING "Second serial port device name (Default COM2)")
SET( IGSTK_SERIAL_PORT_2 "COM3:" CACHE STRING "Third serial port device name (Default COM3)")
SET( IGSTK_SERIAL_PORT_3 "COM4:" CACHE STRING "Fourth serial port device name (Default COM4)")
SET( IGSTK_SERIAL_PORT_4 "COM5:" CACHE STRING "Fifith serial port device name (Default COM5)")
SET( IGSTK_SERIAL_PORT_5 "COM6:" CACHE STRING "Sixth serial port device name (Default COM6)")
SET( IGSTK_SERIAL_PORT_6 "COM7:" CACHE STRING "Seventh serial port device name (Default COM7)")
SET( IGSTK_SERIAL_PORT_7 "COM8:" CACHE STRING "Eighth serial port device name (Default COM7)")
ELSE (WIN32 )
SET( IGSTK_SERIAL_PORT_0 "/dev/ttyS0" CACHE STRING "First serial port device name (Default /dev/ttyS0)")
SET( IGSTK_SERIAL_PORT_1 "/dev/ttyS1" CACHE STRING "Second serial port device name (Default /dev/ttyS1)")
SET( IGSTK_SERIAL_PORT_2 "/dev/ttyS2" CACHE STRING "Third serial port device name (Default /dev/ttyS2)")
SET( IGSTK_SERIAL_PORT_3 "/dev/ttyS3" CACHE STRING "Fourth serial port device name (Default /dev/ttyS3)")
SET( IGSTK_SERIAL_PORT_4 "/dev/ttyS4" CACHE STRING "Fifith serial port device name (Default /dev/ttyS4)")
SET( IGSTK_SERIAL_PORT_5 "/dev/ttyS5" CACHE STRING "Sixth serial port device name (Default /dev/ttyS5)")
SET( IGSTK_SERIAL_PORT_6 "/dev/ttyS6" CACHE STRING "Seventh serial port device name (Default /dev/ttyS6)")
SET( IGSTK_SERIAL_PORT_7 "/dev/ttyS7" CACHE STRING "Eighth serial port device name (Default /dev/ttyS7)")
ENDIF ( WIN32 )
#----------------------------------------------------------------------------
configure_file(CMake/CTestCustom.cmake.in CTestCustom.cmake @ONLY)