]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Include SalomeMacros.cmake with NO_POLICY_SCOPE to apply policies
authorvsr <vsr@opencascade.com>
Fri, 17 Apr 2020 14:10:51 +0000 (17:10 +0300)
committervsr <vsr@opencascade.com>
Fri, 17 Apr 2020 17:40:41 +0000 (20:40 +0300)
13 files changed:
CMakeLists.txt
tools/CMakeLists.txt
tools/CurvePlot/CMakeLists.txt
tools/PyConsole/CMakeLists.txt
tools/PyConsole/src/CMakeLists.txt
tools/PyConsole/src/python/CMakeLists.txt
tools/PyEditor/CMakeLists.txt
tools/PyEditor/src/CMakeLists.txt
tools/PyEditor/src/python/CMakeLists.txt
tools/PyInterp/CMakeLists.txt
tools/PyInterp/src/CMakeLists.txt
tools/RemoteFileBrowser/CMakeLists.txt
tools/TODO [new file with mode: 0644]

index ed57a19275884a80aafcf91668cb6e06f1eb1edc..ca5c1a49559d873e37375d3fc21d454385152598 100644 (file)
@@ -38,7 +38,7 @@ SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
   LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
-  INCLUDE(SalomeMacros)
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
 ELSE()
   MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
 ENDIF()
@@ -47,7 +47,6 @@ ENDIF()
 # ===========
 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
 IF(EXISTS ${KERNEL_ROOT_DIR})
-  LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
   FIND_PACKAGE(SalomeKERNEL REQUIRED)
   ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
   INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
index 14ab59f0c1623a06ca7d35966fc7d670c93a1f78..53cacc3c42309f466a0303e42ae5d4468f64b8ee 100644 (file)
@@ -24,30 +24,33 @@ ADD_SUBDIRECTORY(dlgfactory)
 ##
 
 IF(SALOME_USE_PYCONSOLE)
-  # Include sub-project PyConsole:
-  SET(TOOLS_EXPORT_NAME ${PROJECT_NAME})
+  # Include sub-project PyConsole
+  SET(PYCONSOLE_SUBPROJECT YES CACHE INTERNAL "")
+  SET(PYINTERP_EXPORT_NAME "${PROJECT_NAME}" CACHE STRING "")
+  SET(PYCONSOLE_EXPORT_NAME "${PROJECT_NAME}" CACHE STRING "")
   SET(PYCONSOLE_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "")
+  SET(PYCONSOLE_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "")
   SET(PYCONSOLE_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "") 
   SET(PYCONSOLE_INSTALL_RES "${SALOME_GUI_INSTALL_RES_DATA}" CACHE PATH "")
-     
-  ADD_SUBDIRECTORY(../tools/PyConsole) # will bring in PyInterp automatically
-
-  ADD_SUBDIRECTORY(CurvePlot)
-
+  SET(PYCONSOLE_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH "")
+  ADD_SUBDIRECTORY(PyConsole) # brings in PyInterp automatically
+  ADD_SUBDIRECTORY(CurvePlot) # to be refactored (CurvePlot does not directly depend on PyConsole)
 ENDIF(SALOME_USE_PYCONSOLE)
 
 IF(SALOME_USE_PYVIEWER)
-  # Include sub-project PyEditor:
-  SET(TOOLS_EXPORT_NAME ${PROJECT_NAME})
+  # Include sub-project PyEditor
+  SET(PYEDITOR_SUBPROJECT YES CACHE INTERNAL "")
+  SET(PYEDITOR_EXPORT_NAME "${PROJECT_NAME}" CACHE STRING "")
   SET(PYEDITOR_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "")
   SET(PYEDITOR_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "")
+  SET(PYEDITOR_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "")
   SET(PYEDITOR_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "") 
   SET(PYEDITOR_INSTALL_RES "${SALOME_GUI_INSTALL_RES_DATA}" CACHE PATH "")
+  SET(PYEDITOR_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH "")
   ADD_SUBDIRECTORY(PyEditor)
 ENDIF(SALOME_USE_PYVIEWER)
 
 IF(COMPILER_SUPPORTS_CXX11)
