CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-IF(POLICY CMP0020)
- CMAKE_POLICY(SET CMP0020 NEW)
-ENDIF(POLICY CMP0020)
+## ============
+## = Policies =
+## ============
+
+SET(
+ policies
+ CMP0020
+ CMP0042
+ )
+FOREACH(policy ${policies})
+ IF(POLICY ${policy})
+ CMAKE_POLICY(SET ${policy} NEW)
+ ENDIF(POLICY ${policy})
+ENDFOREACH(policy)
## ================
## = Project name =
## = Packages and options =
## ========================
+# Prepare header to build shared libs (windows)
INCLUDE(GenerateExportHeader)
+# Find ITK and VTK
FIND_PACKAGE(ITK REQUIRED)
-INCLUDE(${ITK_USE_FILE})
-
FIND_PACKAGE(VTK REQUIRED)
+
+INCLUDE(${ITK_USE_FILE})
INCLUDE(${VTK_USE_FILE})
+# Do not use itk-vtk glue --> problems ahead!!!
IF(ITKVtkGlue_LOADED)
MESSAGE(FATAL_ERROR "ITKVtkGlue module is available. Please re-compile your ITK without it. It could lead to nasty compilation problems... Just waiting for Kitware to solve it.")
ENDIF(ITKVtkGlue_LOADED)
-
+SET(QT4_FOUND "0")
IF(USE_QT4)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
- ## Check for required modules
- IF(NOT vtkGUISupportQt_LOADED)
- MESSAGE(
- FATAL_ERROR
- "vtkGUISupportQt module is required but not available."
- )
- ENDIF(NOT vtkGUISupportQt_LOADED)
- IF(NOT vtkGUISupportQtOpenGL_LOADED)
- MESSAGE(
- FATAL_ERROR
- "vtkGUISupportQtOpenGL module is required but not available."
- )
- ENDIF(NOT vtkGUISupportQtOpenGL_LOADED)
+ ## Check for required vtk-qt4 modules
+ SET(
+ vtk_required_modules
+ vtkGUISupportQt
+ vtkGUISupportQtOpenGL
+ )
+ FOREACH(vtk_module ${vtk_required_modules})
+ IF(NOT ${vtk_module}_LOADED)
+ MESSAGE(
+ FATAL_ERROR
+ "${vtk_module} module is required but not available."
+ )
+ SET(QT4_FOUND "0")
+ ENDIF(NOT ${vtk_module}_LOADED)
+ ENDFOREACH(vtk_module)
+ SET(QT4_FOUND "1")
ENDIF(USE_QT4)
## ================================================
${PROJECT_BINARY_DIR}/lib/third_party
${PROJECT_BINARY_DIR}/lib/third_party/ItkVtkGlue
)
-IF(WIN32)
+IF(WIN32 OR APPLE)
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/lib/third_party/glext
)
-ENDIF(WIN32)
+ENDIF(WIN32 OR APPLE)
## ===========================
## = Subdirs containing code =
-FIND_PATH(
- cpPlugins_INCLUDE_DIR1
- cpPlugins/Interface/Interface.h
- PATHS
- /usr/include
- /usr/local/include
- @PROJECT_SOURCE_DIR@/lib
- @PROJECT_BINARY_DIR@/lib
- @CMAKE_INSTALL_PREFIX@/include
- )
+# ===================================
+# -- Some configurations variables --
+# ===================================
-FIND_PATH(
- cpPlugins_INCLUDE_DIR2
- cpPlugins/Interface/cpPlugins_Interface_Export.h
- PATHS
- /usr/include
- /usr/local/include
- @PROJECT_SOURCE_DIR@/lib
- @PROJECT_BINARY_DIR@/lib
- @CMAKE_INSTALL_PREFIX@/include
- )
+SET(cpPlugins_with_QT4 "@QT4_FOUND@")
-FIND_PATH(
- cpPlugins_INCLUDE_DIR3
- Pluma/Pluma.hpp
- PATHS
- /usr/include
- /usr/local/include
- @PROJECT_SOURCE_DIR@/lib/third_party
- @PROJECT_BINARY_DIR@/lib/third_party
- @CMAKE_INSTALL_PREFIX@/include
- )
+# =========================
+# -- Include directories --
+# =========================
-FIND_PATH(
- cpPlugins_INCLUDE_DIR4
- Pluma/cpPlugins_Pluma_Export.h
- PATHS
- /usr/include
- /usr/local/include
+INCLUDE_DIRECTORIES(
+ @PROJECT_SOURCE_DIR@/lib
@PROJECT_SOURCE_DIR@/lib/third_party
- @PROJECT_BINARY_DIR@/lib/third_party
- @CMAKE_INSTALL_PREFIX@/include
- )
-
-FIND_PATH(
- cpPlugins_INCLUDE_DIR5
- itkImageToVTKImageFilter.h
- PATHS
- /usr/include
- /usr/local/include
@PROJECT_SOURCE_DIR@/lib/third_party/ItkVtkGlue
+ @PROJECT_BINARY_DIR@/lib
+ @PROJECT_BINARY_DIR@/lib/third_party
@PROJECT_BINARY_DIR@/lib/third_party/ItkVtkGlue
@CMAKE_INSTALL_PREFIX@/include
+ @CMAKE_INSTALL_PREFIX@/include/third_party
+ @CMAKE_INSTALL_PREFIX@/include/third_party/ItkVtkGlue
)
-INCLUDE_DIRECTORIES(
- ${cpPlugins_INCLUDE_DIR1}
- ${cpPlugins_INCLUDE_DIR2}
- ${cpPlugins_INCLUDE_DIR3}
- ${cpPlugins_INCLUDE_DIR4}
- ${cpPlugins_INCLUDE_DIR5}
- )
-
-FIND_LIBRARY(
- cpPlugins_Interface_LIBRARY_NAME
- cpPlugins_Interface
- PATHS
- /usr/lib
- /usr/local/lib
- @PROJECT_BINARY_DIR@
- @CMAKE_INSTALL_PREFIX@/lib
- )
+# =========================
+# -- Library directories --
+# =========================
-FIND_LIBRARY(
- cpPlugins_Extensions_LIBRARY_NAME
- cpPlugins_Extensions
- PATHS
- /usr/lib
- /usr/local/lib
- @PROJECT_BINARY_DIR@
+LINK_DIRECTORIES(
+ @PROJECT_SOURCE_DIR@/lib
+ @PROJECT_BINARY_DIR@/lib
@CMAKE_INSTALL_PREFIX@/lib
)
-FIND_LIBRARY(
- cpPlugins_LIBRARY_NAME
- cpPlugins
- PATHS
- /usr/lib
- /usr/local/lib
- @PROJECT_BINARY_DIR@
- @CMAKE_INSTALL_PREFIX@/lib
- )
+# ===================
+# -- Library names --
+# ===================
-SET(
- cpPlugins_Interface_INCLUDE_DIRS
- ${cpPlugins_INCLUDE_DIR1}
- ${cpPlugins_INCLUDE_DIR2}
- ${cpPlugins_INCLUDE_DIR2}
- )
-SET(
- cpPlugins_Interface_LIBRARIES
- ${cpPlugins_Interface_LIBRARY_NAME}
- ${cpPlugins_Extensions_LIBRARY_NAME}
- )
-SET(
- cpPlugins_LIBRARIES
- ${cpPlugins_LIBRARY_NAME}
- )
+SET(cpPlugins_Interface_LIBRARY cpPlugins_Interface)
+SET(cpPlugins_Extensions_LIBRARY cpPlugins_Extensions)
+SET(cpPlugins_LIBRARY cpPlugins)
## eof - $RCSfile$
${VTK_LIBRARIES}
)
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
+ )
+SET(
+ local_install_dirs
+ Algorithms
+ DataStructures
+ IO
+ Visualization
+ )
+FOREACH(dir ${local_install_dirs})
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/Extensions
+ FILES_MATCHING PATTERN "*.h"
+ )
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/Extensions
+ FILES_MATCHING PATTERN "*.hxx"
+ )
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/Extensions
+ FILES_MATCHING PATTERN "*.hpp"
+ )
+ENDFOREACH(dir)
+
+INSTALL(
+ FILES
+ ${PROJECT_BINARY_DIR}/lib/cpPlugins/Extensions/${LIBRARY_NAME}_Export.h
+ DESTINATION include/cpPlugins/Extensions
+ )
+
## eof - $RCSfile$
cpPlugins_Extensions
)
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
+ )
+SET(
+ local_install_dirs
+ .
+ )
+FOREACH(dir ${local_install_dirs})
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/Interface
+ FILES_MATCHING PATTERN "*.h"
+ )
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/Interface
+ FILES_MATCHING PATTERN "*.hxx"
+ )
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/Interface
+ FILES_MATCHING PATTERN "*.hpp"
+ )
+ENDFOREACH(dir)
+
+INSTALL(
+ FILES
+ ${PROJECT_BINARY_DIR}/lib/cpPlugins/Interface/${LIBRARY_NAME}_Export.h
+ DESTINATION include/cpPlugins/Interface
+ )
+
## eof - $RCSfile$
${LIBRARY_NAME}
cpPlugins_Interface
${ITK_LIBRARIES}
+ ${VTK_LIBRARIES}
+ )
+
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
)
## eof - $RCSfile$
Pluma
)
+## ========================
+## -- Installation rules --
+## ========================
+IF(WIN32 OR APPLE)
+ SET(
+ local_install_dirs
+ ItkVtkGlue
+ glext
+ )
+ELSE()
+ SET(
+ local_install_dirs
+ ItkVtkGlue
+ )
+ENDIF(WIN32 OR APPLE)
+
+FOREACH(dir ${local_install_dirs})
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/third_party
+ FILES_MATCHING PATTERN "*.h"
+ )
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/third_party
+ FILES_MATCHING PATTERN "*.hxx"
+ )
+ INSTALL(
+ DIRECTORY ${dir}
+ DESTINATION include/cpPlugins/third_party
+ FILES_MATCHING PATTERN "*.hpp"
+ )
+ENDFOREACH(dir)
+
## eof - $RCSfile$
)
ENDIF(NOT WIN32)
+## ========================
+## -- Installation rules --
+## ========================
+
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
+ )
+
## eof - $RCSfile$
#ifndef GL_ARB_shader_objects
/* GL types for program/shader text and shader object handles */
typedef char GLcharARB;
+#ifndef __APPLE__
typedef unsigned int GLhandleARB;
+#endif // __APPLE__
#endif
/* GL type for "half" precision (s10e5) float data in host memory */