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
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(vvToolBinarize_LIBS clitkBinarizeImageLib)
36 SET(vvToolResample_LIBS clitkResampleImageLib)
37 SET(vvToolConvert_LIBS clitkImageConvertLib)
38 SET(vvToolExtractPatient_LIBS clitkSegmentationGgoLib)
39 SET(vvToolExtractLung_LIBS clitkSegmentationGgoLib)
40 SET(vvToolCropImage_LIBS clitkCropImageLib)
41 SET(vvToolMIP_LIBS clitkMIPLib)
42 SET(vvToolMedianFilter_LIBS clitkMedianImageFilterLib)
43 SET(vvToolImageArithm_LIBS clitkImageArithmImageLib)
45 #=========================================================
46 # List of vv source files
48 # in COMMON_WITH_UI -> must have .h and .cxx and .ui
60 vvIntensityValueSlider
61 vvLabelImageLoaderWidget
63 vvToolSimpleInputSelectorWidget
64 vvToolInputSelectorWidget
70 vvQProgressDialogITKCommand.cxx
71 vvQDicomSeriesSelector.cxx
75 vvDeformableRegistration.cxx
77 vvInteractorStyleNavigator.cxx
84 vvSlicerManagerCommand.cxx
86 # vvMaximumIntensityProjection.cxx
91 vvImageMapToWLColors.cxx
94 vvBinaryImageOverlayActor.cxx
95 vvStructureSetActor.cxx
101 vvToolCreatorBase.cxx
104 #=========================================================
105 # Qt related commands
106 FIND_PACKAGE(Qt4 REQUIRED)
113 vvQDicomSeriesSelector.h
116 vvStructureSetActor.h
121 QT4_WRAP_UI(vv_UI_CXX
122 qt_ui/vvHelpDialog.ui
123 qt_ui/vvDocumentation.ui
124 qt_ui/vvDicomSeriesSelector.ui
125 qt_ui/vvDummyWindow.ui #For testing
128 QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
130 # Add the autotools in the header vvToolsList.h for initialization of the dummy
131 # variables in vv.cxx for the tools contained in vvLib
132 if(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
133 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
134 foreach(tool ${vv_TOOLS})
135 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n")
136 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n")
137 FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n")
139 endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h)
141 # Add the autotools and the common files ui
142 foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
143 SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
144 QT4_WRAP_CPP(vv_SRCS ${tool}.h)
145 QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
148 # Add the common source files
149 foreach(tool ${vv_COMMON})
150 SET(vv_SRCS ${vv_SRCS} ${tool}.cxx)
151 QT4_WRAP_CPP(vv_SRCS ${tool}.h)
154 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
157 IF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
158 FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL)
159 IF(${QT_CORE_PRL} MATCHES "static")
161 ENDIF(${QT_CORE_PRL} MATCHES "static")
162 ENDIF(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
165 ADD_DEFINITIONS(-DQT_DLL)
168 ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
173 ${QT_QTGUI_INCLUDE_DIR}
174 ${QT_QTCORE_INCLUDE_DIR}
175 ${CMAKE_CURRENT_BINARY_DIR}
176 ${CMAKE_CURRENT_SOURCE_DIR}
178 #=========================================================
180 #=========================================================
181 #support for parallel deformable registration with OpenMP
183 IF(CMAKE_COMPILER_IS_GNUCC)
184 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
185 ENDIF(CMAKE_COMPILER_IS_GNUCC)
187 #=========================================================
189 #=========================================================
196 LINK_DIRECTORIES(${QT_LIBRARY_DIR})
197 #=========================================================
198 #Add each tool's dependencies
199 foreach(tool ${vv_TOOLS})
200 SET(toolLibs ${toolLibs} ${${tool}_LIBS})
202 #=========================================================
203 #Add Foundation Libraries (this should be after our libraries, since we depend
205 SET(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
207 #=========================================================
208 # Use CxImage to create animated gifs
209 IF(CLITK_EXPERIMENTAL)
210 SET(vvCxImage clitkCxImage)
211 SET(vv_SRCS ${vv_SRCS} vvAnimatedGIFWriter.cxx)
212 INCLUDE_DIRECTORIES(${CLITK_SOURCE_DIR}/utilities/CxImage)
213 ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/utilities/CxImage ${PROJECT_BINARY_DIR}/utilities/CxImage)
214 ENDIF(CLITK_EXPERIMENTAL)
215 #=========================================================
217 #=========================================================
218 #Create binary and libs for tests
219 SET(vvExternalLibs ${QT_QTNETWORK_LIBRARY} clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries} ${vvCxImage})
220 # QtNetwork is required by vvRegisterForm
222 ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX})
223 TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs})
226 ADD_EXECUTABLE(vv WIN32 vv.cxx vvIcon.rc)
228 ADD_EXECUTABLE(vv vv.cxx)
231 #TARGET_LINK_LIBRARIES(vv vvLib)
232 TARGET_LINK_LIBRARIES(vv vvLib)
235 #=========================================================
236 # Install options (also used by CPack)
238 SET_TARGET_PROPERTIES(vv
239 PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}")
240 INSTALL (TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
241 # INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
244 #FOREACH(LIB QtCore QtGui QtOpenGL QtNetwork QtSql)
245 # INSTALL(FILES "${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}"
246 # RENAME "lib${LIB}.so.${QT_VERSION_MAJOR}"
252 #INCLUDE(InstallRequiredSystemLibraries)
253 INSTALL(FILES ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/vv.exe DESTINATION .)
254 #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
256 #=========================================================
258 #=========================================================
260 SET(CPACK_PACKAGE_NAME "vv")
261 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "vv-src")
262 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
263 SET(CPACK_PACKAGE_VENDOR "Creatis-CLB")
264 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
265 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
266 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
267 SET(CPACK_PACKAGE_VERSION_MINOR "2")
268 SET(CPACK_PACKAGE_VERSION_PATCH "2")
269 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
270 SET(CPACK_STRIP_FILES TRUE)
273 # There is a bug in NSI that does not handle full unix paths properly. Make
274 # sure there is at least one set of four (4) backlasshes.
275 SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
276 SET(CPACK_NSIS_INSTALLED_ICON_NAME "${CMAKE_BUILD_TYPE}\\\\vv.exe")
277 SET(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
278 SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
279 SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
280 SET(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
281 SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\vv.exe\\\" ")
282 SET(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
283 #SET(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
284 #SET(CPACK_BINARY_ZIP ON)
286 SET(CPACK_GENERATOR "STGZ")
287 SET(CPACK_SOURCE_GENERATOR "TGZ")
290 #=========================================================
291 #=========================================================
292 configure_file(vvConfiguration.h.in vvConfiguration.h)
293 #=========================================================