-  SET(TOOLS_EXPORT_NAME ${PROJECT_NAME})
   SET(REMOTEFILEBROWSER_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "")
   SET(REMOTEFILEBROWSER_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "")
   SET(REMOTEFILEBROWSER_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "")
index 2921c3a00e1878dd3c5858bb0673fd395915ee94..f6dc0048ce7e27d47ea74ebe7705b9a8515abebc 100644 (file)
@@ -44,7 +44,7 @@ OPTION(SALOME_BUILD_TESTS "Generate SALOME CURVEPLOT tests" ON)
 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
   LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
-  INCLUDE(SalomeMacros)
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
 ELSE()
   MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
 ENDIF()
@@ -54,7 +54,6 @@ IF(NOT SALOME_CURVEPLOT_STANDALONE)
     # ==============
     SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
     IF( EXISTS ${KERNEL_ROOT_DIR} )
-      LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
       FIND_PACKAGE(SalomeKERNEL REQUIRED)
       KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
       ADD_DEFINITIONS(${KERNEL_DEFINITIONS} -DSALOME_KERNEL)
@@ -67,33 +66,27 @@ IF(NOT SALOME_CURVEPLOT_STANDALONE)
     SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
     # Are we compiled being into GUI/tools directory or have we been extracted somewhere else?
     IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../src/Session/SALOME_Session.hxx")  # we are in GUI
-      LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../adm_local/cmake_files")
       # Re-define GUI_INCLUDE_DIRS 
       SET(GUI_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../PyInterp/src)
     ELSE()      
       IF(EXISTS ${GUI_ROOT_DIR})
-        LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
         FIND_PACKAGE(SalomeGUI)
       ELSE()
         MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR or turn option SALOME_CURVEPLOT_STANDALONE to ON!")
       ENDIF()
     ENDIF()
     
-    # Platform setup
-    # ==============
-    INCLUDE(SalomeSetupPlatform)   # From KERNEL
 ENDIF(NOT SALOME_CURVEPLOT_STANDALONE)
 
+# Platform setup
+# ==============
+INCLUDE(SalomeSetupPlatform)
+
 # Always build libraries as shared objects:
 SET(BUILD_SHARED_LIBS TRUE)
 # Local macros:
 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
 
-IF(SALOME_CURVEPLOT_STANDALONE)
-    INCLUDE(SalomeMacros)
-ENDIF()
-
-
 # Prerequisites
 # =============
 # Find "big" prerequisites first - they reference themselves many others
index 1b91bb46b05a1ca952daf48de235ae3e29258dba..a231bede3883bce3ab36904c214e4c46ebd91412 100644 (file)
@@ -22,21 +22,19 @@ PROJECT(PyConsole C CXX)
 
 # Versioning
 # ===========
-# Project name, upper case
+# Project name, uppercase / lowercase
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
+STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LC)
 
-###################
-# To be changed once externalized CMake procedure:
-SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
-IF(EXISTS ${KERNEL_ROOT_DIR})
-  LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
-  INCLUDE(SalomeMacros)
-ELSE(EXISTS ${KERNEL_ROOT_DIR})
-  MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
-ENDIF(EXISTS ${KERNEL_ROOT_DIR})
-# From GUI - again to be changed once externalized:
-LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../adm_local/cmake_files")
-###################
+# Include common macros
+# =====================
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
+ELSE()
+  MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ENDIF()
 
 # Platform setup
 # ==============
@@ -44,50 +42,67 @@ INCLUDE(SalomeSetupPlatform)
 
 # Options
 # =======
-OPTION(PYCONSOLE_BUILD_PYTHON "Build Python wrapping for PyConsole" ON)
+OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
+OPTION(BUILD_PYMODULE "Build Python module" ON)
 
-#
-# Set list of prerequisites
-# =========================
+# Detect prerequisites
+# ====================
 
+# Python
 FIND_PACKAGE(SalomePythonInterp REQUIRED)
 FIND_PACKAGE(SalomePythonLibs REQUIRED)
-
 # Qt
 FIND_PACKAGE(SalomeQt5 REQUIRED)
