]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
CMake: Adding FindSalomeGUI.cmake.
authorbruneton <bruneton>
Wed, 3 Jul 2013 10:26:42 +0000 (10:26 +0000)
committerbruneton <bruneton>
Wed, 3 Jul 2013 10:26:42 +0000 (10:26 +0000)
Ensuring level 1 prerequisites are automatically loaded when
finding GUI. This avoids having to set the LD_LIBRARY_PATH to link.

CMakeLists.txt
adm_local/cmake_files/CMakeLists.txt
adm_local/cmake_files/FindGUI.cmake
adm_local/cmake_files/FindPyQt4.cmake
adm_local/cmake_files/FindSalomeGUI.cmake [new file with mode: 0644]
adm_local/cmake_files/SalomeGUIConfig.cmake.in
bin/CMakeLists.txt
src/GUI_PY/CMakeLists.txt
src/SALOME_SWIG/CMakeLists.txt
src/SalomeApp/CMakeLists.txt
src/SalomeApp/pluginsdemo/CMakeLists.txt

index d52d44683a40f3dc99ce4805c54280197b00deee..dc965b43d23c0cfd400f302919452975ae3051ec 100755 (executable)
@@ -245,14 +245,21 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
 #   - in the build tree:
 
 #      Ensure the variables are always defined for the configure:
-SET(CPPUNIT_ROOT_DIR "${CPPUNIT_ROOT_DIR}")
+SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}")
+SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}")
+SET(PYQT4_ROOT_DIR "${PYQT4_ROOT_DIR}")
+SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}")
+SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}")
+SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
+SET(QWT_ROOT_DIR "${QWT_ROOT_DIR}")
  
 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
 CONFIGURE_PACKAGE_CONFIG_FILE(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.in 
     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX
-       KERNEL_ROOT_DIR)
+       KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR 
+       OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
 
 #   - in the install tree:
 #       Get the relative path of the include directory so 
@@ -262,7 +269,8 @@ CONFIGURE_PACKAGE_CONFIG_FILE(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.
     ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX 
-       KERNEL_ROOT_DIR)
+       KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR 
+       OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
 
 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
     VERSION ${${PROJECT_NAME_UC}_VERSION}
index ff7aec4dc409b6899e971c328274f58fb69dbb9a..5367da95363b9358bba502b64326a181658287a3 100755 (executable)
@@ -37,5 +37,7 @@ SET(DATA
   FindSalomeQwt.cmake
   FindSalomeSIP.cmake
   FindSalomeVTK.cmake
+  FindSalomeGUI.cmake
+  FindSalomeOpenGL.cmake
 )
 INSTALL(FILES ${DATA} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL})
index 4136dcd53a329ef52ba3250e81b3d8ce9fc87485..e7f3117a371a9026a8a40363ff972d958eece839 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+#
+#  TODO: this file should be removed when switching to full CMake
+#
+
 SET(GUI_CXXFLAGS -I${GUI_ROOT_DIR}/include/salome)
 
 FIND_LIBRARY(caf caf ${GUI_ROOT_DIR}/lib/salome)
index ac8df0052e90e097459c5bef0c89982e5b8e9111..d025b58afd4c6e408d41e6bb3a382e6d341f8a07 100644 (file)
@@ -48,7 +48,7 @@ FIND_PROGRAM(PYQT_PYUIC_EXECUTABLE NAMES pyuic4 pyuic4.bat)
 GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYQT_PYUIC_EXECUTABLE}" PATH)
 GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
 
-# Typical location of qobject.sip are: 
+# Typical locations of qobject.sip are: 
 #   - /usr/share/sip/PyQt4/QtCore, for a system install
 #   - or <xyz>/sip/QtCore, for a custom install
 #   - or <xyz>/share/sip/QtCore, for a custom install
