0030682: Configuration, qmake - all warnings are suppressed on macOS target
[occt.git] / adm / genproj.tcl
index 57848aa..147f0fb 100644 (file)
@@ -26,7 +26,7 @@ set path [file normalize .]
 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 } {
@@ -255,16 +255,16 @@ proc genAllResources {} {
 }
 
 # Wrapper-function to generate VS project files
-proc genproj {theIDE args} {
-  set aSupportedIDEs { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc14-uwp" "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" "pro"}
+  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
   }
 
@@ -272,9 +272,9 @@ proc genproj {theIDE args} {
   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"
@@ -302,21 +302,23 @@ proc genproj {theIDE args} {
   }
 
   if {  $isHelpRequire == true } {
-    puts "usage: genproj IDE \[Platform\] \[-static\] \[-h|-help|--help\]
+    puts "usage: genproj Format \[Platform\] \[-static\] \[-h|-help|--help\]
 
-    IDE must be one of:
+    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
-      vc14-uwp -  Visual Studio 2015 for Universal Windows Platform project
+      vc141    -  Visual Studio 2017
       cbp      -  CodeBlocks
       xcd      -  XCode
+      pro      -  Qt Creator
 
-    Platform (optional, only for CodeBlocks and XCode):
-      wnt   -  Windows
+    Platform (optional):
+      wnt   -  Windows Desktop
+      uwp   -  Universal Windows Platform
       lin   -  Linux
       mac   -  OS X
       ios   -  iOS
@@ -332,24 +334,40 @@ proc genproj {theIDE args} {
     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"]
@@ -368,19 +386,24 @@ proc genprojbat {theIDE thePlatform} {
       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 || [regexp {(vc)[0-9]*-uwp$} $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"
+
         # 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" }
     }
@@ -399,13 +422,13 @@ proc removeAllOccurrencesOf { theObject theList } {
 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 == "" } {
@@ -414,14 +437,19 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
 
   # Create output directory
   set aWokStation "$thePlatform"
-  if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12 vc14 vc14-uwp} $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]
@@ -443,22 +471,13 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
   }
 
   # Draw module is turned off due to it is not supported on UWP
-  if { [regexp {(vc)[0-9]*-uwp$} $theIDE] == 1 } {
+  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"
-
-  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"
@@ -469,8 +488,21 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
   puts "Collecting required header files into $path/inc ..."
   osutils:collectinc $aModules $path/inc
 
-  # Generating project files for the selected IDE
-  switch -exact -- "$theIDE" {
+  if { "$theFormat" == "pro" } {
+    return
+  }
+
+  # 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
+  }
+
+  # Generating project files for the selected format
+  switch -exact -- "$theFormat" {
     "vc7"   -
     "vc8"   -
     "vc9"   -
@@ -478,7 +510,7 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
     "vc11"  -
     "vc12"  -
     "vc14"  -
-    "vc14-uwp" { OS:MKVC  $anOutDir $aModules $anAllSolution $theIDE }
+    "vc141"    { OS:MKVC  $anOutDir $aModules $anAllSolution $theFormat $isUWP}
     "cbp"      { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
     "xcd"      {
       set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
@@ -497,14 +529,14 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
 }
 
 # 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
@@ -749,8 +781,8 @@ proc LocateRecur {theName} {
   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) }]]"
@@ -816,6 +848,7 @@ proc osutils:collectinc {theModules theIncPath} {
     }
   }
 
+  set allHeaderFiles {}
   if { $aCopyType == "shortcut" } {
     # template preparation
     if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
@@ -829,9 +862,12 @@ proc osutils:collectinc {theModules theIncPath} {
 
     # 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
 
@@ -863,12 +899,15 @@ proc osutils:collectinc {theModules theIncPath} {
   } 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]
@@ -879,17 +918,26 @@ proc osutils:collectinc {theModules theIncPath} {
             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
@@ -915,9 +963,9 @@ proc osutils:vcsolution:header { vcversion } {
       "# 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"  || "$vcversion" == "vc14-uwp"} {
+  } elseif { "$vcversion" == "vc14"  || "$vcversion" == "vc141"} {
     append var \
       "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
       "# Visual Studio 14\n"
@@ -1126,36 +1174,42 @@ proc OS:vcsolution { theVcVer theSolName theModules theOutDir theGuidsMap } {
 }
 # 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 ""
   set aCharSet "Unicode"
-  if { $isexec } {
+  if { $isExec } {
     set anExt "${anExt}x"
     set what "$what executable"
   }
@@ -1165,8 +1219,7 @@ proc osutils:vcproj:readtemplate {theVcVer isexec} {
   }
   set aTmpl [osutils:readtemplate $anExt "MS VC++ project ($what)"]
 
-  if { $theVcVer == "vc14-uwp" } {
-    set aVerExt "v140"
+  if { $isUWP } {
     set UwpWinRt "<CompileAsWinRT>false</CompileAsWinRT>"
     foreach bitness {32 64} {
       set indent ""
@@ -1177,17 +1230,28 @@ proc osutils:vcproj:readtemplate {theVcVer isexec} {
     }
   }
 
+  set format_template "\[\\r\\n\\s\]*"
   foreach bitness {32 64} {
-    set format_template ""
+    set format_templateloc ""
     if {"[set aCmpl${bitness}]" == ""} {
-      set format_template "\[\\r\\n\\s\]*"
+      set format_templateloc "$format_template"
     }
-    regsub -all -- "${format_template}__VCMPL${bitness}__" $aTmpl "[set aCmpl${bitness}]" aTmpl
+    regsub -all -- "${format_templateloc}__VCMPL${bitness}__" $aTmpl "[set aCmpl${bitness}]" aTmpl
   }
 
-  regsub -all -- {__VCVER__}     $aTmpl $theVcVer aTmpl
-  regsub -all -- {__VCVEREXT__}  $aTmpl $aVerExt  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
 }
 
@@ -1209,12 +1273,16 @@ proc wokUtils:FILES:FileToString { fin } {
 
 # 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]
@@ -1258,9 +1326,11 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
     } else {
       set aLibsMap(CSF_FreeImagePlus) "freeimage"
     }
+  } elseif { "$theOS" == "wnt" } {
+    set aLibsMap(CSF_FreeImagePlus) "windowscodecs"
   }
-  if { "$::HAVE_GL2PS" == "true" } {
-    set aLibsMap(CSF_GL2PS) "gl2ps"
+  if { "$::HAVE_FFMPEG" == "true" } {
+    set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
   }
   if { "$::HAVE_TBB" == "true" } {
     set aLibsMap(CSF_TBB) "tbb tbbmalloc"
@@ -1272,6 +1342,12 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
       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
@@ -1279,10 +1355,11 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
     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_AviLibs)      "ws2_32 vfw32"
+    set aLibsMap(CSF_winmm)        "winmm"
     set aLibsMap(CSF_OpenGlLibs)   "opengl32"
     if { "$::HAVE_GLES2" == "true" } {
       set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
@@ -1299,15 +1376,17 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
     # 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 aFrmsMap(CSF_Appkit)     "AppKit"
       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"
     } else {
       if { "$theOS" == "qnx" } {
         # CSF_ThreadLibs - pthread API is part of libc on QNX
@@ -1402,8 +1481,7 @@ proc osutils:tk:units { tkloc } {
 }
 
 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]
 }
 
@@ -1493,31 +1571,28 @@ proc wokUtils:FILES:wtail { f n } {
 }
 
 # Generate entry for one source file in Visual Studio 10 project file
-proc osutils:vcxproj:file { vcversion 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"
@@ -1528,17 +1603,25 @@ proc osutils:vcxproj:filters { dir proj theFilesMap } {
   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"
@@ -1546,51 +1629,19 @@ proc osutils:vcxproj:filters { dir proj theFilesMap } {
   }
   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
@@ -1619,8 +1670,8 @@ proc osutils:readtemplate:rc {theOutDir theToolKit} {
 }
 
 # 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
@@ -1631,11 +1682,11 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
   }
   regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
 
-  set theProjTmpl [osutils:uwp:proj ${theVcVer} ${theProjTmpl}]
+  set theProjTmpl [osutils:uwp:proj $isUWP ${theProjTmpl}]
 
   set aUsedLibs [list]
 
-  if { "$theVcVer" == "vc14-uwp" } {
+  if { $isUWP } {
     lappend aUsedLibs "WindowsApp.lib"
   }
 
@@ -1650,7 +1701,8 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
 
   # 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"
@@ -1660,11 +1712,11 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
   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"
@@ -1673,9 +1725,10 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
   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]
@@ -1704,12 +1757,22 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
       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: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"
@@ -1725,15 +1788,9 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
       }
       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
@@ -1743,12 +1800,8 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
   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
@@ -1780,16 +1833,14 @@ proc osutils:tk:loadunit { loc map } {
   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 {
@@ -1799,6 +1850,7 @@ proc osutils:tk:files { tkloc thePlatform } {
          "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
@@ -1813,7 +1865,7 @@ proc osutils:tk:files { tkloc thePlatform } {
       #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
         }
       }
@@ -1822,15 +1874,18 @@ proc osutils:tk:files { tkloc thePlatform } {
   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 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
-    }
+  foreach f [osutils:tk:cxxfiles $theToolKit wnt] {
+    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
@@ -1853,7 +1908,8 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
 
     # 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" } {
@@ -1862,15 +1918,16 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
     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 $theVcVer $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"
@@ -1882,10 +1939,8 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
       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
 
@@ -1901,9 +1956,12 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
 
     # 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
@@ -1913,7 +1971,7 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
       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
@@ -2078,7 +2136,7 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit thePlatform} {
     set listloc $theToolKit
   }
 
-  if { $thePlatform == "wnt" } {
+  if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
     set resultloc [osutils:justwnt  $listloc]
   } else {
     set resultloc [osutils:justunix $listloc]
@@ -2086,7 +2144,7 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit thePlatform} {
   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
@@ -2097,9 +2155,9 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit thePlatform} {
     }
 
     # macros for correct DLL exports
-    if { $thePlatform == "wnt" } {
-      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]
@@ -2180,7 +2238,7 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit thePlatform } {
   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]
@@ -2216,9 +2274,9 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit thePlatform } {
     }
 
     # macros for correct DLL exports
-    if { $thePlatform == "wnt" } {
-      lappend aTKDefines "__${theToolKit}_DLL"
-    }
+#    if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
+#      lappend aTKDefines "__${theToolKit}_DLL"
+#    }
 
     # common include paths
     lappend anIncPaths "../../../inc"
@@ -2240,7 +2298,6 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit thePlatform } {
 # @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"
@@ -2249,7 +2306,11 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   set aCmplFlagsDebug   [list]
   set toPassArgsByFile 0
   set aLibPrefix "lib"
-  if { "$aWokStation" == "wnt" || "$aWokStation" == "qnx" } {
+  set aPlatformAndCompiler "${thePlatform}/gcc"
+  if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
+    set aPlatformAndCompiler "${thePlatform}/clang"
+  }
+  if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" || "$thePlatform" == "qnx" } {
     set toPassArgsByFile 1
   }
   if { "$theCmpl" == "msvc" } {
@@ -2264,12 +2325,12 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
     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 {
@@ -2283,7 +2344,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   lappend aCmplFlagsRelease "-DNDEBUG"
   lappend aCmplFlagsRelease "-DNo_Exception"
   lappend aCmplFlagsDebug   "-D_DEBUG"
-  if { "$aWokStation" == "qnx" } {
+  if { "$thePlatform" == "qnx" } {
     lappend aCmplFlags "-D_QNX_SOURCE"
   }
 
@@ -2305,20 +2366,20 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   # 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=\"../../../${aPlatformAndCompiler}/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=\"../../../${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=\"../../../${aWokStation}/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=\"../../../${aWokStation}/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 { "$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\" />"
@@ -2338,15 +2399,15 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   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=\"../../../${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 { "$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=../../../${aPlatformAndCompiler}/lib\" />"
   }
   puts $aFile "\t\t\t\t</Linker>"
 
@@ -2355,20 +2416,20 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   # 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=\"../../../${aPlatformAndCompiler}/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=\"../../../${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=\"../../../${aWokStation}/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=\"../../../${aWokStation}/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 { "$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\" />"
@@ -2388,15 +2449,15 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   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=\"../../../${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 { "$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=../../../${aPlatformAndCompiler}/libd\" />"
   }
   puts $aFile "\t\t\t\t</Linker>"
 
@@ -2417,7 +2478,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
 
   # 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 {
@@ -2463,8 +2524,8 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
       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/" "/${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 {
@@ -2473,7 +2534,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
     }
   }
 
-  if { "$aWokStation" == "wnt" } {
+  if { "$thePlatform" == "wnt" || "$thePlatform" == "uwp" } {
     close $aFileLnkObj
     close $aFileLnkObjd
   }
@@ -2620,7 +2681,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
   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]
   }
@@ -2686,7 +2747,7 @@ proc osutils:xcdtk:sources {theToolKit theTargetType theSrcFileRefSection theGro
       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"
 
@@ -3037,12 +3098,12 @@ proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {t
   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;"
@@ -3080,12 +3141,12 @@ proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {t
   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;"
@@ -3291,7 +3352,7 @@ proc osutils:sdk { theSdkMajorVer {isQuietMode false} {theSdkDirectories {}} } {
 }
 
 # Generate global properties to Visual Studio project file for UWP solution
-proc osutils:uwp:proj { theVcVer theProjTmpl } {
+proc osutils:uwp:proj { isUWP theProjTmpl } {
 
   set uwp_properties ""
   set uwp_generate_metadata ""
@@ -3299,7 +3360,7 @@ proc osutils:uwp:proj { theVcVer theProjTmpl } {
 
   set format_template ""
 
-  if { ${theVcVer} == "vc14-uwp" } {
+  if { $isUWP } {
     set sdk_versions [osutils:sdk 10]
     set sdk_max_ver [lindex ${sdk_versions} end]
 
@@ -3323,3 +3384,35 @@ proc osutils:uwp:proj { theVcVer 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!"
+      }
+    }
+  }
+}