-IF(PYCONSOLE_BUILD_PYTHON)
-  # Sip
-  FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP PYCONSOLE_BUILD_PYTHON)
+IF(BUILD_PYMODULE)
+  # Sip (should come after Python and before PyQt)
+  FIND_PACKAGE(SalomeSIP REQUIRED)
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP BUILD_PYMODULE)
   # PyQt
   FIND_PACKAGE(SalomePyQt5 REQUIRED)
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYCONSOLE_BUILD_PYTHON)
-ENDIF(PYCONSOLE_BUILD_PYTHON)
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 BUILD_PYMODULE)
+ENDIF(BUILD_PYMODULE)
 
-# Detection report
+# Detection summary report
 SALOME_PACKAGE_REPORT_AND_CHECK()
 
 # Directories
 #
 # Directories have to be given after prerequisites (to be able to use
 # Python version string for example).
-# ===========
-SET(PYCONSOLE_INSTALL_LIBS lib CACHE PATH "Install path: PyConsole libs")
-SET(PYCONSOLE_INSTALL_HEADERS include CACHE PATH "Install path: PyConsole headers")
+# ===================================================================
+SET(PYCONSOLE_INSTALL_LIBS lib CACHE PATH "Install path: libraries")
+SET(PYCONSOLE_INSTALL_PYTHON lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages CACHE PATH "Install path: Python module")
+SET(PYCONSOLE_INSTALL_HEADERS include CACHE PATH "Install path: headers")
+SET(PYCONSOLE_INSTALL_RES share/resources CACHE PATH "Install path: resources")
+SET(PYCONSOLE_INSTALL_CMAKE lib/cmake/${PROJECT_NAME_LC} CACHE PATH "Install path: cmake files")
 
-SET(PYCONSOLE_INSTALL_RES share/resources CACHE PATH "Install path: PyConsole resources")
+MARK_AS_ADVANCED(PYCONSOLE_INSTALL_LIBS PYCONSOLE_INSTALL_HEADERS
+                 PYCONSOLE_INSTALL_RES PYCONSOLE_INSTALL_CMAKE)
 
-# Tool dependencies
-# =================
-# PyConsole depends on PyInterp:
-SET(PYINTERP_INSTALL_LIBS "${PYCONSOLE_INSTALL_LIBS}"  CACHE PATH "")
+SET(PYCONSOLE_EXPORT_NAME ${PROJECT_NAME} CACHE STRING "Export name")
+MARK_AS_ADVANCED(PYCONSOLE_EXPORT_NAME)
+
+# Dependencies
+# ============
+# Force PyInterp to build as a sub-project
+SET(PYINTERP_SUBPROJECT YES CACHE INTERNAL "")
+SET(PYINTERP_EXPORT_NAME "${PROJECT_NAME}" CACHE STRING "")
+SET(PYINTERP_INSTALL_LIBS "${PYCONSOLE_INSTALL_LIBS}" CACHE PATH "")
 SET(PYINTERP_INSTALL_HEADERS "${PYCONSOLE_INSTALL_HEADERS}" CACHE PATH "")
 SET(PYINTERP_INSTALL_RES "${PYCONSOLE_INSTALL_RES}" CACHE PATH "")
+SET(PYINTERP_INSTALL_CMAKE "${PYCONSOLE_INSTALL_CMAK}" CACHE PATH "")
 
 ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/../PyInterp ${PROJECT_BINARY_DIR}/PyInterp)
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/../PyInterp/src)
 
-# Sources
-# ========
+# Subdirs
+# =======
 ADD_SUBDIRECTORY(src)
 
+# Export configuration and targets
+# ================================
+IF(NOT PYCONSOLE_SUBPROJECT)
+  # Install the export set for use with the install-tree
+  INSTALL(EXPORT ${PYCONSOLE_EXPORT_NAME}TargetGroup DESTINATION ${PYCONSOLE_INSTALL_CMAKE}
+          FILE ${PROJECT_NAME}Targets.cmake)
+ENDIF()
index 826b64696bfd3a03255ddf842397e812d4390b4a..5b7f45aa42ab5f52e8fd063af547de0ca58e76cc 100644 (file)
@@ -19,9 +19,9 @@
 
 INCLUDE(UseQtExt)
 
-IF(PYCONSOLE_BUILD_PYTHON)
+IF(BUILD_PYMODULE)
   ADD_SUBDIRECTORY(python)
-ENDIF(PYCONSOLE_BUILD_PYTHON)
+ENDIF(BUILD_PYMODULE)
 
 # --- options ---
 
