]> Creatis software - clitk.git/blob - vv/CMakeLists.txt
Display a line between Profile points
[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   vvSlicer.h
127   vvStructureSetActor.h
128   vvROIActor.h
129   vvToolCreatorBase.h
130   )
131
132 qt5_wrap_ui(vv_UI_CXX
133   qt_ui/vvHelpDialog.ui
134   qt_ui/vvDocumentation.ui
135   qt_ui/vvDicomSeriesSelector.ui
136   qt_ui/vvDummyWindow.ui #For testing
137   )
138
139 QT5_add_resources(vv_SRCS vvIcons.qrc)
140
141 # Add the autotools in the header vvToolsList.h for initialization of the dummy
142 # variables in vv.cxx for the tools contained in vvLib
143 if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
144   file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
145   foreach(tool ${vv_TOOLS})
146     file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
147     file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
148     file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
149   endforeach(tool)
150 endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
151
152 # Add the autotools and the common files ui
153 foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
154     set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
155     QT5_WRAP_CPP(vv_SRCS ${tool}.h)
156     QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
157 endforeach(tool)
158
159 # Add the common source files
160 foreach(tool ${vv_COMMON})
161     set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
162     QT5_WRAP_CPP(vv_SRCS ${tool}.h)
163 endforeach(tool)
164
165 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
166 set(QT_STATIC 0)
167 if(WIN32)
168   if(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl)
169     file(READ ${Qt5Widgets_LIBRARIES}/QtCore.prl QT_CORE_PRL)
170     if(${QT_CORE_PRL} MATCHES "static")
171       set(QT_STATIC 1)
172     endif(${QT_CORE_PRL} MATCHES "static")
173   endif(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl)
174 endif(WIN32)
175 if(NOT QT_STATIC)
176   add_definitions(-DQT_DLL)
177 endif(NOT QT_STATIC)
178
179 add_definitions(-DQT_THREAD_SUPPORT)
180
181 include_directories(
182   ${Qt5Widgets_INCLUDE_DIRS}
183   ${Qt5GUI_INCLUDE_DIRS}
184   ${Qt5CORE_INCLUDE_DIRS}
185   ${Qt5Network_INCLUDE_DIRS}
186   ${Qt5Designer_INCLUDE_DIRS}
187   ${CMAKE_CURRENT_BINARY_DIR}
188   ${CMAKE_CURRENT_SOURCE_DIR}
189 )
190 #=========================================================
191
192 #=========================================================
193 #support for parallel deformable registration with OpenMP
194 if(NOT APPLE)
195 if(CMAKE_COMPILER_IS_GNUCC)
196   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
197 endif(CMAKE_COMPILER_IS_GNUCC)
198 endif(NOT APPLE)
199 #=========================================================
200
201 #=========================================================
202 include_directories(
203   ../common
204   ../tools
205   ../segmentation
206   )
207
208 #=========================================================
209 #Add each tool's dependencies
210 foreach(tool ${vv_TOOLS})
211   set(toolLibs ${toolLibs} ${${tool}_LIBS})
212 endforeach(tool)
213
214 #=========================================================
215 #Add Foundation Libraries (this should be after our libraries, since we depend
216 #on them)
217 #set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
218 set(foundationLibraries clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES})
219
220 #=========================================================
221 # Use CxImage to create animated gifs
222 if(CLITK_EXPERIMENTAL)
223   set(vvCxImage clitkCxImage)
224   set(vv_SRCS ${vv_SRCS} vvAnimatedGIFWriter.cxx)
225   include_directories(${CLITK_SOURCE_DIR}/utilities/CxImage)
226   add_subdirectory(${CLITK_SOURCE_DIR}/utilities/CxImage ${PROJECT_BINARY_DIR}/utilities/CxImage)
227 endif(CLITK_EXPERIMENTAL)
228 #=========================================================
229
230 #-----------------------------------------------------------------------------
231 # Avoid linker bug in Mac OS 10.5
232 # See http://wiki.finkproject.org/index.php/Fink:Packaging:Preparing_for_10.5#OpenGL_Bug
233 #
234 if(APPLE)
235   find_library(CoreFoundation_LIBRARY CoreFoundation REQUIRED)
236   find_library(ApplicationServices_LIBRARY ApplicationServices REQUIRED)
237   find_library(SystemConfiguration_LIBRARY SystemConfiguration REQUIRED)
238   find_library(Security_LIBRARY Security REQUIRED)
239   set(APPLE_FRAMEWORKS ${CoreFoundation_LIBRARY}
240     ${ApplicationServices_LIBRARY}
241     ${SystemConfiguration_LIBRARY}
242     ${Security_LIBRARY}
243     )
244   message(STATUS "===== ${APPLE_FRAMEWORKS}")
245 endif()
246 #=========================================================
247 #Create binary and libs for tests
248 #set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${Qt5Widgets_LIBRARIES_DIRS} ${Qt5Network_LIBRARIES_DIRS} ${APPLE_FRAMEWORKS})
249 set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} Qt5::Widgets Qt5::Network Qt5::Designer ${APPLE_FRAMEWORKS})
250 # QtNetwork is required by vvRegisterForm
251
252 add_library(vvLib ${vv_SRCS} ${vv_UI_CXX})
253 target_link_libraries(vvLib ${vvExternalLibs})
254
255 if(WIN32)
256   add_executable(vv WIN32 vv.cxx vvIcon.rc)
257 else(WIN32)
258   add_executable(vv vv.cxx)
259 endif(WIN32)
260
261 target_link_libraries(vv vvLib)
262
263 #=========================================================
264 # Install options (also used by CPack)
265 install(TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
266
267 #=========================================================
268
269 #=========================================================
270 # CPack options
271 set(CPACK_PACKAGE_NAME "vv")
272 set(CPACK_SOURCE_PACKAGE_FILE_NAME "vv-src")
273 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
274 set(CPACK_PACKAGE_VENDOR "Creatis-CLB")
275 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
276 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
277 set(CPACK_PACKAGE_VERSION_MAJOR "1")
278 set(CPACK_PACKAGE_VERSION_MINOR "3")
279 set(CPACK_PACKAGE_VERSION_PATCH "0")
280 if(NIGHTLY)
281   set(CPACK_PACKAGE_INSTALL_DIRECTORY "vv-nightly")
282 else(NIGHTLY)
283   set(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
284 endif(NIGHTLY)
285 set(CPACK_STRIP_FILES TRUE)
286
287 if(WIN32)
288   # There is a bug in NSI that does not handle full unix paths properly. Make
289   # sure there is at least one set of four (4) backlasshes.
290   set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
291   set(CPACK_NSIS_INSTALLED_ICON_NAME "vv.exe")
292 if(NIGHTLY)
293   set(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer (nightly)")
294 else(NIGHTLY)
295   set(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
296 endif(NIGHTLY)
297   set(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
298   set(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
299   set(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
300   set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\bin\\\\vv.exe\\\" ")
301   set(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
302   #set(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
303   #set(CPACK_BINARY_ZIP ON)
304 else(WIN32)
305   set(CPACK_GENERATOR "STGZ")
306   set(CPACK_SOURCE_GENERATOR "TGZ")
307 endif(WIN32)
308 include(CPack)
309 #=========================================================
310 #=========================================================
311 configure_file(vvConfiguration.h.in vvConfiguration.h)
312 #=========================================================