set THE_CASROOT ""
set fBranch ""
if { [info exists ::env(CASROOT)] } {
- set THE_CASROOT "$::env(CASROOT)"
+ set THE_CASROOT [file normalize "$::env(CASROOT)"]
}
proc _get_options { platform type branch } {
}
# Wrapper-function to generate VS project files
-proc genproj {theIDE args} {
- set aSupportedIDEs { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
- set aSupportedPlatforms { "wnt" "lin" "mac" "ios" "qnx" }
+proc genproj {theFormat args} {
+ set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "cbp" "xcd"}
+ set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false
- # check IDE argument
- if { $theIDE == "-h" || $theIDE == "-help" || $theIDE == "--help" } {
+ # check format argument
+ if { $theFormat == "-h" || $theFormat == "-help" || $theFormat == "--help" } {
set isHelpRequire true
- } elseif { [lsearch -exact $aSupportedIDEs $theIDE] < 0 } {
- puts "Error: genproj: unrecognized IDE \"$theIDE\""
+ } elseif { [lsearch -exact $aSupportedFormats $theFormat] < 0 } {
+ puts "Error: genproj: unrecognized project format \"$theFormat\""
set isHelpRequire true
}
set aCmpl "gcc"
# Determine default platform: wnt for vc*, mac for xcd, current for cbp
- if { [regexp "^vc" $theIDE] } {
+ if { [regexp "^vc" $theFormat] } {
set aPlatform "wnt"
- } elseif { $theIDE == "xcd" || $::tcl_platform(os) == "Darwin" } {
+ } elseif { $theFormat == "xcd" || $::tcl_platform(os) == "Darwin" } {
set aPlatform "mac"
} elseif { $::tcl_platform(platform) == "windows" } {
set aPlatform "wnt"
}
if { $isHelpRequire == true } {
- puts "usage: genproj IDE \[Platform\] \[-static\] \[-h|-help|--help\]
-
- IDE must be one of:
- vc8 - Visual Studio 2005
- vc9 - Visual Studio 2008
- vc10 - Visual Studio 2010
- vc11 - Visual Studio 2012
- vc12 - Visual Studio 2013
- vc14 - Visual Studio 2015
- cbp - CodeBlocks
- xcd - XCode
-
- Platform (optional, only for CodeBlocks and XCode):
- wnt - Windows
+ puts "usage: genproj Format \[Platform\] \[-static\] \[-h|-help|--help\]
+
+ Format must be one of:
+ vc8 - Visual Studio 2005
+ vc9 - Visual Studio 2008
+ vc10 - Visual Studio 2010
+ vc11 - Visual Studio 2012
+ vc12 - Visual Studio 2013
+ vc14 - Visual Studio 2015
+ vc141 - Visual Studio 2017
+ cbp - CodeBlocks
+ xcd - XCode
+
+ Platform (optional):
+ wnt - Windows Desktop
+ uwp - Universal Windows Platform
lin - Linux
mac - OS X
ios - iOS
return
}
- puts "Preparing to generate $theIDE projects for $aPlatform platform..."
+ puts "Preparing to generate $theFormat projects for $aPlatform platform..."
- # path to where to generate projects, hardcoded from current dir
+ # base path to where to generate projects, hardcoded from current dir
set anAdmPath [file normalize "${::path}/adm"]
- OS:MKPRC "$anAdmPath" "$theIDE" "$aLibType" "$aPlatform" "$aCmpl"
+ OS:MKPRC "$anAdmPath" "$theFormat" "$aLibType" "$aPlatform" "$aCmpl"
- genprojbat "$theIDE" $aPlatform
+ genprojbat "$theFormat" "$aPlatform"
genAllResources
}
-proc genprojbat {theIDE thePlatform} {
+# copy file providing warning if the target file exists and has
+# different date or size; if it is newer than source, save it as .bak
+proc copy_with_warning {from to} {
+ if { [file exists "$to"] &&
+ ([file size "$to"] != [file size "$from"] ||
+ [file mtime "$to"] != [file mtime "$from"]) } {
+ puts "Warning: file $to is updated (copied from $from)!"
+ if { [file mtime $to] > [file mtime $from] } {
+ puts "Info: old content of file $to is saved in ${to}.bak"
+ file copy -force -- "$to" "${to}.bak"
+ }
+ }
+
+ file copy -force -- "$from" "$to"
+}
+
+proc genprojbat {theFormat thePlatform} {
set aTargetPlatformExt sh
- if { $thePlatform == "wnt" } {
+ if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
set aTargetPlatformExt bat
}
- if {"$theIDE" != "cmake"} {
+ if {"$theFormat" != "cmake"} {
# copy env.bat/sh only if not yet present
if { ! [file exists "$::path/env.${aTargetPlatformExt}"] } {
set anEnvTmplFile [open "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}" "r"]
close $anEnvFile
}
- file copy -force -- "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
+ copy_with_warning "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
}
- if {[regexp {(vc)[0-9]*$} $theIDE] == 1} {
- file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
+ if { [regexp {^vc} $theFormat] } {
+ copy_with_warning "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
} else {
- switch -exact -- "$theIDE" {
+ switch -exact -- "$theFormat" {
"cbp" {
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh"
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat"
set aTKNullKey "TKNull"
set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
-# Entry function to generate project files and solutions for IDE
+# Entry function to generate project files
# @param theOutDir Root directory for project files
-# @param theIDE IDE code name (vc10 for Visual Studio 2010, cbp for Code::Blocks, xcd for XCode)
+# @param theFormat Project format name (vc.. for Visual Studio projects, cbp for Code::Blocks, xcd for XCode)
# @param theLibType Library type - dynamic or static
# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS
# @param theCmpl Compiler option (msvc or gcc)
-proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
+proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
global path
set anOutRoot $theOutDir
if { $anOutRoot == "" } {
# Create output directory
set aWokStation "$thePlatform"
- if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12 vc14} $theIDE] != -1 } {
+ if { [regexp {^vc} $theFormat] } {
set aWokStation "msvc"
}
-
- set anOutDir "${anOutRoot}/${aWokStation}/${theIDE}"
+ set aSuffix ""
+ set isUWP 0
+ if { $thePlatform == "uwp" } {
+ set aSuffix "-uwp"
+ set isUWP 1
+ }
+ set anOutDir "${anOutRoot}/${aWokStation}/${theFormat}${aSuffix}"
# read map of already generated GUIDs
- set aGuidsFilePath [file join $anOutDir "wok_${theIDE}_guids.txt"]
+ set aGuidsFilePath [file join $anOutDir "wok_${theFormat}_guids.txt"]
if [file exists "$aGuidsFilePath"] {
set aFileIn [open "$aGuidsFilePath" r]
set aFileDataRaw [read $aFileIn]
set aModules [osutils:juststation $goaway $aModules]
}
+ # Draw module is turned off due to it is not supported on UWP
+ if { $isUWP } {
+ set aDrawIndex [lsearch -exact ${aModules} "Draw"]
+ if { ${aDrawIndex} != -1 } {
+ set aModules [lreplace ${aModules} ${aDrawIndex} ${aDrawIndex}]
+ }
+ }
+
# generate one solution for all projects if complete OS or VAS is processed
set anAllSolution "OCCT"
puts "Collecting required header files into $path/inc ..."
osutils:collectinc $aModules $path/inc
- # Generating project files for the selected IDE
- switch -exact -- "$theIDE" {
+ # Generating project files for the selected format
+ switch -exact -- "$theFormat" {
"vc7" -
"vc8" -
"vc9" -
- "vc10" -
- "vc11" -
- "vc12" -
- "vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
- "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
- "xcd" {
+ "vc10" -
+ "vc11" -
+ "vc12" -
+ "vc14" -
+ "vc141" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
+ "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
+ "xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
}
}
# Function to generate Visual Studio solution and project files
-proc OS:MKVC { theOutDir {theModules {}} {theAllSolution ""} {theVcVer "vc8"} } {
+proc OS:MKVC { theOutDir theModules theAllSolution theVcVer isUWP } {
puts stderr "Generating VS project files for $theVcVer"
# generate projects for toolkits and separate solution for each module
foreach aModule $theModules {
OS:vcsolution $theVcVer $aModule $aModule $theOutDir ::THE_GUIDS_LIST
- OS:vcproj $theVcVer $aModule $theOutDir ::THE_GUIDS_LIST
+ OS:vcproj $theVcVer $isUWP $aModule $theOutDir ::THE_GUIDS_LIST
}
# generate single solution "OCCT" containing projects from all modules
return ""
}
-proc OS:genGUID { {theIDE "vc"} } {
- if { "$theIDE" == "vc" } {
+proc OS:genGUID { {theFormat "vc"} } {
+ if { "$theFormat" == "vc" } {
set p1 "[format %07X [expr { int(rand() * 268435456) }]][format %X [expr { int(rand() * 16) }]]"
set p2 "[format %04X [expr { int(rand() * 6536) }]]"
set p3 "[format %04X [expr { int(rand() * 6536) }]]"
}
}
+ set allHeaderFiles {}
if { $aCopyType == "shortcut" } {
# template preparation
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
# create and copy short-cut header files
foreach anUnit $anUnits {
- set aHFiles [glob -nocomplain -dir $aCasRoot/src/$anUnit "*.h"]
- foreach aHeaderFile [concat [glob -nocomplain -dir $aCasRoot/src/$anUnit "*.\[hgl\]xx"] $aHFiles] {
- set aHeaderFileName [file tail $aHeaderFile]
+ osutils:checksrcfiles ${anUnit}
+
+ set aHFiles [_get_used_files ${anUnit} true false]
+ foreach aHeaderFile ${aHFiles} {
+ set aHeaderFileName [lindex ${aHeaderFile} 1]
+ lappend allHeaderFiles "${aHeaderFileName}"
regsub -all -- {@OCCT_HEADER_FILE_CONTENT@} $aHeaderTmpl "#include \"$aFromBuildIncToSrcPath/$anUnit/$aHeaderFileName\"" aShortCutHeaderFileContent
} else {
set nbcopied 0
foreach anUnit $anUnits {
- set aHFiles [glob -nocomplain -dir $aCasRoot/src/$anUnit "*.h"]
- foreach aHeaderFile [concat [glob -nocomplain -dir $aCasRoot/src/$anUnit "*.\[hgl\]xx"] $aHFiles] {
- set aHeaderFileName [file tail $aHeaderFile]
+ osutils:checksrcfiles ${anUnit}
+
+ set aHFiles [_get_used_files ${anUnit} true false]
+ foreach aHeaderFile ${aHFiles} {
+ set aHeaderFileName [lindex ${aHeaderFile} 1]
+ lappend allHeaderFiles "${aHeaderFileName}"
# copy file only if target does not exist or is older than original
- set torig [file mtime $aHeaderFile]
+ set torig [file mtime $aCasRoot/src/$anUnit/$aHeaderFileName]
set tcopy 0
if { [file isfile $anIncPath/$aHeaderFileName] } {
set tcopy [file mtime $anIncPath/$aHeaderFileName]
if { $tcopy != 0 } {
file delete -force "$theIncPath/$aHeaderFileName"
}
- file link -hard $anIncPath/$aHeaderFileName $aHeaderFile
+ file link -hard $anIncPath/$aHeaderFileName $aCasRoot/src/$anUnit/$aHeaderFileName
} else {
- file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
+ file copy -force $aCasRoot/src/$anUnit/$aHeaderFileName $anIncPath/$aHeaderFileName
}
} elseif { $tcopy != $torig } {
- puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aHeaderFile, not changed!"
+ puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aCasRoot/src/$anUnit/$aHeaderFileName, not changed!"
}
}
}
puts "Info: $nbcopied files updated"
}
+
+ # remove header files not listed in FILES
+ set anIncFiles [glob -tails -nocomplain -dir ${anIncPath} "*"]
+ foreach anIncFile ${anIncFiles} {
+ if { [lsearch -exact ${allHeaderFiles} ${anIncFile}] == -1 } {
+ puts "Warning: file ${anIncPath}/${anIncFile} is not presented in the sources and will be removed from ${theIncPath}!"
+ file delete -force "${theIncPath}/${anIncFile}"
+ }
+ }
}
# Generate header for VS solution file
"# Visual Studio 2012\n"
} elseif { "$vcversion" == "vc12" } {
append var \
- "Microsoft Visual Studio Solution File, Format Version 13.00\n" \
+ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n"
- } elseif { "$vcversion" == "vc14" } {
+ } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141"} {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n"
}
# Generate Visual Studio projects for specified version
-proc OS:vcproj { theVcVer theModules theOutDir theGuidsMap } {
+proc OS:vcproj { theVcVer isUWP theModules theOutDir theGuidsMap } {
upvar $theGuidsMap aGuidsMap
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
- lappend aProjectFiles [osutils:vcproj $theVcVer $theOutDir $aToolKit aGuidsMap]
+ lappend aProjectFiles [osutils:vcproj $theVcVer $isUWP $theOutDir $aToolKit aGuidsMap]
}
foreach anExecutable [OS:executable ${aModule}] {
- lappend aProjectFiles [osutils:vcprojx $theVcVer $theOutDir $anExecutable aGuidsMap]
+ lappend aProjectFiles [osutils:vcprojx $theVcVer $isUWP $theOutDir $anExecutable aGuidsMap]
}
}
return $aProjectFiles
}
# generate template name and load it for given version of Visual Studio and platform
-proc osutils:vcproj:readtemplate {theVcVer isexec} {
+proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
set anExt $theVcVer
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set anExt vc10
}
+ # determine versions of runtime and toolset
+ set aVCRTVer $theVcVer
+ set aToolset "v[string range $theVcVer 2 3]0"
+ if { $theVcVer == "vc141" } {
+ set aVCRTVer "vc14"
+ set aToolset "v141"
+ }
+
set what "$theVcVer"
- set aVerExt [string range $theVcVer 2 end]
- set aVerExt "v${aVerExt}0"
set aCmpl32 ""
set aCmpl64 ""
- if { $isexec } {
+ set aCharSet "Unicode"
+ if { $isExec } {
set anExt "${anExt}x"
set what "$what executable"
}
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 aCmpl32 "<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
+
+ if { $isUWP } {
+ set UwpWinRt "<CompileAsWinRT>false</CompileAsWinRT>"
+ foreach bitness {32 64} {
+ set indent ""
+ if {"[set aCmpl${bitness}]" != ""} {
+ set indent "\n "
+ }
+ set aCmpl${bitness} "[set aCmpl${bitness}]${indent}${UwpWinRt}"
+ }
+ }
+
+ set format_template "\[\\r\\n\\s\]*"
+ foreach bitness {32 64} {
+ set format_templateloc ""
+ if {"[set aCmpl${bitness}]" == ""} {
+ set format_templateloc "$format_template"
+ }
+ regsub -all -- "${format_templateloc}__VCMPL${bitness}__" $aTmpl "[set aCmpl${bitness}]" aTmpl
+ }
+
+ set aDebugInfo "no"
+ set aReleaseLnk ""
+ if { "$::HAVE_RelWithDebInfo" == "true" } {
+ set aDebugInfo "true"
+ set aReleaseLnk "\n <OptimizeReferences>true</OptimizeReferences>\n <EnableCOMDATFolding>true</EnableCOMDATFolding>"
+ }
+
+ regsub -all -- {__VCVER__} $aTmpl $aVCRTVer aTmpl
+ regsub -all -- {__VCVEREXT__} $aTmpl $aToolset aTmpl
+ regsub -all -- {__VCCHARSET__} $aTmpl $aCharSet aTmpl
+ regsub -all -- {__VCReleasePDB__} $aTmpl $aDebugInfo aTmpl
+ regsub -all -- "${format_template}__VCLNKREL__" $aTmpl "${aReleaseLnk}" aTmpl
+
return $aTmpl
}
} else {
set aLibsMap(CSF_FreeImagePlus) "freeimage"
}
+ } elseif { "$theOS" == "wnt" } {
+ set aLibsMap(CSF_FreeImagePlus) "windowscodecs"
+ }
+ if { "$::HAVE_FFMPEG" == "true" } {
+ set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
}
if { "$::HAVE_GL2PS" == "true" } {
set aLibsMap(CSF_GL2PS) "gl2ps"
set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
}
}
+ if { "$::HAVE_ZLIB" == "true" } {
+ set aLibsMap(CSF_ZLIB) "zlib"
+ }
+ if { "$::HAVE_LIBLZMA" == "true" } {
+ set aLibsMap(CSF_LIBLZMA) "liblzma"
+ }
if { "$theOS" == "wnt" } {
# WinAPI libraries
set aLibsMap(CSF_opengl32) "opengl32"
set aLibsMap(CSF_wsock32) "wsock32"
set aLibsMap(CSF_netapi32) "netapi32"
- set aLibsMap(CSF_AviLibs) "ws2_32 vfw32"
set aLibsMap(CSF_OpenGlLibs) "opengl32"
if { "$::HAVE_GLES2" == "true" } {
set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
# tbb headers define different pragma lib depending on debug/release
set aLibsMap(CSF_TBB) ""
} else {
+ set aLibsMap(CSF_dl) "dl"
if { "$theOS" == "mac" } {
set aLibsMap(CSF_objc) "objc"
set aFrmsMap(CSF_Appkit) "Appkit"
set aLibsMap(CSF_TclLibs) ""
set aFrmsMap(CSF_TclTkLibs) "Tk"
set aLibsMap(CSF_TclTkLibs) ""
+ set aLibsMap(CSF_QT) "QtCore QtGui"
} else {
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part of libc on QNX
}
# Generate entry for one source file in Visual Studio 10 project file
-proc osutils:vcxproj:file { vcversion file params } {
+proc osutils:vcxproj:file { file params } {
append text " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $file 3]]\">\n"
if { $params != "" } {
append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Debug|Win32\'\">[string trim ${params}] %(AdditionalOptions)</AdditionalOptions>\n"
}
# Generate Visual Studio project file for ToolKit
-proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } {
- if { $theProjTmpl == {} } {set theProjTmpl [osutils:vcproj:readtemplate $theVcVer 0]}
+proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
+ set theProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 0]
set l_compilable [osutils:compilable wnt]
regsub -all -- {__TKNAM__} $theProjTmpl $theToolKit theProjTmpl
}
regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
+ set theProjTmpl [osutils:uwp:proj $isUWP ${theProjTmpl}]
+
set aUsedLibs [list]
+
+ if { $isUWP } {
+ lappend aUsedLibs "WindowsApp.lib"
+ }
+
foreach tkx [osutils:commonUsedTK $theToolKit] {
lappend aUsedLibs "${tkx}.lib"
}
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
- regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
+ set aVCRTVer [string range $theVcVer 0 3]
+ regsub -all -- {vc[0-9]+} $aUsedLibs $aVCRTVer aUsedLibs
# and put this list to project file
#puts "$theToolKit requires $aUsedLibs"
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
- append aFilesSection [osutils:vcxproj:file $theVcVer $aSrcFile $needparam]
+ append aFilesSection [osutils:vcxproj:file $aSrcFile $needparam]
} else {
puts "Warning : in vcproj more than one occurences for [file tail $aSrcFile]"
}
}
# Generate Visual Studio project file for executable
-proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } {
+proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
set aVcFiles {}
foreach f [osutils:tk:files $theToolKit wnt] {
- if { $theProjTmpl == {} } {
- set aProjTmpl [osutils:vcproj:readtemplate $theVcVer 1]
- } else {
- set aProjTmpl $theProjTmpl
- }
+ set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
+
set aProjName [file rootname [file tail $f]]
set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
- regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
+ set aVCRTVer [string range $theVcVer 0 3]
+ regsub -all -- {vc[0-9]+} $aUsedLibs $aVCRTVer aUsedLibs
# puts "$aProjName requires $aUsedLibs"
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set written([file tail $f]) 1
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
- append aFilesSection [osutils:vcxproj:file $theVcVer $f ""]
+ append aFilesSection [osutils:vcxproj:file $f ""]
if { ! [info exists aVcFilesX($theToolKit)] } { lappend aVcFilesX(units) $theToolKit }
lappend aVcFilesX($theToolKit) $f
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
- regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $theVcVer aCommonSettingsFileTmpl
+ regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf
set listloc $theToolKit
}
- if { $thePlatform == "wnt" } {
+ if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
set resultloc [osutils:justwnt $listloc]
} else {
set resultloc [osutils:justunix $listloc]
}
# macros for correct DLL exports
- if { $thePlatform == "wnt" } {
+ if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
lappend aTKDefines "__${xlo}_DLL"
}
}
}
# macros for correct DLL exports
- if { $thePlatform == "wnt" } {
+ if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
lappend aTKDefines "__${theToolKit}_DLL"
}
# @param theDefines - compiler macro definitions
# @param theIsExe - flag to indicate executable / library target
proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
- set aWokStation $thePlatform
set aWokArch "$::env(ARCH)"
set aCmplCbp "gcc"
set aCmplFlagsDebug [list]
set toPassArgsByFile 0
set aLibPrefix "lib"
- if { "$aWokStation" == "wnt" || "$aWokStation" == "qnx" } {
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" || "$thePlatform" == "qnx" } {
set toPassArgsByFile 1
}
if { "$theCmpl" == "msvc" } {
lappend aCmplFlags "-D_CRT_SECURE_NO_WARNINGS"
lappend aCmplFlags "-D_CRT_NONSTDC_NO_DEPRECATE"
} elseif { "$theCmpl" == "gcc" } {
- if { "$aWokStation" != "qnx" } {
+ if { "$thePlatform" != "qnx" } {
set aCmplFlags "-mmmx -msse -msse2 -mfpmath=sse"
}
set aCmplFlagsRelease "-O2"
set aCmplFlagsDebug "-O0 -g"
- if { "$aWokStation" == "wnt" } {
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
lappend aCmplFlags "-std=gnu++0x"
lappend aCmplFlags "-D_WIN32_WINNT=0x0501"
} else {
lappend aCmplFlagsRelease "-DNDEBUG"
lappend aCmplFlagsRelease "-DNo_Exception"
lappend aCmplFlagsDebug "-D_DEBUG"
- if { "$aWokStation" == "qnx" } {
+ if { "$thePlatform" == "qnx" } {
lappend aCmplFlags "-D_QNX_SOURCE"
}
# 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=\"0\" extension_auto=\"0\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/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/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
+ puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${thePlatform}/cbp/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
- 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 output=\"../../../${thePlatform}/cbp/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
- puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/obj\" />"
+ puts $aFile "\t\t\t\t<Option object_output=\"../../../${thePlatform}/cbp/obj\" />"
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
- if { "$aWokStation" == "wnt" } {
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
}
- puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/lib\" />"
- if { "$aWokStation" == "mac" } {
+ puts $aFile "\t\t\t\t\t<Add directory=\"../../../${thePlatform}/cbp/lib\" />"
+ if { "$thePlatform" == "mac" } {
if { [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
- if { "$aWokStation" == "lin" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/lib\" />"
+ if { "$thePlatform" == "lin" } {
+ puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${thePlatform}/cbp/lib\" />"
}
puts $aFile "\t\t\t\t</Linker>"
# 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=\"0\" extension_auto=\"0\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/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/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
+ puts $aFile "\t\t\t\t<Option output=\"../../../${thePlatform}/cbp/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${thePlatform}/cbp/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
- 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 output=\"../../../${thePlatform}/cbp/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
- puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/objd\" />"
+ puts $aFile "\t\t\t\t<Option object_output=\"../../../${thePlatform}/cbp/objd\" />"
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
- if { "$aWokStation" == "wnt" } {
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
}
- puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/libd\" />"
- if { "$aWokStation" == "mac" } {
+ puts $aFile "\t\t\t\t\t<Add directory=\"../../../${thePlatform}/cbp/libd\" />"
+ if { "$thePlatform" == "mac" } {
if { [ lsearch $theLibsList X11 ] >= 0} {
puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
- if { "$aWokStation" == "lin" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/libd\" />"
+ if { "$thePlatform" == "lin" } {
+ puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${thePlatform}/cbp/libd\" />"
}
puts $aFile "\t\t\t\t</Linker>"
# COMMON linker options
puts $aFile "\t\t<Linker>"
- if { "$aWokStation" == "wnt" && "$theCmpl" == "gcc" } {
+ if { "$thePlatform" == "wnt" && "$theCmpl" == "gcc" } {
puts $aFile "\t\t\t<Add option=\"-Wl,--export-all-symbols\" />"
}
foreach aFrameworkName $theFrameworks {
puts $aFile "\t\t\t<Option link=\"0\" />"
puts $aFile "\t\t</Unit>"
- set aFileObj [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/obj/src/"] $aSrcFile]]
- set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/objd/src/"] $aSrcFile]]
+ set aFileObj [string map {.cxx .o} [string map [list "/src/" "/$thePlatform/cbp/obj/src/"] $aSrcFile]]
+ set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/$thePlatform/cbp/objd/src/"] $aSrcFile]]
puts -nonewline $aFileLnkObj "$aFileObj "
puts -nonewline $aFileLnkObjd "$aFileObjd "
} else {
}
}
- if { "$aWokStation" == "wnt" } {
+ if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
close $aFileLnkObj
close $aFileLnkObjd
}
if { "$thePlatform" == "ios" } {
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphoneos\*\]\" = \"\$(ARCHS_STANDARD)\";";
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphonesimulator\*\]\" = \"x86_64\";";
- puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";"
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_MODULES = YES;"
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;"
}
puts $aPbxprojFile "\t\t\t\tARCHS = \"\$(ARCHS_STANDARD_64_BIT)\";"
- puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";"
+ puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";"
+ puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++0x\";"
puts $aPbxprojFile "\t\t\t\tCOPY_PHASE_STRIP = NO;"
puts $aPbxprojFile "\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;"
puts $aPbxprojFile "\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;"
if { "$thePlatform" == "ios" } {
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphoneos\*\]\" = \"\$(ARCHS_STANDARD)\";";
puts $aPbxprojFile "\t\t\t\t\"ARCHS\[sdk=iphonesimulator\*\]\" = \"x86_64\";";
- puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";"
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_MODULES = YES;"
puts $aPbxprojFile "\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;"
}
puts $aPbxprojFile "\t\t\t\tARCHS = \"\$(ARCHS_STANDARD_64_BIT)\";"
- puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";"
+ puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";"
+ puts $aPbxprojFile "\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++0x\";"
puts $aPbxprojFile "\t\t\t\tCOPY_PHASE_STRIP = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;"
puts $aPbxprojFile "\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;"
puts $aPlistFile $aPlistTmpl
close $aPlistFile
}
+
+# Returns available Windows SDKs versions
+proc osutils:sdk { theSdkMajorVer {isQuietMode false} {theSdkDirectories {}} } {
+ if { ![llength ${theSdkDirectories}] } {
+ foreach anEnvVar { "ProgramFiles" "ProgramFiles\(x86\)" "ProgramW6432" } {
+ if {[ info exists ::env(${anEnvVar}) ]} {
+ lappend theSdkDirectories "$::env(${anEnvVar})/Windows Kits/${theSdkMajorVer}/Include"
+ }
+ }
+ }
+
+ set sdk_versions {}
+ foreach sdk_dir ${theSdkDirectories} {
+ if { [file isdirectory ${sdk_dir}] } {
+ lappend sdk_versions [glob -tails -directory "${sdk_dir}" -type d *]
+ }
+ }
+
+ if {![llength ${sdk_versions}] && !${isQuietMode}} {
+ error "Error : Could not find Windows SDK ${theSdkMajorVer}"
+ }
+
+ return [join [lsort -unique ${sdk_versions}] " "]
+}
+
+# Generate global properties to Visual Studio project file for UWP solution
+proc osutils:uwp:proj { isUWP theProjTmpl } {
+
+ set uwp_properties ""
+ set uwp_generate_metadata ""
+ set uwp_app_container ""
+
+ set format_template ""
+
+ if { $isUWP } {
+ set sdk_versions [osutils:sdk 10]
+ set sdk_max_ver [lindex ${sdk_versions} end]
+
+ set uwp_properties "<DefaultLanguage>en-US</DefaultLanguage>\n \
+<ApplicationType>Windows Store</ApplicationType>\n \
+<ApplicationTypeRevision>10.0</ApplicationTypeRevision>\n \
+<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>\n \
+<AppContainerApplication>true</AppContainerApplication>\n \
+<WindowsTargetPlatformVersion>${sdk_max_ver}</WindowsTargetPlatformVersion>\n \
+<WindowsTargetPlatformMinVersion>${sdk_max_ver}</WindowsTargetPlatformMinVersion>"
+
+ set uwp_generate_metadata "<GenerateWindowsMetadata>false</GenerateWindowsMetadata>"
+
+ regsub -all -- {[\r\n\s]*<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>} ${theProjTmpl} "" theProjTmpl
+ } else {
+ set format_template "\[\\r\\n\\s\]*"
+ }
+
+ regsub -all -- "${format_template}__UWP_PROPERTIES__" ${theProjTmpl} "${uwp_properties}" theProjTmpl
+ regsub -all -- "${format_template}__UWP_GENERATE_METADATA__" ${theProjTmpl} "${uwp_generate_metadata}" theProjTmpl
+
+ return ${theProjTmpl}
+}
+
+# Report all files found in package directory but not listed in FILES
+proc osutils:checksrcfiles { theUnit } {
+ global path
+ set aCasRoot [file normalize ${path}]
+
+ if {![file isdirectory ${aCasRoot}]} {
+ puts "OCCT directory is not defined correctly: ${aCasRoot}"
+ return
+ }
+
+ set anUnitAbsPath [file normalize "${aCasRoot}/src/${theUnit}"]
+
+ if {[file exists "${anUnitAbsPath}/FILES"]} {
+ set aFilesFile [open "${anUnitAbsPath}/FILES" rb]
+ set aFilesFileList [split [read ${aFilesFile}] "\n"]
+ close ${aFilesFile}
+
+ set aFilesFileList [lsearch -inline -all -not -exact ${aFilesFileList} ""]
+
+ # report all files not listed in FILES
+ set anAllFiles [glob -tails -nocomplain -dir ${anUnitAbsPath} "*"]
+ foreach aFile ${anAllFiles} {
+ if { "${aFile}" == "FILES" } {
+ continue
+ }
+ if { [lsearch -exact ${aFilesFileList} ${aFile}] == -1 } {
+ puts "Warning: file ${anUnitAbsPath}/${aFile} is not listed in ${anUnitAbsPath}/FILES!"
+ }
+ }
+ }
+}