@@ -29,7 +29,6 @@ ENDIF(PYCONSOLE_BUILD_PYTHON)
 INCLUDE_DIRECTORIES(
   ${QT_INCLUDES}
   ${PYTHON_INCLUDE_DIRS}
-  ${PROJECT_SOURCE_DIR}/src/PyInterp
 )
 
 # additional preprocessor / compiler flags
@@ -87,7 +86,7 @@ SET(PyConsole_SOURCES ${_other_SOURCES} ${_moc_SOURCES})
 
 ADD_LIBRARY(PyConsole ${PyConsole_SOURCES})
 TARGET_LINK_LIBRARIES(PyConsole ${_link_LIBRARIES})
-INSTALL(TARGETS PyConsole EXPORT ${TOOLS_EXPORT_NAME}TargetGroup DESTINATION ${PYCONSOLE_INSTALL_LIBS})
+INSTALL(TARGETS PyConsole EXPORT ${PYCONSOLE_EXPORT_NAME}TargetGroup DESTINATION ${PYCONSOLE_INSTALL_LIBS})
 
 INSTALL(FILES ${PyConsole_HEADERS} DESTINATION ${PYCONSOLE_INSTALL_HEADERS})
 QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${PYCONSOLE_INSTALL_RES}")
index 8c78c772907913f4c8627f326a3e23797d2d4a4f..d5e301350c28f79da0e29f51aeb593429cc2d31b 100644 (file)
@@ -59,4 +59,4 @@ ELSE()
   SET_TARGET_PROPERTIES(PyConsolePy PROPERTIES PREFIX "")
 ENDIF()
 TARGET_LINK_LIBRARIES(PyConsolePy ${_link_LIBRARIES})
-INSTALL(TARGETS PyConsolePy EXPORT ${TOOLS_EXPORT_NAME}TargetGroup DESTINATION ${PYCONSOLE_INSTALL_LIBS})
+INSTALL(TARGETS PyConsolePy EXPORT ${PYCONSOLE_EXPORT_NAME}TargetGroup DESTINATION ${PYCONSOLE_INSTALL_PYTHON})
index 018124bd01d7139e268c073c9e07ac247639cbd5..9d5c0d64dd424f67b6bcbdabad790f2becb120d3 100644 (file)
@@ -22,21 +22,19 @@ PROJECT(PyEditor C CXX)
 
 # Versioning
 # ===========
-# Project name, upper case
+# Project name, uppercase / lowercase
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
+STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LC)
 
-# To be changed once externalized CMake procedure:
-###################
-SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
-IF(EXISTS ${KERNEL_ROOT_DIR})
-  LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
-  INCLUDE(SalomeMacros)
-ELSE(EXISTS ${KERNEL_ROOT_DIR})
-  MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
-ENDIF(EXISTS ${KERNEL_ROOT_DIR})
-# From GUI - again to be changed once externalized:
-LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../adm_local/cmake_files")
-###################
+# Include common macros
+# =====================
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
+ELSE()
+  MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ENDIF()
 
 # Platform setup
 # ==============
@@ -44,50 +42,58 @@ INCLUDE(SalomeSetupPlatform)
 
 # Options
 # =======
-OPTION(PYEDITOR_BUILD_SHARED_LIBS "Build shared libraries for PyEditor" ON)
-OPTION(PYEDITOR_BUILD_EXE "Build PyEditor's executable" ON)
-OPTION(PYEDITOR_BUILD_PYTHON "Build Python wrapping for PyEditor" ON)
+OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
+OPTION(BUILD_EXECUTABLE "Build executable" ON)
+OPTION(BUILD_PYMODULE "Build Python module" ON)
 
-#
-# Set list of prerequisites
-# =========================
-
-IF(PYEDITOR_BUILD_SHARED_LIBS)
-  SET(BUILD_SHARED_LIBS TRUE)
-ELSE(PYEDITOR_BUILD_SHARED_LIBS)
-  SET(BUILD_SHARED_LIBS FALSE)
-ENDIF(PYEDITOR_BUILD_SHARED_LIBS)
+# Detect prerequisites
+# ====================
 
 # Qt
 FIND_PACKAGE(SalomeQt5 REQUIRED)
