]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Rework building procedure and testing environment
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Fri, 9 Oct 2020 19:31:35 +0000 (22:31 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Sat, 28 Nov 2020 11:33:26 +0000 (14:33 +0300)
CMakeCommon/FindSUIT.cmake
CMakeCommon/UnitTest.cmake
CMakeLists.txt
doc/gui/conf.py.in
doc/swig/doxyfile.in
doc/tui/doxyfile.in
src/SHAPERGUI/resources/LightApp.xml.in

index 43a29f809d99a881314c1f5f2d176164698142a8..518b31983e01efbf62be3a4a561b4be248d6bd80 100644 (file)
@@ -46,3 +46,6 @@ ELSE(HAVE_SALOME)
     ENDIF()
   ENDIF(EXISTS ${SUIT_DIR})
 ENDIF(HAVE_SALOME)
+
+FILE(TO_CMAKE_PATH ${SUIT_LIB_DIR} SUIT_LIB_DIR)
+FILE(TO_CMAKE_PATH ${SUIT_INCLUDE} SUIT_INCLUDE)
index 6e47a80720389bda38030e991af0b2263507fb7d..b3abbba732b56a70bee04dd9f3c3236e44181fe6 100644 (file)
 
 ENABLE_TESTING()
 
-MACRO(ADD_UNIT_TESTS)
-  if (WIN32) # different separators and path to libraries variable name
-    SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};${SALOME_KERNEL_LIBDIR};$ENV{PATH}")
-    STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
-    STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
-    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
-    STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
-    STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
-  else()
-    SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:${SALOME_KERNEL_LIBDIR}:$ENV{LD_LIBRARY_PATH}")
-    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
-  endif()
+function(GENERATE_TESTS PATH testdir TESTS)
+  SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 
   foreach(eachFileName ${ARGN})
     # Strip the ".py" suffix
@@ -64,117 +54,36 @@ MACRO(ADD_UNIT_TESTS)
     SET(aTestName "${aSubprojectName}_${aTestName}")
 
     # Full path to the python test file beeing executed
-    SET(aTestFileName "${CMAKE_CURRENT_SOURCE_DIR}/Test/${eachFileName}")
+    SET(aTestFileName "${testdir}/${eachFileName}")
     IF(EXISTS ${aTestFileName})
       ADD_TEST(NAME ${aTestName}
                COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
-      if (WIN32) # different path to libraries variable name
-        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
-               ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
+      SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+               ENVIRONMENT "${tests_env};SHAPER_UNIT_TEST_IN_PROGRESS=1"
                LABELS "${aSubprojectName}")
-      else()
-        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
-               ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-               LABELS "${aSubprojectName}")
-      endif()
       # Debug output...
       #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
     ELSE(EXISTS ${aTestFileName})
       MESSAGE(WARNING "Can not find the test file: ${aTestFileName}")
     ENDIF(EXISTS ${aTestFileName})
   endforeach(eachFileName ${ARGN})
-ENDMACRO(ADD_UNIT_TESTS)
+endfunction(GENERATE_TESTS)
 
-MACRO(ADD_UNIT_TESTS_API)
-  if (WIN32) # different separators and path to libraries variable name
-    SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};${SALOME_KERNEL_LIBDIR};$ENV{PATH}")
-    STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
-    STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
-    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
-    STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
-    STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
-  else()
-    SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:${SALOME_KERNEL_LIBDIR}:$ENV{LD_LIBRARY_PATH}")
-    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
-  endif()
-
-  foreach(eachFileName ${ARGN})
-    # Strip the ".py" suffix
-    GET_FILENAME_COMPONENT(aTestName ${eachFileName} NAME_WE)
-
-    # Add "SubprojectName_" prefix
-    GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-    SET(aTestName "${aSubprojectName}_${aTestName}")
+function(ADD_UNIT_TESTS)
+  GENERATE_TESTS(PATH "${CMAKE_CURRENT_SOURCE_DIR}/Test" TESTS ${ARGN})
+endfunction(ADD_UNIT_TESTS)
 
