]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 27 Jun 2016 22:40:33 +0000 (17:40 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 27 Jun 2016 22:40:33 +0000 (17:40 -0500)
CMakeLists.txt
appli/plugins/CMakeLists.txt
cmake/cpPluginsConfig.cmake.in

index 28e32f4def619dc141067fc9f093707fdc7dc9f2..25e62fa0c137afeb332e8cde624c1152a0e7723f 100644 (file)
@@ -31,16 +31,19 @@ INCLUDE(cmake/cpPlugins_Qt4Tools.cmake)
 ## == Include directories ==
 ## =========================
 
-INCLUDE_DIRECTORIES(
-  ${PROJECT_SOURCE_DIR}
-  ${PROJECT_BINARY_DIR}
-  ${PROJECT_SOURCE_DIR}/lib
-  ${PROJECT_BINARY_DIR}/lib
-  ${PROJECT_SOURCE_DIR}/lib/Itk2Vtk
-  ${PROJECT_BINARY_DIR}/lib/Itk2Vtk
-  ${PROJECT_SOURCE_DIR}/lib/Instances
-  ${PROJECT_BINARY_DIR}/lib/Instances
+SET(
+  cpPlugins_RELATIVE_INCLUDE_DIRS
+  .
+  lib
+  lib/Itk2Vtk
+  lib/Instances
   )
+SET(cpPlugins_INCLUDE_DIRS)
+FOREACH(_d ${cpPlugins_RELATIVE_INCLUDE_DIRS})
+  LIST(APPEND cpPlugins_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/${_d})
+  LIST(APPEND cpPlugins_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/${_d})
+ENDFOREACH(_d)
+INCLUDE_DIRECTORIES(${cpPlugins_INCLUDE_DIRS})
 
 ## =============================
 ## == Subdirs containing code ==
index 5c99f74aa9aeef0d76a404c831ed65f9a47372ec..59a5076c8edd6deff20d68e487eb0ecfe8701a3e 100644 (file)
@@ -16,6 +16,7 @@ FOREACH(source ${all_SOURCE_CXX_FILES})
   GET_FILENAME_COMPONENT(name ${source} NAME_WE)
   ADD_EXECUTABLE(${name} ${source})
   TARGET_LINK_LIBRARIES(${name} ${cpPlugins_LIB})
+  SET(${name}_APP ${name} CACHE INTERNAL "plugin program ${name}")
 ENDFOREACH(source)
 
 ## eof - $RCSfile$
index 42871e9433403f95c0a3dfd1878f0a5b1fab7500..6def2e7e05e4f6688dc88d44479716a62a997d75 100644 (file)
@@ -3,46 +3,67 @@
 ## =================================
 
 FIND_FILE(
-  cpPlugins_FUNCTIONS
+  cpPlugins_Functions_cmake
   NAMES cpPlugins_Functions.cmake
   HINTS /usr/share/cmake /usr/local/share/cmake
   PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
   DOC "Where is \"cpPlugins_Functions.cmake\"?"
   )
-IF(NOT cpPlugins_FUNCTIONS)
+IF(NOT cpPlugins_Functions_cmake)
   MESSAGE(FATAL_ERROR "Where is \"cpPlugins_Functions.cmake\"?")
-ENDIF(NOT cpPlugins_FUNCTIONS)
-GET_FILENAME_COMPONENT(
-  cpPlugins_FUNCTIONS_ABSOLUTE ${cpPlugins_FUNCTIONS}
-  ABSOLUTE
-  )
-GET_FILENAME_COMPONENT(
-  cpPlugins_CMAKE_DIR ${cpPlugins_FUNCTIONS_ABSOLUTE}
-  DIRECTORY
-  )
+ENDIF(NOT cpPlugins_Functions_cmake)
+INCLUDE(${cpPlugins_Functions_cmake})
 
-## ===========================
-## == Include cmake scripts ==
-## ===========================
+FIND_FILE(
+  cpPlugins_Options_cmake
+  NAMES cpPlugins_Options.cmake
+  HINTS /usr/share/cmake /usr/local/share/cmake
+  PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
+  DOC "Where is \"cpPlugins_Options.cmake\"?"
+  )
+IF(NOT cpPlugins_Options_cmake)
+  MESSAGE(FATAL_ERROR "Where is \"cpPlugins_Options.cmake\"?")
+ENDIF(NOT cpPlugins_Options_cmake)
+INCLUDE(${cpPlugins_Options_cmake})
 
-INCLUDE(${cpPlugins_FUNCTIONS})
-INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Options.cmake)
+## =========================
+## == Find base libraries ==
+## =========================
 
 SET(ITK_DIR @ITK_DIR@)
 SET(VTK_DIR @VTK_DIR@)
-INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_KitwareTools.cmake)
+FIND_PACKAGE(ITK REQUIRED)
+FIND_PACKAGE(VTK REQUIRED)
+INCLUDE(${ITK_USE_FILE})
+INCLUDE(${VTK_USE_FILE})
+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(USE_QT4 "@QT4_FOUND@")
 IF(USE_QT4 EQUAL "1")
-  INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Qt4Tools.cmake)
-  cpPlugins_FindQt4()
   SET(QT_QMAKE_EXECUTABLE @QT_QMAKE_EXECUTABLE@)
