#
IF(HAVE_SALOME)
- SET(SUIT_INCLUDE ${SALOME_GUI_INCLUDE})
- MESSAGE(STATUS "SUIT_INCLUDE: ${SALOME_GUI_INCLUDE}")
+ SET(SUIT_INCLUDE "${GUI_ROOT_DIR}/include/salome")
SET(SUIT_LIB_DIR "${GUI_ROOT_DIR}/lib/salome")
ELSE(HAVE_SALOME)
SET(SUIT_DIR $ENV{SUIT_DIR})
IF(EXISTS ${SUIT_DIR})
-
MESSAGE(STATUS "SUIT found at ${SUIT_DIR}")
IF(WIN32)
SET(SUIT_LIB_DIR ${SUIT_DIR}/lib)
FILE(TO_CMAKE_PATH ${SUIT_LIB_DIR} SUIT_LIB_DIR)
FILE(TO_CMAKE_PATH ${SUIT_INCLUDE} SUIT_INCLUDE)
+MESSAGE(STATUS "SUIT includes: ${SUIT_INCLUDE}")
+MESSAGE(STATUS "SUIT libraries: ${SUIT_LIB_DIR}")
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL directory")
-SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI directory")
-SET(HAVE_SALOME NO)
-IF(EXISTS ${GUI_ROOT_DIR})
- MESSAGE("-- SALOME found at " ${GUI_ROOT_DIR})
- SET(HAVE_SALOME YES)
-
+IF(${HAVE_SALOME})
FIND_LIBRARY(caf caf ${GUI_ROOT_DIR}/lib/salome)
FIND_LIBRARY(CAM CAM ${GUI_ROOT_DIR}/lib/salome)
FIND_LIBRARY(CASCatch CASCatch ${GUI_ROOT_DIR}/lib/salome)
FIND_LIBRARY(vtkTools vtkTools ${GUI_ROOT_DIR}/lib/salome)
FIND_LIBRARY(SalomeGuiHelpers SalomeGuiHelpers ${GUI_ROOT_DIR}/lib/salome)
FIND_LIBRARY(SalomeTreeData SalomeTreeData ${GUI_ROOT_DIR}/lib/salome)
-
- SET(SALOME_GUI_INCLUDE ${GUI_ROOT_DIR}/include/salome)
- SET(SALOME_KERNEL_INCLUDE ${KERNEL_ROOT_DIR}/include/salome)
- SET(SALOME_KERNEL_LIBDIR ${KERNEL_ROOT_DIR}/lib/salome)
- ADD_DEFINITIONS( -DHAVE_SALOME )
-ENDIF(EXISTS ${GUI_ROOT_DIR})
+ENDIF()
ENDIF()
ENDIF()
ENDMACRO(SWIG_CHECK_GENERATION)
+
+#########################################################################
+# SALOME_SETUP_VERSION()
+#
+# USAGE: SALOME_SETUP_VERSION(version [DEVELOPMENT])
+#
+# ARGUMENTS:
+# version [in] Version decriptor (string).
+#
+# OPTIONS:
+# DEVELOPMENT Forces setting development flag.
+#
+# The macro sets the following variables:
+# - PROJECTNAME_MAJOR_VERSION - major version number
+# - PROJECTNAME_MINOR_VERSION - minor version number
+# - PROJECTNAME_PATCH_VERSION - release version number
+# - PROJECTNAME_VERSION - full qualified version
+# - PROJECTNAME_VERSION_DEV - development flag (0 value for released version)
+# - PROJECTNAME_XVERSION - hexadecimal representation of version
+# - PROJECTNAME_GIT_SHA1 - git commit's sha1
+#
+FUNCTION(SALOME_SETUP_VERSION version)
+ # parse arguments
+ PARSE_ARGUMENTS(SALOME_SETUP_VERSION "" "DEVELOPMENT" ${ARGN})
+ # project name in upper case (if not set in master CMakeLists.txt)
+ STRING(TOUPPER ${PROJECT_NAME} _pkg_uc)
+ # parse version component
+ STRING(REGEX MATCHALL "[^.]" _components "${version}")
+ LIST(LENGTH _components _length)
+ IF(${_length} GREATER 0)
+ LIST(GET _components 0 _major)
+ LIST(REMOVE_AT _components 0)
+ ELSE()
+ SET(_major 0)
+ ENDIF()
+ LIST(LENGTH _components _length)
+ IF(${_length} GREATER 0)
+ LIST(GET _components 0 _minor)
+ LIST(REMOVE_AT _components 0)
+ ELSE()
+ SET(_minor 0)
+ ENDIF()
+ LIST(LENGTH _components _length)
+ IF(${_length} GREATER 0)
+ LIST(GET _components 0 _patch)
+ LIST(REMOVE_AT _components 0)
+ ELSE()
+ SET(_patch 0)
+ ENDIF()
+ # set project version: 'major', 'minor' and 'patch' components
+ SET(${_pkg_uc}_MAJOR_VERSION ${_major} PARENT_SCOPE)
+ SET(${_pkg_uc}_MINOR_VERSION ${_minor} PARENT_SCOPE)
+ SET(${_pkg_uc}_PATCH_VERSION ${_patch} PARENT_SCOPE)
+ SET(${_pkg_uc}_VERSION ${_major}.${_minor}.${_patch} PARENT_SCOPE)
+ # set 'development' flag
+ IF(SALOME_SETUP_VERSION_DEVELOPMENT)
+ SET(${_pkg_uc}_VERSION_DEV 1 PARENT_SCOPE)
+ ELSE()
+ SET(${_pkg_uc}_VERSION_DEV 0 PARENT_SCOPE)
+ ENDIF()
+ # set hexa representation of version
+ SALOME_TOHEXA(${_major} _major_h)
+ SALOME_TOHEXA(${_minor} _minor_h)
+ SALOME_TOHEXA(${_patch} _patch_h)
+ SET(${_pkg_uc}_XVERSION "0x${_major_h}${_minor_h}${_patch_h}" PARENT_SCOPE)
+ # detect git sha1
+ EXECUTE_PROCESS(COMMAND git describe --dirty --tags --match=V* --always
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ OUTPUT_VARIABLE _git_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(_git_version)
+ SET(${_pkg_uc}_GIT_SHA1 "${_git_version}" PARENT_SCOPE)
+ ELSE(_)
+ SET(${_pkg_uc}_GIT_SHA1 "unknown" PARENT_SCOPE)
+ ENDIF()
+ENDFUNCTION()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
-PROJECT (SHAPER)
-SET(${PROJECT_NAME}_MAJOR_VERSION 9)
-SET(${PROJECT_NAME}_MINOR_VERSION 7)
-SET(${PROJECT_NAME}_PATCH_VERSION 0)
-SET(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION})
-SET(COMPONENT_NAME SHAPER)
+# Project name
+# ============
+PROJECT(SHAPER)
-# Ensure a proper linker behavior:
+# Ensure a proper linker behavior
+# ===============================
CMAKE_POLICY(SET CMP0003 NEW)
IF(WIN32)
CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
ENDIF(WIN32)
+# Append path to common macros
+# ===========================
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
+# Detect SALOME mode; append path to SALOME macros
+# ================================================
+SET(HAVE_SALOME NO)
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+ SET(HAVE_SALOME YES)
+ MESSAGE(STATUS "SALOME found; building with SALOME!")
+ SET(CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
+ INCLUDE(SalomeMacros)
+ELSE()
+ MESSAGE(STATUS "SALOME is not found; building without it!")
+ INCLUDE(SalomeMacros)
+ENDIF()
+
+# Versioning
+# ===========
+SALOME_SETUP_VERSION(9.7.0 DEVELOPMENT)
+MESSAGE(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} from \"${${PROJECT_NAME}_GIT_SHA1}\"")
+SET(COMPONENT_NAME SHAPER)
+
+# Options
+# =======
IF (NOT CADBUILDER_BUILD_DOC)
OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
ENDIF(NOT CADBUILDER_BUILD_DOC)
INCLUDE(FindEclipse)
INCLUDE(Common)
-INCLUDE(FindSalome)
-INCLUDE(FindSUIT)
INCLUDE(FindTInspector)
+INCLUDE(FindSalomeQt5)
IF(HAVE_SALOME)
- SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
- IF(EXISTS ${CONFIGURATION_ROOT_DIR})
- SET(CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
- INCLUDE(SalomeMacros)
- INCLUDE(FindSalomeQt5)
- ELSE()
- MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
- ENDIF()
+ INCLUDE(SalomeSetupPlatform) # From CONFIGURATION
+
+ ADD_DEFINITIONS(-DHAVE_SALOME)
+
SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
IF(EXISTS ${KERNEL_ROOT_DIR})
FIND_PACKAGE(SalomeKERNEL REQUIRED)
ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
+ SET(SALOME_KERNEL_LIBDIR ${KERNEL_ROOT_DIR}/lib/salome)
ELSE(EXISTS ${KERNEL_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+
SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
IF(EXISTS ${GUI_ROOT_DIR})
FIND_PACKAGE(SalomeGUI REQUIRED)
ELSE(EXISTS ${GUI_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
ENDIF(EXISTS ${GUI_ROOT_DIR})
- INCLUDE(SalomeSetupPlatform) # From CONFIGURATION
FIND_PACKAGE(SalomePythonInterp REQUIRED)
FIND_PACKAGE(SalomePythonLibs REQUIRED)
-
FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
-
+ INCLUDE(FindSalome)
ELSE()
- INCLUDE(SalomeMacros)
- INCLUDE(FindSalomeQt5)
INCLUDE(FindPython)
INCLUDE(FindSalomeOpenCASCADE)
ENDIF()
-# Common CMake macros
-# ===================
-
+INCLUDE(FindSUIT)
# Find LibXml2
IF(DEFINED ENV{LIBXML2_ROOT_DIR})
${SUIT_INCLUDE}
)
-IF(${HAVE_SALOME})
- INCLUDE_DIRECTORIES(${SALOME_KERNEL_INCLUDE})
-ENDIF(${HAVE_SALOME})
-
ADD_DEFINITIONS(-DMODULEBASE_EXPORTS ${OpenCASCADE_DEFINITIONS})
ADD_LIBRARY(ModuleBase SHARED
${PROJECT_SOURCES}
${SUIT_INCLUDE}
)
-IF(${HAVE_SALOME})
- INCLUDE_DIRECTORIES(${SALOME_KERNEL_INCLUDE})
-ELSE(${HAVE_SALOME})
+IF(NOT ${HAVE_SALOME})
INCLUDE_DIRECTORIES(${APPELEMENTS_INCLUDE_DIR})
-ENDIF(${HAVE_SALOME})
+ENDIF()
ADD_DEFINITIONS(-DPARTSET_EXPORTS ${OpenCASCADE_DEFINITIONS})
ADD_LIBRARY(PartSet SHARED
#
INSTALL(DIRECTORY geom model examples DESTINATION ${SHAPER_INSTALL_PYTHON_API})
-INSTALL(FILES __init__.py DESTINATION ${SHAPER_INSTALL_PYTHON_API})
-#INSTALL(FILES __init__.py DESTINATION ${_pydir}/salome)
INSTALL(FILES initConfig.py DESTINATION ${SHAPER_INSTALL_PYTHON_API})
+SALOME_CONFIGURE_FILE(__init__.py __init__.py INSTALL ${SHAPER_INSTALL_PYTHON_API})
# --------- Unit tests -----------
INCLUDE(UnitTest)
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
+__version__ = "@SHAPER_GIT_SHA1@"
${PROJECT_SOURCE_DIR}/src/GeomAPI
${PROJECT_SOURCE_DIR}/src/Config
${PROJECT_SOURCE_DIR}/src/ExchangePlugin
- ${SALOME_GUI_INCLUDE}
- ${SALOME_KERNEL_INCLUDE}
+ ${SUIT_INCLUDE}
${OpenCASCADE_INCLUDE_DIR}
)
-IF(${HAVE_SALOME})
- INCLUDE_DIRECTORIES(${SALOME_KERNEL_INCLUDE})
-ENDIF(${HAVE_SALOME})
-
ADD_LIBRARY(SHAPER SHARED
${PROJECT_SOURCES}
${PROJECT_HEADERS}
${OpenCASCADE_INCLUDE_DIR}
${SUIT_INCLUDE})
-IF(${HAVE_SALOME})
- INCLUDE_DIRECTORIES(${SALOME_KERNEL_INCLUDE})
-ENDIF(${HAVE_SALOME})
-
IF(NOT ${HAVE_SALOME})
SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${APPELEMENTS_INCLUDE_DIR})
ENDIF(NOT ${HAVE_SALOME})