]> Creatis software - clitk.git/blob - vv/CMakeLists.txt
Creation of the Profile Tool
[clitk.git] / vv / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.4)
2
3 #=========================================================
4 # To avoid warning with some version
5 if(COMMAND cmake_policy)
6   cmake_policy(SET CMP0003 NEW)
7 endif(COMMAND cmake_policy)
8 #=========================================================
9
10
11 #=========================================================
12 #List of vv tools to compile
13 set(vv_TOOLS
14   vvToolMedianFilter
15   vvToolRigidReg
16   vvToolCropImage
17   vvToolBinarize
18   vvToolImageArithm
19   vvToolResample
20   vvToolMIP
21   vvToolConvert ## with dummy vvToolConvert.ui
22   vvToolROIManager
23   vvToolSegmentation
24   vvToolProfile
25   ## these ones are for tests (not working)
26   # vvToolTest
27   # vvToolFoo
28   # vvToolFooWithWidgetBase
29   # vvToolPlastimatch
30   # vvToolConnectedComponentLabeling
31   ## these ones are old ones
32   # vvToolExtractPatient
33   # vvToolExtractLung
34   # vvToolStructureSetManager
35 )
36 # dependencies of the tools
37 # Future issues : when tool depend on other tools ... how to manage that ?
38 #  >> add the relevant $_LIBS variable to the tool that has dependencies?
39 set(vvToolBinarize_LIBS clitkBinarizeImageLib)
40 set(vvToolProfile_LIBS clitkProfileImageLib)
41 set(vvToolResample_LIBS clitkResampleImageLib)
42 set(vvToolConvert_LIBS clitkImageConvertLib)
43 set(vvToolExtractPatient_LIBS clitkSegmentationGgoLib)
44 set(vvToolExtractLung_LIBS clitkSegmentationGgoLib)
45 set(vvToolCropImage_LIBS clitkCropImageLib)
46 set(vvToolMIP_LIBS clitkMIPLib)
47 set(vvToolMedianFilter_LIBS clitkMedianImageFilterLib)
48 set(vvToolImageArithm_LIBS clitkImageArithmImageLib)
49 set(vvToolROIManager_LIBS clitkDicomRTStruct)
50
51 #=========================================================
52 # List of vv source files
53
54 # in COMMON_WITH_UI -> must have .h and .cxx and .ui
55 set(vv_COMMON_WITH_UI
56   vvInfoPanel
57   vvMainWindow
58   vvLinkPanel
59   vvOverlayPanel
60   vvLandmarksPanel
61   vvProgressDialog
62   vvSegmentationDialog
63   vvSurfaceViewerDialog
64   vvDeformationDialog
65   vvStructSelector
66   vvIntensityValueSlider
67   vvLabelImageLoaderWidget
68   vvToolWidgetBase
69   vvToolSimpleInputSelectorWidget
70   vvToolInputSelectorWidget
71   vvRegisterForm
72 )
73
74 # All others sources
75 set(vv_SRCS
76   vvQProgressDialogITKCommand.cxx
77   vvQDicomSeriesSelector.cxx
78   QTreePushButton.cxx
79   vvMainWindowBase.cxx
80   vvImageWarp.cxx
81   vvDeformableRegistration.cxx
82   vtkVOXImageWriter.cxx
83   vvInteractorStyleNavigator.cxx
84   vvSlicer.cxx
85   vvLandmarks.cxx
86   vvLandmarksGlyph.cxx
87   vvClipPolyData.cxx
88   vvGlyphSource.cxx
89   vvGlyph2D.cxx
90   vvSlicerManager.cxx
91   vvSlicerManagerCommand.cxx
92   vvUtils.cxx
93 #  vvMaximumIntensityProjection.cxx
94   vvMesh.cxx
95   vvMeshActor.cxx
96   vvMeshReader.cxx
97   vvMidPosition.cxx
98   vvImageContour.cxx
99   vvBinaryImageOverlayActor.cxx
100   vvStructureSetActor.cxx
101   vvSaveState.cxx
102   vvReadState.cxx
103   vvROIActor.cxx
104   vvBlendImageActor.cxx
105   vvToolManager.cxx
106   vvToolCreatorBase.cxx
107   vvToolBaseBase.cxx
108 )
109
110 #=========================================================
111 # Qt related commands
112 find_package(Qt5Widgets REQUIRED)
113 find_package(Qt5Network REQUIRED)
114 find_package(Qt5Designer REQUIRED)
115 link_directories(${QT5Widgets_LIBRARIES})
116 link_directories(${QT5Network_LIBRARIES})
117 link_directories(${QT5Designer_LIBRARIES})
118
119 qt5_wrap_cpp(vv_SRCS
120   vvMainWindowBase.h
121   QTreePushButton.h
122   vvDocumentation.h
123   vvHelpDialog.h
124   vvQDicomSeriesSelector.h
125   vvSlicerManager.h
126   vvStructureSetActor.h
127   vvROIActor.h
128   vvToolCreatorBase.h
129   )
130
131 qt5_wrap_ui(vv_UI_CXX
132   qt_ui/vvHelpDialog.ui
133   qt_ui/vvDocumentation.ui
134   qt_ui/vvDicomSeriesSelector.ui
135   qt_ui/vvDummyWindow.ui #For testing
136   )
137
138 QT5_add_resources(vv_SRCS vvIcons.qrc)
139
140 # Add the autotools in the header vvToolsList.h for initialization of the dummy
141 # variables in vv.cxx for the tools contained in vvLib
142 if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
143   file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
144   foreach(tool ${vv_TOOLS})
145     file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
146     file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
147     file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
148   endforeach(tool)
149 endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
150
151 # Add the autotools and the common files ui
152 foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
153     set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
154     QT5_WRAP_CPP(vv_SRCS ${tool}.h)
155     QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
156 endforeach(tool)
157
158 # Add the common source files
159 foreach(tool ${vv_COMMON})
160     set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
161     QT5_WRAP_CPP(vv_SRCS ${tool}.h)
162 endforeach(tool)
163
164 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
165 set(QT_STATIC 0)
166 if(WIN32)
167   if(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl)
168     file(READ ${Qt5Widgets_LIBRARIES}/QtCore.prl QT_CORE_PRL)
169     if(${QT_CORE_PRL} MATCHES "static")
170       set(QT_STATIC 1)
171     endif(${QT_CORE_PRL} MATCHES "static")
172   endif(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl)
173 endif(WIN32)
174 if(NOT QT_STATIC)
175   add_definitions(-DQT_DLL)
176 endif(NOT QT_STATIC)
177
178 add_definitions(-DQT_THREAD_SUPPORT)
179
180 include_directories(
181   ${Qt5Widgets_INCLUDE_DIRS}
182   ${Qt5GUI_INCLUDE_DIRS}
183   ${Qt5CORE_INCLUDE_DIRS}
184   ${Qt5Network_INCLUDE_DIRS}
185   ${Qt5Designer_INCLUDE_DIRS}
186   ${CMAKE_CURRENT_BINARY_DIR}
187   ${CMAKE_CURRENT_SOURCE_DIR}
188 )
189 #=========================================================
190
191 #=========================================================
192 #support for parallel deformable registration with OpenMP
193 if(NOT APPLE)
194 if(CMAKE_COMPILER_IS_GNUCC)
195   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
196 endif(CMAKE_COMPILER_IS_GNUCC)
197 endif(NOT APPLE)
198 #=========================================================
199
200 #=========================================================
201 include_directories(
202   ../common
203   ../tools
204   ../segmentation
205   )
206
207 #=========================================================
208 #Add each tool's dependencies
209 foreach(tool ${vv_TOOLS})
210   set(toolLibs ${toolLibs} ${${tool}_LIBS})
211 endforeach(tool)
212
213 #=========================================================
214 #Add Foundation Libraries (this should be after our libraries, since we depend
215 #on them)
216 #set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
217 set(foundationLibraries clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES})
218
219 #=========================================================
220 # Use CxImage to create animated gifs
221 if(CLITK_EXPERIMENTAL)
222   set(vvCxImage clitkCxImage)
223   set(vv_SRCS ${vv_SRCS} vvAnimatedGIFWriter.cxx)
224   include_directories(${CLITK_SOURCE_DIR}/utilities/CxImage)
225   add_subdirectory(${CLITK_SOURCE_DIR}/utilities/CxImage ${PROJECT_BINARY_DIR}/utilities/CxImage)
226 endif(CLITK_EXPERIMENTAL)
227 #=========================================================
228
229 #-----------------------------------------------------------------------------
230 # Avoid linker bug in Mac OS 10.5
231 # See http://wiki.finkproject.org/index.php/Fink:Packaging:Preparing_for_10.5#OpenGL_Bug
232 #
233 if(APPLE)
234   find_library(CoreFoundation_LIBRARY CoreFoundation REQUIRED)
235   find_library(ApplicationServices_LIBRARY ApplicationServices REQUIRED)
236   find_library(SystemConfiguration_LIBRARY SystemConfiguration REQUIRED)
237   find_library(Security_LIBRARY Security REQUIRED)
238   set(APPLE_FRAMEWORKS ${CoreFoundation_LIBRARY}
239     ${ApplicationServices_LIBRARY}
240     ${SystemConfiguration_LIBRARY}
241     ${Security_LIBRARY}
242     )
243   message(STATUS "===== ${APPLE_FRAMEWORKS}")
244 endif()
245 #=========================================================
246 #Create binary and libs for tests
247 #set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${Qt5Widgets_LIBRARIES_DIRS} ${Qt5Network_LIBRARIES_DIRS} ${APPLE_FRAMEWORKS})
248 set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} Qt5::Widgets Qt5::Network Qt5::Designer ${APPLE_FRAMEWORKS})
249 # QtNetwork is required by vvRegisterForm
250
251 add_library(vvLib ${vv_SRCS} ${vv_UI_CXX})
252 target_link_libraries(vvLib ${vvExternalLibs})
253
254 if(WIN32)
255   add_executable(vv WIN32 vv.cxx vvIcon.rc)
256 else(WIN32)
257   add_executable(vv vv.cxx)
258 endif(WIN32)
259
260 target_link_libraries(vv vvLib)
261
262 #=========================================================
263 # Install options (also used by CPack)
264 install(TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
265
266 #=========================================================
267
268 #=========================================================
269 # CPack options
270 set(CPACK_PACKAGE_NAME "vv")
271 set(CPACK_SOURCE_PACKAGE_FILE_NAME "vv-src")
272 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
273 set(CPACK_PACKAGE_VENDOR "Creatis-CLB")
274 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
275 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
276 set(CPACK_PACKAGE_VERSION_MAJOR "1")
277 set(CPACK_PACKAGE_VERSION_MINOR "3")
278 set(CPACK_PACKAGE_VERSION_PATCH "0")
279 if(NIGHTLY)
280   set(CPACK_PACKAGE_INSTALL_DIRECTORY "vv-nightly")
281 else(NIGHTLY)
282   set(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
283 endif(NIGHTLY)
284 set(CPACK_STRIP_FILES TRUE)
285
286 if(WIN32)
287   # There is a bug in NSI that does not handle full unix paths properly. Make
288   # sure there is at least one set of four (4) backlasshes.
289   set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
290   set(CPACK_NSIS_INSTALLED_ICON_NAME "vv.exe")
291 if(NIGHTLY)
292   set(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer (nightly)")
293 else(NIGHTLY)
294   set(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
295 endif(NIGHTLY)
296   set(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
297   set(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
298   set(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
299   set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\bin\\\\vv.exe\\\" ")
300   set(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
301   #set(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
302   #set(CPACK_BINARY_ZIP ON)
303 else(WIN32)
304   set(CPACK_GENERATOR "STGZ")
305   set(CPACK_SOURCE_GENERATOR "TGZ")
306 endif(WIN32)
307 include(CPack)
308 #=========================================================
309 #=========================================================
310 configure_file(vvConfiguration.h.in vvConfiguration.h)
311 #=========================================================