+  FIND_PACKAGE(Qt4 REQUIRED)
+  INCLUDE(${QT_USE_FILE})
+  SET(
+    _required_vtk_modules
+    vtkGUISupportQt
+    vtkGUISupportQtOpenGL
+    )
+  FOREACH(_m ${_required_vtk_modules})
+    IF(NOT ${_m}_LOADED)
+      MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
+      BREAK()
+    ENDIF(NOT ${_m}_LOADED)
+  ENDFOREACH(_m)
+  SET(QT4_FOUND "1")
 ENDIF(USE_QT4 EQUAL "1")
 
 ## =========================
 ## == Include directories ==
 ## =========================
 
+## TODO: this is not completely correct!!!
 INCLUDE_DIRECTORIES(
   @CMAKE_INSTALL_PREFIX@/include
   @CMAKE_INSTALL_PREFIX@/include/cpPlugins/Itk2Vtk
@@ -57,49 +78,73 @@ INCLUDE_DIRECTORIES(
   @PROJECT_BINARY_DIR@/lib/Instances
   )
 
-## =========================
-## == Library directories ==
-## =========================
-
-IF(MSVC)
-  LINK_DIRECTORIES(
-    @PROJECT_BINARY_DIR@/$(ConfigurationName)
-    @CMAKE_INSTALL_PREFIX@/bin
-    @CMAKE_INSTALL_PREFIX@/lib
-    )
-ELSE(MSVC)
-  LINK_DIRECTORIES(
-    @PROJECT_BINARY_DIR@
-    @CMAKE_INSTALL_PREFIX@/bin
-    @CMAKE_INSTALL_PREFIX@/lib
-    )
-ENDIF(MSVC)
-
-## ===================
-## == Library names ==
-## ===================
+## ===================================
+## == Library names and directories ==
+## ===================================
 
 SET(cpPlugins_tinyxml2_LIB "@cpPlugins_tinyxml2_LIB@")
 SET(cpExtensions_LIB "@cpExtensions_LIB@")
 SET(cpPlugins_LIB "@cpPlugins_LIB@")
 SET(cpBaseQtApplication_LIB "@cpBaseQtApplication_LIB@")
 SET(cpPlugins_Instances "@cpPlugins_Instances@")
+SET(
+  _all_libs
+  ${cpPlugins_tinyxml2_LIB}
+  ${cpExtensions_LIB}
+  ${cpPlugins_LIB}
+  ${cpBaseQtApplication_LIB}
+  ${cpPlugins_Instances}
+  )
+
+SET(_l_locations)
+FOREACH(_l ${_all_libs})
+  SET(cpPlugins_library_location)
+  IF(MSVC)
+    FIND_LIBRARY(
+      cpPlugins_library_location_${_l} NAMES ${_l}
+      HINTS
+      @PROJECT_BINARY_DIR@/$(ConfigurationName)
+      @CMAKE_INSTALL_PREFIX@/bin
+      @CMAKE_INSTALL_PREFIX@/lib
+      )
+  ELSE(MSVC)
+    FIND_LIBRARY(
+      cpPlugins_library_location_${_l} NAMES ${_l}
+      HINTS
+      @PROJECT_BINARY_DIR@
+      @CMAKE_INSTALL_PREFIX@/bin
+      @CMAKE_INSTALL_PREFIX@/lib
+      )
+  ENDIF(MSVC)
+  MARK_AS_ADVANCED(FORCE cpPlugins_library_location_${_l})
+  IF(cpPlugins_library_location_${_l})
+    GET_FILENAME_COMPONENT(_dir ${cpPlugins_library_location_${_l}} DIRECTORY)
+    LIST(APPEND _l_locations ${_dir})
+  ENDIF(cpPlugins_library_location_${_l})
+ENDFOREACH(_l)
+IF(_l_locations)
+  LIST(REMOVE_DUPLICATES _l_locations)
+  LINK_DIRECTORIES(${_l_locations})
+ENDIF(_l_locations)
 
 ## ======================
 ## == Executable names ==
 ## ======================
+
 SET(
-  exec_PROGRAMS
-  cpPlugins_CreateInstances
-  cpPlugins_HostCreator
+  _exec_programs
+  @cpPlugins_CreateInstances_APP@
+  @cpPlugins_HostCreator_APP@
+  @cpPlugins_ExecuteWorkspace_APP@
   )
-FOREACH(prog ${exec_PROGRAMS})
+
+FOREACH(prog ${_exec_programs})
   IF(MSVC)
     FIND_PROGRAM(
       ${prog}_APP
       NAMES ${prog}
       HINTS /usr /usr/local
-      PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@/Debug @PROJECT_BINARY_DIR@/Release @PROJECT_BINARY_DIR@/MinSizeRel @PROJECT_BINARY_DIR@/RelWithDebInfo
+      PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@/$(ConfigurationName)
       PATH_SUFFIXES bin sbin
       DOC "Where is ${prog}?"
       )
@@ -115,4 +160,4 @@ FOREACH(prog ${exec_PROGRAMS})
   ENDIF(MSVC)
 ENDFOREACH(prog)
 
-## eof - $RCSfile$
+# ## eof - $RCSfile$