1 cmake_minimum_required(VERSION 2.4)
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 #=========================================================
11 #=========================================================
12 #List of vv tools to compile
20 # vvToolExtractPatient
22 vvToolStructureSetManager
24 vvToolConvert ## with dummy vvToolConvert.ui
27 ## these ones are for tests (not working)
29 # vvToolFooWithWidgetBase
31 # vvToolConnectedComponentLabeling
33 # dependencies of the tools
34 # Future issues : when tool depend on other tools ... how to manage that ?
35 # >> add the relevant $_LIBS variable to the tool that has dependencies?
36 SET(vvToolBinarize_LIBS clitkBinarizeImageLib)
37 SET(vvToolResample_LIBS clitkResampleImageLib)
38 SET(vvToolConvert_LIBS clitkImageConvertLib)
39 SET(vvToolExtractPatient_LIBS clitkSegmentationGgoLib)
40 SET(vvToolExtractLung_LIBS clitkSegmentationGgoLib)
41 SET(vvToolCropImage_LIBS clitkCropImageLib)
42 SET(vvToolMIP_LIBS clitkMIPLib)
43 SET(vvToolMedianFilter_LIBS clitkMedianImageFilterLib)
44 SET(vvToolImageArithm_LIBS clitkImageArithmImageLib)
46 #=========================================================
47 # List of vv source files
49 # in COMMON_WITH_UI -> must have .h and .cxx and .ui
61 vvIntensityValueSlider
62 vvLabelImageLoaderWidget
64 vvToolSimpleInputSelectorWidget
65 vvToolInputSelectorWidget
71 vvQProgressDialogITKCommand.cxx
72 vvQDicomSeriesSelector.cxx
76 vvDeformableRegistration.cxx
78 vvInteractorStyleNavigator.cxx
85 vvSlicerManagerCommand.cxx
87 # vvMaximumIntensityProjection.cxx
92 vvImageMapToWLColors.cxx
95 vvBinaryImageOverlayActor.cxx
96 vvStructureSetActor.cxx
100 vvBlendImageActor.cxx
102 vvToolCreatorBase.cxx
106 #=========================================================
107 # Qt related commands
108 FIND_PACKAGE(Qt4 REQUIRED)
115 vvQDicomSeriesSelector.h
118 vvStructureSetActor.h
123 QT4_WRAP_UI(vv_UI_CXX
124 qt_ui/vvHelpDialog.ui
125 qt_ui/vvDocumentation.ui
126 qt_ui/vvDicomSeriesSelector.ui
127 qt_ui/vvDummyWindow.ui #For testing
130 QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
132 # Add the autotools in the header vvToolsList.h for initialization of the dummy
133 # variables in vv.cxx for the tools contained in vvLib
134 if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
135 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
136 foreach(tool ${vv_TOOLS})
137 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
138 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
139 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
141 endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
143 # Add the autotools and the common files ui
144 foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
145 SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
146 QT4_WRAP_CPP(vv_SRCS ${tool}.h)
147 QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
150 # Add the common source files
151 foreach(tool ${vv_COMMON})
152 SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
153 QT4_WRAP_CPP(vv_SRCS ${tool}.h)
156 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
159 IF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
160 FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL)
161 IF(${QT_CORE_PRL} MATCHES "static")
163 ENDIF(${QT_CORE_PRL} MATCHES "static")
164 ENDIF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
167 ADD_DEFINITIONS(-DQT_DLL)
170 ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
175 ${QT_QTGUI_INCLUDE_DIR}
176 ${QT_QTCORE_INCLUDE_DIR}
177 ${CMAKE_CURRENT_BINARY_DIR}
178 ${CMAKE_CURRENT_SOURCE_DIR}
180 #=========================================================
182 #=========================================================
183 #support for parallel deformable registration with OpenMP
185 IF(CMAKE_COMPILER_IS_GNUCC)
186 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
187 ENDIF(CMAKE_COMPILER_IS_GNUCC)
189 #=========================================================
191 #=========================================================
198 LINK_DIRECTORIES(${QT_LIBRARY_DIR})
199 #=========================================================
200 #Add each tool's dependencies
201 foreach(tool ${vv_TOOLS})
202 SET(toolLibs ${toolLibs} ${${tool}_LIBS})
204 #=========================================================
205 #Add Foundation Libraries (this should be after our libraries, since we depend
207 SET(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
209 #=========================================================
210 # Use CxImage to create animated gifs
211 IF(CLITK_EXPERIMENTAL)
212 SET(vvCxImage clitkCxImage)
213 SET(vv_SRCS ${vv_SRCS} vvAnimatedGIFWriter.cxx)
214 INCLUDE_DIRECTORIES(${CLITK_SOURCE_DIR}/utilities/CxImage)
215 ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/utilities/CxImage ${PROJECT_BINARY_DIR}/utilities/CxImage)
216 ENDIF(CLITK_EXPERIMENTAL)
217 #=========================================================
219 #=========================================================
220 #Create binary and libs for tests
221 SET(vvExternalLibs ${QT_QTNETWORK_LIBRARY} clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries} ${vvCxImage})
222 # QtNetwork is required by vvRegisterForm
224 ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX})
225 TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs})
228 ADD_EXECUTABLE(vv WIN32 vv.cxx vvIcon.rc)
230 ADD_EXECUTABLE(vv vv.cxx)
233 #TARGET_LINK_LIBRARIES(vv vvLib)
234 TARGET_LINK_LIBRARIES(vv vvLib)
237 #=========================================================
238 # Install options (also used by CPack)
240 SET_TARGET_PROPERTIES(vv
241 PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}")
242 INSTALL (TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
243 # INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
246 #FOREACH(LIB QtCore QtGui QtOpenGL QtNetwork QtSql)
247 # INSTALL(FILES "${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}"
248 # RENAME "lib${LIB}.so.${QT_VERSION_MAJOR}"
254 #INCLUDE(InstallRequiredSystemLibraries)
255 INSTALL(FILES ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/vv.exe DESTINATION .)
256 #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
258 #=========================================================
260 #=========================================================
262 SET(CPACK_PACKAGE_NAME "vv")
263 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "vv-src")
264 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
265 SET(CPACK_PACKAGE_VENDOR "Creatis-CLB")
266 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
267 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
268 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
269 SET(CPACK_PACKAGE_VERSION_MINOR "2")
270 SET(CPACK_PACKAGE_VERSION_PATCH "2")
271 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
272 SET(CPACK_STRIP_FILES TRUE)
275 # There is a bug in NSI that does not handle full unix paths properly. Make
276 # sure there is at least one set of four (4) backlasshes.
277 SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
278 SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_BUILD_TYPE}\\\\vv.exe")
279 SET(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
280 SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
281 SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
282 SET(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
283 SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\vv.exe\\\" ")
284 SET(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
285 #SET(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
286 #SET(CPACK_BINARY_ZIP ON)
288 SET(CPACK_GENERATOR "STGZ")
289 SET(CPACK_SOURCE_GENERATOR "TGZ")
292 #=========================================================
293 #=========================================================
294 configure_file(vvConfiguration.h.in vvConfiguration.h)
295 #=========================================================