-IF(PYEDITOR_BUILD_PYTHON)
+IF(BUILD_PYMODULE)
   # Python
   FIND_PACKAGE(SalomePythonInterp REQUIRED)
   FIND_PACKAGE(SalomePythonLibs REQUIRED)
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonInterp PYEDITOR_BUILD_PYTHON)
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonLibs PYEDITOR_BUILD_PYTHON)
-  # Sip
-  FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP PYEDITOR_BUILD_PYTHON)
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonInterp BUILD_PYMODULE)
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomePythonLibs BUILD_PYMODULE)
+  # Sip (should come after Python and before PyQt)
+  FIND_PACKAGE(SalomeSIP REQUIRED)
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomeSIP BUILD_PYMODULE)
   # PyQt
   FIND_PACKAGE(SalomePyQt5 REQUIRED)
-  SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 PYEDITOR_BUILD_PYTHON)
-ENDIF(PYEDITOR_BUILD_PYTHON)
+  SALOME_LOG_OPTIONAL_PACKAGE(SalomePyQt5 BUILD_PYMODULE)
+ENDIF(BUILD_PYMODULE)
 
-# Detection report
+# Detection summary report
 SALOME_PACKAGE_REPORT_AND_CHECK()
 
 # Directories
 #
 # Directories have to be given after prerequisites (to be able to use
 # Python version string for example).
-# ===========
-SET(PYEDITOR_INSTALL_BINS bin CACHE PATH "Install path: PyEditor binaries")
-SET(PYEDITOR_INSTALL_LIBS lib CACHE PATH "Install path: PyEditor libraries")
-SET(PYEDITOR_INSTALL_HEADERS include CACHE PATH "Install path: PyEditor headers")
-SET(PYEDITOR_INSTALL_RES share/resources CACHE PATH "Install path: PyEditor resources")
+# ===================================================================
+SET(PYEDITOR_INSTALL_BINS bin CACHE PATH "Install path: binaries")
+SET(PYEDITOR_INSTALL_LIBS lib CACHE PATH "Install path: libraries")
+SET(PYEDITOR_INSTALL_PYTHON lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages CACHE PATH "Install path: Python module")
+SET(PYEDITOR_INSTALL_HEADERS include CACHE PATH "Install path: headers")
+SET(PYEDITOR_INSTALL_RES share/resources CACHE PATH "Install path: resources")
+SET(PYEDITOR_INSTALL_CMAKE lib/cmake/${PROJECT_NAME_LC} CACHE PATH "Install path: cmake files")
 
-# Sources
-# ========
+MARK_AS_ADVANCED(PYEDITOR_INSTALL_BINS PYEDITOR_INSTALL_LIBS PYEDITOR_INSTALL_PYTHON
+                 PYEDITOR_INSTALL_HEADERS PYEDITOR_INSTALL_RES PYEDITOR_INSTALL_CMAKE)
+
+SET(PYEDITOR_EXPORT_NAME ${PROJECT_NAME} CACHE STRING "Export name")
+MARK_AS_ADVANCED(PYEDITOR_EXPORT_NAME)
+
+# Subdirs
+# =======
 ADD_SUBDIRECTORY(src)
 
+# Export configuration and targets
+# ================================
+IF(NOT PYEDITOR_SUBPROJECT)
+  # Install the export set for use with the install-tree
+  INSTALL(EXPORT ${PYEDITOR_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_CMAKE}
+          FILE ${PROJECT_NAME}Targets.cmake)
+ENDIF()
index f7bfb9d2f3d0454bb8521ff72cc5d16ebadac65a..f9f180d4f143ec2c302e6efedff7c22456b2098a 100644 (file)
@@ -21,9 +21,9 @@
 
 INCLUDE(UseQtExt)
 
-IF(PYEDITOR_BUILD_PYTHON)
+IF(BUILD_PYMODULE)
   ADD_SUBDIRECTORY(python)
-ENDIF(PYEDITOR_BUILD_PYTHON)
+ENDIF(BUILD_PYMODULE)
 
 # --- options ---
 
@@ -108,15 +108,15 @@ SET(pyeditorexe_SOURCES ${PyEditor_SOURCES} PyEditor.cxx)
 
 ADD_LIBRARY(PyEditor ${PyEditor_SOURCES})
 TARGET_LINK_LIBRARIES(PyEditor ${_link_LIBRARIES})
