0030967: Configuration, genproj.tcl - generate OCCProducts solution for products
[occt.git] / adm / genproj.tcl
index 2bc4f38..57323a4 100644 (file)
@@ -256,7 +256,7 @@ proc genAllResources {} {
 
 # 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" "cbp" "xcd" "pro"}
   set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
   set isHelpRequire false
 
@@ -284,8 +284,12 @@ proc genproj {theFormat args} {
 
   # 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
@@ -295,6 +299,9 @@ proc genproj {theFormat args} {
     } 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
@@ -312,8 +319,10 @@ proc genproj {theFormat args} {
       vc12     -  Visual Studio 2013
       vc14     -  Visual Studio 2015
       vc141    -  Visual Studio 2017
+      vc142    -  Visual Studio 2019
       cbp      -  CodeBlocks
       xcd      -  XCode
+      pro      -  Qt Creator
 
     Platform (optional):
       wnt   -  Windows Desktop
@@ -338,9 +347,9 @@ proc genproj {theFormat args} {
   # 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
 }
 
@@ -360,7 +369,8 @@ proc copy_with_warning {from to} {
   file copy -force -- "$from" "$to"
 }
 
-proc genprojbat {theFormat thePlatform} {
+# Generate auxiliary scripts for launching IDE.
+proc genprojbat {theFormat thePlatform theSolution} {
   set aTargetPlatformExt sh
   if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
     set aTargetPlatformExt bat
@@ -388,20 +398,36 @@ proc genprojbat {theFormat thePlatform} {
     copy_with_warning "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
   }
 
+  set aSolShList ""
   if { [regexp {^vc} $theFormat] } {
-    copy_with_warning "$::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
@@ -422,7 +448,8 @@ set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
 # @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 == "" } {
@@ -472,15 +499,6 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
     }
   }
 
-  # 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"
@@ -491,6 +509,16 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
   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"   -
@@ -500,11 +528,12 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
     "vc11"  -
     "vc12"  -
     "vc14"  -
-    "vc141"    { OS:MKVC  $anOutDir $aModules $anAllSolution $theFormat $isUWP}
-    "cbp"      { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
+    "vc141" -
+    "vc142"    { 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
     }
   }
 
@@ -924,7 +953,7 @@ proc osutils:collectinc {theModules theIncPath} {
   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}"
     }
   }
@@ -955,7 +984,7 @@ proc osutils:vcsolution:header { vcversion } {
     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" } {
     append var \
       "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
       "# Visual Studio 14\n"
@@ -1193,6 +1222,9 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
   if { $theVcVer == "vc141" } {
     set aVCRTVer "vc14"
     set aToolset "v141"
+  } elseif { $theVcVer == "vc142" } {
+    set aVCRTVer "vc14"
+    set aToolset "v142"
   }
 
   set what "$theVcVer"
@@ -1263,12 +1295,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]
@@ -1318,9 +1354,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
   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"
   }
@@ -1344,9 +1377,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_winmm)        "winmm"
     set aLibsMap(CSF_OpenGlLibs)   "opengl32"
     if { "$::HAVE_GLES2" == "true" } {
       set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
@@ -1364,17 +1399,23 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
     set aLibsMap(CSF_TBB) ""
   } else {
     set aLibsMap(CSF_dl)           "dl"
-    if { "$theOS" == "mac" } {
+    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"
     } 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"
@@ -1468,8 +1509,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]
 }
 
@@ -1559,31 +1599,28 @@ proc wokUtils:FILES:wtail { f n } {
 }
 
 # 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"
@@ -1594,17 +1631,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"
@@ -1612,51 +1657,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)
+  # list of hxx files
   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
-  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
@@ -1727,11 +1740,11 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
   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"
@@ -1740,9 +1753,10 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
   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]
@@ -1771,12 +1785,22 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
       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"
@@ -1792,15 +1816,9 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
       }
       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
@@ -1810,12 +1828,8 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
   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
@@ -1847,16 +1861,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 {
@@ -1866,6 +1878,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
@@ -1880,7 +1893,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
         }
       }
@@ -1889,10 +1902,16 @@ 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 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]]
@@ -1927,15 +1946,16 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
     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"
@@ -1947,10 +1967,8 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
       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
 
@@ -1966,9 +1984,12 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap } {
 
     # 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
@@ -2151,7 +2172,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
@@ -2162,9 +2183,9 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit thePlatform} {
     }
 
     # 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]
@@ -2245,7 +2266,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]
@@ -2281,9 +2302,9 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit thePlatform } {
     }
 
     # 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"
@@ -2313,6 +2334,10 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   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
   }
@@ -2369,17 +2394,17 @@ 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=\"../../../${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" } {
@@ -2402,7 +2427,7 @@ 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=\"../../../${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\" />"
@@ -2410,7 +2435,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   }
   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>"
 
@@ -2419,17 +2444,17 @@ 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=\"../../../${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" } {
@@ -2452,7 +2477,7 @@ 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=\"../../../${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\" />"
@@ -2460,7 +2485,7 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
   }
   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>"
 
@@ -2527,8 +2552,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/" "/$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 {
@@ -2673,7 +2698,7 @@ proc OS:xcodeproj { theModules theOutDir theGuidsMap theLibType thePlatform} {
 }
 
 # 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
@@ -2684,7 +2709,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]
   }
@@ -2697,7 +2722,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
     }
   }
 
-  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 {
@@ -2750,7 +2775,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"
 
@@ -2912,7 +2937,7 @@ proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {t
   }
 
   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