diff --git a/adm_local/cmake_files/FindSalomeGUI.cmake b/adm_local/cmake_files/FindSalomeGUI.cmake
new file mode 100644 (file)
index 0000000..f397b07
--- /dev/null
@@ -0,0 +1,39 @@
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+#
+# Author: Adrien Bruneton
+#
+
+# GUI detection for Salome - this is typically called by dependent modules
+# (PARAVIS, etc ...)
+#
+# The detection is simpler than for other prerequisites.
+# See explanation in FindSalomeKERNEL.cmake.
+#
+
+IF(NOT SalomeGUI_FIND_QUIETLY)
+  MESSAGE(STATUS "Looking for Salome GUI ...")
+ENDIF()
+
+SET(CMAKE_PREFIX_PATH "${GUI_ROOT_DIR}")
+SALOME_FIND_PACKAGE(SalomeGUI SalomeGUI CONFIG)
+
+IF(NOT SalomeGUI_FIND_QUIETLY)
+  MESSAGE(STATUS "Found Salome GUI: ${GUI_ROOT_DIR}")
+ENDIF()
\ No newline at end of file
index 3592fdbde9d753ec40b0111a785d7817f540779a..a5a1bfb9f346d9551fcd2a3a9d0d9d531dad2c53 100644 (file)
@@ -34,7 +34,7 @@
 # Load the dependencies for the libraries of @PROJECT_NAME@ 
 # (contains definitions for IMPORTED targets). This is only 
 # imported if we are not built as a subproject (in this case targets are already there)
-IF(NOT Event AND NOT @PROJECT_NAME@_BINARY_DIR)
+IF(NOT TARGET Event AND NOT @PROJECT_NAME@_BINARY_DIR)
   INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE@/@PROJECT_NAME@Targets.cmake")
 ENDIF()   
 
@@ -49,31 +49,73 @@ SET(SALOME_BUILD_DOC   @SALOME_BUILD_DOC@)
 SET(SALOME_BUILD_TESTS @SALOME_BUILD_TESTS@)
 SET(SALOME_LIGHT_ONLY  @SALOME_LIGHT_ONLY@)
 
-# Prerequisites:
+# Advanced options
+SET(SALOME_USE_OCCVIEWER    @SALOME_USE_OCCVIEWER@)
+SET(SALOME_USE_GLVIEWER     @SALOME_USE_GLVIEWER@)
+SET(SALOME_USE_VTKVIEWER    @SALOME_USE_VTKVIEWER@)
+SET(SALOME_USE_PLOT2DVIEWER @SALOME_USE_PLOT2DVIEWER@)
+
+# Level 1 prerequisites:
 SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
+SET_AND_CHECK(SIP_ROOT_DIR_EXP "@PACKAGE_SIP_ROOT_DIR@")
+SET_AND_CHECK(QT4_ROOT_DIR_EXP "@PACKAGE_QT4_ROOT_DIR@")
+SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT4_ROOT_DIR@")
+
+# Optional level 1 prerequisites:
+IF(SALOME_USE_OCCVIEWER)
+  SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@")    
+ENDIF()
+IF(SALOME_USE_GLVIEWER)
+  SET_AND_CHECK(OPENGL_ROOT_DIR_EXP "@PACKAGE_OPENGL_ROOT_DIR@") 
+ENDIF()
+IF(SALOME_USE_VTKVIEWER) 
+  SET_AND_CHECK(VTK_ROOT_DIR_EXP "@PACKAGE_VTK_ROOT_DIR@")
+ENDIF()
+IF(SALOME_USE_PLOT2DVIEWER)
+  SET_AND_CHECK(QWT_ROOT_DIR_EXP "@PACKAGE_QWT_ROOT_DIR@")
+ENDIF()
 
-SET_AND_CHECK(SWIG_ROOT_DIR_EXP     "@PACKAGE_SWIG_ROOT_DIR@")
+# For all prerequisites, load the corresponding targets if the package was used 
+# in CONFIG mode. This ensures dependent projects link correctly
+# without having to set LD_LIBRARY_PATH:
+SET(_PREREQ CAS OpenGL PyQt4 Qt4 Qwt SIP VTK)
+SET(_PREREQ_CONFIG_DIR "@CAS_DIR@" "@OpenGL_DIR@" "@PyQt4_DIR@" "@Qt4_DIR@" "@Qwt_DIR@" "@SIP_DIR@" "@VTK_DIR@")
+LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
+# Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
+MATH(EXPR _range "${_list_len}-1")
+FOREACH(_p RANGE ${_range})  
+  LIST(GET _PREREQ            ${_p} _pkg    )
+  LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
+  IF(_pkg_dir)
+     MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
+     FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE 
+          PATHS "${_pkg_dir}" 
+          NO_DEFAULT_PATH)
+  ENDIF()
+ENDFOREACH()
 
 # Installation directories
