From a0726e55a712da6debdfcbaa3268118506ca38d2 Mon Sep 17 00:00:00 2001 From: ibs Date: Mon, 16 Dec 2013 18:05:20 +0400 Subject: [PATCH] 0024426: CMake ignores 3rd party options; env.sh does not set "CASROOT" environment variable unrelative changes: #!/bin/bash line was added to env.sh.in CMake: debug environment was removed for the time being; env.sh and env.bat templates were refactored possibility of using of redundant command line parameters were removed from env.sh & env.bat scripts tcl installation corrected; Removed "echo off" from shell script --- CMakeLists.txt | 33 +++++++---------- adm/templates/draw.bat | 2 +- adm/templates/draw.sh | 2 +- adm/templates/env.bat.in | 75 +++++++++++++++++++------------------- adm/templates/env.sh.in | 78 +++++++++++++++++++++------------------- adm/templates/tcl.cmake | 8 ----- 6 files changed, 96 insertions(+), 102 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ca586192c..682caf8e20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,8 +300,11 @@ INCLUDE(adm/templates/tcl.cmake) #install tcltk IF(INSTALL_TCL) - GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIB_DIR "${3RDPARTY_TCL_LIBRARY}" PATH) - GET_FILENAME_COMPONENT(3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH) + SET(3RDPARTY_TCL_DLL_DIR "") + SET(3RDPARTY_TCL_LIB_DIR "") + + GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIB_DIR_INSIDE "${3RDPARTY_TCL_LIBRARY}" PATH) + GET_FILENAME_COMPONENT(3RDPARTY_TCL_DLL_DIR_INSIDE "${3RDPARTY_TCL_DLL}" PATH) IF (IS_TCL_VERSION_FOUND) SET (TCL_VERSION ${TCL_MAJOR_VERSION}${TCL_SEP}${TCL_MINOR_VERSION}) @@ -313,17 +316,20 @@ IF(INSTALL_TCL) SET (TCL_FOLDER_VERSION "") ENDIF() - INSTALL(FILES "${3RDPARTY_TCL_DLL_DIR}/${DLL_SO_PREFIX}tcl${TCL_VERSION}.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}") - INSTALL(FILES "${3RDPARTY_TCL_DLL_DIR}/${DLL_SO_PREFIX}tk${TCL_VERSION}.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}") + INSTALL(FILES "${3RDPARTY_TCL_DLL_DIR_INSIDE}/${DLL_SO_PREFIX}tcl${TCL_VERSION}.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}") + INSTALL(FILES "${3RDPARTY_TCL_DLL_DIR_INSIDE}/${DLL_SO_PREFIX}tk${TCL_VERSION}.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}") IF (IS_TCL_VERSION_FOUND) - INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/lib") - INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR}/tcl${TCL_FOLDER_VERSION}" DESTINATION "${INSTALL_DIR}/lib") - INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR}/tk${TCL_FOLDER_VERSION}" DESTINATION "${INSTALL_DIR}/lib") + INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR_INSIDE}/tcl8" DESTINATION "${INSTALL_DIR}/lib") + INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR_INSIDE}/tcl${TCL_FOLDER_VERSION}" DESTINATION "${INSTALL_DIR}/lib") + INSTALL(DIRECTORY "${3RDPARTY_TCL_LIB_DIR_INSIDE}/tk${TCL_FOLDER_VERSION}" DESTINATION "${INSTALL_DIR}/lib") ELSE() MESSAGE(STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.") MESSAGE(STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.") ENDIF() +ELSE() + GET_FILENAME_COMPONENT(3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH) + GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIB_DIR "${3RDPARTY_TCL_LIBRARY}" PATH) ENDIF() # GLX @@ -452,12 +458,6 @@ string( REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIB MESSAGE(STATUS "3RDPARTY_LIBRARY_DIRS: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") link_directories( ${3RDPARTY_LIBRARY_DIRS} ) -# -SET(RUN_PROJECT "") -SET(CASROOT_DEFINITION "set \"CASROOT=${CMAKE_SOURCE_DIR}\"") -SET(BIN_DIR_POSTFIX "bin") -SET(RESOURCE_DIR_PREFIX "%SCRIPTROOT%\\src") - IF("${INSTALL_DIR}" STREQUAL "") MESSAGE(FATAL_ERROR "INSTALL_DIR is empty") ELSE() @@ -480,13 +480,6 @@ ELSE() install(FILES "${OCCT_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" ) ENDIF() -IF(MSVC AND "${BUILD_CONFIGURATION}" STREQUAL "Debug") - SET(RUN_PROJECT "start OCCT.sln") - SET(BIN_DIR_POSTFIX "out\\bin\\Debug") - SET(RESOURCE_DIR_PREFIX "%CASROOT%\\src") - configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.bat.in" OCCT.bat @ONLY) -ENDIF() - include(adm/cmake/CMakeToolKitsDeps.txt) IF (BUILD_Samples) diff --git a/adm/templates/draw.bat b/adm/templates/draw.bat index b5c66c92c1..7c964e96bb 100644 --- a/adm/templates/draw.bat +++ b/adm/templates/draw.bat @@ -1,7 +1,7 @@ @echo off rem Setup environment and launch DRAWEXE -call "%~dp0env.bat" %1 %2 %3 +call "%~dp0env.bat" echo Hint: use "pload ALL" command to load standard commands DRAWEXE.exe diff --git a/adm/templates/draw.sh b/adm/templates/draw.sh index 49e54364fa..cf063fc005 100644 --- a/adm/templates/draw.sh +++ b/adm/templates/draw.sh @@ -2,7 +2,7 @@ aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD"; -source "${aScriptPath}/env.sh" "$1" "$2" +source "${aScriptPath}/env.sh" echo 'Hint: use "pload ALL" command to load standard commands' DRAWEXE diff --git a/adm/templates/env.bat.in b/adm/templates/env.bat.in index 20ae357bc1..f270e6b444 100644 --- a/adm/templates/env.bat.in +++ b/adm/templates/env.bat.in @@ -3,54 +3,57 @@ echo off set "SCRIPTROOT=%~dp0" set "SCRIPTROOT=%SCRIPTROOT:~0,-1%" -@CASROOT_DEFINITION@ - -set "FREETYPE_DIR=@3RDPARTY_FREETYPE_DLL_DIR@" -set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIR@" - -set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@" -set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@" +if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%" set "TCL_DIR=@3RDPARTY_TCL_DLL_DIR@" +if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%" -set "PATH=%FREETYPE_DIR%;%GL2PS_DIR%;%FREEIMAGE_DIR%;%TBB_DIR%;%TCL_DIR%;%PATH%" +set "FREETYPE_DIR=@3RDPARTY_FREETYPE_DLL_DIR@" +if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%" + +set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@" +if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%" + +set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIR@" +if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%" + +set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@" +if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%" rem ----- Set path to 3rd party and OCCT libraries ----- -set "PATH=%SCRIPTROOT%\@BIN_DIR_POSTFIX@;%PATH%" +set "PATH=%CASROOT%\bin;%PATH%" rem ----- Set envoronment variables used by OCCT ----- set CSF_LANGUAGE=us set MMGT_CLEAR=1 set CSF_EXCEPTION_PROMPT=1 -set "CSF_SHMessage=@RESOURCE_DIR_PREFIX@\SHMessage" -set "CSF_MDTVTexturesDirectory=@RESOURCE_DIR_PREFIX@\Textures" -set "CSF_ShadersDirectory=@RESOURCE_DIR_PREFIX@\Shaders" -set "CSF_XSMessage=@RESOURCE_DIR_PREFIX@\XSMessage" -set "CSF_TObjMessage=@RESOURCE_DIR_PREFIX@\TObj" -set "CSF_StandardDefaults=@RESOURCE_DIR_PREFIX@\StdResource" -set "CSF_PluginDefaults=@RESOURCE_DIR_PREFIX@\StdResource" -set "CSF_XCAFDefaults=@RESOURCE_DIR_PREFIX@\StdResource" -set "CSF_TObjDefaults=@RESOURCE_DIR_PREFIX@\StdResource" -set "CSF_StandardLiteDefaults=@RESOURCE_DIR_PREFIX@\StdResource" -set "CSF_UnitsLexicon=@RESOURCE_DIR_PREFIX@\UnitsAPI\Lexi_Expr.dat" -set "CSF_UnitsDefinition=@RESOURCE_DIR_PREFIX@\UnitsAPI\Units.dat" -set "CSF_IGESDefaults=@RESOURCE_DIR_PREFIX@\XSTEPResource" -set "CSF_STEPDefaults=@RESOURCE_DIR_PREFIX@\XSTEPResource" -set "CSF_XmlOcafResource=@RESOURCE_DIR_PREFIX@\XmlOcafResource" -set "CSF_MIGRATION_TYPES=@RESOURCE_DIR_PREFIX@\StdResource\MigrationSheet.txt" +set "CSF_SHMessage=%CASROOT%\src\SHMessage" +set "CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures" +set "CSF_ShadersDirectory=%CASROOT%\src\Shaders" +set "CSF_XSMessage=%CASROOT%\src\XSMessage" +set "CSF_TObjMessage=%CASROOT%\src\TObj" +set "CSF_StandardDefaults=%CASROOT%\src\StdResource" +set "CSF_PluginDefaults=%CASROOT%\src\StdResource" +set "CSF_XCAFDefaults=%CASROOT%\src\StdResource" +set "CSF_TObjDefaults=%CASROOT%\src\StdResource" +set "CSF_StandardLiteDefaults=%CASROOT%\src\StdResource" +set "CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat" +set "CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat" +set "CSF_IGESDefaults=%CASROOT%\src\XSTEPResource" +set "CSF_STEPDefaults=%CASROOT%\src\XSTEPResource" +set "CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource" +set "CSF_MIGRATION_TYPES=%CASROOT%\src\StdResource\MigrationSheet.txt" rem Draw Harness special stuff -if exist "@RESOURCE_DIR_PREFIX@\DrawResources" ( - set "DRAWHOME=@RESOURCE_DIR_PREFIX@\DrawResources" - set "CSF_DrawPluginDefaults=@RESOURCE_DIR_PREFIX@\DrawResources" - - if exist "@RESOURCE_DIR_PREFIX@\DrawResources\DrawDefault" ( - set "DRAWDEFAULT=@RESOURCE_DIR_PREFIX@\DrawResources\DrawDefault" +if exist "%CASROOT%\src\DrawResources" ( + set "DRAWHOME=%CASROOT%\src\DrawResources" + set "CSF_DrawPluginDefaults=%CASROOT%\src\DrawResources" + + if exist "%CASROOT%\src\DrawResources\DrawDefault" ( + set "DRAWDEFAULT=%CASROOT%\src\DrawResources\DrawDefault" ) ) -if exist "@RESOURCE_DIR_PREFIX@\DrawResourcesProducts" ( - set "CSF_DrawPluginProductsDefaults=@RESOURCE_DIR_PREFIX@\DrawResourcesProducts" -) - -@RUN_PROJECT@ \ No newline at end of file +if exist "%CASROOT%\src\DrawResourcesProducts" ( + set "CSF_DrawPluginProductsDefaults=%CASROOT%\src\DrawResourcesProducts" +) \ No newline at end of file diff --git a/adm/templates/env.sh.in b/adm/templates/env.sh.in index 1015bee041..1c4aca28ec 100644 --- a/adm/templates/env.sh.in +++ b/adm/templates/env.sh.in @@ -1,30 +1,36 @@ -echo off +#!/bin/bash aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD"; -FREETYPE_DIR="@3RDPARTY_FREETYPE_DLL_DIR@" -GL2PS_DIR="@3RDPARTY_GL2PS_DLL_DIR@" +if [ "${CASROOT}" == "" ]; then + export CASROOT="${aScriptPath}" +fi -TBB_DIR="@3RDPARTY_TBB_DLL_DIR@" -FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_DLL_DIR@" +aLibPath="${CASROOT}/lib" TCL_DIR="@3RDPARTY_TCL_DLL_DIR@" - -aLibPath="$aScriptPath/lib" if [ "$TCL_DIR" != "" ]; then aLibPath="${TCL_DIR}:${aLibPath}" fi -if [ "$TBB_DIR" != "" ]; then - aLibPath="${TBB_DIR}:${aLibPath}" + +FREETYPE_DIR="@3RDPARTY_FREETYPE_DLL_DIR@" +if [ "$FREETYPE_DIR" != "" ]; then + aLibPath="${FREETYPE_DIR}:${aLibPath}" fi + +FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_DLL_DIR@" if [ "$FREEIMAGE_DIR" != "" ]; then aLibPath="${FREEIMAGE_DIR}:${aLibPath}" fi + +GL2PS_DIR="@3RDPARTY_GL2PS_DLL_DIR@" if [ "$GL2PS_DIR" != "" ]; then aLibPath="${GL2PS_DIR}:${aLibPath}" fi -if [ "$FREETYPE_DIR" != "" ]; then - aLibPath="${FREETYPE_DIR}:${aLibPath}" + +TBB_DIR="@3RDPARTY_TBB_DLL_DIR@" +if [ "$TBB_DIR" != "" ]; then + aLibPath="${TBB_DIR}:${aLibPath}" fi # ----- Set path to 3rd party and OCCT libraries ----- @@ -46,7 +52,7 @@ else fi # ----- Set path to OCCT executables ----- -PATH="${PATH}:$aScriptPath/bin" +PATH="${PATH}:${CASROOT}/bin" # ----- Setup Environment Variables ----- anArch=`uname -m` @@ -63,33 +69,33 @@ fi export CSF_LANGUAGE=us export MMGT_CLEAR=1 export CSF_EXCEPTION_PROMPT=1 -export CSF_SHMessage="${aScriptPath}/res/SHMessage" -export CSF_MDTVTexturesDirectory="${aScriptPath}/res/Textures" -export CSF_ShadersDirectory="${aScriptPath}/res/Shaders" -export CSF_XSMessage="SCRIPTROOT/res/XSMessage" -export CSF_TObjMessage="SCRIPTROOT/res/TObj" -export CSF_StandardDefaults="${aScriptPath}/res/StdResource" -export CSF_PluginDefaults="${aScriptPath}/res/StdResource" -export CSF_XCAFDefaults="${aScriptPath}/res/StdResource" -export CSF_TObjDefaults="${aScriptPath}/res/StdResource" -export CSF_StandardLiteDefaults="${aScriptPath}/res/StdResource" -export CSF_UnitsLexicon="${aScriptPath}/res/UnitsAPI/Lexi_Expr.dat" -export CSF_UnitsDefinition="${aScriptPath}/res/UnitsAPI/Units.dat" -export CSF_IGESDefaults="${aScriptPath}/res/XSTEPResource" -export CSF_STEPDefaults="${aScriptPath}/res/XSTEPResource" -export CSF_XmlOcafResource="${aScriptPath}/res/XmlOcafResource" -export CSF_MIGRATION_TYPES="${aScriptPath}/res/StdResource/MigrationSheet.txt" +export CSF_SHMessage="${CASROOT}/src/SHMessage" +export CSF_MDTVTexturesDirectory="${CASROOT}/src/Textures" +export CSF_ShadersDirectory="${CASROOT}/src/Shaders" +export CSF_XSMessage="${CASROOT}/src/XSMessage" +export CSF_TObjMessage="${CASROOT}/src/TObj" +export CSF_StandardDefaults="${CASROOT}/src/StdResource" +export CSF_PluginDefaults="${CASROOT}/src/StdResource" +export CSF_XCAFDefaults="${CASROOT}/src/StdResource" +export CSF_TObjDefaults="${CASROOT}/src/StdResource" +export CSF_StandardLiteDefaults="${CASROOT}/src/StdResource" +export CSF_UnitsLexicon="${CASROOT}/src/UnitsAPI/Lexi_Expr.dat" +export CSF_UnitsDefinition="${CASROOT}/src/UnitsAPI/Units.dat" +export CSF_IGESDefaults="${CASROOT}/src/XSTEPResource" +export CSF_STEPDefaults="${CASROOT}/src/XSTEPResource" +export CSF_XmlOcafResource="${CASROOT}/src/XmlOcafResource" +export CSF_MIGRATION_TYPES="${CASROOT}/src/StdResource/MigrationSheet.txt" # Draw Harness special stuff -if [ -e "${aScriptPath}/res/DrawResources" ]; then - export DRAWHOME="${aScriptPath}/res/DrawResources" - export CSF_DrawPluginDefaults="${aScriptPath}/res/DrawResources" - - if [ -e "${aScriptPath}/res/DrawResources/DrawDefault" ]; then - export DRAWDEFAULT="${aScriptPath}/res/DrawResources/DrawDefault" +if [ -e "${CASROOT}/src/DrawResources" ]; then + export DRAWHOME="${CASROOT}/src/DrawResources" + export CSF_DrawPluginDefaults="${CASROOT}/src/DrawResources" + + if [ -e "${CASROOT}/src/DrawResources/DrawDefault" ]; then + export DRAWDEFAULT="${CASROOT}/src/DrawResources/DrawDefault" fi fi -if [ -e "${aScriptPath}/res/DrawResourcesProducts" ]; then - export CSF_DrawPluginProductsDefaults="${aScriptPath}/res/DrawResourcesProducts" +if [ -e "${CASROOT}/src/DrawResourcesProducts" ]; then + export CSF_DrawPluginProductsDefaults="${CASROOT}/src/DrawResourcesProducts" fi \ No newline at end of file diff --git a/adm/templates/tcl.cmake b/adm/templates/tcl.cmake index 7c2599cff1..3284f82500 100644 --- a/adm/templates/tcl.cmake +++ b/adm/templates/tcl.cmake @@ -160,12 +160,4 @@ ENDIF() IF(3RDPARTY_TCL_DLL) ELSE() LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL) -ENDIF() - -IF(INSTALL_TCL) - SET(3RDPARTY_TCL_DLL_DIR "") - SET(3RDPARTY_TCL_LIB_DIR "") -ELSE() - GET_FILENAME_COMPONENT(3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH) - GET_FILENAME_COMPONENT(3RDPARTY_TCL_LIB_DIR "${3RDPARTY_TCL_LIBRARY}" PATH) ENDIF() \ No newline at end of file