]> SALOME platform Git repositories - tools/documentation.git/commitdiff
Salome HOME
Update adm files.
authorrnv <rnv@opencascade.com>
Tue, 12 Nov 2013 09:22:21 +0000 (09:22 +0000)
committerrnv <rnv@opencascade.com>
Tue, 12 Nov 2013 09:22:21 +0000 (09:22 +0000)
CMakeModules/SalomeMacros.cmake

index ea9604d2a39d0dcd7a69e22e60c9bfbda4631f5b..df81302fbddbf6cd18860d05105ae95b7a71f802 100755 (executable)
@@ -594,6 +594,21 @@ MACRO(SALOME_ADD_MPI_TO_HDF5)
   SET(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${MPI_LIBRARIES})
 ENDMACRO(SALOME_ADD_MPI_TO_HDF5)
 
+####################################################################
+# SALOME_TOHEXA()
+# Convert a number (smaller than 16) into hexadecimal representation
+# with a leading 0.
+MACRO(SALOME_TOHEXA num result)
+  SET(_hexa_map a b c d e f)
+  IF(${num} LESS 10)
+    SET(${result} "0${num}")
+  ELSE()
+    MATH(EXPR _res "${num}-10" )
+    LIST(GET _hexa_map ${_res} _out)
+    SET(${result} "0${_out}")
+  ENDIF()
+ENDMACRO(SALOME_TOHEXA)
+
 ####################################################################
 # SALOME_XVERSION()
 # 
@@ -613,11 +628,17 @@ ENDMACRO(SALOME_ADD_MPI_TO_HDF5)
 MACRO(SALOME_XVERSION pkg)
   STRING(TOUPPER ${pkg} _pkg_UC)
   IF(${_pkg_UC}_VERSION)
-    EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; t=sys.argv[-1].split(\".\") ; t[:]=(int(elt) for elt in t) ; sys.stdout.write(\"0x%02x%02x%02x\"%tuple(t))" ${${_pkg_UC}_VERSION}
-                    OUTPUT_VARIABLE ${_pkg_UC}_XVERSION)
+    SET(_major)
+    SET(_minor)
+    SET(_patch)
+    SALOME_TOHEXA(${${_pkg_UC}_MAJOR_VERSION} _major)
+    SALOME_TOHEXA(${${_pkg_UC}_MINOR_VERSION} _minor)
+    SALOME_TOHEXA(${${_pkg_UC}_PATCH_VERSION} _patch)
+    SET(${_pkg_UC}_XVERSION "0x${_major}${_minor}${_patch}")
   ENDIF()
 ENDMACRO(SALOME_XVERSION)
 
+
 #########################################################################
 # SALOME_ACCUMULATE_HEADERS()
 # 
@@ -736,6 +757,14 @@ MACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT output script cmd opts)
     SET(_script ${CMAKE_CURRENT_BINARY_DIR}/${script})
   ENDIF()
 
+  IF(WIN32)
+    SET(_ext "bat")
+    SET(_call_cmd "call")
+  ELSE()
+    SET(_ext "sh")
+    SET(_call_cmd ".")
+  ENDIF()
+  
   SET(_env)
   FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
     FOREACH(_val ${_${PROJECT_NAME}_EXTRA_ENV_${_item}})
@@ -743,13 +772,9 @@ MACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT output script cmd opts)
         IF(${_item} STREQUAL "LD_LIBRARY_PATH")
           SET(_item PATH)
         ENDIF()
-        STRING(REPLACE "/" "\\" _env "${_env} @SET ${_item}=${_val};%${_item}%\n")
-        SET(_ext "bat")
-        SET(_call_cmd "call")
+        STRING(REPLACE "/" "\\" _env "${_env} @SET ${_item}=${_val};%${_item}%\n")        
       ELSE(WIN32)
         SET(_env "${_env} export ${_item}=${_val}:\${${_item}}\n")
-        SET(_ext "sh")
-        SET(_call_cmd ".")
       ENDIF(WIN32)
     ENDFOREACH()
   ENDFOREACH()
@@ -777,18 +802,32 @@ ENDMACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT)
 #
 MACRO(SALOME_GENERATE_TESTS_ENVIRONMENT output)
   SET(_env)
+  SET(_WIN_LD_LIBRARY OFF)
   FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
+    IF(${_item} STREQUAL "LD_LIBRARY_PATH")
+      SET(_WIN_LD_LIBRARY ON)
+    ENDIF()
+    SET(_env_${_item})
     FOREACH(_val ${_${PROJECT_NAME}_EXTRA_ENV_${_item}})
       IF(WIN32)
-        SET(_env "${_val};${_env}")
+        SET(_env_${_item} "${_val};${_env_${_item}}")
       ELSE()
-        SET(_env "${_val}:${_env}")
+        SET(_env_${_item} "${_val}:${_env_${_item}}")
       ENDIF()
     ENDFOREACH()
-    SET(_env " ${_item}=${_env}")
-  ENDFOREACH() 
+  ENDFOREACH()
+
+  IF(_WIN_LD_LIBRARY AND WIN32)
+    SET(_env_PATH "${_env_PATH} ${_env_LD_LIBRARY_PATH}")
+  ENDIF()
+
+  FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
+    IF(NOT(WIN32 AND ${_item} STREQUAL "LD_LIBRARY_PATH"))
+      SET(_env "${_item}=${_env_${_item}} ${_env}")
+    ENDIF()
+  ENDFOREACH()
   SET(${output} ${_env})  
-ENDMACRO(SALOME_GENERATE_TESTS_ENVIRONMENT)
+ENDMACRO(SALOME_GENERATE_TESTS_ENVIRONMENT) 
 
 #########################################################################
 # SALOME_APPEND_LIST_OF_LIST()