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 {theFormat args} {
- set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "cbp" "xcd"}
+ set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false
# Check optional arguments
set aLibType "dynamic"
- foreach arg $args {
- if { $arg == "-h" || $arg == "-help" || $arg == "--help" } {
+ set aSolution "OCCT"
+ for {set anArgIter 0} {$anArgIter < [llength args]} {incr anArgIter} {
+ set arg [lindex $args $anArgIter]
+ if { $arg == "" } {
+ continue
+ } elseif { $arg == "-h" || $arg == "-help" || $arg == "--help" } {
set isHelpRequire true
} elseif { [lsearch -exact $aSupportedPlatforms $arg] >= 0 } {
set aPlatform $arg
} elseif { $arg == "-dynamic" } {
set aLibType "dynamic"
puts "Dynamic build has been selected"
+ } elseif { $arg == "-solution" } {
+ incr anArgIter
+ set aSolution [lindex $args $anArgIter]
} else {
puts "Error: genproj: unrecognized option \"$arg\""
set isHelpRequire true
vc12 - Visual Studio 2013
vc14 - Visual Studio 2015
vc141 - Visual Studio 2017
+ vc142 - Visual Studio 2019
+ vclang - Visual Studio with ClangCL toolset
cbp - CodeBlocks
xcd - XCode
+ pro - Qt Creator
Platform (optional):
wnt - Windows Desktop
# base path to where to generate projects, hardcoded from current dir
set anAdmPath [file normalize "${::path}/adm"]
- OS:MKPRC "$anAdmPath" "$theFormat" "$aLibType" "$aPlatform" "$aCmpl"
+ OS:MKPRC "$anAdmPath" "$theFormat" "$aLibType" "$aPlatform" "$aCmpl" "$aSolution"
- genprojbat "$theFormat" "$aPlatform"
+ genprojbat "$theFormat" "$aPlatform" "$aSolution"
genAllResources
}
-proc genprojbat {theFormat 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"
+}
+
+# Generate auxiliary scripts for launching IDE.
+proc genprojbat {theFormat thePlatform theSolution} {
set aTargetPlatformExt sh
if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
set aTargetPlatformExt bat
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}"
}
+ set aSolShList ""
if { [regexp {^vc} $theFormat] } {
- file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
+ set aSolShList "msvc.bat"
} else {
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"
+ "cbp" {
+ set aSolShList { "codeblocks.sh" "codeblocks.bat" }
# Code::Blocks 16.01 does not create directory for import libs, help him
- file mkdir "$::path/$thePlatform/cbp/lib"
- file mkdir "$::path/$thePlatform/cbp/libd"
+ set aPlatformAndCompiler "${thePlatform}/gcc"
+ if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
+ set aPlatformAndCompiler "${thePlatform}/clang"
+ }
+ file mkdir "$::path/${aPlatformAndCompiler}/lib"
+ file mkdir "$::path/${aPlatformAndCompiler}/libd"
}
- "xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" }
+ "xcd" { set aSolShList "xcode.sh" }
}
}
+
+ foreach aSolSh $aSolShList {
+ set anShFile [open "$::THE_CASROOT/adm/templates/${aSolSh}" "r"]
+ set anShTmpl [read $anShFile]
+ close $anShFile
+
+ regsub -all -- {__SOLUTION__} $anShTmpl "$theSolution" anShTmpl
+
+ set anShFile [open "$::path/${aSolSh}" "w"]
+ puts $anShFile $anShTmpl
+ close $anShFile
+ }
}
###### MSVC #############################################################33
# @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 theFormat theLibType thePlatform theCmpl } {
+# @param theSolution Solution name
+proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution } {
global path
set anOutRoot $theOutDir
if { $anOutRoot == "" } {
}
}
- # generate one solution for all projects if complete OS or VAS is processed
- set anAllSolution "OCCT"
-
- wokUtils:FILES:mkdir $anOutDir
- if { ![file exists $anOutDir] } {
- puts stderr "Error: Could not create output directory \"$anOutDir\""
- return
- }
-
# create the out dir if it does not exist
if (![file isdirectory $path/inc]) {
puts "$path/inc folder does not exists and will be created"
puts "Collecting required header files into $path/inc ..."
osutils:collectinc $aModules $path/inc
+ if { "$theFormat" == "pro" } {
+ return
+ }
+
+ wokUtils:FILES:mkdir $anOutDir
+ if { ![file exists $anOutDir] } {
+ puts stderr "Error: Could not create output directory \"$anOutDir\""
+ return
+ }
+
# Generating project files for the selected format
switch -exact -- "$theFormat" {
"vc7" -
"vc11" -
"vc12" -
"vc14" -
- "vc141" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
- "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
+ "vc141" -
+ "vc142" -
+ "vclang" { OS:MKVC $anOutDir $aModules $theSolution $theFormat $isUWP}
+ "cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
- OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
+ OS:MKXCD $anOutDir $aModules $theSolution $theLibType $thePlatform
}
}
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}!"
+ puts "Warning: file ${anIncPath}/${anIncFile} is not present in the sources and will be removed from ${theIncPath}"
file delete -force "${theIncPath}/${anIncFile}"
}
}
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n"
- } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141"} {
+ } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
+ "$vcversion" == "vc142" || "$vcversion" == "vclang" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n"
if { $theVcVer == "vc141" } {
set aVCRTVer "vc14"
set aToolset "v141"
+ } elseif { $theVcVer == "vc142" } {
+ set aVCRTVer "vc14"
+ set aToolset "v142"
+ } elseif { $theVcVer == "vclang" } {
+ set aVCRTVer "vc14"
+ set aToolset "ClangCL"
}
set what "$theVcVer"
# List extensions of compilable files in OCCT
proc osutils:compilable {thePlatform} {
- if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
- return [list .c .cxx .cpp .mm]
- }
+ if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } { return [list .c .cxx .cpp .mm] }
return [list .c .cxx .cpp]
}
+# List extensions of header file in OCCT
+proc osutils:fileExtensionsHeaders {thePlatform} {
+ if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } { return [list .h .hxx .hpp .lxx .pxx .gxx ] }
+ return [list .h .hxx .hpp .lxx .pxx .gxx .mm ]
+}
+
proc osutils:commonUsedTK { theToolKit } {
set anUsedToolKits [list]
set aDepToolkits [LibToLink $theToolKit]
} 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"
- }
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
}
}
}
if { "$::HAVE_ZLIB" == "true" } {
- set aLibsMap(CSF_ZLIB) "zlib"
+ set aLibsMap(CSF_ZLIB) "z"
}
if { "$::HAVE_LIBLZMA" == "true" } {
set aLibsMap(CSF_LIBLZMA) "liblzma"
}
+ if { "$::HAVE_E57" == "true" && "$theOS" != "wnt" } {
+ # exclude wnt, as there are different pragma lib depending on debug/release
+ set aLibsMap(CSF_E57) "E57RefImpl"
+ set aLibsMap(CSF_xerces) "xerces-c"
+ }
if { "$theOS" == "wnt" } {
# WinAPI libraries
set aLibsMap(CSF_advapi32) "advapi32"
set aLibsMap(CSF_gdi32) "gdi32"
set aLibsMap(CSF_user32) "user32 comdlg32"
+ set aLibsMap(CSF_shell32) "shell32"
set aLibsMap(CSF_opengl32) "opengl32"
set aLibsMap(CSF_wsock32) "wsock32"
set aLibsMap(CSF_netapi32) "netapi32"
+ set aLibsMap(CSF_winmm) "winmm"
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) ""
+
+ if { "$::HAVE_ZLIB" == "true" } {
+ set aLibsMap(CSF_ZLIB) "zlib"
+ }
} else {
- if { "$theOS" == "mac" } {
+ set aLibsMap(CSF_dl) "dl"
+ if { "$theOS" == "mac" || "$theOS" == "ios" } {
set aLibsMap(CSF_objc) "objc"
- set aFrmsMap(CSF_Appkit) "Appkit"
+ if { "$theOS" == "ios" } {
+ set aFrmsMap(CSF_Appkit) "UIKit"
+ set aFrmsMap(CSF_OpenGlLibs) "OpenGLES"
+ } else {
+ set aFrmsMap(CSF_Appkit) "AppKit"
+ set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
+ }
set aFrmsMap(CSF_IOKit) "IOKit"
- set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_TclLibs) "Tcl"
set aLibsMap(CSF_TclLibs) ""
set aFrmsMap(CSF_TclTkLibs) "Tk"
set aLibsMap(CSF_TclTkLibs) ""
+ set aLibsMap(CSF_QT) "QtCore QtGui"
+ } elseif { "$theOS" == "android" } {
+ set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
+ set aLibsMap(CSF_androidlog) "log"
} else {
+ set aLibsMap(CSF_fontconfig) "fontconfig"
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part of libc on QNX
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
}
proc osutils:justwnt { listloc } {
- # ImageUtility is required for support for old (<6.5.4) versions of OCCT
- set goaway [list Xdps Xw ImageUtility WOKUnix]
+ set goaway [list Xw]
return [osutils:juststation $goaway $listloc]
}
}
# Generate entry for one source file in Visual Studio 10 project file
-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"
- }
-
- if { $params != "" } {
- append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Release|Win32\'\">[string trim ${params}] %(AdditionalOptions)</AdditionalOptions>\n"
- }
-
- if { $params != "" } {
- append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Debug|x64\'\">[string trim ${params}] %(AdditionalOptions)</AdditionalOptions>\n"
- }
-
- if { $params != "" } {
- append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Release|x64\'\">[string trim ${params}] %(AdditionalOptions)</AdditionalOptions>\n"
+proc osutils:vcxproj:cxxfile { theFile theParams } {
+ if { $theParams == "" } {
+ return " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile 3]]\" />\n"
}
+ set aParams [string trim ${theParams}]
+ append text " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile 3]]\">\n"
+ append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Debug|Win32\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
+ append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Release|Win32\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
+ append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Debug|x64\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
+ append text " <AdditionalOptions Condition=\"\'\$(Configuration)|\$(Platform)\'==\'Release|x64\'\">${aParams} %(AdditionalOptions)</AdditionalOptions>\n"
append text " </ClCompile>\n"
return $text
}
+# Generate entry for one header file in Visual Studio 10 project file
+proc osutils:vcxproj:hxxfile { theFile } { return " <ClInclude Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $theFile 3]]\" />\n" }
+
# Generate Visual Studio 2010 project filters file
-proc osutils:vcxproj:filters { dir proj theFilesMap } {
- upvar $theFilesMap aFilesMap
+proc osutils:vcxproj:filters { dir proj theCxxFilesMap theHxxFilesMap } {
+ upvar $theCxxFilesMap aCxxFilesMap
+ upvar $theHxxFilesMap aHxxFilesMap
# header
append text "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
append text " <Filter Include=\"Source files\">\n"
append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
append text " </Filter>\n"
- foreach unit $aFilesMap(units) {
+ append text " <Filter Include=\"Header files\">\n"
+ append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
+ append text " </Filter>\n"
+ foreach unit $aCxxFilesMap(units) {
append text " <Filter Include=\"Source files\\${unit}\">\n"
append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
append text " </Filter>\n"
}
+ foreach unit $aHxxFilesMap(units) {
+ append text " <Filter Include=\"Header files\\${unit}\">\n"
+ append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
+ append text " </Filter>\n"
+ }
append text " </ItemGroup>\n"
- # list of files
+ # list of cxx files
append text " <ItemGroup>\n"
- foreach unit $aFilesMap(units) {
- foreach file $aFilesMap($unit) {
+ foreach unit $aCxxFilesMap(units) {
+ foreach file $aCxxFilesMap($unit) {
append text " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $file 3]]\">\n"
append text " <Filter>Source files\\${unit}</Filter>\n"
append text " </ClCompile>\n"
}
append text " </ItemGroup>\n"
- # end
- append text "</Project>"
-
- # write file
- set fp [open [set fvcproj [file join $dir ${proj}.vcxproj.filters]] w]
- fconfigure $fp -translation crlf
- puts $fp $text
- close $fp
-
- return ${proj}.vcxproj.filters
-}
-
-# Generate Visual Studio 2011 project filters file
-proc osutils:vcx1proj:filters { dir proj theFilesMap } {
- upvar $theFilesMap aFilesMap
-
- # header
- append text "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- append text "<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
-
- # list of "filters" (units)
- append text " <ItemGroup>\n"
- append text " <Filter Include=\"Source files\">\n"
- append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
- append text " </Filter>\n"
- foreach unit $aFilesMap(units) {
- append text " <Filter Include=\"Source files\\${unit}\">\n"
- append text " <UniqueIdentifier>[OS:genGUID]</UniqueIdentifier>\n"
- append text " </Filter>\n"
- }
- append text " </ItemGroup>\n"
-
- # list of files
+ # list of hxx files
append text " <ItemGroup>\n"
- foreach unit $aFilesMap(units) {
- foreach file $aFilesMap($unit) {
- append text " <ClCompile Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $file 3]]\">\n"
- append text " <Filter>Source files\\${unit}</Filter>\n"
- append text " </ClCompile>\n"
+ foreach unit $aHxxFilesMap(units) {
+ foreach file $aHxxFilesMap($unit) {
+ append text " <ClInclude Include=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $file 3]]\">\n"
+ append text " <Filter>Header files\\${unit}</Filter>\n"
+ append text " </ClInclude>\n"
}
}
append text " </ItemGroup>\n"
append text " <ItemGroup>\n"
- append text " <ResourceCompile Include=\"${proj}.rc\" />"
+ append text " <ResourceCompile Include=\"${proj}.rc\" />\n"
append text " </ItemGroup>\n"
# end
regsub -all -- {__TKDEP__} $theProjTmpl $aUsedLibs theProjTmpl
set anIncPaths "..\\..\\..\\inc"
- set aTKDefines ""
+# set aTKDefines ""
set aFilesSection ""
- set aVcFilesX(units) ""
+ set aVcFilesCxx(units) ""
+ set aVcFilesHxx(units) ""
set listloc [osutils:tk:units $theToolKit]
- set resultloc [osutils:justwnt $listloc]
if [array exists written] { unset written }
#puts "\t1 [wokparam -v %CMPLRS_CXX_Options [w_info -f]] father"
#puts "\t2 [wokparam -v %CMPLRS_CXX_Options] branch"
set fxloparamfcxx [lindex [osutils:intersect3 [_get_options wnt cmplrs_cxx f] [_get_options wnt cmplrs_cxx b]] 2]
set fxloparamfc [lindex [osutils:intersect3 [_get_options wnt cmplrs_c f] [_get_options wnt cmplrs_c b]] 2]
set fxloparam ""
- foreach fxlo $resultloc {
+ foreach fxlo $listloc {
set xlo $fxlo
- set aSrcFiles [osutils:tk:files $xlo wnt]
+ set aSrcFiles [osutils:tk:cxxfiles $xlo wnt]
+ set aHxxFiles [osutils:tk:hxxfiles $xlo wnt]
set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx $fxlo]
if {$fxlo_cmplrs_options_cxx == ""} {
set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx b]
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
- append aFilesSection [osutils:vcxproj:file $aSrcFile $needparam]
+ append aFilesSection [osutils:vcxproj:cxxfile $aSrcFile $needparam]
} else {
puts "Warning : in vcproj more than one occurences for [file tail $aSrcFile]"
}
- if { ! [info exists aVcFilesX($xlo)] } { lappend aVcFilesX(units) $xlo }
- lappend aVcFilesX($xlo) $aSrcFile
+ if { ! [info exists aVcFilesCxx($xlo)] } { lappend aVcFilesCxx(units) $xlo }
+ lappend aVcFilesCxx($xlo) $aSrcFile
+ }
+ foreach aHxxFile [lsort $aHxxFiles] {
+ if { ![info exists written([file tail $aHxxFile])] } {
+ set written([file tail $aHxxFile]) 1
+ append aFilesSection [osutils:vcxproj:hxxfile $aHxxFile]
+ } else {
+ puts "Warning : in vcproj more than one occurences for [file tail $aHxxFile]"
+ }
+ if { ! [info exists aVcFilesHxx($xlo)] } { lappend aVcFilesHxx(units) $xlo }
+ lappend aVcFilesHxx($xlo) $aHxxFile
}
} else {
append aFilesSection "\t\t\t<Filter\n"
}
append aFilesSection "\t\t\t</Filter>\n"
}
-
- # macros
- append aTKDefines ";__${xlo}_DLL"
- # common includes
-# append anIncPaths ";..\\..\\..\\src\\${xlo}"
}
regsub -all -- {__TKINC__} $theProjTmpl $anIncPaths theProjTmpl
- regsub -all -- {__TKDEFS__} $theProjTmpl $aTKDefines theProjTmpl
regsub -all -- {__FILES__} $theProjTmpl $aFilesSection theProjTmpl
# write file
close $aFile
# write filters file for vc10+
- if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" || "$theVcVer" == "vc9" } {
- # nothing
- } elseif { "$theVcVer" == "vc10" } {
- lappend aVcFiles [osutils:vcxproj:filters $theOutDir $theToolKit aVcFilesX]
- } else {
- lappend aVcFiles [osutils:vcx1proj:filters $theOutDir $theToolKit aVcFilesX]
+ if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
+ lappend aVcFiles [osutils:vcxproj:filters $theOutDir $theToolKit aVcFilesCxx aVcFilesHxx]
}
# write resource file
return
}
-# Returns the list of all compilable files name in a toolkit, or devunit of any type
-# Tfiles lists for each unit the type of file that can be compiled.
-proc osutils:tk:files { tkloc thePlatform } {
+# Returns the list of all files name in a toolkit within specified list of file extensions.
+proc osutils:tk:files { tkloc theExtensions } {
set Tfiles(source,nocdlpack) {source pubinclude}
set Tfiles(source,toolkit) {}
set Tfiles(source,executable) {source pubinclude}
set listloc [concat [osutils:tk:units $tkloc] $tkloc]
#puts " listloc = $listloc"
- set l_comp [osutils:compilable $thePlatform]
set resultloc $listloc
set lret {}
foreach loc $resultloc {
"t" { set utyp "toolkit" }
"n" { set utyp "nocdlpack" }
"x" { set utyp "executable" }
+ default { error "Error: Cannot determine type of unit $loc, check adm/UDLIST!" }
}
if [array exists map] { unset map }
osutils:tk:loadunit $loc map
#puts $type
foreach f $map($type) {
#puts $f
- if { [lsearch $l_comp [file extension $f]] != -1 } {
+ if { [lsearch $theExtensions [file extension $f]] != -1 } {
lappend lret $f
}
}
return $lret
}
+# Returns the list of all compilable files name in a toolkit.
+proc osutils:tk:cxxfiles { tkloc thePlatform } { return [osutils:tk:files $tkloc [osutils:compilable $thePlatform]] }
+
+# Returns the list of all header files name in a toolkit.
+proc osutils:tk:hxxfiles { tkloc thePlatform } { return [osutils:tk:files $tkloc [osutils:fileExtensionsHeaders $thePlatform]] }
+
# Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
set aVcFiles {}
- foreach f [osutils:tk:files $theToolKit wnt] {
+ foreach f [osutils:tk:cxxfiles $theToolKit wnt] {
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjName [file rootname [file tail $f]]
regsub -all -- {__TKDEP__} $aProjTmpl $aUsedLibs aProjTmpl
set aFilesSection ""
- set aVcFilesX(units) ""
+ set aVcFilesCxx(units) ""
+ set aVcFilesHxx(units) ""
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
- append aFilesSection [osutils:vcxproj:file $f ""]
- if { ! [info exists aVcFilesX($theToolKit)] } { lappend aVcFilesX(units) $theToolKit }
- lappend aVcFilesX($theToolKit) $f
+ append aFilesSection [osutils:vcxproj:cxxfile $f ""]
+ if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
+ lappend aVcFilesCxx($theToolKit) $f
} else {
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
puts "Warning : in vcproj there are than one occurences for [file tail $f]"
}
#puts "$aProjTmpl $aFilesSection"
- set aTKDefines ";__${theToolKit}_DLL"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
- regsub -all -- {__TKDEFS__} $aProjTmpl $aTKDefines aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
- lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesX]
+ lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
+ # write resource file
+ lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
+
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
if [array exists written] { unset written }
foreach fxlo $resultloc {
set xlo $fxlo
- set aSrcFiles [osutils:tk:files $xlo $thePlatform]
+ set aSrcFiles [osutils:tk:cxxfiles $xlo $thePlatform]
foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
}
# macros for correct DLL exports
- if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
- lappend aTKDefines "__${xlo}_DLL"
- }
+# if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
+# lappend aTKDefines "__${xlo}_DLL"
+# }
}
return [osutils:cbp $theCmpl $theOutDir $theToolKit $thePlatform $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
set aWokArch "$::env(ARCH)"
set aCbpFiles {}
- foreach aSrcFile [osutils:tk:files $theToolKit $thePlatform] {
+ foreach aSrcFile [osutils:tk:cxxfiles $theToolKit $thePlatform] {
# collect list of referred libraries to link with
set aUsedLibs [list]
set aFrameworks [list]
}
# macros for correct DLL exports
- if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
- lappend aTKDefines "__${theToolKit}_DLL"
- }
+# if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
+# lappend aTKDefines "__${theToolKit}_DLL"
+# }
# common include paths
lappend anIncPaths "../../../inc"
set aCmplFlagsDebug [list]
set toPassArgsByFile 0
set aLibPrefix "lib"
+ set aPlatformAndCompiler "${thePlatform}/gcc"
+ if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
+ set aPlatformAndCompiler "${thePlatform}/clang"
+ }
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" || "$thePlatform" == "qnx" } {
set toPassArgsByFile 1
}
# Release target configuration
puts $aFile "\t\t\t<Target title=\"Release\">"
if { "$theIsExe" == "true" } {
- 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 output=\"../../../${aPlatformAndCompiler}/bin/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
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\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aPlatformAndCompiler}/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
- 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 output=\"../../../${aPlatformAndCompiler}/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=\"../../../${thePlatform}/cbp/obj\" />"
+ puts $aFile "\t\t\t\t<Option object_output=\"../../../${aPlatformAndCompiler}/obj\" />"
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
}
- puts $aFile "\t\t\t\t\t<Add directory=\"../../../${thePlatform}/cbp/lib\" />"
+ puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aPlatformAndCompiler}/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 { "$thePlatform" == "lin" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${thePlatform}/cbp/lib\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aPlatformAndCompiler}/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=\"../../../${thePlatform}/cbp/bind/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bind/${theProjName}\" prefix_auto=\"0\" extension_auto=\"0\" />"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
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\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aPlatformAndCompiler}/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aPlatformAndCompiler}/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
- 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 output=\"../../../${aPlatformAndCompiler}/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=\"../../../${thePlatform}/cbp/objd\" />"
+ puts $aFile "\t\t\t\t<Option object_output=\"../../../${aPlatformAndCompiler}/objd\" />"
puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
if { $toPassArgsByFile == 1 } {
puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
}
- puts $aFile "\t\t\t\t\t<Add directory=\"../../../${thePlatform}/cbp/libd\" />"
+ puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aPlatformAndCompiler}/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 { "$thePlatform" == "lin" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${thePlatform}/cbp/libd\" />"
+ puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aPlatformAndCompiler}/libd\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t<Option link=\"0\" />"
puts $aFile "\t\t</Unit>"
- 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]]
+ set aFileObj [string map {.cxx .o} [string map [list "/src/" "/${aPlatformAndCompiler}/obj/src/"] $aSrcFile]]
+ set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/${aPlatformAndCompiler}/objd/src/"] $aSrcFile]]
puts -nonewline $aFileLnkObj "$aFileObj "
puts -nonewline $aFileLnkObjd "$aFileObjd "
} else {
}
# Generates dependencies section for Xcode project files.
-proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids theIsStatic} {
+proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids thePlatform theIsStatic} {
upvar $theGuidsMap aGuidsMap
upvar $theFileRefSection aFileRefSection
upvar $theDepsGuids aDepsGuids
set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit]
if { "$theTargetType" == "executable" } {
- set aFile [osutils:tk:files $theToolKit mac]
+ set aFile [osutils:tk:cxxfiles $theToolKit mac]
set aProjName [file rootname [file tail $aFile]]
set aDepToolkits [LibToLinkX $theToolKit $aProjName]
}
}
}
- osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
+ osutils:usedOsLibs $theToolKit $thePlatform aLibs aFrameworks
set aUsedLibs [concat $aUsedLibs $aLibs]
set aUsedLibs [concat $aUsedLibs $aFrameworks]
foreach tkx $aUsedLibs {
set aGuidsMap($aPackage) [OS:genGUID "xcd"]
}
- set aSrcFiles [osutils:tk:files $xlo mac]
+ set aSrcFiles [osutils:tk:cxxfiles $xlo mac]
foreach aSrcFile [lsort $aSrcFiles] {
set aFileExt "sourcecode.cpp.cpp"
}
puts $aPbxprojFile [osutils:xcdtk:sources $theToolKit $theTargetType aSrcFileRefSection aGroupSection aPackagesGuids aSrcFileGuids aGuidsMap anIncPaths]
- puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $theIsStatic]
+ puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $thePlatform $theIsStatic]
# End PBXBuildFile section
# Begin PBXFileReference section