-INSTALL(TARGETS PyEditor EXPORT ${TOOLS_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_LIBS})
+INSTALL(TARGETS PyEditor EXPORT ${PYEDITOR_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_LIBS})
 
-IF(PYEDITOR_BUILD_EXE)
+IF(BUILD_EXECUTABLE)
   ADD_EXECUTABLE(pyeditorexe ${pyeditorexe_SOURCES})
   SET_TARGET_PROPERTIES(pyeditorexe PROPERTIES OUTPUT_NAME "pyeditor")
   TARGET_LINK_LIBRARIES(pyeditorexe ${_link_LIBRARIES})
   TARGET_COMPILE_DEFINITIONS(pyeditorexe PUBLIC "-DPYEDITOREXE")
-  INSTALL(TARGETS pyeditorexe EXPORT ${TOOLS_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_BINS})
-ENDIF(PYEDITOR_BUILD_EXE)
+  INSTALL(TARGETS pyeditorexe EXPORT ${PYEDITOR_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_BINS})
+ENDIF(BUILD_EXECUTABLE)
 
 INSTALL(FILES ${PyEditor_HEADERS} DESTINATION ${PYEDITOR_INSTALL_HEADERS})
 QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${PYEDITOR_INSTALL_RES}")
index 4339a1e19df9dcf6ff5afc6c238c82e2ddb29829..3db1dd4b814bc7ed9a4932022466d61588b148a1 100644 (file)
@@ -59,4 +59,4 @@ ELSE()
   SET_TARGET_PROPERTIES(PyEditorPy PROPERTIES PREFIX "")
 ENDIF()
 TARGET_LINK_LIBRARIES(PyEditorPy ${_link_LIBRARIES})
-INSTALL(TARGETS PyEditorPy EXPORT ${TOOLS_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_LIBS})
+INSTALL(TARGETS PyEditorPy EXPORT ${PYEDITOR_EXPORT_NAME}TargetGroup DESTINATION ${PYEDITOR_INSTALL_PYTHON})
index 55a496784978eb64bb91a55ae5b44a5555b786a3..ff56d2517bf51bfe7c52feb9682add494725916f 100644 (file)
@@ -22,21 +22,19 @@ PROJECT(PyInterp C CXX)
 
 # Versioning
 # ===========
-# Project name, upper case
+# Project name, uppercase / lowercase
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
+STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LC)
 
-# To be changed once externalized CMake procedure:
-###################
-SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
-IF(EXISTS ${KERNEL_ROOT_DIR})
-  LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
-  INCLUDE(SalomeMacros)
-ELSE(EXISTS ${KERNEL_ROOT_DIR})
-  MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
-ENDIF(EXISTS ${KERNEL_ROOT_DIR})
-# From GUI - again to be changed once externalized:
-LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../adm_local/cmake_files")
-###################
+# Include common macros
+# =====================
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
+ELSE()
+  MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ENDIF()
 
 # Platform setup
 # ==============
@@ -44,30 +42,44 @@ INCLUDE(SalomeSetupPlatform)
 
 # Options
 # =======
+OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
 
-#
-# Set list of prerequisites
-# =========================
+# Detect prerequisites
+# ====================
 
+# Python
 FIND_PACKAGE(SalomePythonInterp REQUIRED)
 FIND_PACKAGE(SalomePythonLibs REQUIRED)
 # Qt
 FIND_PACKAGE(SalomeQt5 REQUIRED)
 
-# Detection report
+# Detection summary report
 SALOME_PACKAGE_REPORT_AND_CHECK()
 
 # Directories
 #
 # Directories have to be given after prerequisites (to be able to use
 # Python version string for example).
-# ===========
-SET(PYINTERP_INSTALL_LIBS lib CACHE PATH "Install path: PyInterp libs")
-SET(PYINTERP_INSTALL_HEADERS include CACHE PATH "Install path: PyInterp headers")
+# ===================================================================
+SET(PYINTERP_INSTALL_LIBS lib CACHE PATH "Install path: libraries")
+SET(PYINTERP_INSTALL_HEADERS include CACHE PATH "Install path: headers")
+SET(PYINTERP_INSTALL_RES share/resources CACHE PATH "Install path: resources")
+SET(PYINTERP_INSTALL_CMAKE lib/cmake/${PROJECT_NAME_LC} CACHE PATH "Install path: cmake files")
 
