forked from shakes76/smili
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (84 loc) · 3.78 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
cmake_minimum_required(VERSION 2.6)
PROJECT(SMILI)
#Set output paths
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(LIBRARY_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/include)
set(SMILI_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(SMILI_BINARY_DIR ${PROJECT_BINARY_DIR})
set(CMAKE_MODULE_PATH "${SMILI_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
#load modules
#-----------------------------------------------------------------------------
include(zlib)
include(find)
include(macros)
include(version)
#Add compiler flags
#GCC
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
endif(CMAKE_COMPILER_IS_GNUCC)
#MSVC
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj")
endif(MSVC)
# Enable/Disable Build the testing
OPTION(BUILD_SHARED_LIBS "Build the Libraries as shared libraries" ON)
OPTION(BUILD_GUI_RELATED "Build the MILX Qt Related Components" ON)
OPTION(BUILD_VIEWER "Build the MILX Qt Viewer Application" ON)
OPTION(BUILD_APPLICATIONS "Build the applications for SMILI. Use BUILD_GUI_RELATED to enable Qt applications." ON)
OPTION(BUILD_TESTS "Build the tests for SMILI" OFF)
OPTION(BUILD_PROTOTYPES "Build the prototype tests for SMILI" OFF)
#dependent options, triggered if another option is set
DEPENDENT_OPTION(USE_ITK "Build all the ITK components" ON "ITK_LIBRARIES" OFF)
DEPENDENT_OPTION(USE_VTK "Build all the VTK components" ON "VTK_USE_FILE_INCLUDED" OFF)
DEPENDENT_OPTION(BUILD_VTK_EXTENSIONS "Build the VTK Extensions Library" ON "USE_VTK" OFF)
DEPENDENT_OPTION(BUILD_MILXQT "Build the MILX Qt Library" ON "BUILD_GUI_RELATED" OFF)
DEPENDENT_OPTION(BUILD_PLUGINS "Build the plugins for the Viewer" OFF "BUILD_VIEWER" OFF)
IF(BUILD_PLUGINS)
OPTION(BUILD_PYTHON_PLUGIN "Build the Python plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_DICOM_PLUGIN "Build the DICOM plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_SSM_PLUGIN "Build the Shape Model plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_DENOISE_PLUGIN "Build the Denoise plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_ANIMATE_PLUGIN "Build the Animate plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_DTI_PLUGIN "Build the Diffusion Tensor plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_FTL_PLUGIN "Build the Finite Transform Library plugin for MILX Qt Viewer" OFF)
OPTION(BUILD_REGISTRATION_PLUGIN "Build the Image Registration Plugin for MILX Qt " OFF)
ENDIF(BUILD_PLUGINS)
#Check ITK/VTK statuses
IF(USE_ITK AND NOT USE_VTK)
add_definitions(-DITK_ONLY)
message("Disabling non-ITK components. Enable USE_VTK to enable VTK components.")
ENDIF(USE_ITK AND NOT USE_VTK)
IF(USE_VTK AND NOT USE_ITK)
add_definitions(-DVTK_ONLY)
message("Disabling non-VTK components. Enable USE_ITK to enable ITK components.")
ENDIF(USE_VTK AND NOT USE_ITK)
IF(USE_VTK)
message("VTK Version: ${VTK_VERSION}")
ENDIF(USE_VTK)
IF(USE_ITK)
message("ITK Version: ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}")
ENDIF(USE_ITK)
#advanced options
MARK_AS_ADVANCED(BUILD_PROTOTYPES)
MARK_AS_ADVANCED(BUILD_VTK_EXTENSIONS)
#Important variables for configurations
set(SMILI_INCLUDE_DIRS ${LIBRARY_INCLUDE_PATH} ${LIBRARY_INCLUDE_PATH}/vtk-ext ${LIBRARY_INCLUDE_PATH}/itk-ext ${LIBRARY_INCLUDE_PATH}/itkVTKGlue ${LIBRARY_INCLUDE_PATH}/utils)
set(MILXQT_INCLUDE_DIRS ${SMILI_INCLUDE_DIRS} ${LIBRARY_INCLUDE_PATH}/Qt ${SMILI_SOURCE_DIR}/ui)
set(SMILI_PLUGINS_PATH ${SMILI_BINARY_DIR}/plugins)
# Recurse into the "apps" subdirectory. This does not actually
# cause another cmake executable to run.
add_subdirectory (src)
IF(BUILD_VIEWER)
add_subdirectory (apps/smilx)
ENDIF(BUILD_VIEWER)
IF(BUILD_PLUGINS)
add_subdirectory (plugin)
ENDIF(BUILD_PLUGINS)
IF(BUILD_APPLICATIONS)
add_subdirectory (apps)
ENDIF(BUILD_APPLICATIONS)
IF(BUILD_TESTS)
add_subdirectory (tests)
ENDIF(BUILD_TESTS)