# =======================================================================
-# This script generates project files for different IDEs:
-# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "cbp" "amk" "xcd"
+# Created on: 2014-07-24
+# Created by: SKI
+# Copyright (c) 2014 OPEN CASCADE SAS
+#
+# This file is part of Open CASCADE Technology software library.
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License version 2.1 as published
+# by the Free Software Foundation, with special exception defined in the file
+# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+# distribution for complete text of the license and disclaimer of any warranty.
+#
+# Alternatively, this file may be used under the terms of Open CASCADE
+# commercial license or contractual agreement.
+
+# =======================================================================
+# This script defines Tcl command genproj generating project files for
+# different IDEs:
+# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd"
#
# Example:
# genproj -path=D:/occt -target=vc10
# genproj -target=xcd -ios -static
# =======================================================================
+source [file join [file dirname [info script]] genconfdeps.tcl]
+
set path ""
+set THE_CASROOT ""
set fBranch ""
+if { [info exists ::env(CASROOT)] } {
+ set THE_CASROOT "$::env(CASROOT)"
+}
switch -exact -- "$tcl_platform(platform)" {
"windows" {set targetStation "wnt"}
"unix" {set targetStation "lin"}
"Darwin" {set targetStation "mac"}
}
-source "./adm/genconfdeps.tcl"
-
proc _get_options { platform type branch } {
- global path
set res ""
- if {[file exists "$path/adm/CMPLRS"]} {
- set fd [open "$path/adm/CMPLRS" rb]
+ if {[file exists "$::THE_CASROOT/adm/CMPLRS"]} {
+ set fd [open "$::THE_CASROOT/adm/CMPLRS" rb]
set opts [split [read $fd] "\n"]
close $fd
foreach line $opts {
}
proc _get_type { name } {
- global path
- if {[file exists "$path/adm/UDLIST"]} {
- set fd [open "$path/adm/UDLIST" rb]
- set UDLIST [split [read $fd] "\n"]
+ set UDLIST {}
+ if {[file exists "$::path/adm/UDLIST"]} {
+ set fd [open "$::path/adm/UDLIST" rb]
+ set UDLIST [concat $UDLIST [split [read $fd] "\n"]]
close $fd
- foreach uitem $UDLIST {
- set line [split $uitem]
- if {[lindex $line 1] == "$name"} {
- return [lindex $line 0]
- }
+ }
+ if { "$::path/adm/UDLIST" != "$::THE_CASROOT/adm/UDLIST" && [file exists "$::THE_CASROOT/adm/UDLIST"] } {
+ set fd [open "$::THE_CASROOT/adm/UDLIST" rb]
+ set UDLIST [concat $UDLIST [split [read $fd] "\n"]]
+ close $fd
+ }
+
+ foreach uitem $UDLIST {
+ set line [split $uitem]
+ if {[lindex $line 1] == "$name"} {
+ return [lindex $line 0]
}
}
return ""
return $lret
}
+# return location of the path within src directory
+proc osutils:findSrcSubPath {theSubPath} {
+ if {[file exists "$::path/src/$theSubPath"]} {
+ return "$::path/src/$theSubPath"
+ }
+ return "$::THE_CASROOT/src/$theSubPath"
+}
+
# Wrapper-function to generate VS project files
proc genproj { args } {
- global path targetStation
- set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "cbp" "amk" "xcd" }
+ global path THE_CASROOT targetStation
+ set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
set anArgs $args
# Setting default IDE.
set anTarget ""
switch -exact -- "$targetStation" {
"wnt" {set anTarget "$::env(VCVER)"}
- "lin" {set anTarget "amk"}
+ "lin" {set anTarget "cbp"}
"mac" {set anTarget "xcd"}
}
vc10 - Visual Studio 2010
vc11 - Visual Studio 2012
vc12 - Visual Studio 2013
+ vc14 - Visual Studio 2015
cbp - CodeBlocks
- xcd - XCode
- amk - AutoMake"
+ xcd - XCode"
return
}
if {!$isTargetDefault} {
puts "the \'$anTarget\' target has been applied"
}
-
- if {"$anTarget" == "amk"} {
- set targetStation "lin"
- }
+
set anAdmPath "$path/adm"
OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform"
- genprojbat "$anAdmPath" "$anTarget"
+ genprojbat "$anTarget"
}
-proc genprojbat {thePath theIDE} {
- global path
-
- set anOsIncPath "$path/src/OS"
- set anOsRootPath "$path"
-
+proc genprojbat {theIDE} {
set aTargetPlatform "lin"
if { "$::tcl_platform(platform)" == "windows" } {
set aTargetPlatform "wnt"
if {[regexp {(vc)[0-9]*$} $theIDE] == 1} {
set aTargetPlatform wnt
- } elseif {"$theIDE" == "amk"} {
- set aTargetPlatform lin
} elseif {"$theIDE" == "xcd"} {
set aTargetPlatform mac
}
set aTargetPlatformExt bat
}
- set aBox [file normalize "$thePath/.."]
-
if {"$theIDE" != "cmake"} {
- set anEnvTmplFile [open "$path/adm/templates/env.${aTargetPlatformExt}" "r"]
+ set anEnvTmplFile [open "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}" "r"]
set anEnvTmpl [read $anEnvTmplFile]
close $anEnvTmplFile
set aCasRoot ""
- if { [file normalize "$anOsRootPath"] != "$aBox" } {
- set aCasRoot [relativePath "$aBox" "$anOsRootPath"]
+ if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
+ set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
}
- set anOsIncPath [relativePath "$aBox" "$anOsRootPath"]
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
- set anEnvFile [open "$aBox/env.${aTargetPlatformExt}" "w"]
+ set anEnvFile [open "$::path/env.${aTargetPlatformExt}" "w"]
puts $anEnvFile $anEnvTmpl
close $anEnvFile
- file copy -force -- "$path/adm/templates/draw.${aTargetPlatformExt}" "$aBox/draw.${aTargetPlatformExt}"
+ file copy -force -- "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
}
if {[regexp {(vc)[0-9]*$} $theIDE] == 1} {
- file copy -force -- "$path/adm/templates/msvc.bat" "$aBox/msvc.bat"
+ file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
} else {
switch -exact -- "$theIDE" {
- "cbp" { file copy -force -- "$path/adm/templates/codeblocks.sh" "$aBox/codeblocks.sh" }
- "xcd" { file copy -force -- "$path/adm/templates/xcode.sh" "$aBox/xcode.sh" }
+ "cbp" { file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" }
+ "xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" }
}
}
}
# Entry function to generate project files and solutions for IDE
proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } {
global path targetStation
- set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "cbp" "amk" "xcd" }
+ set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
if { [lsearch $aSupportedIDE $theIDE] < 0 } {
puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE\nSupported IDEs: [join ${aSupportedIDE} " "]"
# Create output directory
set aWokStation "$targetStation"
- if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12} $theIDE] != -1 } {
+ if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12 vc14} $theIDE] != -1 } {
set aWokStation "msvc"
}
"vc9" -
"vc10" -
"vc11" -
- "vc12" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
+ "vc12" -
+ "vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution }
- "amk" { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"}
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
}
proc OS:init {{os {}}} {
- global path
- global env
- global tcl_platform
-
- set askplat $os
- if { "$os" == "" } {
- set os $tcl_platform(os)
- }
-
- ;# Load list of OCCT modules and their definitions
- source "$path/src/OS/Modules.tcl"
- set Modules {}
- foreach module [OS:Modules] {
- set f "$path/src/OS/${module}.tcl"
- if [file exists $f] {
- source $f
- lappend Modules $module
- } else {
- puts stderr "Definition file for module $module is not found in unit OS"
- }
+ set askplat $os
+ set aModules {}
+ if { "$os" == "" } {
+ set os $::tcl_platform(os)
+ }
+
+ if [file exists "$::path/src/VAS/Products.tcl"] {
+ source "$::path/src/VAS/Products.tcl"
+ foreach aModuleIter [VAS:Products] {
+ set aFileTcl "$::path/src/VAS/${aModuleIter}.tcl"
+ if [file exists $aFileTcl] {
+ source $aFileTcl
+ lappend aModules $aModuleIter
+ } else {
+ puts stderr "Definition file for module $aModuleIter is not found in unit VAS"
+ }
}
+ return $aModules
+ }
- # Load list of products and their definitions
-# set Products [woklocate -p VAS:source:Products.tcl]
- #if { "$Products" != "" } {
- #source "$Products"
- #foreach product [VAS:Products] {
- #set f [woklocate -p VAS:source:${product}.tcl]
- #if [file exists $f] {
- #source $f
- #} else {
- #puts stderr "Definition file for product $product is not found in unit VAS"
- #}
- #}
- #}
+ # Load list of OCCT modules and their definitions
+ source "$::path/src/OS/Modules.tcl"
+ foreach aModuleIter [OS:Modules] {
+ set aFileTcl "$::path/src/OS/${aModuleIter}.tcl"
+ if [file exists $aFileTcl] {
+ source $aFileTcl
+ lappend aModules $aModuleIter
+ } else {
+ puts stderr "Definition file for module $aModuleIter is not found in unit OS"
+ }
+ }
- return $Modules
+ return $aModules
}
# topological sort. returns a list { {a h} {b g} {c f} {c h} {d i} } => { d a b c i g f h }
set recurse {}
foreach dir $ltk {
set ids [LibToLink $dir]
+# puts "osutils:tk:close($ltk) ids='$ids'"
set eated [osutils:tk:eatpk $ids]
set result [concat $result $eated]
set ids [LibToLink $dir]
set result [concat $result $ids]
foreach file $eated {
- set kds "$path/src/$file/EXTERNLIB"
+ set kds [osutils:findSrcSubPath "$file/EXTERNLIB"]
if { [osutils:tk:eatpk $kds] != {} } {
lappend recurse $file
}
return
}
set aToolkits {}
- set anExtLibList [osutils:tk:eatpk "$path/src/$theTKit/EXTERNLIB"]
+ set anExtLibList [osutils:tk:eatpk [osutils:findSrcSubPath "$theTKit/EXTERNLIB"]]
foreach anExtLib $anExtLibList {
set aFullPath [LocateRecur $anExtLib]
if { "$aFullPath" != "" && [_get_type $anExtLib] == "t" } {
# Search unit recursively
proc LocateRecur {theName} {
- global path
- set theNamePath "$path/src/$theName"
+ set theNamePath [osutils:findSrcSubPath "$theName"]
if {[file isdirectory $theNamePath]} {
return $theNamePath
}
if { [info exists ::env(SHORTCUT_HEADERS)] &&
$::env(SHORTCUT_HEADERS) == "true" } {
# template preparation
- if { ![file exists $aCasRoot/adm/templates/header.in] } {
- puts "template file does not exist: $aCasRoot/adm/templates/header.in"
+ if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
+ puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
return
}
- set aHeaderTmpl [wokUtils:FILES:FileToString $aCasRoot/adm/templates/header.in]
+ set aHeaderTmpl [wokUtils:FILES:FileToString $::THE_CASROOT/adm/templates/header.in]
# relative anIncPath in connection with aCasRoot/src
set aFromBuildIncToSrcPath [relativePath "$anIncPath" "$aCasRoot/src"]
append var \
"Microsoft Visual Studio Solution File, Format Version 13.00\n" \
"# Visual Studio 2013\n"
+ } elseif { "$vcversion" == "vc14" } {
+ append var \
+ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
+ "# Visual Studio 14\n"
} else {
puts stderr "Error: Visual Studio version $vcversion is not supported by this function!"
}
proc osutils:vcproj:ext { vcversion } {
if { "$vcversion" == "vc7" || "$vcversion" == "vc8" || "$vcversion" == "vc9" } {
return "vcproj"
- } elseif { "$vcversion" == "vc10" || "$vcversion" == "vc11" || "$vcversion" == "vc12" } {
- return "vcxproj"
} else {
- puts stderr "Error: Visual Studio version $vc is not supported by this function!"
+ return "vcxproj"
}
}
# Generate start of configuration section of VS solution file
"\t\tRelease = Release\n" \
"\tEndGlobalSection\n" \
"\tGlobalSection(ProjectConfiguration) = postSolution\n"
- } elseif { "$vcversion" == "vc8" || "$vcversion" == "vc9" ||
- "$vcversion" == "vc10" || "$vcversion" == "vc11" ||
- "$vcversion" == "vc12" } {
+ } else {
append var \
"Global\n" \
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" \
"\t\tRelease|x64 = Release|x64\n" \
"\tEndGlobalSection\n" \
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n"
- } else {
- puts stderr "Error: Visual Studio version $vcversion is not supported by this function!"
}
return $var
}
"\t\t$guid.Debug.Build.0 = Debug|Win32\n" \
"\t\t$guid.Release.ActiveCfg = Release|Win32\n" \
"\t\t$guid.Release.Build.0 = Release|Win32\n"
- } elseif { "$vcversion" == "vc8" || "$vcversion" == "vc9" ||
- "$vcversion" == "vc10" || "$vcversion" == "vc11" ||
- "$vcversion" == "vc12" } {
+ } else {
append var \
"\t\t$guid.Debug|Win32.ActiveCfg = Debug|Win32\n" \
"\t\t$guid.Debug|Win32.Build.0 = Debug|Win32\n" \
"\t\t$guid.Debug|x64.Build.0 = Debug|x64\n" \
"\t\t$guid.Release|x64.ActiveCfg = Release|x64\n" \
"\t\t$guid.Release|x64.Build.0 = Release|x64\n"
- } else {
- puts stderr "Error: Visual Studio version $vcversion is not supported by this function!"
}
return $var
}
"\tEndGlobalSection\n" \
"\tGlobalSection(ExtensibilityAddIns) = postSolution\n" \
"\tEndGlobalSection\n"
- } elseif { "$vcversion" == "vc8" || "$vcversion" == "vc9" ||
- "$vcversion" == "vc10" || "$vcversion" == "vc11" ||
- "$vcversion" == "vc12" } {
+ } else {
append var \
"\tEndGlobalSection\n" \
"\tGlobalSection(SolutionProperties) = preSolution\n" \
"\t\tHideSolutionNode = FALSE\n" \
"\tEndGlobalSection\n"
- } else {
- puts stderr "Error: Visual Studio version $vcversion is not supported by this function!"
}
return $var
}
}
# generate template name and load it for given version of Visual Studio and platform
-proc osutils:vcproj:readtemplate {vc isexec} {
- set ext $vc
- set what "$vc"
+proc osutils:vcproj:readtemplate {theVcVer isexec} {
+ set anExt $theVcVer
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
+ set anExt vc10
+ }
+
+ set what "$theVcVer"
+ set aVerExt [string range $theVcVer 2 end]
+ set aVerExt "v${aVerExt}0"
+ set aCmpl32 ""
+ set aCmpl64 ""
if { $isexec } {
- set ext "${ext}x"
+ set anExt "${anExt}x"
set what "$what executable"
}
- return [osutils:readtemplate $ext "MS VC++ project ($what)"]
+ if { "$theVcVer" == "vc10" } {
+ # SSE2 is enabled by default in vc11+, but not in vc10 for 32-bit target
+ set aCmpl32 "\n <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>"
+ }
+ set aTmpl [osutils:readtemplate $anExt "MS VC++ project ($what)"]
+ regsub -all -- {__VCVER__} $aTmpl $theVcVer aTmpl
+ regsub -all -- {__VCVEREXT__} $aTmpl $aVerExt aTmpl
+ regsub -all -- {__VCMPL32__} $aTmpl $aCmpl32 aTmpl
+ regsub -all -- {__VCMPL64__} $aTmpl $aCmpl64 aTmpl
+ return $aTmpl
}
proc osutils:readtemplate {ext what} {
- global env
- global path
- set loc "$path/adm/templates/template.$ext"
+ set loc "$::THE_CASROOT/adm/templates/template.$ext"
return [wokUtils:FILES:FileToString $loc]
}
# Read a file in a string as is.
}
proc osutils:commonUsedTK { theToolKit } {
- global path
set anUsedToolKits [list]
set aDepToolkits [LibToLink $theToolKit]
foreach tkx $aDepToolkits {
set aLibsMap(CSF_advapi32) "advapi32.lib"
set aLibsMap(CSF_gdi32) "gdi32.lib"
set aLibsMap(CSF_user32) "user32.lib"
- set aLibsMap(CSF_glu32) "glu32.lib"
set aLibsMap(CSF_opengl32) "opengl32.lib"
set aLibsMap(CSF_wsock32) "wsock32.lib"
set aLibsMap(CSF_netapi32) "netapi32.lib"
set aLibsMap(CSF_AviLibs) "ws2_32.lib vfw32.lib"
- set aLibsMap(CSF_OpenGlLibs) "opengl32.lib glu32.lib"
+ set aLibsMap(CSF_OpenGlLibs) "opengl32.lib"
set aLibsMap(CSF_QT) "QtCore4.lib QtGui4.lib"
set aFrmsMap(CSF_TclLibs) "Tcl"
set aFrmsMap(CSF_TclTkLibs) "Tk"
} else {
- set aLibsMap(CSF_ThreadLibs) "pthread rt"
- set aLibsMap(CSF_OpenGlLibs) "GLU GL"
- set aLibsMap(CSF_TclLibs) "tcl8.6"
- set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
- set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
- set aLibsMap(CSF_MotifLibs) "X11"
+ if { "$theOS" == "qnx" } {
+ # CSF_ThreadLibs - pthread API is part og libc on QNX
+ set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
+ set aLibsMap(CSF_TclLibs) "tcl8.6"
+ set aLibsMap(CSF_TclTkLibs) "tk8.6"
+ } else {
+ set aLibsMap(CSF_ThreadLibs) "pthread rt"
+ set aLibsMap(CSF_OpenGlLibs) "GL"
+ set aLibsMap(CSF_TclLibs) "tcl8.6"
+ set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
+ set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
+ set aLibsMap(CSF_MotifLibs) "X11"
+ }
}
# optional 3rd-parties
# Generate RC file content for ToolKit from template
proc osutils:readtemplate:rc {theOutDir theToolKit} {
- global path
- set aLoc "$path/adm/templates/template_dll.rc"
+ set aLoc "$::THE_CASROOT/adm/templates/template_dll.rc"
set aBody [wokUtils:FILES:FileToString $aLoc]
regsub -all -- {__TKNAM__} $aBody $theToolKit aBody
# and put this list to project file
#puts "$theToolKit requires $aUsedToolKits"
- if { "$theVcVer" == "vc10" || "$theVcVer" == "vc11" || "$theVcVer" == "vc12" } {
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set aUsedToolKits [join $aUsedToolKits {;}]
}
regsub -all -- {__TKDEP__} $theProjTmpl $aUsedToolKits theProjTmpl
set needparam "$needparam $partopt"
}
- # Format of projects in vc10 and vc11 is different from vc7-9
- if { "$theVcVer" == "vc10" || "$theVcVer" == "vc11" || "$theVcVer" == "vc12" } {
+ # Format of projects in vc10+ is different from vc7-9
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
puts $aFile $theProjTmpl
close $aFile
- # write filters file for vc10 and vc11
- if { "$theVcVer" == "vc10" } {
+ # write filters file for vc10+
+ if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" || "$theVcVer" == "vc9" } {
+ # nothing
+ } elseif { "$theVcVer" == "vc10" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $theToolKit aVcFilesX]
- } elseif { "$theVcVer" == "vc11" || "$theVcVer" == "vc12" } {
+ } else {
lappend aVcFiles [osutils:vcx1proj:filters $theOutDir $theToolKit aVcFilesX]
}
# Call unit filter on units name to accept or reject a unit
# Tfiles lists for each unit the type of file that can be compiled.
proc osutils:tk:files { tkloc {l_compilable {} } {justail 1} {unitfilter {}} } {
- global path
set Tfiles(source,nocdlpack) {source pubinclude}
set Tfiles(source,toolkit) {}
set Tfiles(source,executable) {source pubinclude}
# Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } {
- global path
set aVcFiles {}
foreach f [osutils:tk:files $theToolKit osutils:compilable 0] {
if { $theProjTmpl == {} } {
regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
# puts "$aProjName requires $aUsedToolKits"
- if { "$theVcVer" == "vc10" || "$theVcVer" == "vc11" || "$theVcVer" == "vc12" } {
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set aUsedToolKits [join $aUsedToolKits {;}]
}
regsub -all -- {__TKDEP__} $aProjTmpl $aUsedToolKits aProjTmpl
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
- if { "$theVcVer" == "vc10" || "$theVcVer" == "vc11" || "$theVcVer" == "vc12" } {
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
append aFilesSection [osutils:vcxproj:file $theVcVer $f ""]
if { ! [info exists aVcFilesX($theToolKit)] } { lappend aVcFilesX(units) $theToolKit }
lappend aVcFilesX($theToolKit) $f
lappend aVcFiles $aVcFilePath
# write filters file for vc10
- if { "$theVcVer" == "vc10" || "$theVcVer" == "vc11" || "$theVcVer" == "vc12" } {
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesX]
}
set aCommonSettingsFileTmpl ""
- if { "$theVcVer" == "vc9" } {
- set aCommonSettingsFileTmpl "$path/adm/templates/vcproj.user.vc9x"
- } elseif { "$theVcVer" == "vc10" } {
- set aCommonSettingsFileTmpl "$path/adm/templates/vcxproj.user.vc10x"
- } elseif { "$theVcVer" == "vc11" } {
- set aCommonSettingsFileTmpl "$path/adm/templates/vcxproj.user.vc11x"
- } elseif { "$theVcVer" == "vc12" } {
- set aCommonSettingsFileTmpl "$path/adm/templates/vcxproj.user.vc12x"
+ if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
+ # nothing
+ } elseif { "$theVcVer" == "vc9" } {
+ set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
+ } else {
+ set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
- file copy -force -- "$aCommonSettingsFileTmpl" "$aCommonSettingsFile"
+ regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $theVcVer aCommonSettingsFileTmpl
+
+ set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
+ fconfigure $aFile -translation crlf
+ puts $aFile $aCommonSettingsFileTmpl
+ close $aFile
+
lappend aVcFiles "$aCommonSettingsFile"
}
}
return $aText
}
-### AUTOMAKE ###############################################################################
-proc OS:MKAMK { theOutDir {theModules {}} theSubPath} {
- global path
- wokUtils:FILES:mkdir $theOutDir
-
- foreach aModule $theModules {
- foreach aToolKit [$aModule:toolkits] {
- puts " toolkit: $aToolKit ==> $path/src/$aToolKit/EXTERNLIB"
- wokUtils:FILES:rmdir $theOutDir/$aToolKit
- wokUtils:FILES:mkdir $theOutDir/$aToolKit
- osutils:tk:mkam $theOutDir/$aToolKit $aToolKit
- }
- foreach anExecutable [OS:executable $aModule] {
- wokUtils:FILES:rmdir $theOutDir/$anExecutable
- wokUtils:FILES:mkdir $theOutDir/$anExecutable
- osutils:tk:mkamx $theOutDir/$anExecutable $anExecutable
- }
- }
- osutils:am:adm $theOutDir $theModules
- osutils:am:root $path $theSubPath $theModules
-
- puts "The automake files are stored in the $theOutDir directory"
-}
-
-proc wokUtils:FILES:rmdir { d } {
- global env
- global tcl_platform tcl_version
- regsub -all {\.[^.]*} $tcl_version "" major
- if { $major == 8 } {
- file delete -force $d
- } else {
- if { "$tcl_platform(platform)" == "unix" } {
- catch { exec rm -rf $d}
- } else {
-
- }
- }
- return
-}
-
proc wokUtils:FILES:mkdir { d } {
global tcl_version
regsub -all {\.[^.]*} $tcl_version "" major
}
}
-# "Nice letter: %s" { a b c } => {Nice letter: %a} {Nice letter: %b} ..
-# as a string without backslash
-proc wokUtils:EASY:FmtSimple1 { fmt l {backslh 1} } {
- foreach e $l {
- if { $backslh } {
- append str [format $fmt $e] "\n"
- } else {
- append str [format $fmt $e]
- }
- }
- return $str
-}
-
-# edit_last is performed ONCE fmt has been applied.
-proc wokUtils:EASY:FmtString2 { fmt l {yes_for_last 0} {edit_last {}} } {
- set ldeb [lrange $l 0 [expr [llength $l] -2]]
- set last [lrange $l end end]
- foreach e $ldeb {
- append str [format $fmt $e $e] " \\" "\n"
- }
-
- if {$edit_last != {} } {
- set slast [$edit_last [format $fmt $last $last]]
- } else {
- set slast [format $fmt $last $last]
- }
-
- if { $yes_for_last } {
- append str $slast " \\" "\n"
- } else {
- append str $slast "\n"
- }
-
- return $str
-}
-
-# { a.x b.c c.v } => { a b c}
-proc wokUtils:LIST:sanspoint { l } {
- set rr {}
- foreach x $l {
- lappend rr [file root $x]
- }
- return $rr
-}
-
# remove from listloc OpenCascade units indesirables on Unix
proc osutils:justunix { listloc } {
if { "$::tcl_platform(os)" == "Darwin" } {
return [osutils:juststation $goaway $listloc]
}
-# remove ":" from last item of dependencies list in target VPATH of Makefile.am
-proc osutils:am:__VPATH__lastoccur { str } {
- if { [regsub {:$} $str "" u] != 0 } {
- return $u
- }
-}
-
-# ((((((((((((( Formats in Makefile.am )))))))))))))
-# Used to replace the string __VPATH__ in Makefile.am
-# l is the list of the units in a toolkit.
-proc osutils:am:__VPATH__ { l } {
- set fmt "@top_srcdir@/src/%s:"
- return [wokUtils:EASY:FmtString2 $fmt $l 0 osutils:am:__VPATH__lastoccur]
-}
-
-# Used to replace the string __INCLUDES__ in Makefile.am
-# l is the list of packages in a toolkit.
-proc osutils:am:__INCLUDES__ { l } {
- set fmt "-I@top_srcdir@/src/%s"
- return [wokUtils:EASY:FmtString2 $fmt $l]
-}
-
-# Used to replace the string __LIBADD__ in Makefile.am
-# l is the toolkit closure list of a toolkit.
-proc osutils:am:__LIBADD__ { theIncToolkits {final 0} } {
- global path
- global fBranch
- set aFatherModules ""
- set aCurrentWorkBench [file tail $path]
- if { $fBranch != "" } {
- set fd [open $fBranch/adm/UDLIST rb]
- set fileContent [split [read $fd] "\n"]
- close $fd
- set ftoolkits [lsearch -all -inline $fileContent "t *"]
- foreach ft $ftoolkits {
- set aFatherModules "$aFatherModules [string range $ft 2 end]"
- }
- }
- set aLibString ""
- foreach aIncToolkit $theIncToolkits {
- if { [lsearch [split $aFatherModules " "] $aIncToolkit] != -1} {
- append aLibString " \\\n-l$aIncToolkit"
- } else {
- append aLibString " \\\n../$aIncToolkit/lib$aIncToolkit.la"
- }
- }
- return $aLibString
-}
-
-# Used to replace the string __SOURCES__ in Makefile.am
-# l is the list of all compilable files in a toolkit.
-proc osutils:am:__SOURCES__ { l } {
- set fmt "%s"
- return [wokUtils:EASY:FmtString1 $fmt $l]
-}
-
-proc osutils:am:__CXXFLAG__ { l } {
- set fmt "%s"
- return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCXXOption $l]]
-}
-
-proc osutils:am:PkCXXOption { ppk } {
- global path
- #puts "\t 1 [lindex [wokparam -e %CMPLRS_CXX_Options [wokcd]] 0]"
- set CXXCOMMON [_get_options lin cmplrs_cxx b]
- #puts "\t 2 [wokparam -v %CMPLRS_CXX_Options [w_info -f]]"
- #puts "\t 3 [wokparam -v %CMPLRS_CXX_Options]"
- set FoundFlag "[lindex [osutils:intersect3 [split [_get_options lin cmplrs_cxx f]] [split [_get_options lin cmplrs_cxx b]] ] 2]"
- foreach pk $ppk {
- #puts $pk
- if {![file isdirectory $path/src/$pk]} {
- continue
- }
- set src_files [_get_used_files $pk false]
- set only_src_files {}
- foreach s $src_files {
- regexp {source ([^\s]+)} $s dummy name
- lappend only_src_files $name
- }
- if {[lsearch $only_src_files ${pk}_CMPLRS.edl] != "-1"} {
- set pk_cmplrs_cxx [_get_options lin cmplrs_cxx $pk]
- if {$pk_cmplrs_cxx == ""} {
- set pk_cmplrs_cxx [_get_options lin cmplrs_cxx b]
- }
- set CXXStr $pk_cmplrs_cxx
- #puts "\t 4 [wokparam -e %CMPLRS_CXX_Options [woklocate -u $pk]] $pk"
- set LastIndex [expr {[string length $CXXCOMMON ] - 1}]
- if {[string equal $CXXCOMMON [string range $CXXStr 0 $LastIndex]]} {
- set CXXOption " "
- } else {
- set CXXOption [string range $CXXStr 0 [expr {[string last $CXXCOMMON $CXXStr] - 1}]]
- }
- if {$CXXOption != " " && $CXXOption != "" && $CXXOption != " " && $CXXOption != " "} {
- set FoundList [split $CXXOption " "]
- foreach elem $FoundList {
- if {$elem != ""} {
- if {[string first "-I" $elem] == "-1" } {
- if {[string first $elem $FoundFlag] == "-1"} {
- set FoundFlag "$FoundFlag $elem"
- }
- }
- }
- }
- }
- }
- }
- return $FoundFlag
-}
-
-# Create in dir the Makefile.am associated with toolkit tkloc.
-# Returns the full path of the created file.
-proc osutils:tk:mkam { dir tkloc } {
- global path
- set pkgs $path/src/${tkloc}/PACKAGES
- if { ![file exists $pkgs] } {
- puts stderr "osutils:tk:mkam : Error. File PACKAGES not found for toolkit $tkloc."
- return {}
- }
-
- set tmplat [osutils:readtemplate mam "Makefile.am"]
- set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
- set close [wokUtils:LIST:Purge [osutils:tk:close $tkloc]]
- set lsrc [lsort [osutils:tk:files $tkloc osutils:compilable 1 osutils:justunix]]
- set lobj [wokUtils:LIST:sanspoint $lsrc]
-
- set lcsf [osutils:tk:csfInExternlib $path/src/${tkloc}/EXTERNLIB]
-
- set final 0
- set externinc ""
- set externlib ""
- if { $lcsf != {} } {
- set final 1
- set fmtinc "\$(%s_INCLUDES) "
- set fmtlib "\$(%s_LIB) "
- set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
- set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
- }
-
- regsub -all -- {__TKNAM__} $tmplat $tkloc tmplat
- set vpath [osutils:am:__VPATH__ $lpkgs]
- regsub -all -- {__VPATH__} $tmplat $vpath tmplat
- set inclu [osutils:am:__INCLUDES__ $lpkgs]
- regsub -all -- {__INCLUDES__} $tmplat $inclu tmplat
- if { $close != {} } {
- set libadd [osutils:am:__LIBADD__ $close $final]
- } else {
- set libadd ""
- }
- regsub -all -- {__LIBADD__} $tmplat $libadd tmplat
- set source [osutils:am:__SOURCES__ $lsrc]
- regsub -all -- {__SOURCES__} $tmplat $source tmplat
- regsub -all -- {__EXTERNINC__} $tmplat $externinc tmplat
- set CXXFl [osutils:am:__CXXFLAG__ $lpkgs]
- regsub -all -- {__CXXFLAG__} $tmplat $CXXFl tmplat
- set CFl [osutils:am:__CFLAG__ $lpkgs]
- regsub -all -- {__CFLAG__} $tmplat $CFl tmplat
-
- regsub -all -- {__EXTERNLIB__} $tmplat $externlib tmplat
-
- wokUtils:FILES:StringToFile $tmplat [set fmam [file join $dir Makefile.am]]
- return [list $fmam]
-}
-
-# Write a string in a file
-proc wokUtils:FILES:StringToFile { str path } {
- if { [catch { set out [ open $path w ] } errout] == 0 } {
- puts -nonewline $out $str
- close $out
- return 1
- } else {
- return {}
- }
-}
-
-# Create in dir the Makefile.am associated with toolkit tkloc.
-# Returns the full path of the created file.
-proc osutils:tk:mkamx { dir tkloc } {
- global path
- set src_files [_get_used_files $tkloc false]
- set only_src_files {}
- foreach s $src_files {
- regexp {source ([^\s]+)} $s dummy name
- lappend only_src_files $name
- }
- if { [lsearch $only_src_files ${tkloc}_WOKSteps.edl] != "-1"} {
- set pkgs "$path/src/${tkloc}/EXTERNLIB"
- if { $pkgs == {} } {
- puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."
- #return {}
- }
- set tmplat [osutils:readtemplate mamx "Makefile.am (executable)"]
- set close [wokUtils:LIST:Purge [osutils:tk:close $tkloc]]
- set lsrc [lsort [osutils:tk:files $tkloc osutils:compilable 1 osutils:justunix]]
- set lobj [wokUtils:LIST:sanspoint $lsrc]
- set CXXList {}
- foreach SourceFile $only_src_files {
- if {[file extension $SourceFile] == ".cxx"} {
- lappend CXXList [file rootname $SourceFile]
- }
- }
- set pkgs [LibToLinkX $tkloc [lindex $CXXList 0]]
- set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
- puts "pkgs $pkgs"
- #set lcsf [osutils:tk:csfInExternlib [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]
-
- set lcsf {}
- foreach tk $pkgs {
- foreach element [osutils:tk:csfInExternlib "$path/src/${tk}/EXTERNLIB"] {
- if {[lsearch $lcsf $element] == "-1"} {
- set lcsf [concat $lcsf $element]
- }
- }
- }
- set final 0
- set externinc ""
- set externlib ""
- if { $lcsf != {} } {
- set final 1
- set fmtinc "\$(%s_INCLUDES) "
- set fmtlib "\$(%s_LIB) "
- set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
- set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
- }
- regsub -all -- {__XQTNAM__} $tmplat $tkloc tmplat
- set tmplat "$tmplat \nlib_LTLIBRARIES="
- foreach entity $CXXList {
- set tmplat "$tmplat lib${entity}.la"
- }
- set tmplat "$tmplat\n"
- set inclu [osutils:am:__INCLUDES__ $lpkgs]
- regsub -all -- {__INCLUDES__} $tmplat $inclu tmplat
- if { $pkgs != {} } {
- set libadd [osutils:am:__LIBADD__ $pkgs $final]
- } else {
- set libadd ""
- }
- regsub -all -- {__LIBADD__} $tmplat $libadd tmplat
- set source [osutils:am:__SOURCES__ $CXXList]
- regsub -all -- {__SOURCES__} $tmplat $source tmplat
- regsub -all -- {__EXTERNINC__} $tmplat $externinc tmplat
- foreach entity $CXXList {
- set tmplat "$tmplat lib${entity}_la_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"
- }
- foreach entity $CXXList {
- set tmplat "$tmplat lib${entity}_la_LIBADD = $libadd $externlib \n"
- }
- wokUtils:FILES:StringToFile $tmplat [set fmam [file join $dir Makefile.am]]
-
- unset tmplat
-
- return [list $fmam]
-
- } else {
- set pkgs "$path/src/${tkloc}/EXTERNLIB"
- if { $pkgs == {} } {
- puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."
- #return {}
- }
- set tmplat [osutils:readtemplate mamx "Makefile.am (executable)"]
- set close [wokUtils:LIST:Purge [osutils:tk:close $tkloc]]
- set lsrc [lsort [osutils:tk:files $tkloc osutils:compilable 1 osutils:justunix]]
- set lobj [wokUtils:LIST:sanspoint $lsrc]
- set CXXList {}
- foreach SourceFile $only_src_files {
- if {[file extension $SourceFile] == ".cxx"} {
- lappend CXXList [file rootname $SourceFile]
- }
- }
- set pkgs [LibToLinkX $tkloc [lindex $CXXList 0]]
- set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
- set lcsf [osutils:tk:csfInExternlib "$path/src/${tkloc}/EXTERNLIB"]
-
- set lcsf {}
- foreach tk $pkgs {
- foreach element [osutils:tk:csfInExternlib "$path/src/${tk}/EXTERNLIB"] {
- if {[lsearch $lcsf $element] == "-1"} {
- set lcsf [concat $lcsf $element]
- }
- }
- }
- set final 0
- set externinc ""
- set externlib ""
- if { $lcsf != {} } {
- set final 1
- set fmtinc "\$(%s_INCLUDES) "
- set fmtlib "\$(%s_LIB) "
- set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
- set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
- }
- regsub -all -- {__XQTNAM__} $tmplat $tkloc tmplat
- set tmplat "$tmplat \nbin_PROGRAMS="
- foreach entity $CXXList {
- set tmplat "${tmplat} ${entity}"
- }
-
- set tmplat "${tmplat}\n"
- set inclu [osutils:am:__INCLUDES__ $lpkgs]
- regsub -all -- {__INCLUDES__} $tmplat $inclu tmplat
- if { $pkgs != {} } {
- set libadd [osutils:am:__LIBADD__ $pkgs $final]
- } else {
- set libadd ""
- }
- set source [osutils:am:__SOURCES__ $CXXList]
- regsub -all -- {__SOURCES__} $tmplat $source tmplat
- regsub -all -- {__EXTERNINC__} $tmplat $externinc tmplat
- foreach entity $CXXList {
- set tmplat "$tmplat ${entity}_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"
- }
- foreach entity $CXXList {
- set tmplat "$tmplat ${entity}_LDADD = $libadd $externlib \n"
- }
- wokUtils:FILES:StringToFile $tmplat [set fmam [file join $dir Makefile.am]]
-
- return [list $fmam]
- }
-}
-
-# Create in dir the Makefile.am in $dir directory.
-# Returns the full path of the created file.
-proc osutils:am:adm { dir {lesmodules {}} } {
- set amstring "srcdir = @srcdir@\n\n"
- set subdirs "SUBDIRS ="
- set vpath "VPATH = @srcdir@ ${dir}: "
- set make ""
- set phony ".PHONY:"
- foreach theModule $lesmodules {
- set units [osutils:tk:sort [$theModule:toolkits]]
- set units [concat $units [OS:executable $theModule]]
- append amstring "${theModule}_PKGS ="
- append vpath "\\\n"
- foreach unit $units {
- append amstring " ${unit}"
- append vpath "${dir}/${unit}: "
- }
- set up ${theModule}
- if { [info procs ${theModule}:alias] != "" } {
- set up [${theModule}:alias]
- }
- set up [string toupper ${up}]
- append amstring "\n\nif ENABLE_${up}\n"
- append amstring " ${theModule}_DIRS = \$(${theModule}_PKGS)\n"
- append amstring "else\n"
- append amstring " ${theModule}_DIRS = \n"
- append amstring "endif\n\n"
- append subdirs " \$(${theModule}_DIRS)"
- append make "${theModule}:\n"
- append make "\tfor d in \$(${theModule}_PKGS); do \\\n"
- append make "\t\tcd \$\$d; \$(MAKE) \$(AM_MAKEFLAGS) lib\$\$d.la; cd ..; \\\n"
- append make "\tdone\n\n"
- append phony " ${theModule}"
- }
- append amstring "$subdirs\n\n"
- append amstring "$vpath\n\n"
- append amstring $make
- append amstring $phony
- wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
- return [list $fmam]
-}
-
-# retourne la liste de dependances de module.
-proc OS:lsdep { m } {
- set res {}
- set l [${m}:depends]
- if { $l != {} } {
- set res [concat $res $l]
- foreach h $l {
- set res [concat $res [OS:lsdep ${h}]]
- }
- }
- return $res
-}
-
-# Create in dir the Makefile.am and configure.ac in CASROOT directory.
-# Returns the full path of the created file.
-proc osutils:am:root { dir theSubPath {lesmodules {}} } {
- global path
- set amstring "srcdir = @srcdir@\n\n"
- append amstring "SUBDIRS = ${theSubPath}\n\n"
- append amstring "VPATH = @srcdir@ @top_srcdir@/${theSubPath}: @top_srcdir@/${theSubPath}:\n\n"
-
- set phony ".PHONY:"
-
- set acstring [osutils:readtemplate ac "Makefile.am"]
- set enablestr ""
- set confstr ""
- set condstr ""
- set repstr ""
- set acconfstr ""
-
- set exelocal "install-exec-local:\n"
- append exelocal "\t"
- append exelocal {$(INSTALL) -d $(prefix)/$(platform)}
- append exelocal "\n"
- foreach d {bin lib} {
- append exelocal "\t"
- append exelocal "if \[ -e \$(prefix)/${d} -a ! -e \$(prefix)/\$(platform)/${d} \]; then \\\n"
- append exelocal "\t\tcd \$(prefix)/\$(platform) && ln -s ../${d} ${d}; \\\n"
- append exelocal "\tfi\n"
- }
- append exelocal "\t"
- append exelocal {buildd=`pwd`; cd $(top_srcdir); sourced=`pwd`; cd $(prefix); installd=`pwd`; cd $$buildd;}
- append exelocal " \\\n"
- append exelocal "\t"
- append exelocal {if [ "$$installd" != "$$sourced" ]; then}
- append exelocal " \\\n"
- append exelocal "\t\t"
- append exelocal {$(INSTALL) -d $(prefix)/src;}
- append exelocal " \\\n"
- append exelocal "\t\t"
- append exelocal {cp -frL $(top_srcdir)/src $(prefix);}
- append exelocal " \\\n"
- append exelocal "\t\t"
- append exelocal {cp -frL $$buildd/config.h $(prefix);}
- append exelocal " \\\n"
- append exelocal "\t\tfor d in "
-
- foreach theModule $lesmodules {
- append amstring "${theModule}_PKGS ="
- foreach r [${theModule}:ressources] {
- if { "[lindex $r 1]" == "r" } {
- append amstring " [lindex $r 2]"
- }
- }
- set up ${theModule}
- if { [info procs ${theModule}:alias] != "" } {
- set up [${theModule}:alias]
- }
- set up [string toupper ${up}]
- set lower ${theModule}
- if { [info procs ${theModule}:alias] != "" } {
- set lower [${theModule}:alias]
- }
- set lower [string tolower ${lower}]
-
- append amstring "\n\nif ENABLE_${up}\n"
- append amstring " ${theModule}_DIRS = \$(${theModule}_PKGS)\n"
- append amstring "else\n"
- append amstring " ${theModule}_DIRS = \n"
- append amstring "endif\n\n"
- append amstring "${theModule}:\n"
- append amstring "\tcd \$(top_builddir)/${theSubPath} && \$(MAKE) \$(AM_MAKEFLAGS) ${theModule}\n\n"
- append phony " ${theModule}"
-
- append exelocal " \$(${theModule}_DIRS)"
-
- append enablestr "AC_ARG_ENABLE(\[${lower}\],\n"
- append enablestr " \[AS_HELP_STRING(\[--disable-${lower}\],\[Disable ${theModule} components\])\],\n"
- append enablestr " \[ENABLE_${up}=\${enableval}\],\[ENABLE_${up}=yes\])\n"
-
- set deplist [OS:lsdep ${theModule}]
- set acdeplist {}
- if { [info procs ${theModule}:acdepends] != "" } {
- set acdeplist [${theModule}:acdepends]
- }
-
- if { [llength $deplist] > 0 || [llength $acdeplist] > 0} {
- append confstr "if test \"xyes\" = \"x\$ENABLE_${up}\"; then\n"
- } else {
- append confstr "if test \"xyes\" != \"x\$ENABLE_${up}\"; then\n"
- }
- foreach dep $deplist {
- set dup ${dep}
- if { [info procs ${dep}:alias] != "" } {
- set dup [${dep}:alias]
- }
- set dup [string toupper ${dup}]
- append confstr " if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$ENABLE_${dup}\"; then\n"
- append confstr " AC_MSG_NOTICE(\[Disabling ${theModule}: not building ${dep} component\])\n"
- append confstr " DISABLE_${up}_REASON=\"(${dep} component disabled)\"\n"
- append confstr " ENABLE_${up}=no\n"
- append confstr " fi\n"
- }
- foreach dep $acdeplist {
- append confstr " if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$HAVE_${dep}\"; then\n"
- append confstr " AC_MSG_NOTICE(\[Disabling ${theModule}: ${dep} not found\])\n"
- append confstr " DISABLE_${up}_REASON=\"(${dep} not found)\"\n"
- append confstr " ENABLE_${up}=no\n"
- append confstr " fi\n"
- }
- if { [llength $deplist] > 0 || [llength $acdeplist] > 0 } {
- append confstr "else\n"
- }
- append confstr " DISABLE_${up}_REASON=\"(Disabled)\"\n"
- append confstr "fi\n"
-
- append condstr "AM_CONDITIONAL(\[ENABLE_${up}\], \[test \"xyes\" = \"x\$ENABLE_${up}\"\])\n"
- append repstr [format "echo \"%-*s \$ENABLE_${up} \$DISABLE_${up}_REASON\"" 26 ${theModule}]
- append repstr "\n"
-
- set units [$theModule:toolkits]
- set units [concat $units [OS:executable $theModule]]
- foreach unit $units {
- append acconfstr "${theSubPath}/${unit}/Makefile \\\n"
- }
- }
-
- append exelocal "; do \\\n"
- append exelocal "\t\t\t"
- append exelocal {$(INSTALL) -d $(prefix)/src/$$d;}
- append exelocal " \\\n"
- append exelocal "\t\t\t"
- append exelocal {cp -frL $(top_srcdir)/src/$$d $(prefix)/src;}
- append exelocal " \\\n"
- append exelocal "\t\tdone; \\\n"
- append exelocal "\tfi\n"
- append exelocal "\t"
- append exelocal {if [ -e $(prefix)/src/config.h ]; then}
- append exelocal " \\\n"
- append exelocal "\t\t"
- append exelocal {unlink $(prefix)/src/config.h;}
- append exelocal " \\\n"
- append exelocal "\tfi\n"
- append exelocal "\t"
- append exelocal {cd $(prefix)/src && ln -s ../config.h config.h}
- append exelocal "\n"
- append exelocal "\t"
- append exelocal {cd $(top_srcdir) && cp *.sh $(prefix)}
- append exelocal "\n"
- append exelocal "\n"
-
- append amstring $exelocal
- append amstring $phony
-
- regsub -all -- {__ENABLEMODULES__} $acstring $enablestr acstring
- regsub -all -- {__CONFMODULES__} $acstring $confstr acstring
- regsub -all -- {__CONDMODULES__} $acstring $condstr acstring
- regsub -all -- {__REPMODULES__} $acstring $repstr acstring
- regsub -all -- {__ACCONFMODULES__} $acstring $acconfstr acstring
-
- wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
- wokUtils:FILES:StringToFile $acstring [set fmam [file join $dir configure.ac]]
- file copy -force -- [file join $path/adm/templates build_configure] [file join $dir build_configure]
- file copy -force -- [file join $path/adm/templates acinclude.m4] [file join $dir acinclude.m4]
- file copy -force -- [file join $path/adm/templates custom.sh.in] [file join $dir custom.sh.in]
- return [list $fmam]
-}
-
-proc wokUtils:EASY:FmtString1 { fmt l {yes_for_last 0} {edit_last {}} } {
- set ldeb [lrange $l 0 [expr [llength $l] -2]]
- set last [lrange $l end end]
- foreach e $ldeb {
- append str [format $fmt $e] " \\" "\n"
- }
-
- if {$edit_last != {} } {
- set slast [$edit_last [format $fmt $last]]
- } else {
- set slast [format $fmt $last]
- }
-
- if { $yes_for_last } {
- append str $slast " \\" "\n"
- } else {
- append str $slast "\n"
- }
- return $str
-}
-
-# Used to replace the string __CFLAG__ in Makefile.am
-# l is the list of all compilable files in a toolkit.
-proc osutils:am:__CFLAG__ { l } {
- set fmt "%s"
- return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCOption $l]]
-}
-
-proc osutils:am:PkCOption { ppk } {
- global path
- #puts "\t\t $ppk"
- #puts "\t 5 [lindex [wokparam -e %CMPLRS_C_Options [wokcd]] 0]"
- set CCOMMON [_get_options lin cmplrs_c b]
- #puts "\t 6 [lindex [wokparam -v %CMPLRS_C_Options [w_info -f]] 0]"
- set FoundFlag "[lindex [osutils:intersect3 [split [_get_options lin cmplrs_c f]] [split [_get_options lin cmplrs_c b]]] 2]"
- foreach pk $ppk {
- if {![file isdirectory $path/src/$pk]} {
- continue
- }
- set src_files [_get_used_files $pk false]
- set only_src_files {}
- foreach s $src_files {
- regexp {source ([^\s]+)} $s dummy name
- lappend only_src_files $name
- }
- if {[lsearch $src_files ${pk}_CMPLRS.edl] != "-1"} {
- #puts "\t 7 [lindex [wokparam -e %CMPLRS_C_Options [woklocate -u $pk]] 0] $pk"
- set aPkList [split "[_get_options lin cmplrs_c $pk]" " "]
- set aCcomList [split "$CCOMMON" " "]
-
- foreach aPkItem $aPkList {
- if { [lsearch aCcomList $aPkItem] != -1 } {
- if {[string first "-I" $aPkItem] == "-1" } {
- set FoundFlag "$FoundFlag $aPkItem"
- }
- }
- }
- }
- }
- return $FoundFlag
-}
-
-proc osutils:tksrcfiles { theUnits theRelatedPath {theCompatible {}} } {
- set aTKSrcFiles [list]
-
- if [array exists written] { unset written }
- foreach anUnit $theUnits {
- set xlo $anUnit
- set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
-
- if { $theCompatible != {} } {
- set aSrcFiles [osutils:tk:files $xlo $theCompatible 0]
- }
-
- foreach aSrcFile [lsort $aSrcFiles] {
- if { ![info exists written([file tail $aSrcFile])] } {
- set written([file tail $aSrcFile]) 1
- lappend aTKSrcFiles "${theRelatedPath}/[wokUtils:FILES:wtail $aSrcFile 3]"
- } else {
- puts "Warning : more than one occurences for [file tail $aSrcFile]"
- }
- }
- }
-
- return $aTKSrcFiles
-}
-
-proc osutils:mm_compilable { } {
- return [list .mm]
-}
-
-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
-}
-
####### CODEBLOCK ###################################################################
# Function to generate Code Blocks workspace and project files
lappend anIncPaths "../../../inc"
# extra macros
- lappend aTKDefines "CSFDB"
if { "$aWokStation" == "wnt" } {
- lappend aTKDefines "WNT"
lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
} else {
- if { "$aWokStation" == "lin" } {
- lappend aTKDefines "LIN"
- }
lappend aTKDefines "OCC_CONVERT_SIGNALS"
#lappend aTKDefines "_GNU_SOURCE=1"
}
# Release target configuration
puts $aFile "\t\t\t<Target title=\"Release\">"
if { "$theIsExe" == "true" } {
- puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bin/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bin/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
- puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/lib${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
} else {
puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
}
- puts $aFile "\t\t\t\t<Option createDefFile=\"1\" />"
- puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
+ puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
+ puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
} else {
puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
+ if { "$aWokStation" != "qnx" } {
+ puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
+ }
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
puts $aFile "\t\t\t\t\t<Add option=\"-DNDEBUG\" />"
+ if { "$aWokStation" == "qnx" } {
+ puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
+ }
puts $aFile "\t\t\t\t\t<Add option=\"-DNo_Exception\" />"
puts $aFile "\t\t\t\t</Compiler>"
# Debug target configuration
puts $aFile "\t\t\t<Target title=\"Debug\">"
if { "$theIsExe" == "true" } {
- puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bind/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bind/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$aWokStation" == "wnt" } {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
- puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/lib${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
} else {
puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
}
- puts $aFile "\t\t\t\t<Option createDefFile=\"1\" />"
- puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
+ puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
+ puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
} else {
puts $aFile "\t\t\t\t\t<Add option=\"-O0\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
puts $aFile "\t\t\t\t\t<Add option=\"-g\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
+ if { "$aWokStation" != "qnx" } {
+ puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
+ }
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
puts $aFile "\t\t\t\t\t<Add option=\"-D_DEBUG\" />"
+ if { "$aWokStation" == "qnx" } {
+ puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
+ }
puts $aFile "\t\t\t\t\t<Add option=\"-DDEB\" />"
puts $aFile "\t\t\t\t</Compiler>"
}
# extra macros
- lappend aTKDefines "CSFDB"
if { "$aWokStation" == "wnt" } {
- lappend aTKDefines "WNT"
lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
} else {
- if { "$aWokStation" == "lin" } {
- lappend aTKDefines "LIN"
- }
lappend aTKDefines "OCC_CONVERT_SIGNALS"
#lappend aTKDefines "_GNU_SOURCE=1"
}
# Generates dependencies section for Xcode project files.
proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids theIsStatic} {
- global path
upvar $theGuidsMap aGuidsMap
upvar $theFileRefSection aFileRefSection
upvar $theDepsGuids aDepsGuids
set anExecExtension "\t\t\t\tEXECUTABLE_EXTENSION = dylib;"
set anExecPrefix "\t\t\t\tEXECUTABLE_PREFIX = lib;"
set aWrapperExtension "\t\t\t\tWRAPPER_EXTENSION = dylib;"
- set aTKDefines [list "CSFDB" "OCC_CONVERT_SIGNALS"]
+ set aTKDefines [list "OCC_CONVERT_SIGNALS"]
if { "$theTargetType" == "executable" } {
set aPBXBuildPhase "CopyFiles"
puts $aPlistFile $aPlistTmpl
close $aPlistFile
}
-
-# launch generation
-genproj {*}$::argv