-SET(PYINTERP_INSTALL_RES share/resources CACHE PATH "Install path: PyInterp resources")
+MARK_AS_ADVANCED(PYINTERP_INSTALL_LIBS PYINTERP_INSTALL_HEADERS
+                 PYINTERP_INSTALL_RES PYINTERP_INSTALL_CMAKE)
 
-# Sources
-# ========
+SET(PYINTERP_EXPORT_NAME ${PROJECT_NAME} CACHE STRING "Export name")
+MARK_AS_ADVANCED(PYINTERP_EXPORT_NAME)
+
+# Subdirs
+# =======
 ADD_SUBDIRECTORY(src)
 
+# Export configuration and targets
+# ================================
+IF(NOT PYINTERP_SUBPROJECT)
+  # Install the export set for use with the install-tree
+  INSTALL(EXPORT ${PYINTERP_EXPORT_NAME}TargetGroup DESTINATION ${PYINTERP_INSTALL_CMAKE}
+          FILE ${PROJECT_NAME}Targets.cmake)
+ENDIF()
index 523c8b13b2b7389e55494e284a1a29fbf28bc84f..cbfb14085d921eea41d77f6c6d4746057f6c81c3 100644 (file)
@@ -73,6 +73,6 @@ SET(PyInterp_SOURCES ${_other_SOURCES} ${_moc_SOURCES})
 
 ADD_LIBRARY(PyInterp ${PyInterp_SOURCES})
 TARGET_LINK_LIBRARIES(PyInterp ${_link_LIBRARIES})
-INSTALL(TARGETS PyInterp EXPORT ${TOOLS_EXPORT_NAME}TargetGroup DESTINATION ${PYINTERP_INSTALL_LIBS})
+INSTALL(TARGETS PyInterp EXPORT ${PYINTERP_EXPORT_NAME}TargetGroup DESTINATION ${PYINTERP_INSTALL_LIBS})
 
 INSTALL(FILES ${PyInterp_HEADERS} DESTINATION ${PYINTERP_INSTALL_HEADERS})
index 005efe376b2f1c631430d8aa3f1529359987a5e4..d1d69fe9c305d123b56fe43c140ebb8501e1011f 100644 (file)
@@ -24,7 +24,7 @@ PROJECT(RemoteFileBrowser CXX)
 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake files")
 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
   LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
-  INCLUDE(SalomeMacros)
+  INCLUDE(SalomeMacros NO_POLICY_SCOPE)
 ELSE()
   MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
 ENDIF()
@@ -35,7 +35,6 @@ SET(REMOTEFILEBROWSER_INSTALL_HEADERS include CACHE PATH "Install path: RemoteFi
 
 INCLUDE(SalomeSetupPlatform)
 SET(BUILD_SHARED_LIBS TRUE)
-INCLUDE(SalomeMacros)
 FIND_PACKAGE(SalomeQt5 REQUIRED)
 INCLUDE(UseQtExt)
 INCLUDE_DIRECTORIES(
diff --git a/tools/TODO b/tools/TODO
new file mode 100644 (file)
index 0000000..751e8a7
--- /dev/null
@@ -0,0 +1,18 @@
+1. Each sub-project must export its own configuration.
+
+2. When building as sub-projects within SALOME GUI top-level project,
+   targets file can be directly included from the GUI main configuration.
+   Or, alternatively, find_package(sub-project) must be called from
+   GUI main configuration file, similarly to other pre-requisites.
+
+3. As soon as (1) and (2) are done, refactor sub-projects to:
+   * Include other sub-projects recursively, following this approach,
+     for example, SalomeGUI -> PyConsole -> PyInterp.
+   * CurvePlot should become independent project, probably depending
+     on PyInterp. Also, it seems reasonable to avoid this direct
+     dependency as it is minimal de facto and needed features can be
+     achieved by simple copy-paste.
+   * Due to this refactoring, direct inclusion of PyInterp to PyConsole
+     via add_subdirectory() will be not needed anymore.
+
+4. Export targets for RemoteFileBrowser.