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()
# ===========
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})
##
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 "")
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()
# ==============
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)
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
# 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
# ==============
# 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()
INCLUDE(UseQtExt)
-IF(PYCONSOLE_BUILD_PYTHON)
+IF(BUILD_PYMODULE)
ADD_SUBDIRECTORY(python)
-ENDIF(PYCONSOLE_BUILD_PYTHON)
+ENDIF(BUILD_PYMODULE)
# --- options ---
INCLUDE_DIRECTORIES(
${QT_INCLUDES}
${PYTHON_INCLUDE_DIRS}
- ${PROJECT_SOURCE_DIR}/src/PyInterp
)
# additional preprocessor / compiler flags
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}")
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})
# 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
# ==============
# 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()
INCLUDE(UseQtExt)
-IF(PYEDITOR_BUILD_PYTHON)
+IF(BUILD_PYMODULE)
ADD_SUBDIRECTORY(python)
-ENDIF(PYEDITOR_BUILD_PYTHON)
+ENDIF(BUILD_PYMODULE)
# --- options ---
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}")
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})
# 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
# ==============
# 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()
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})
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()
INCLUDE(SalomeSetupPlatform)
SET(BUILD_SHARED_LIBS TRUE)
-INCLUDE(SalomeMacros)
FIND_PACKAGE(SalomeQt5 REQUIRED)
INCLUDE(UseQtExt)
INCLUDE_DIRECTORIES(
--- /dev/null
+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.