endif(COMMAND cmake_policy)
PROJECT(clitk)
#=========================================================
-#IF(CMAKE_COMPILER_IS_GNUCXX)
-# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
-# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
-#ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-IF(MSVC)
- ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
-ENDIF(MSVC)
+
+#=========================================================
+INCLUDE(cmake/common.cmake)
+#=========================================================
+
#=========================================================
# Find ITK (required)
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
- LINK_LIBRARIES(ITKBasicFilters)
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build without ITK. Please set ITK_DIR.")
ENDIF(ITK_FOUND)
+#=========================================================
#=========================================================
-IF(CLITK_BUILD_VV)
- FIND_PACKAGE(VTK)
- IF(VTK_FOUND)
- INCLUDE(${VTK_USE_FILE})
- LINK_LIBRARIES (
- vtkCommon
- vtkRendering
- vtkIO
- vtkFiltering
- vtkGraphics
- vtkWidgets
- vtkImaging
- )
- ELSE(VTK_FOUND)
- MESSAGE(FATAL_ERROR
- "Please set VTK_DIR.")
- ENDIF(VTK_FOUND)
-ENDIF(CLITK_BUILD_VV)
+# Find VTK (required)
+FIND_PACKAGE(VTK REQUIRED)
+IF(VTK_FOUND)
+ INCLUDE(${VTK_USE_FILE})
+ELSE(VTK_FOUND)
+ MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
+ENDIF(VTK_FOUND)
+#=========================================================
#=========================================================
# Find gengetopt
ENDIF (CLITK_GENGETOPT STREQUAL "CLITK_GENGETOPT-NOTFOUND")
#=========================================================
-#=========================================================
-INCLUDE(cmake/common.cmake)
-#=========================================================
-
#=========================================================
# Building in the source tree is forbidden
IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
#=========================================================
#=========================================================
-OPTION(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
-OPTION(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
-OPTION(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
-OPTION(CLITK_BUILD_SEGMENTATION "Build segmentation tools" OFF)
+# Remove some MS Visual c++ flags
+IF(MSVC)
+ ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
+ENDIF(MSVC)
#=========================================================
-include_directories(itk filters ${PROJECT_BINARY_DIR})
-
#=========================================================
-add_subdirectory(common)
-add_subdirectory(filters)
+INCLUDE_DIRECTORIES(itk filters ${PROJECT_BINARY_DIR})
+
+# Select what is compiled
+ADD_SUBDIRECTORY(common)
+ADD_SUBDIRECTORY(filters)
+# Compilation options
+OPTION(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
+
+OPTION(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
IF (CLITK_BUILD_VV)
add_subdirectory(vv)
ENDIF(CLITK_BUILD_VV)
+OPTION(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
IF (CLITK_BUILD_TOOLS)
add_subdirectory(tools)
ENDIF(CLITK_BUILD_TOOLS)
+OPTION(CLITK_BUILD_SEGMENTATION "Build segmentation tools" OFF)
IF (CLITK_BUILD_SEGMENTATION)
- add_subdirectory(segmentation)
+ add_subdirectory(segmentation)
ENDIF (CLITK_BUILD_SEGMENTATION)
-
#=========================================================
+
cmake_minimum_required(VERSION 2.4)
-#=========================================================
-INCLUDE(${PROJECT_SOURCE_DIR}/cmake/common.cmake)
-#=========================================================
-# Find ITK (required)
-FIND_PACKAGE(ITK)
-IF(ITK_FOUND)
- INCLUDE(${ITK_USE_FILE})
-ELSE(ITK_FOUND)
- MESSAGE(FATAL_ERROR
- "Cannot build without ITK. Please set ITK_DIR.")
-ENDIF(ITK_FOUND)
-#=========================================================
-
-#=========================================================
-# Find QT
-FIND_PACKAGE(Qt4 REQUIRED)
-
-#=========================================================
-INCLUDE_DIRECTORIES(
- ${QT_INCLUDES}
- ${VTK_INCLUDE_DIR}
- ${QT_INCLUDE_DIR}
- ${QT_QTGUI_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ../common
- ../tools
- )
#=========================================================
# To avoid warning with some version
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
-
-#SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
-#SET(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}/../lib)
-
#=========================================================
-LINK_LIBRARIES (
- #ITKIO
- clitkCommon
- clitkDicomRTStruct
- clitkFilters
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
- vtkCommon
- vtkRendering
- vtkIO
- vtkFiltering
- vtkGraphics
- vtkWidgets
- vtkImaging
- QVTK
- )
-
-LINK_DIRECTORIES(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} )
#=========================================================
-
-# OPTION(CLITK_VV_USE_BDCM "Build vv with Dicom selector bdcm" OFF)
-
+# List of vv source files
SET(vv_SRCS
vvInfoPanel.cxx
vvLinkPanel.cxx
vvToolResample.cxx
vvBlendImageActor.cxx
)
+#=========================================================
+
+#=========================================================
+# Qt related commands
+FIND_PACKAGE(Qt4 REQUIRED)
QT4_WRAP_CPP(vv_SRCS
vvMainWindowBase.h
qt_ui/vvToolResample.ui
)
-SET(vvUI_RCCS vvIcons.qrc)
-QT4_ADD_RESOURCES(vv_SRCS ${vvUI_RCCS})
+QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
+
+ADD_DEFINITIONS(-DQT_DLL)
+ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
+
+INCLUDE_DIRECTORIES(
+ ${QT_INCLUDES}
+ ${QT_INCLUDE_DIR}
+ ${QT_QTGUI_INCLUDE_DIR}
+ ${QT_QTCORE_INCLUDE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+#=========================================================
#=========================================================
#support for parallel deformable registration with OpenMP
ENDIF(NOT __APPLE__)
#=========================================================
-# IF (CLITK_VV_USE_BDCM)
-# FIND_PACKAGE(bdcm)
-# IF(bdcm_FOUND)
-# INCLUDE(${bdcm_USE_FILE})
-# ELSE(bdcm_FOUND)
-# MESSAGE(FATAL_ERROR
-# "Cannot build without BDCM. Please set BDCM_DIR.")
-# ENDIF(bdcm_FOUND)
-# #LINK_DIRECTORIES(/home/dsarrut/src/bdcm/build/)
-# #INCLUDE_DIRECTORIES(/home/dsarrut/src/bdcm/src2/)
-
-# FIND_PACKAGE(GDCM)
-# IF(GDCM_FOUND)
-# INCLUDE(${GDCM_USE_FILE})
-# ELSE(GDCM_FOUND)
-# MESSAGE(FATAL_ERROR
-# "Cannot build without GDCM. Please set GDCM_DIR.")
-# ENDIF(GDCM_FOUND)
-
-# ENDIF (CLITK_VV_USE_BDCM)
-
-IF(WIN32)
- SET(EXE_ICON vvIcon.rc)
-ENDIF(WIN32)
-
-ADD_DEFINITIONS(-DQT_DLL)
-
-ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
+#=========================================================
+INCLUDE_DIRECTORIES(
+ ../common
+ ../tools
+ )
+LINK_DIRECTORIES(${QT_INCLUDES})
ADD_EXECUTABLE(vv ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON})
-TARGET_LINK_LIBRARIES(vv ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} )
-
-#test executable
-#QT4_WRAP_CPP(VVS_MOC_OUTFILE vvs.h)
-#QT4_WRAP_UI(VVS_UI_OUTFILE qt_ui/vvDummyWindow.ui)
-#ADD_EXECUTABLE(vvs ${vv_SRCS} vvs.cxx ${vv_UI_CXX} ${VVS_UI_OUTFILE}
-#${VVS_MOC_OUTFILE} ${EXE_ICON})
-#TARGET_LINK_LIBRARIES(vvs ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} )
+TARGET_LINK_LIBRARIES(vv clitkCommon clitkDicomRTStruct clitkFilters ${ITK_LIBRARIES} QVTK)
IF (CLITK_VV_USE_BDCM)
- TARGET_LINK_LIBRARIES(vv ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} bdcm)
-ELSE (CLITK_VV_USE_BDCM)
- #TARGET_LINK_LIBRARIES(vv ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} )
+ TARGET_LINK_LIBRARIES(vv bdcm)
ENDIF (CLITK_VV_USE_BDCM)
-
-#IF( MINGW )
-# # resource compilation for MinGW
-# ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vvIcons.o
-# COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/vvIcons.qrc -o ${CMAKE_CURRENT_BINARY_DIR}/vvIcons.o )
-# SET(vv_SRCS ${vv_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/vvIcons.o)
-#ENDIF (MINGW)
-
-#IF( MINGW )
-# ADD_EXECUTABLE(vv WIN32 ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON})
-#ELSE (MINGW)
-# ADD_EXECUTABLE(vv ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON})
-#ENDIF (MINGW)
-#TARGET_LINK_LIBRARIES(vv ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} QVTKWidgetPlugin )
+#=========================================================
#=========================================================
-# Installation file
-INSTALL(TARGETS vv vv
- RUNTIME DESTINATION bin CONFIGURATIONS ${CMAKE_BUILD_TYPE}
- LIBRARY DESTINATION lib CONFIGURATIONS ${CMAKE_BUILD_TYPE}
- ARCHIVE DESTINATION lib CONFIGURATIONS ${CMAKE_BUILD_TYPE})
-INSTALL(FILES ${vv_HDRS} DESTINATION include)
+# Install options (also used by CPack)
+IF(UNIX AND NOT APPLE)
+ INSTALL(TARGETS vv
+ DESTINATION .)
+ #QT
+ FOREACH(LIB QtCore QtGui QtOpenGL QtWebKit QtXmlPatterns QtNetwork QtSql)
+ INSTALL(FILES "${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}"
+ RENAME "lib${LIB}.so.${QT_VERSION_MAJOR}"
+ DESTINATION .)
+ ENDFOREACH(LIB)
+
+ #VTK
+ FOREACH(LIB QVTK vtkQtChart vtkViews vtkInfovis vtkWidgets vtkHybrid vtkRendering vtkImaging vtkGraphics vtkverdict
+ vtkIO vtkFiltering vtkCommon vtkDICOMParser vtkmetaio vtksqlite vtkpng vtktiff vtkjpeg vtkexpat vtksys
+ vtkftgl vtkfreetype vtkexoIIc vtkNetCDF vtklibxml2 vtkzlib vtkalglib)
+ INSTALL(FILES "${VTK_DIR}/bin/lib${LIB}.so.${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR}.0"
+ RENAME "lib${LIB}.so.${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR}"
+ DESTINATION .)
+ ENDFOREACH(LIB)
+
+ #ITK
+ FOREACH(LIB ITKAlgorithms ITKStatistics ITKFEM itkNetlibSlatec ITKNumerics ITKBasicFilters ITKIO ITKNrrdIO itkgdcm
+ itkjpeg12 itkjpeg16 itkopenjpeg itkpng itktiff itkjpeg8 ITKSpatialObject ITKCommon itkvnl_inst
+ itkvnl_algo itkv3p_netlib itkvnl itkvcl ITKMetaIO itksys ITKDICOMParser ITKEXPAT ITKniftiio ITKznz itkzlib)
+ INSTALL(FILES "${ITK_DIR}/bin/lib${LIB}.so.${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.0"
+ RENAME "lib${LIB}.so.${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}"
+ DESTINATION .)
+ ENDFOREACH(LIB)
+ENDIF(UNIX AND NOT APPLE)
IF(WIN32)
- INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION bin)
- INSTALL (FILES ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/vv.exe DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtCore4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtGui4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtWebKit4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtOpenGL4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/phonon4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtXmlPatterns4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtNetwork4.dll DESTINATION bin)
- INSTALL (FILES ${QT_PLUGINS_DIR}/../bin/QtSql4.dll DESTINATION bin)
- INSTALL (FILES ${ITK_DIR}/bin/${CMAKE_BUILD_TYPE}/itkCommon.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkCommon.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtksys.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkRendering.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkGraphics.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkImaging.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkFiltering.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkGenericFiltering.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkIO.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkverdict.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/QVTK.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkDICOMParser.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkexoIIc.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkexpat.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkmetaio.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkftgl.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkfreetype.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkHybrid.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkInfovis.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkjpeg.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtklibxml2.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkNetCDF.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkpng.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtktiff.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkViews.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkWidgets.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkzlib.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkQtChart.dll DESTINATION bin)
- INSTALL (FILES ${VTK_DIR}/bin/${CMAKE_BUILD_TYPE}/vtkalglib.dll DESTINATION bin)
+ SET(EXE_ICON vvIcon.rc)
ENDIF(WIN32)
-IF(UNIX)
- INSTALL (FILES ${EXECUTABLE_OUTPUT_PATH}/vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
- INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION bin)
- INSTALL (FILES ${EXECUTABLE_OUTPUT_PATH}vv DESTINATION bin)
-ENDIF(UNIX)
-
#=========================================================
# CPack options
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vv, the 4D slicer : let's jump into a new dimension !")
-SET(CPACK_PACKAGE_VENDOR "Creatis, CLB/RIO Team")
+SET(CPACK_PACKAGE_VENDOR "Creatis-CLB")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
-IF(WIN32 AND NOT UNIX)
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
+#IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
# SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\ducky.png")
# SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin/${CMAKE_BUILD_TYPE}\\\\vv.exe")
- SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} The 4D slicer")
- SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio")
- SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
- SET(CPACK_NSIS_MODIFY_PATH ON)
-ELSE(WIN32 AND NOT UNIX)
- SET(CPACK_STRIP_FILES "bin/vv")
- SET(CPACK_SOURCE_STRIP_FILES "")
-ENDIF(WIN32 AND NOT UNIX)
+# SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} The 4D slicer")
+# SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio")
+# SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
+# SET(CPACK_NSIS_MODIFY_PATH ON)
+#ELSE(WIN32 AND NOT UNIX)
+# SET(CPACK_STRIP_FILES "bin/vv")
+# SET(CPACK_SOURCE_STRIP_FILES "")
+#ENDIF(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_EXECUTABLES "vv" "vv")
INCLUDE(CPack)