-    # Full path to the python test file beeing executed
-    SET(aTestFileName "${CMAKE_CURRENT_SOURCE_DIR}/${eachFileName}")
-    IF(EXISTS ${aTestFileName})
-      ADD_TEST(NAME ${aTestName}
-               COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
-      if (WIN32) # different path to libraries variable name
-        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
-               ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-               LABELS "${aSubprojectName}")
-      else()
-        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
-               ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-               LABELS "${aSubprojectName}")
-      endif()
-      # Debug output...
-      #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
-    ELSE(EXISTS ${aTestFileName})
-      MESSAGE(WARNING "Can not find the test file: ${aTestFileName}")
-    ENDIF(EXISTS ${aTestFileName})
-  endforeach(eachFileName ${ARGN})
-ENDMACRO(ADD_UNIT_TESTS_API)
+function(ADD_UNIT_TESTS_API)
+  GENERATE_TESTS(PATH "${CMAKE_CURRENT_SOURCE_DIR}" TESTS ${ARGN})
+endfunction(ADD_UNIT_TESTS_API)
 
 
 function(ADD_RESTRICTED_TESTS)
   SET(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR} CACHE PATH "Path to the restricted repository")
 
-  if (NOT EXISTS ${RESTRICTED_ROOT_DIR})
-    message(WARNING "RESTRICTED_ROOT_DIR is not specified to run restricted tests")
-    return()
-  endif()
-
-  if (WIN32) # different separators and path to libraries variable name
-    SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};${SALOME_KERNEL_LIBDIR};$ENV{PATH}")
-    STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
-    STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
-    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
-    STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
-    STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
+  if (EXISTS ${RESTRICTED_ROOT_DIR})
+    GENERATE_TESTS(PATH "${RESTRICTED_ROOT_DIR}/SHAPER/bugs" TESTS ${ARGN})
   else()
-    SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:${SALOME_KERNEL_LIBDIR}:$ENV{LD_LIBRARY_PATH}")
-    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
+    message(WARNING "RESTRICTED_ROOT_DIR is not specified to run restricted tests")
   endif()
-
-  foreach(eachFileName ${ARGN})
-    # Strip the ".py" suffix
-    GET_FILENAME_COMPONENT(aTestName ${eachFileName} NAME_WE)
-
-    # Add "SubprojectName_" prefix
-    GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-    SET(aTestName "${aSubprojectName}_${aTestName}")
-
-    # Full path to the python test file beeing executed
-    SET(aTestFileName "${RESTRICTED_ROOT_DIR}/SHAPER/bugs/${eachFileName}")
-    IF(EXISTS ${aTestFileName})
-      ADD_TEST(NAME ${aTestName}
-               COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
-      if (WIN32) # different path to libraries variable name
-        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
-               ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-               LABELS "${aSubprojectName}")
-      else()
-        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
-               ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-               LABELS "${aSubprojectName}")
-      endif()
-      # Debug output...
-      #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
-    ELSE(EXISTS ${aTestFileName})
-      MESSAGE(WARNING "Can not find the test file: ${aTestFileName}")
-    ENDIF(EXISTS ${aTestFileName})
-  endforeach(eachFileName ${ARGN})
 endfunction(ADD_RESTRICTED_TESTS)
index 4d7500c9329da2cd95928ee57b39d3ee700cda7a..8baa2bfec86af201e3b364d520e2f335eb38d5fd 100644 (file)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10)
 
 PROJECT (SHAPER)
+SET(${PROJECT_NAME}_MAJOR_VERSION 9)
+SET(${PROJECT_NAME}_MINOR_VERSION 6)
+SET(${PROJECT_NAME}_PATCH_VERSION 0)
+SET(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION})
+
 # 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)
 
-SET (SHAPER_Version 9.6.0)
-
 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
 
 IF (NOT CADBUILDER_BUILD_DOC)
   OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
 ENDIF(NOT CADBUILDER_BUILD_DOC)
 
-INCLUDE(SalomeMacros)
-
 INCLUDE(FindEclipse)
 INCLUDE(Common)
-INCLUDE(FindSalomeQt5)
 INCLUDE(FindSalome)
 INCLUDE(FindSUIT)
 INCLUDE(FindTInspector)
@@ -48,6 +48,7 @@ IF(${HAVE_SALOME})
   IF(EXISTS ${CONFIGURATION_ROOT_DIR})
     LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
     INCLUDE(SalomeMacros)
+    INCLUDE(FindSalomeQt5)
   ELSE()
     MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
   ENDIF()
