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 clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries})
208 ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX})
209 TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs})
212 ADD_EXECUTABLE(vv WIN32 vv.cxx vvIcon.rc)
214 ADD_EXECUTABLE(vv vv.cxx)
217 TARGET_LINK_LIBRARIES(vv vvLib)
220 #=========================================================
221 # Install options (also used by CPack)
222 IF(UNIX AND NOT APPLE)
223 SET_TARGET_PROPERTIES(vv
224 PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}" )
225 INSTALL (TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
226 # INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
229 #FOREACH(LIB QtCore QtGui QtOpenGL QtNetwork QtSql)
230 # INSTALL(FILES "${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}"
231 # RENAME "lib${LIB}.so.${QT_VERSION_MAJOR}"
234 ENDIF(UNIX AND NOT APPLE)
237 #INCLUDE(InstallRequiredSystemLibraries)
238 INSTALL(FILES ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/vv.exe DESTINATION .)
239 #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
241 #=========================================================
243 #=========================================================
245 SET(CPACK_PACKAGE_NAME "vv")
246 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "vv-src")
247 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
248 SET(CPACK_PACKAGE_VENDOR "Creatis-CLB")
249 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
250 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
251 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
252 SET(CPACK_PACKAGE_VERSION_MINOR "2")
253 SET(CPACK_PACKAGE_VERSION_PATCH "2")
254 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
255 SET(CPACK_STRIP_FILES TRUE)
258 # There is a bug in NSI that does not handle full unix paths properly. Make
259 # sure there is at least one set of four (4) backlasshes.
260 SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
261 SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_BUILD_TYPE}\\\\vv.exe")
262 SET(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
263 SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
264 SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
265 SET(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
266 SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\vv.exe\\\" ")
267 SET(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
268 #SET(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
269 #SET(CPACK_BINARY_ZIP ON)
271 SET(CPACK_GENERATOR "STGZ")
272 SET(CPACK_SOURCE_GENERATOR "TGZ")
275 #=========================================================
276 #=========================================================
277 configure_file(vvConfiguration.h.in vvConfiguration.h)
278 #=========================================================