From: Leonardo Florez-Valencia Date: Fri, 11 Sep 2015 09:38:10 +0000 (+0200) Subject: Now ported to macosx and easier to configure on win32... hopefully X-Git-Tag: v0.1~386 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=0eec827392a9544a6e61fce74c5b430c1873f5a2;p=cpPlugins.git Now ported to macosx and easier to configure on win32... hopefully --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c64dad9..93dd1ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,19 @@ 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 = @@ -28,36 +39,42 @@ OPTION(BUILD_EXAMPLES "Build examples" OFF) ## = 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) ## ================================================ @@ -92,11 +109,11 @@ INCLUDE_DIRECTORIES( ${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 = diff --git a/cmake/cpPluginsConfig.cmake.in b/cmake/cpPluginsConfig.cmake.in index 7367ed0..f6ec0f7 100644 --- a/cmake/cpPluginsConfig.cmake.in +++ b/cmake/cpPluginsConfig.cmake.in @@ -1,110 +1,41 @@ -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$ diff --git a/lib/cpPlugins/Extensions/CMakeLists.txt b/lib/cpPlugins/Extensions/CMakeLists.txt index 550daf7..b18e5bd 100644 --- a/lib/cpPlugins/Extensions/CMakeLists.txt +++ b/lib/cpPlugins/Extensions/CMakeLists.txt @@ -75,4 +75,45 @@ TARGET_LINK_LIBRARIES( ${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$ diff --git a/lib/cpPlugins/Interface/CMakeLists.txt b/lib/cpPlugins/Interface/CMakeLists.txt index 634a0fd..b498063 100644 --- a/lib/cpPlugins/Interface/CMakeLists.txt +++ b/lib/cpPlugins/Interface/CMakeLists.txt @@ -35,4 +35,42 @@ TARGET_LINK_LIBRARIES( 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$ diff --git a/lib/cpPlugins/Plugins/CMakeLists.txt b/lib/cpPlugins/Plugins/CMakeLists.txt index 372b150..e8e9d5e 100644 --- a/lib/cpPlugins/Plugins/CMakeLists.txt +++ b/lib/cpPlugins/Plugins/CMakeLists.txt @@ -33,6 +33,18 @@ TARGET_LINK_LIBRARIES( ${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$ diff --git a/lib/third_party/CMakeLists.txt b/lib/third_party/CMakeLists.txt index 1dd3f14..af1194b 100644 --- a/lib/third_party/CMakeLists.txt +++ b/lib/third_party/CMakeLists.txt @@ -2,4 +2,38 @@ SUBDIRS( 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$ diff --git a/lib/third_party/Pluma/CMakeLists.txt b/lib/third_party/Pluma/CMakeLists.txt index da0147b..c7e062c 100644 --- a/lib/third_party/Pluma/CMakeLists.txt +++ b/lib/third_party/Pluma/CMakeLists.txt @@ -36,4 +36,15 @@ IF(NOT WIN32) ) ENDIF(NOT WIN32) +## ======================== +## -- Installation rules -- +## ======================== + +INSTALL( + TARGETS ${LIBRARY_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static + ) + ## eof - $RCSfile$ diff --git a/lib/third_party/glext/GL/glext.h b/lib/third_party/glext/GL/glext.h index f1a4174..4b82166 100644 --- a/lib/third_party/glext/GL/glext.h +++ b/lib/third_party/glext/GL/glext.h @@ -6215,7 +6215,9 @@ typedef ptrdiff_t GLsizeiptrARB; #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 */