@@ -68,6 +69,8 @@ IF(${HAVE_SALOME})
   FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
 
 ELSE(${HAVE_SALOME})
+  INCLUDE(SalomeMacros)
+  INCLUDE(FindSalomeQt5)
   INCLUDE(FindPython)
   INCLUDE(FindSalomeOpenCASCADE)
 ENDIF(${HAVE_SALOME})
@@ -81,11 +84,9 @@ IF(DEFINED ENV{LIBXML2_ROOT_DIR})
     IF(WIN32)
         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.lib LIBXML2_LIBRARIES)
         FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include LIBXML2_INCLUDE_DIR)
-    ELSE()
-        IF(NOT "$ENV{LIBXML2_ROOT_DIR}" STREQUAL "/usr")
-            FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.so LIBXML2_LIBRARIES)
-            FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include/libxml2 LIBXML2_INCLUDE_DIR)
-        ENDIF()
+    ELSEIF(NOT "$ENV{LIBXML2_ROOT_DIR}" STREQUAL "/usr")
+        FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.so LIBXML2_LIBRARIES)
+        FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include/libxml2 LIBXML2_INCLUDE_DIR)
     ENDIF()
 ENDIF()
 # It could be called only once
@@ -121,12 +122,33 @@ ELSE(${HAVE_SALOME})
     SET(SHAPER_INSTALL_TUI_DOC doc CACHE INTERNAL "" FORCE)
 ENDIF(${HAVE_SALOME})
 
+#  Test environment
+# ===================
+
+IF(WIN32)
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}")
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${SUIT_LIB_DIR}")
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${SALOME_KERNEL_LIBDIR}")
+ELSE(WIN32)
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}")
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${SUIT_LIB_DIR}")
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${SALOME_KERNEL_LIBDIR}")
+ENDIF(WIN32)
+
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}")
+
 # Sketcher: Change radius of circular edges while dragging a point on the edge
 SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
 
 SET(MAKE_TRANSLATION YES)
+ADD_DEFINITIONS( -DMAKE_TRANSLATION )
 
-    ADD_DEFINITIONS( -DMAKE_TRANSLATION )
 ADD_SUBDIRECTORY (src/Config)
 ADD_SUBDIRECTORY (src/Locale)
 ADD_SUBDIRECTORY (src/Events)
index d6a8bebf203c5e73bbe3509d7a679728ffcf13ef..d1327b144b3a9daa3812e651536c266e333636b4 100644 (file)
@@ -68,9 +68,9 @@ html_show_copyright = False
 # built documents.
 #
 # The short X.Y version.
-version = u'@SHAPER_Version@'
+version = u'@SHAPER_VERSION@'
 # The full version, including alpha/beta/rc tags.
-release = u'@SHAPER_Version@'
+release = u'@SHAPER_VERSION@'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index eded674971f4a402f68411fe7848f00b4c0e0fa3..0d4795380ab337cf871b7688436e3f65e01ffe3b 100644 (file)
@@ -3,7 +3,7 @@
 #---------------------------------------------------------------------------
 DOXYFILE_ENCODING      = UTF-8
 PROJECT_NAME           = @CMAKE_PROJECT_NAME@
-PROJECT_NUMBER         = @SHAPER_Version@
+PROJECT_NUMBER         = @SHAPER_VERSION@
 PROJECT_BRIEF          =
 PROJECT_LOGO           =
 OUTPUT_DIRECTORY       =
index 538e959257ae461dd503fd6f48ea1c2f66fa53d8..4d4d3485742fe7d6d4d9b60e7162854221f9c12f 100644 (file)
@@ -32,7 +32,7 @@ PROJECT_NAME           = @CMAKE_PROJECT_NAME@
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER         = @SHAPER_Version@
+PROJECT_NUMBER         = @SHAPER_VERSION@
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer
index 081f2b03e59026d7cfe4ebc1db8e03f8a1090993..33908724f1de83403969f09bfd6e7ce62a43e555 100644 (file)
@@ -7,7 +7,7 @@
     <!-- Major module parameters -->
     <parameter name="name" value="Shaper"/>
     <parameter name="icon" value="shaper.png"/>
-    <parameter name="version" value="@SHAPER_Version@"/>
+    <parameter name="version" value="@SHAPER_VERSION@"/>
     <parameter name="documentation" value="shaper_help"/>
   </section>
   <section name="shaper_help" >