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
15 # vvToolRigidReg ## Very long to compile
20 # vvToolExtractPatient
22 vvToolStructureSetManager
24 vvToolConvert ## with dummy vvToolConvert.ui
26 ## these ones are for tests (not working)
28 # vvToolFooWithWidgetBase
30 # vvToolConnectedComponentLabeling
32 # dependencies of the tools
33 # Future issues : when tool depend on other tools ... how to manage that ?
34 # >> add the relevant $_LIBS variable to the tool that has dependencies?
35 SET(vvToolRigidReg_LIBS clitkAffineRegistrationLib)
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 vvToolCreatorBase.cxx
103 #=========================================================
104 # Qt related commands
105 FIND_PACKAGE(Qt4 REQUIRED)
112 vvQDicomSeriesSelector.h
115 vvStructureSetActor.h
120 QT4_WRAP_UI(vv_UI_CXX
121 qt_ui/vvHelpDialog.ui
122 qt_ui/vvDocumentation.ui
123 qt_ui/vvDicomSeriesSelector.ui
124 qt_ui/vvDummyWindow.ui #For testing
127 QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
129 # Add the autotools in the header vvToolsList.h for initialization of the dummy
130 # variables in vv.cxx for the tools contained in vvLib
131 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
132 foreach(tool ${vv_TOOLS})
133 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
134 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
135 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
138 # Add the autotools and the common files ui
139 foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
140 SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
141 QT4_WRAP_CPP(vv_SRCS ${tool}.h)
142 QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
145 # Add the common source files
146 foreach(tool ${vv_COMMON})
147 SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
148 QT4_WRAP_CPP(vv_SRCS ${tool}.h)
151 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
154 IF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
155 FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL)
156 IF(${QT_CORE_PRL} MATCHES "static")
158 ENDIF(${QT_CORE_PRL} MATCHES "static")
159 ENDIF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
162 ADD_DEFINITIONS(-DQT_DLL)
165 ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
170 ${QT_QTGUI_INCLUDE_DIR}
171 ${QT_QTCORE_INCLUDE_DIR}
172 ${CMAKE_CURRENT_BINARY_DIR}
173 ${CMAKE_CURRENT_SOURCE_DIR}
175 #=========================================================
177 #=========================================================
178 #support for parallel deformable registration with OpenMP
180 IF(CMAKE_COMPILER_IS_GNUCC)
181 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
182 ENDIF(CMAKE_COMPILER_IS_GNUCC)
184 #=========================================================
186 #=========================================================
193 LINK_DIRECTORIES(${QT_LIBRARY_DIR})
194 #=========================================================
195 #Add each tool's dependencies
196 foreach(tool ${vv_TOOLS})
197 SET(toolLibs ${toolLibs} ${${tool}_LIBS})
199 #=========================================================
200 #Add Foundation Libraries (this should be after our libraries, since we depend
202 SET(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
204 #=========================================================
205 #Create binary and libs for tests
206 SET(vvExternalLibs ${QT_QTNETWORK_LIBRARY} clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries})
207 # QtNetwork is required by vvRegisterForm
209 ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX})
210 TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs})
213 ADD_EXECUTABLE(vv WIN32 vv.cxx vvIcon.rc)
215 ADD_EXECUTABLE(vv vv.cxx)
218 #TARGET_LINK_LIBRARIES(vv vvLib)
219 TARGET_LINK_LIBRARIES(vv vvLib)
222 #=========================================================
223 # Install options (also used by CPack)
224 IF(UNIX AND NOT APPLE)
225 SET_TARGET_PROPERTIES(vv
226 PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}" )
227 INSTALL (TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
228 # INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
231 #FOREACH(LIB QtCore QtGui QtOpenGL QtNetwork QtSql)
232 # INSTALL(FILES "${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}"
233 # RENAME "lib${LIB}.so.${QT_VERSION_MAJOR}"
236 ENDIF(UNIX AND NOT APPLE)
239 #INCLUDE(InstallRequiredSystemLibraries)
240 INSTALL(FILES ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/vv.exe DESTINATION .)
241 #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
243 #=========================================================
245 #=========================================================
247 SET(CPACK_PACKAGE_NAME "vv")
248 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "vv-src")
249 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
250 SET(CPACK_PACKAGE_VENDOR "Creatis-CLB")
251 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
252 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
253 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
254 SET(CPACK_PACKAGE_VERSION_MINOR "2")
255 SET(CPACK_PACKAGE_VERSION_PATCH "2")
256 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
257 SET(CPACK_STRIP_FILES TRUE)
260 # There is a bug in NSI that does not handle full unix paths properly. Make
261 # sure there is at least one set of four (4) backlasshes.
262 SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
263 SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_BUILD_TYPE}\\\\vv.exe")
264 SET(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
265 SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
266 SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
267 SET(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
268 SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\vv.exe\\\" ")
269 SET(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
270 #SET(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
271 #SET(CPACK_BINARY_ZIP ON)
273 SET(CPACK_GENERATOR "STGZ")
274 SET(CPACK_SOURCE_GENERATOR "TGZ")
277 #=========================================================
278 #=========================================================
279 configure_file(vvConfiguration.h.in vvConfiguration.h)
280 #=========================================================