From 7144c5178df2c861ff6984f9587cd2e62abf3458 Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 19 Jul 2012 17:55:13 +0400 Subject: [PATCH] Code Block projects files generation refactored Now WOK adds necessary directories to search path. wgenproj command now creates codeblocks.sh and draw.sh scripts in the workbench root directory --- src/WOKBuilderDef/CSF_MAC.edl | 4 ++-- src/WOKTclLib/osutils.tcl | 27 +++++++++++++++++++++++++++ src/WOKTclLib/templates/codeblocks.sh | 8 ++++++++ src/WOKTclLib/templates/draw.sh | 5 +++++ src/WOKTclLib/templates/env.sh | 11 ++++++++++- src/WOKsite/wok_deps.tcl | 4 +++- src/WOKsite/wok_tclshrc.tcl | 4 +++- 7 files changed, 58 insertions(+), 5 deletions(-) create mode 100755 src/WOKTclLib/templates/codeblocks.sh create mode 100644 src/WOKTclLib/templates/draw.sh diff --git a/src/WOKBuilderDef/CSF_MAC.edl b/src/WOKBuilderDef/CSF_MAC.edl index 2d8c52f..c0e493b 100644 --- a/src/WOKBuilderDef/CSF_MAC.edl +++ b/src/WOKBuilderDef/CSF_MAC.edl @@ -64,10 +64,10 @@ @if (%CSF_TCL_HOME != "") then @string %CSF_TCL_INCLUDE = %CSF_TCL_HOME "/include "; @string %CSF_TclLibs = "-L" %CSF_TCL_HOME "/lib -ltcl8.5 "; - @string %CSF_TclTkLibs = "-L" %CSF_TCL_HOME "/lib -ltk8.5 -L" %X11_LIB " -lX11 "; + @string %CSF_TclTkLibs = "-L" %X11_LIB " -lX11 -L" %CSF_TCL_HOME "/lib -ltk8.5 "; @else @string %CSF_TclLibs = " -ltcl8.5 "; - @string %CSF_TclTkLibs = " -ltk8.5 -L" %X11_LIB " -lX11 "; + @string %CSF_TclTkLibs = "-L" %X11_LIB " -lX11 -ltk8.5 "; @endif; -- FTGL (font renderer for OpenGL) diff --git a/src/WOKTclLib/osutils.tcl b/src/WOKTclLib/osutils.tcl index 33228e7..b5ce2cf 100755 --- a/src/WOKTclLib/osutils.tcl +++ b/src/WOKTclLib/osutils.tcl @@ -1794,6 +1794,7 @@ proc osutils:cbptk { theOutDir theToolKit } { lappend aUsedToolKits "${tkx}" } wokparam -l CSF + foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $theToolKit]]] $theToolKit] { foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] { if {[wokparam -t %$element] == 0} { @@ -2013,6 +2014,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theIncPaths the puts $aFile "\t\t\t\t" puts $aFile "\t\t\t\t\t" + if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} { + puts $aFile "\t\t\t\t\t" + } puts $aFile "\t\t\t\t\t" puts $aFile "\t\t\t\t" @@ -2057,6 +2061,9 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theIncPaths the puts $aFile "\t\t\t\t" puts $aFile "\t\t\t\t\t" + if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} { + puts $aFile "\t\t\t\t\t" + } puts $aFile "\t\t\t\t\t" puts $aFile "\t\t\t\t" @@ -2073,6 +2080,7 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theIncPaths the foreach anIncPath $theIncPaths { puts $aFile "\t\t\t" } + puts $aFile "\t\t\t" puts $aFile "\t\t" # COMMON linker options @@ -2093,6 +2101,25 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theIncPaths the } } + if { "$theIsExe" == "true" } { + puts $aFile "\t\t" + puts $aFile "\t\t\t" + puts $aFile "\t\t\t" + puts $aFile "\t\t\t" + puts $aFile "\t\t\t\t" + puts $aFile "\t\t\t\t\t" + puts $aFile "\t\t\t\t" + puts $aFile "\t\t\t\t" + puts $aFile "\t\t\t\t\t" + puts $aFile "\t\t\t\t" + puts $aFile "\t\t\t\t" + puts $aFile "\t\t\t\t\t" + puts $aFile "\t\t\t\t" + puts $aFile "\t\t\t" + puts $aFile "\t\t\t" + puts $aFile "\t\t" + } + puts $aFile "\t" puts $aFile "" close $aFile diff --git a/src/WOKTclLib/templates/codeblocks.sh b/src/WOKTclLib/templates/codeblocks.sh new file mode 100755 index 0000000..43bb383 --- /dev/null +++ b/src/WOKTclLib/templates/codeblocks.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +source ./env.sh "$1" + +export CSF_OPT_LIB64="$CSF_OPT_LIB64:/usr/X11/lib" +export CSF_OPT_LIB64D="$CSF_OPT_LIB64:/usr/X11/lib" + +/Applications/CodeBlocks.app/Contents/MacOS/CodeBlocks ./adm/mac/cbp/OCCT.workspace diff --git a/src/WOKTclLib/templates/draw.sh b/src/WOKTclLib/templates/draw.sh new file mode 100644 index 0000000..8470a91 --- /dev/null +++ b/src/WOKTclLib/templates/draw.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source ./env.sh "$1" + +DRAWEXE diff --git a/src/WOKTclLib/templates/env.sh b/src/WOKTclLib/templates/env.sh index eae1a35..0a13cad 100644 --- a/src/WOKTclLib/templates/env.sh +++ b/src/WOKTclLib/templates/env.sh @@ -6,6 +6,7 @@ aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath export CASROOT="$aScriptPath" # Reset values +export CASDEB="" export HAVE_TBB="false"; export HAVE_FREEIMAGE="false"; export HAVE_GL2PS="false"; @@ -18,6 +19,12 @@ export CSF_OPT_BIN64="" # ----- Set local settings ----- if [ -e "${aScriptPath}/custom.sh" ]; then source "${aScriptPath}/custom.sh"; fi +# Read script arguments +shopt -s nocasematch +if [[ "$1" == "debug" ]]; then export CASDEB="d"; fi +if [[ "$1" == "d" ]]; then export CASDEB="d"; fi +shopt -u nocasematch + export CSF_OPT_INC="${CSF_OPT_INC}:__CSF_OPT_INC__" export CSF_OPT_LIB32="${CSF_OPT_LIB32}:__CSF_OPT_LIB32__" export CSF_OPT_LIB64="${CSF_OPT_LIB64}:__CSF_OPT_LIB64__" @@ -40,7 +47,6 @@ else export WOKSTATION="lin"; fi -if [ "${CASDEB}" == "" ]; then export CASDEB=""; fi export CASBIN="${WOKSTATION}/cbp" export CSF_OPT_CMPL="" @@ -101,6 +107,9 @@ fi export PATH="${CASROOT}/${CASBIN}/bin${CASDEB}:${PATH}" export LD_LIBRARY_PATH="${CASROOT}/${CASBIN}/lib${CASDEB}:${LD_LIBRARY_PATH}" +if [ "$WOKSTATION" == "mac" ]; then + export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}" +fi # Set envoronment variables used by OCCT export CSF_MDTVFontDirectory="${CASROOT}/src/FontMFT" diff --git a/src/WOKsite/wok_deps.tcl b/src/WOKsite/wok_deps.tcl index c84186e..9dbc262 100644 --- a/src/WOKsite/wok_deps.tcl +++ b/src/WOKsite/wok_deps.tcl @@ -694,7 +694,9 @@ proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 if { "$aXmuLibPath" == "" } { set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"] if { "$aXmuLibPath" != "" } { - lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib" + if { "$::tcl_platform(os)" != "Darwin" } { + lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib" + } } else { lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)" set isFound "false" diff --git a/src/WOKsite/wok_tclshrc.tcl b/src/WOKsite/wok_tclshrc.tcl index ea84622..c3d22c7 100644 --- a/src/WOKsite/wok_tclshrc.tcl +++ b/src/WOKsite/wok_tclshrc.tcl @@ -292,7 +292,9 @@ proc wgenprojbat {thePath} { file copy -force -- "$::env(WOKHOME)/lib/templates/draw.bat" "$aBox/draw.bat" file copy -force -- "$::env(WOKHOME)/lib/templates/msvc.bat" "$aBox/msvc.bat" } else { - catch {file copy -- "$::env(WOKHOME)/site/custom.sh" "$aBox/custom.sh"} + catch {file copy -- "$::env(WOKHOME)/site/custom.sh" "$aBox/custom.sh"} + file copy -force -- "$::env(WOKHOME)/lib/templates/draw.sh" "$aBox/draw.sh" + file copy -force -- "$::env(WOKHOME)/lib/templates/codeblocks.sh" "$aBox/codeblocks.sh" } } -- 2.39.5