0029986: Configuration - environment scripts generated by CMake on Linux do not allow...
authorapn <apn@opencascade.com>
Wed, 29 Aug 2018 09:40:35 +0000 (12:40 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 11 Sep 2018 17:08:12 +0000 (20:08 +0300)
Correct launching custom.sh in env.sh.in.
Correct definition of FFMPEG_DIR in custom.build.bat/sh.in and generation of custom_*.sh (variables CSF_OCCTBinPath and CSF_OCCTLibPath are not empty on the first run)

CMakeLists.txt
adm/cmake/ffmpeg.cmake
adm/templates/env.build.sh.in [copied from adm/templates/env.sh.in with 95% similarity]
adm/templates/env.install.sh.in [moved from adm/templates/env.sh.in with 100% similarity]

index f249f4e..b6029e1 100644 (file)
@@ -63,7 +63,7 @@ set (BUILD_RESOURCES OFF CACHE BOOL "${BUILD_RESOURCES_DESCR}")
 
 # single-configuration generator
 set (SINGLE_GENERATOR OFF)
-if (CMAKE_BUILD_TYPE)
+if (DEFINED CMAKE_BUILD_TYPE)
   set (SINGLE_GENERATOR ON)
 endif()
 
@@ -899,11 +899,19 @@ if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
   OCCT_COPY_FILE_OR_DIR    ("adm/templates/sample.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
 endif()
 
-# env script for draw in building environment
-OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
-
-# install env script
-install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
+if (WIN32)
+  # env script for draw in building environment
+  OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
+  # install env script
+  install (FILES "${CMAKE_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}")
+else()
+  set (SUB_ENV_NAME "env.${SCRIPT_EXT}")
+  set (SUB_ENV_BUILD_NAME "env.install.${SCRIPT_EXT}")
+  # install env script
+  OCCT_CONFIGURE_AND_INSTALL ("adm/templates/env.install.${SCRIPT_EXT}.in" "${SUB_ENV_BUILD_NAME}" "${SUB_ENV_NAME}" "${INSTALL_DIR_SCRIPT}")
+  # env script for draw in building environment
+  OCCT_CONFIGURE ("adm/templates/env.build.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
+endif()
 
 # copy DrawAppliInit from OCCT source to build directory
 if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit")
index 89c5376..e4cd736 100644 (file)
@@ -37,6 +37,10 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
     set (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}           "" CACHE PATH "The directory containing FFmpeg framework (${LIBRARY_NAME})")
   endif()
 
+  if (NOT DEFINED 3RDPARTY_FFMPEG_LIBRARY_DIR)
+    set (3RDPARTY_FFMPEG_LIBRARY_DIR                           "" CACHE PATH "The directory containing FFmpeg libraries")
+  endif()
+
   if (WIN32)
     if (NOT DEFINED 3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME} OR NOT 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} OR NOT EXISTS "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}")
       set (3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}                 "" CACHE FILEPATH "FFmpeg shared libraries (${LIBRARY_NAME})" FORCE)
@@ -47,6 +51,9 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
     if (NOT DEFINED 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME})
       set (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}               "" CACHE PATH "The directory containing FFmpeg shared libraries (${LIBRARY_NAME})")
     endif()
+    if (NOT DEFINED 3RDPARTY_FFMPEG_DLL_DIR)
+      set (3RDPARTY_FFMPEG_DLL_DIR                               "" CACHE PATH "The directory containing FFmpeg shared libraries")
+    endif()
   endif()
 
   # check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
@@ -56,6 +63,7 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
 
     if (3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME}}")
       get_filename_component (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_LIBRARY_${LIBRARY_NAME}}" PATH)
+      set (3RDPARTY_FFMPEG_LIBRARY_DIR "${3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg libraries" FORCE)
       set (3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg library (${LIBRARY_NAME})" FORCE)
     else()
       CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FFMPEG_DIR 3RDPARTY_FFMPEG_LIBRARY_DIR_${LIBRARY_NAME} PATH "The directory containing FFmpeg library (${LIBRARY_NAME})")
@@ -66,6 +74,7 @@ foreach (LIBRARY_NAME ${CSF_FFmpeg})
 
       if (3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}")
         get_filename_component (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_DLL_${LIBRARY_NAME}}" PATH)
+        set (3RDPARTY_FFMPEG_DLL_DIR "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg shared libraries" FORCE)
         set (3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing FFmpeg shared library (${LIBRARY_NAME})" FORCE)
       else()
         CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FFMPEG_DIR 3RDPARTY_FFMPEG_DLL_DIR_${LIBRARY_NAME} PATH "The directory containing FFmpeg shared library (${LIBRARY_NAME})")
similarity index 95%
copy from adm/templates/env.sh.in
copy to adm/templates/env.build.sh.in
index 94d6da8..4e6f2f2 100644 (file)
@@ -4,7 +4,7 @@ aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath
 
 # ----- For compatability with external application using CASROOT -----
 if [ "${CASROOT}" == "" ]; then
-  export CASROOT="@INSTALL_DIR@"
+  export CASROOT="${aScriptPath}"
 fi
 
 # ----- Define path to 3rdparty products -----
@@ -36,8 +36,8 @@ else
 fi
 
 # ----- Set local settings -----
-if [ -e "${CASROOT}/@INSTALL_DIR_SCRIPT@/custom.sh" ]; then
-  source "${CASROOT}/@INSTALL_DIR_SCRIPT@/custom.sh" "${CASDEB}" "${ARCH}"
+if [ -e "${CASROOT}/custom.sh" ]; then
+  source "${CASROOT}/custom.sh" "${CASDEB}" "${ARCH}"
 fi
 
 THRDPARTY_PATH=""