-SET_AND_CHECK(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@")
-SET_AND_CHECK(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@")
-SET_AND_CHECK(SALOME_INSTALL_IDLS "@SALOME_INSTALL_IDLS@")
-SET_AND_CHECK(SALOME_INSTALL_HEADERS "@SALOME_INSTALL_HEADERS@")
-SET_AND_CHECK(SALOME_INSTALL_SCRIPT_SCRIPTS "@SALOME_INSTALL_SCRIPT_SCRIPTS@")
-SET_AND_CHECK(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@")
-SET_AND_CHECK(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@")
-SET_AND_CHECK(SALOME_INSTALL_APPLISKEL_SCRIPTS "@SALOME_INSTALL_APPLISKEL_SCRIPTS@")
-SET_AND_CHECK(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@") 
-SET_AND_CHECK(SALOME_INSTALL_CMAKE "@SALOME_INSTALL_CMAKE@")
-SET_AND_CHECK(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@")
-SET_AND_CHECK(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@")
-SET_AND_CHECK(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@")
-SET_AND_CHECK(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@")
+SET(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@")
+SET(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@")
+SET(SALOME_INSTALL_IDLS "@SALOME_INSTALL_IDLS@")
+SET(SALOME_INSTALL_HEADERS "@SALOME_INSTALL_HEADERS@")
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS "@SALOME_INSTALL_SCRIPT_SCRIPTS@")
+SET(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@")
+SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@")
+SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "@SALOME_INSTALL_APPLISKEL_SCRIPTS@")
+SET(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@") 
+SET(SALOME_INSTALL_CMAKE "@SALOME_INSTALL_CMAKE@")
+SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@")
+SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@")
+SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@")
+SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@")
 
-# Include KERNEL targets:
-INCLUDE("${KERNEL_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeKERNELTargets.cmake")
+# Include KERNEL targets if they were not already loaded:
+IF(NOT (TARGET SALOMEBasics)) 
+  INCLUDE("${KERNEL_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeKERNELTargets.cmake")
+ENDIF()
 
-# Exposed targets:
+# Exposed GUI targets:
 SET(GUI_caf caf)
 SET(GUI_CAM CAM)
 SET(GUI_CASCatch CASCatch)
index 29f771fc56bd6e613581488cab5eff86940f09a9..d17b54c71fc1b1fbdf25ca4721813780ee1dc02b 100755 (executable)
@@ -17,8 +17,6 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
-
 CONFIGURE_FILE(VERSION.in VERSION @ONLY)
 
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION DESTINATION ${SALOME_INSTALL_BINS})
index 09abae1654adf9301a98a1a8b62f99f934979208..53a636543c20c800ba09723e71f4b4867dbdc060 100755 (executable)
@@ -17,8 +17,6 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
-
 INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_BINARY_DIR}
 )
index 8c37162fedcb8b914b8a9db0873e4153b841f499..dcb2550755cb7a6acbc473b6642b2f0421220c1c 100755 (executable)
@@ -17,9 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-FIND_PACKAGE(SWIG REQUIRED)
 INCLUDE(${SWIG_USE_FILE})
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
 INCLUDE(${VTK_USE_FILE})
 
 SET_SOURCE_FILES_PROPERTIES(libSALOME_Swig.i PROPERTIES CPLUSPLUS ON)
index 89f240b349c886cf5729c584ea4084aaaeb16ed3..66aeb22642d222c2a199ede0a4c6bd57f7916b7f 100755 (executable)
@@ -24,7 +24,6 @@ IF(NOT SALOME_LIGHT_ONLY AND SALOME_BUILD_TESTS)
 ENDIF()
 
 INCLUDE(UseQt4Ext)
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
 INCLUDE(${VTK_USE_FILE})
 
 INCLUDE_DIRECTORIES(
index 2abfb591e7e3852307b9e94f629590bbb3a2d512..1e27491975c10eca844fabc2015e6762b7095cbb 100755 (executable)
@@ -25,8 +25,6 @@
 # variable *_ROOT_DIR).  
 #
 
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
-
 SET(plugins_PYTHON
   salome_plugins.py
   smesh_plugins.py