From 9971fe5cbcfad134f7ebe98085c1640fa02c2da5 Mon Sep 17 00:00:00 2001 From: ibs Date: Mon, 21 Jan 2013 15:23:35 +0400 Subject: [PATCH] 0023723: CMake meta-projects generated by WOK link with unnecessary libraries toolkit's project links with just required libraries unused variable SYSTEM removed; -DLIN not defined for MAC OS --- src/WOKTclLib/OS.tcl | 56 +++++----- src/WOKTclLib/osutils.tcl | 201 ++++++++++++++++++------------------ src/WOKsite/wok_tclshrc.tcl | 52 +++++----- 3 files changed, 153 insertions(+), 156 deletions(-) diff --git a/src/WOKTclLib/OS.tcl b/src/WOKTclLib/OS.tcl index c0d2357..ec6a5b9 100644 --- a/src/WOKTclLib/OS.tcl +++ b/src/WOKTclLib/OS.tcl @@ -2968,31 +2968,31 @@ proc OS:MKVC { theOutDir {theModules {}} {theAllSolution ""} {theVcVer "vc8"} } if { "$theAllSolution" != "" } { OS:vcsolution $theVcVer $theAllSolution $theModules $theOutDir ::THE_GUIDS_LIST } - + puts "The Visual Studio solution and project files are stored in the $theOutDir directory" } # Function to generate CMake meta file proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { puts stderr "Generating CMake meta project" - + set anOutFileName "CMakeLists.txt" set aProjectName $theAllSolution - + set theProjTmpl [osutils:readtemplate cmake "CMake main meta-project"] - + regsub -all -- {__PROJECT_NAME__} $theProjTmpl $aProjectName theProjTmpl regsub -all -- {__BITNESS__} $theProjTmpl $::env(ARCH) theProjTmpl - regsub -all -- {__WOK_LIB_PATH__} $theProjTmpl [file normalize $::env(WOK_LIBRARY)] theProjTmpl + regsub -all -- {__WOK_LIB_PATH__} $theProjTmpl [file normalize $::env(WOK_LIBRARY)] theProjTmpl regsub -all -- {__CASROOT_DIR__} $theProjTmpl "[OS:casroot]" theProjTmpl - - + + set aBuff [list] foreach aModule $theModules { lappend aBuff "SET(BUILD_${aModule} ON CACHE BOOL \"include ${aModule}\" )" } regsub -all -- {__MODULE_LIST__} $theProjTmpl [join $aBuff "\n"] theProjTmpl - + set aBuff [list] foreach aModule $theModules { foreach aToolKit [${aModule}:toolkits] { @@ -3005,7 +3005,7 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { } } regsub -all -- {__TOOLKIT_DEPS__} $theProjTmpl [join $aBuff "\n"] theProjTmpl - + set aBuff [list] foreach aModule $theModules { lappend aBuff "" @@ -3013,13 +3013,13 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { foreach aToolKit [${aModule}:toolkits] { lappend aBuff " LIST(APPEND USED_TOOLKITS ${aToolKit} )" lappend aBuff " foreach( TK \$\{${aToolKit}_DEPS\})" - lappend aBuff " LIST(APPEND USED_TOOLKITS \$\{TK\} )" + lappend aBuff " LIST(APPEND USED_TOOLKITS \$\{TK\} )" lappend aBuff " endforeach()" } foreach anExecutable [OS:executable ${aModule}] { lappend aBuff " LIST(APPEND USED_TOOLKITS ${anExecutable} )" lappend aBuff " foreach( TK \$\{${anExecutable}_DEPS\})" - lappend aBuff " LIST(APPEND USED_TOOLKITS \$\{TK\} )" + lappend aBuff " LIST(APPEND USED_TOOLKITS \$\{TK\} )" lappend aBuff " endforeach()" } lappend aBuff "endif()" @@ -3033,10 +3033,10 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { if {![file exists "$theOutDir/$aToolKit"]} { file mkdir "$theOutDir/$aToolKit" } - + #add directory to main cmake metafile lappend aBuff "subdirs(${aToolKit})" - + # create cmake metafile into target subdir osutils:cmktk $theOutDir $aToolKit false ${aModule} } @@ -3045,14 +3045,14 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { if {![file exists "$theOutDir/$anExecutable"]} { file mkdir "$theOutDir/$anExecutable" } - + #add directory to main cmake metafile lappend aBuff "subdirs(${anExecutable})" - + # create cmake metafile into target subdir osutils:cmktk $theOutDir $anExecutable true ${aModule} } - } + } regsub -all -- {__INCLUDE_TOOLKITS__} $theProjTmpl [join $aBuff "\n"] theProjTmpl #generate cmake meta file @@ -3060,7 +3060,7 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { fconfigure $aFile -translation crlf puts $aFile $theProjTmpl close $aFile - + puts "The Cmake meta-files are stored in the $theOutDir directory" } @@ -3159,8 +3159,8 @@ proc OS:MKAMK { theOutDir {theModules {}} theSubPath} { } osutils:am:adm $theOutDir $theModules - osutils:am:root [wokinfo -p HomeDir] $theSubPath $theModules - + osutils:am:root [wokinfo -p HomeDir] $theSubPath $theModules + puts "The automake files are stored in the $theOutDir directory" } @@ -3179,7 +3179,7 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } { if { "$theAllSolution" != "" } { OS:cworkspace $theAllSolution $theModules $theOutDir } - + puts "The Code Blocks workspace and project files are stored in the $theOutDir directory" } @@ -3190,7 +3190,7 @@ set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}" # Entry function to generate project files and solutions for IDE proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } { set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" } - + if { [lsearch $aSupportedIDE $theIDE] < 0 } { puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE\nSupported IDEs: [join ${aSupportedIDE} " "]" return @@ -3217,7 +3217,7 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } { } # make list of modules and platforms - set aModules [OS:listmodules $theProjectType {win32}] + set aModules [OS:listmodules $theProjectType {win32}] # generate one solution for all projects if complete OS or VAS is processed set anAllSolution "" @@ -3229,13 +3229,13 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } { # Create output directory set aWokStation "$::env(WOKSTATION)" - + if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11} $theIDE] != -1 } { set aWokStation "msvc" } - + set anOutDir "${anOutRoot}/${aWokStation}/${theIDE}" - + if { "$theIDE" == "cmake" } { set anOutDir "${anOutRoot}/${theIDE}" } @@ -3245,7 +3245,7 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } { puts stderr "Error: Could not create output directory \"$anOutDir\"" return } - + # Generating project files for the selected IDE switch -exact -- "$theIDE" { "vc7" - @@ -3257,12 +3257,12 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } { "cmake" { OS:MKCMK "${anOutRoot}/${theIDE}" $aModules $anAllSolution } "amk" { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"} } - + # generate config.txt file if { ${anAllSolution} == "Products" && "$::env(WOKSTATION)" == "wnt" } { osutils:mkCollectScript "collect_binary.cfg" "$anOutRoot/../" ${theIDE} $::env(ARCH) "release" } - + # Store generated GUIDs map set anOutFile [open "$aGuidsFilePath" "w"] fconfigure $anOutFile -translation lf diff --git a/src/WOKTclLib/osutils.tcl b/src/WOKTclLib/osutils.tcl index f1cc10d..c9bd150 100755 --- a/src/WOKTclLib/osutils.tcl +++ b/src/WOKTclLib/osutils.tcl @@ -1713,7 +1713,7 @@ proc osutils:tkinfo { theRelativePath theToolKit theUsedLib theFrameworks theInc upvar $theIncPaths anIncPaths upvar $theTKDefines aTKDefines upvar $theTKSrcFiles aTKSrcFiles - + set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $theToolKit]]] foreach tkx $aDepToolkits { lappend aUsedLibs "${tkx}" @@ -1812,111 +1812,108 @@ proc osutils:commonUsedTK { theToolKit } { lappend anUsedToolKits "${tkx}" } } - + return $anUsedToolKits } -proc osutils:usedwntlibs { theToolKit } { - set anUsedLibs [list] - - lappend anUsedLibs "advapi32.lib" - lappend anUsedLibs "gdi32.lib" - lappend anUsedLibs "user32.lib" - lappend anUsedLibs "kernel32.lib" - - lappend anUsedLibs "opengl32.lib" - lappend anUsedLibs "glu32.lib" - lappend anUsedLibs "ws2_32.lib" - lappend anUsedLibs "vfw32.lib" - - lappend anUsedLibs "tcl85.lib" - lappend anUsedLibs "tk85.lib" +proc osutils:csfList { theOS theCsfMap } { + upvar $theCsfMap aCsfMap - return $anUsedLibs -} + unset theCsfMap -proc osutils:usedunixlibs { theToolKit } { - set anUsedLibs [list] - - lappend anUsedLibs "dl" - lappend anUsedLibs "pthread" - lappend anUsedLibs "rt" + if { "$theOS" == "wnt" } { + # -- WinAPI libraries + set aCsfMap(CSF_kernel32) "kernel32.lib" + set aCsfMap(CSF_advapi32) "advapi32.lib" + set aCsfMap(CSF_gdi32) "gdi32.lib" + set aCsfMap(CSF_user32) "user32.lib" + set aCsfMap(CSF_glu32) "glu32.lib" + set aCsfMap(CSF_opengl32) "opengl32.lib" + set aCsfMap(CSF_wsock32) "wsock32.lib" + set aCsfMap(CSF_netapi32) "netapi32.lib" + set aCsfMap(CSF_AviLibs) "ws2_32.lib vfw32.lib" + set aCsfMap(CSF_OpenGlLibs) "opengl32.lib glu32.lib" - # Xlib - lappend anUsedLibs "X11" - lappend anUsedLibs "Xext" - lappend anUsedLibs "Xmu" - lappend anUsedLibs "Xi" - - # TCL/TK 8.5 - lappend anUsedLibs "tcl8.5" - lappend anUsedLibs "tk8.5" + # -- 3rd-parties precompiled libraries + set aCsfMap(CSF_TclLibs) "tcl85.lib" + set aCsfMap(CSF_TclTkLibs) "tk85.lib" + set aCsfMap(CSF_QT) "QtCore4.lib QtGui4.lib" - # FTGL - lappend anUsedLibs "freetype" - lappend anUsedLibs "ftgl" + } else { - #if tbb - lappend anUsedLibs "tbb" - lappend anUsedLibs "tbbmalloc" - - #if freeimage - lappend anUsedLibs "freeimage" - - #if gl2ps - lappend anUsedLibs "gl2ps" + if { "$theOS" == "lin" } { + set aCsfMap(CSF_ThreadLibs) "pthread rt" + set aCsfMap(CSF_XwLibs) "X11 Xext Xmu Xi" + set aCsfMap(CSF_OpenGlLibs) "GLU GL" - return $anUsedLibs -} + } elseif { "$theOS" == "mac" } { + set aCsfMap(CSF_objc) "objc" -proc osutils:usedmacoslibs { theToolKit } { - set anUsedLibs [list] + # frameworks + set aCsfMap(CSF_Appkit) "Appkit" + set aCsfMap(CSF_IOKit) "IOKit" + set aCsfMap(CSF_OpenGlLibs) "OpenGL" + } - lappend anUsedLibs "objc" + set aCsfMap(CSF_MotifLibs) "X11" - # frameworks - lappend anUsedLibs "Appkit" - lappend anUsedLibs "IOKit" - lappend anUsedLibs "OpenGL" + # -- Tcl/Tk configuration + set aCsfMap(CSF_TclLibs) "tcl8.5" + set aCsfMap(CSF_TclTkLibs) "tk8.5 X11" - # FTGL - lappend anUsedLibs "freetype" - lappend anUsedLibs "ftgl" + #-- FTGL (font renderer for OpenGL) + set aCsfMap(CSF_FTGL) "ftgl" - # to be removed - lappend anUsedLibs "X11" + #-- FreeType + set aCsfMap(CSF_FREETYPE) "freetype" - # TCL/TK 8.5 - lappend anUsedLibs "tcl8.5" - lappend anUsedLibs "tk8.5" + #-- optional 3rd-parties + #-- TBB + set aCsfMap(CSF_TBB) "tbb tbbmalloc" - #if tbb - lappend anUsedLibs "tbb" - lappend anUsedLibs "tbbmalloc" + #-- FreeImage + set aCsfMap(CSF_FreeImagePlus) "freeimage" - #if freeimage - lappend anUsedLibs "freeimage" + #-- GL2PS + set aCsfMap(CSF_GL2PS) "gl2ps" + } +} - #if gl2ps - lappend anUsedLibs "gl2ps" +proc osutils:usedOsLibs { theToolKit theOS } { + set aUsedLibs [list] - return $anUsedLibs + osutils:csfList $theOS anOsCsfList + + foreach element [osutils:tk:hascsf [woklocate -p ${theToolKit}:source:EXTERNLIB [wokcd]]] { + # test if variable is not setted - continue + if ![info exists anOsCsfList($element)] { + continue + } + + foreach aLib [split "$anOsCsfList($element)"] { + if { [lsearch $aUsedLibs $aLib] == "-1"} { + lappend aUsedLibs $aLib + } + } + } + + return $aUsedLibs } proc osutils:incpaths { theUnits theRelatedPath } { set anIncPaths [list] - + foreach anUnit $theUnits { lappend anIncPaths "${theRelatedPath}/drv/${anUnit}" lappend anIncPaths "${theRelatedPath}/src/${anUnit}" } - + return $anIncPaths } proc osutils:tksrcfiles { theUnits theRelatedPath } { set aTKSrcFiles [list] - + if [array exists written] { unset written } foreach anUnit $theUnits { set xlo [wokinfo -n $anUnit] @@ -1930,81 +1927,81 @@ proc osutils:tksrcfiles { theUnits theRelatedPath } { } } } - + return $aTKSrcFiles } proc osutils:tkdefs { theUnits } { set aTKDefines [list] - + foreach anUnit $theUnits { lappend aTKDefines "__${anUnit}_DLL" } - + return $aTKDefines } proc osutils:fileGroupName { theSrcFile } { set path [file dirname [file normalize ${theSrcFile}]] regsub -all [file normalize "${path}/.."] ${path} "" aGroupName - + return $aGroupName } -proc osutils:cmktk { theOutDir theToolKit {theIsExec false} theModule} { - set anOutFileName "CMakeLists.txt" +proc osutils:cmktk { theOutDir theToolKit {theIsExec false} theModule} { + set anOutFileName "CMakeLists.txt" set anCommonUsedToolKits [osutils:commonUsedTK $theToolKit] - set anUsedWntLibs [osutils:usedwntlibs $theToolKit] - set anUsedUnixLibs [osutils:usedunixlibs $theToolKit] - set anUsedMacLibs [osutils:usedmacoslibs $theToolKit] + set anUsedWntLibs [osutils:usedOsLibs $theToolKit "wnt"] + set anUsedUnixLibs [osutils:usedOsLibs $theToolKit "lin"] + set anUsedMacLibs [osutils:usedOsLibs $theToolKit "mac"] set anUnits [list] foreach anUnitWithPath [osutils:tk:units [woklocate -u $theToolKit]] { lappend anUnits [wokinfo -n $anUnitWithPath] } - + if { [llength $anUnits] == 0 } { set anUnits [wokinfo -n [woklocate -u $theToolKit]] } - + set anCommonUnits [list] set aWntUnits [osutils:justwnt $anUnits] set anUnixUnits [osutils:justunix $anUnits] - + #remove duplicates from wntUnits and unixUnits and collect these duplicates in commonUnits variable foreach aWntUnit $aWntUnits { if { [set anIndex [lsearch -exact $anUnixUnits $aWntUnit]] != -1 } { #add to common list lappend anCommonUnits $aWntUnit - + #remove from wnt list set anUnixUnits [lreplace $anUnixUnits $anIndex $anIndex] - + #remove from unix list set anIndex [lsearch -exact $aWntUnits $aWntUnit] set aWntUnits [lreplace $aWntUnits $anIndex $anIndex] } } - set aRelatedPath [relativePath "$theOutDir/$theToolKit" [pwd]] + set aRelatedPath [relativePath "$theOutDir/$theToolKit" [pwd]] set anCommonIncPaths [osutils:incpaths $anCommonUnits $aRelatedPath] set anWntIncPaths [osutils:incpaths $aWntUnits $aRelatedPath] set anUnixIncPaths [osutils:incpaths $anUnixUnits $aRelatedPath] - + set aCommonTKSrcFiles [osutils:tksrcfiles $anCommonUnits $aRelatedPath] set aWntTKSrcFiles [osutils:tksrcfiles $aWntUnits $aRelatedPath] set aUnixTKSrcFiles [osutils:tksrcfiles $anUnixUnits $aRelatedPath] - + set aFileBuff [list "project(${theToolKit})\n"] - + # macros for wnt lappend aFileBuff "if (WIN32)" foreach aMacro [osutils:tkdefs [concat $anCommonUnits $aWntUnits]] { lappend aFileBuff " list( APPEND ${theToolKit}_PRECOMPILED_DEFS \"-D${aMacro}\" )" - } + } lappend aFileBuff " string( REGEX REPLACE \";\" \" \" ${theToolKit}_PRECOMPILED_DEFS \"\$\{${theToolKit}_PRECOMPILED_DEFS\}\")" lappend aFileBuff "endif()" lappend aFileBuff "" @@ -2026,7 +2023,7 @@ proc osutils:cmktk { theOutDir theToolKit {theIsExec false} theModule} { } lappend aFileBuff "endif()" lappend aFileBuff "" - + # used libs foreach anCommonUsedToolKit $anCommonUsedToolKits { if { $anCommonUsedToolKit != "" } { @@ -2091,13 +2088,13 @@ proc osutils:cmktk { theOutDir theToolKit {theIsExec false} theModule} { } } lappend aFileBuff "endif()\n" - + #used source files foreach aCommonTKSrcFile $aCommonTKSrcFiles { lappend aFileBuff " list( APPEND ${theToolKit}_USED_SRCFILES \"${aCommonTKSrcFile}\" )" lappend aFileBuff " SOURCE_GROUP ([string range [osutils:fileGroupName $aCommonTKSrcFile] 1 end] FILES \"${aCommonTKSrcFile}\")\n" } - + lappend aFileBuff "if (WIN32)" foreach aWntTKSrcFile $aWntTKSrcFiles { lappend aFileBuff " list( APPEND ${theToolKit}_USED_SRCFILES \"${aWntTKSrcFile}\" )" @@ -2109,7 +2106,7 @@ proc osutils:cmktk { theOutDir theToolKit {theIsExec false} theModule} { lappend aFileBuff " SOURCE_GROUP ([string range [osutils:fileGroupName $aUnixTKSrcFile] 1 end] FILES \"${aUnixTKSrcFile}\")\n" } lappend aFileBuff "endif()\n" - + #install instrutions lappend aFileBuff "if (\"\$\{USED_TOOLKITS\}\" STREQUAL \"\" OR DEFINED TurnONthe${theToolKit})" if { $theIsExec == true } { @@ -2124,7 +2121,7 @@ proc osutils:cmktk { theOutDir theToolKit {theIsExec false} theModule} { lappend aFileBuff " set_property(TARGET ${theToolKit} PROPERTY FOLDER ${theModule})" lappend aFileBuff "" lappend aFileBuff " install( TARGETS ${theToolKit} - RUNTIME DESTINATION \"\$\{INSTALL_DIR\}/bin\" + RUNTIME DESTINATION \"\$\{INSTALL_DIR\}/bin\" ARCHIVE DESTINATION \"\$\{INSTALL_DIR\}/lib\" LIBRARY DESTINATION \"\$\{INSTALL_DIR\}/lib\")" lappend aFileBuff "" @@ -2444,10 +2441,10 @@ proc relativePath {thePathFrom thePathTo} { set aPathFrom [file normalize "$thePathFrom"] set aPathTo [file normalize "$thePathTo"] - + set aCutedPathFrom "${aPathFrom}/dummy" set aRelatedDeepPath "" - + while { "$aCutedPathFrom" != [file normalize "$aCutedPathFrom/.."] } { set aCutedPathFrom [file normalize "$aCutedPathFrom/.."] # does aPathTo contain aCutedPathFrom? @@ -2462,8 +2459,8 @@ proc relativePath {thePathFrom thePathTo} { regsub -all "//" $aPathToAfterCut "/" aPathToAfterCut return $aPathToAfterCut } - set aRelatedDeepPath "$aRelatedDeepPath../" - + set aRelatedDeepPath "$aRelatedDeepPath../" + } return $thePathTo diff --git a/src/WOKsite/wok_tclshrc.tcl b/src/WOKsite/wok_tclshrc.tcl index 03b9011..1ae141d 100644 --- a/src/WOKsite/wok_tclshrc.tcl +++ b/src/WOKsite/wok_tclshrc.tcl @@ -94,10 +94,10 @@ proc relativePath {thePathFrom thePathTo} { set aPathFrom [file normalize "$thePathFrom"] set aPathTo [file normalize "$thePathTo"] - + set aCutedPathFrom "${aPathFrom}/dummy" set aRelatedDeepPath "" - + while { "$aCutedPathFrom" != [file normalize "$aCutedPathFrom/.."] } { set aCutedPathFrom [file normalize "$aCutedPathFrom/.."] # does aPathTo contain aCutedPathFrom? @@ -112,8 +112,8 @@ proc relativePath {thePathFrom thePathTo} { regsub -all "//" $aPathToAfterCut "/" aPathToAfterCut return $aPathToAfterCut } - set aRelatedDeepPath "$aRelatedDeepPath../" - + set aRelatedDeepPath "$aRelatedDeepPath../" + } return $thePathTo @@ -243,10 +243,10 @@ proc wgenprojbat {thePath theIDE} { wokcd -P Home set anOsRootPath [pwd] wokcd $aWokCD - + set aPlatformExt sh if { "$::tcl_platform(platform)" == "windows" } { - set aPlatformExt bat + set aPlatformExt bat } set aBox [file normalize "$thePath/.."] @@ -256,17 +256,17 @@ proc wgenprojbat {thePath theIDE} { file copy -force -- "$::env(WOKHOME)/lib/templates/env.${aPlatformExt}.in" "$aBox/adm/cmake/env.${aPlatformExt}.in" file copy -force -- "$::env(WOKHOME)/lib/config.h" "$aBox/inc/config.h" } else { - + set anEnvTmplFile [open "$::env(WOKHOME)/lib/templates/env.${aPlatformExt}" "r"] set anEnvTmpl [read $anEnvTmplFile] close $anEnvTmplFile - + set aCasRoot "" if { [file normalize "$anOsRootPath"] != "$aBox" } { set aCasRoot [relativePath "$aBox" "$anOsRootPath"] } set anOsIncPath [relativePath "$aBox" "$anOsRootPath"] - + regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl regsub -all -- {__CSF_OPT_INC__} $anEnvTmpl "$anOsIncPath" anEnvTmpl if { "$::tcl_platform(platform)" != "windows" } { @@ -281,11 +281,11 @@ proc wgenprojbat {thePath theIDE} { regsub -all -- {__CSF_OPT_LIB64__} $anEnvTmpl "${anOsRootPath}/${::env(WOKSTATION)}/cbp/lib" anEnvTmpl regsub -all -- {__CSF_OPT_LIB64D__} $anEnvTmpl "${anOsRootPath}/${::env(WOKSTATION)}/cbp/libd" anEnvTmpl } - } + } set anEnvFile [open "$aBox/env.${aPlatformExt}" "w"] puts $anEnvFile $anEnvTmpl - close $anEnvFile - + close $anEnvFile + catch {file copy -- "$::env(WOKHOME)/site/custom.${aPlatformExt}" "$aBox/custom.${aPlatformExt}"} file copy -force -- "$::env(WOKHOME)/lib/templates/draw.${aPlatformExt}" "$aBox/draw.${aPlatformExt}" } @@ -300,7 +300,7 @@ proc wgenprojbat {thePath theIDE} { } } -proc removeAllOccurrencesOf { theObject theList } { +proc removeAllOccurrencesOf { theObject theList } { set aSortIndices [lsort -decreasing [lsearch -all -nocase $theList $theObject]] foreach anIndex $aSortIndices { set theList [lreplace $theList $anIndex $anIndex] @@ -310,9 +310,9 @@ proc removeAllOccurrencesOf { theObject theList } { # Wrapper-function to generate VS project files proc wgenproj { args } { - set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" } + set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" } set anArgs $args - + # Setting default IDE. # For Windows - Visual Studio (vc), Linux - Code Blocks (cbp), Mac OS X - Xcode (cmake). set anTarget "" @@ -327,35 +327,35 @@ proc wgenproj { args } { if { [lsearch -nocase $anArgs -no_wprocess] != -1 } { set anArgs [removeAllOccurrencesOf -no_wprocess $anArgs] set willWProcessStart false - } - + } + if { [set anIndex [lsearch -nocase $anArgs -ide=*]] != -1 } { regsub -nocase "\\-ide=" [lindex $anArgs $anIndex] "" anTarget set anArgs [removeAllOccurrencesOf -ide=* $anArgs] set isTargetDefault false } - + if { [set anIndex [lsearch -nocase $anArgs -target=*]] != -1 } { regsub -nocase "\\-target=" [lindex $anArgs $anIndex] "" anTarget set anArgs [removeAllOccurrencesOf -target=* $anArgs] set isTargetDefault false } - + if { [llength $anArgs] == 0 && $isTargetDefault == true } { puts "the default \'$anTarget\' target has been applied" } - - set isHelpRequire false + + set isHelpRequire false if { [lsearch -nocase $anArgs -h] != -1} { set anArgs [removeAllOccurrencesOf -h $anArgs] set isHelpRequire true } - + if { [lsearch -nocase $aSupportedTargets $anTarget] == -1} { puts "the \'$anTarget\' is wrong TARGET" set isHelpRequire true } - + if {[llength $anArgs] > 0} { set isHelpRequire true @@ -367,19 +367,19 @@ proc wgenproj { args } { if { $isHelpRequire == true } { puts "usage: wgenproj \[ -target= \] \[ -no_wprocess \] -no_wprocess - skip wprocess - TARGET: + TARGET: vc8 - Visual Studio 2005 vc9 - Visual Studio 2008 vc10 - Visual Studio 2010 vc11 - Visual Studio 2012 cbp - CodeBlocks - cmake - CMake + cmake - CMake amk - AutoMake" return } puts "the \'$anTarget\' target has been applied" - + # create the inc directory. The directory should be created by wprocess function. wokcd -P Home file mkdir [file join [pwd] inc] -- 2.39.5