]> OCCT Git - occt-wok.git/commitdiff
0023395: Add support for generating projects files for Xcode
authordbv <dbv@opencascade.com>
Tue, 12 Mar 2013 13:33:51 +0000 (17:33 +0400)
committerdbv <dbv@opencascade.com>
Tue, 12 Mar 2013 13:33:51 +0000 (17:33 +0400)
Fixed "-framework" flag parsing
Fixed scripts

src/WOKBuilderDef/CSF_MAC.edl [changed mode: 0644->0755]
src/WOKTclLib/OS.tcl [changed mode: 0644->0755]
src/WOKTclLib/osutils.tcl
src/WOKTclLib/templates/env.sh
src/WOKTclLib/templates/template.plist [new file with mode: 0755]
src/WOKTclLib/templates/template.xcscheme [new file with mode: 0755]
src/WOKTclLib/templates/xcode.sh [new file with mode: 0755]
src/WOKsite/wok_tclshrc.tcl

old mode 100644 (file)
new mode 100755 (executable)
index d7c9db3..9a1d0d1
@@ -59,7 +59,7 @@
 
   -- Cocoa staff
   @set %CSF_objc            = "-lobjc ";
-  @set %CSF_Appkit          = "-framework Appkit ";
+  @set %CSF_Appkit          = "-framework AppKit ";
   @set %CSF_IOKit           = "-framework IOKit ";
 
   @if (%MACOSX_USE_GLX == "true") then
old mode 100644 (file)
new mode 100755 (executable)
index ec6a5b9..4909ec6
@@ -3183,13 +3183,118 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
   puts "The Code Blocks workspace and project files are stored in the $theOutDir directory"
 }
 
+# Generates toolkits sections for Xcode workspace file.
+proc OS:xcworkspace:toolkits { theModule } {
+  set aBuff ""
+
+  # Adding toolkits for module in workspace.
+  foreach aToolKit [osutils:tk:sort [${theModule}:toolkits]] {
+    append aBuff "         <FileRef\n"
+    append aBuff "            location = \"group:${aToolKit}.xcodeproj\">\n"
+    append aBuff "         </FileRef>\n"
+  }
+
+  # Adding executables for module, assume one project per cxx file...
+  foreach aUnit [OS:executable ${theModule}] {
+    set aUnitLoc [woklocate -u $aUnit]
+    set aSrcFiles [uinfo -f -T source $aUnitLoc]
+    foreach aSrcFile $aSrcFiles {
+      set aFileExtension [file extension $aSrcFile]
+      if { $aFileExtension == ".cxx" } {
+        set aPrjName [file rootname $aSrcFile]
+        append aBuff "         <FileRef\n"
+        append aBuff "            location = \"group:${aPrjName}.xcodeproj\">\n"
+        append aBuff "         </FileRef>\n"
+      }
+    }
+  }
+
+  # Removing unnecessary newline character from the end.
+  set aBuff [string replace $aBuff end end]
+  return $aBuff
+}
+
+# Generates workspace files for Xcode.
+proc OS:xcworkspace { theWorkspaceName theModules theOutDir } {
+  # Creating workspace directory for Xcode.
+  set aWorkspaceDir "${theOutDir}/${theWorkspaceName}.xcworkspace"
+  OS:mkdir $aWorkspaceDir
+  if { ! [file exists $aWorkspaceDir] } {
+    puts stderr "Error: Could not create workspace directory \"$aWorkspaceDir\""
+    return
+  }
+
+  # Creating workspace file.
+  set aWsFilePath "${aWorkspaceDir}/contents.xcworkspacedata"
+  set aFile [open $aWsFilePath "w"]
+  
+  # Adding header and section for main Group.
+  puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+  puts $aFile "<Workspace"
+  puts $aFile "   version = \"1.0\">"
+  puts $aFile "   <Group"
+  puts $aFile "      location = \"container:\""
+  puts $aFile "      name = \"${theWorkspaceName}\">"
+  
+  # Adding modules.
+  if { [llength "$theModules"] > 1 } {
+    foreach aModule $theModules {
+      puts $aFile "      <Group"
+      puts $aFile "         location = \"container:\""
+      puts $aFile "         name = \"${aModule}\">"
+      puts $aFile [OS:xcworkspace:toolkits $aModule]
+      puts $aFile "      </Group>"
+    }
+  } else {
+    puts $aFile [OS:xcworkspace:toolkits $theModules]
+  }
+
+  # Adding footer.
+  puts $aFile "   </Group>"
+  puts $aFile "</Workspace>"
+  close $aFile
+}
+
+# Generates Xcode project files.
+proc OS:xcodeproj { theModules theOutDir theGuidsMap} {
+  upvar $theGuidsMap aGuidsMap
+
+  set aProjectFiles {}
+  foreach aModule $theModules {
+    foreach aToolKit [${aModule}:toolkits] {
+      lappend aProjectFiles [osutils:xcdtk $theOutDir $aToolKit      aGuidsMap "dylib"]
+    }
+    foreach anExecutable [OS:executable ${aModule}] {
+      lappend aProjectFiles [osutils:xcdtk  $theOutDir $anExecutable aGuidsMap "executable"]
+    }
+  }
+  return $aProjectFiles
+}
+
+# Function to generate Xcode workspace and project files
+proc OS:MKXCD { theOutDir {theModules {}} {theAllSolution ""} } {
+
+  puts stderr "Generating project files for Xcode"
+
+  # Generate projects for toolkits and separate workspace for each module
+  foreach aModule $theModules {
+    OS:xcworkspace $aModule $aModule $theOutDir
+    OS:xcodeproj   $aModule          $theOutDir ::THE_GUIDS_LIST
+  }
+
+  # Generate single workspace "OCCT" containing projects from all modules
+  if { "$theAllSolution" != "" } {
+    OS:xcworkspace $theAllSolution $theModules $theOutDir
+  }
+}
+
 # Store global GUIDs map to reproduce same values on sequential calls
 set aTKNullKey "TKNull"
 set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
 
 # Entry function to generate project files and solutions for IDE
 proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } {
-  set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" }
+  set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" "xcd"}
 
   if { [lsearch $aSupportedIDE $theIDE] < 0 } {
     puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE\nSupported IDEs: [join ${aSupportedIDE} " "]"
@@ -3256,6 +3361,10 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } {
     "cbp"   { OS:MKCBP $anOutDir $aModules $anAllSolution }
     "cmake" { OS:MKCMK "${anOutRoot}/${theIDE}" $aModules $anAllSolution }
     "amk"   { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"}
+    "xcd"   {
+      set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000" 
+      OS:MKXCD $anOutDir $aModules $anAllSolution
+    }
   }
 
   # generate config.txt file
index 3d07339ab55336506c787648e180eae02b0a58b8..ecee1522078803522b4ad7100d63ef480cc3f51f 100755 (executable)
@@ -2430,3 +2430,618 @@ proc relativePath {thePathFrom thePathTo} {
 
   return $thePathTo
 }
+
+# Generates dependencies section for Xcode project files.
+proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids} {
+  upvar $theGuidsMap         aGuidsMap
+  upvar $theFileRefSection   aFileRefSection
+  upvar $theDepsGuids        aDepsGuids
+  upvar $theDepsRefGuids     aDepsRefGuids
+
+  set aBuildFileSection ""
+  set aFrameworks       [list]
+  set aUsedToolKits     [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $theToolKit]]]
+  set aDepToolkits      [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $theToolKit]]] $theToolKit]
+  
+  if { "$theTargetType" == "executable" } {
+    set aFile [osutils:tk:files $theToolKit osutils:compilable 0]
+    set aProjName [file rootname [file tail $aFile]]
+    set aDepToolkits [LibToLinkX [woklocate -u $theToolKit] $aProjName]
+  }
+  wokparam -l CSF
+
+  foreach tk $aDepToolkits {
+    foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+      if {[wokparam -t %$element] == 0} {
+        continue
+      }
+      set isFrameworkNext 0
+      foreach fl [split [wokparam -v %$element] \{\ \}] {
+        if {[string first "-libpath" $fl] != "-1"} {
+          # this is library search path, not the library name
+          continue
+        } elseif {[string first "-framework" $fl] != "-1"} {
+          set isFrameworkNext 1
+          continue
+        }
+        set felem [file tail $fl]
+        if {$isFrameworkNext == 1} {
+          lappend aFrameworks "${felem}"
+          set isFrameworkNext 0
+        }
+        if {[lsearch $aUsedToolKits $felem] == "-1"} {
+          if {$felem != "\{\}" & $felem != "lib"} {
+            if {[lsearch -nocase [osutils:optinal_libs] $felem] == -1} {
+              set aLibName [string trimleft "${felem}" "-l"]
+              if { [string length $aLibName] > 0 && [lsearch $aUsedToolKits $aLibName] == "-1" } {
+                lappend aUsedToolKits $aLibName
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  foreach tkx $aUsedToolKits {
+    set aDepLib    "${tkx}_Dep"
+    set aDepLibRef "${tkx}_DepRef"
+
+    if { ! [info exists aGuidsMap($aDepLib)] } {
+      set aGuidsMap($aDepLib) [OS:genGUID "xcd"]
+    }
+    if { ! [info exists aGuidsMap($aDepLibRef)] } {
+      set aGuidsMap($aDepLibRef) [OS:genGUID "xcd"]
+    }
+
+    append aBuildFileSection "\t\t$aGuidsMap($aDepLib) = \{isa = PBXBuildFile; fileRef = $aGuidsMap($aDepLibRef) ; \};\n"
+    if {[lsearch -nocase $aFrameworks $tkx] == -1} {
+      append aFileRefSection   "\t\t$aGuidsMap($aDepLibRef) = \{isa = PBXFileReference; lastKnownFileType = file; name = lib${tkx}.dylib; path = lib${tkx}.dylib; sourceTree = \"<group>\"; \};\n"
+    } else {
+      append aFileRefSection   "\t\t$aGuidsMap($aDepLibRef) = \{isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ${tkx}.framework; path = /System/Library/Frameworks/${tkx}.framework; sourceTree = \"<absolute>\"; \};\n"
+    }
+    append aDepsGuids        "\t\t\t\t$aGuidsMap($aDepLib) ,\n"
+    append aDepsRefGuids     "\t\t\t\t$aGuidsMap($aDepLibRef) ,\n"
+  }
+
+  return $aBuildFileSection
+}
+
+# Generates PBXBuildFile and PBXGroup sections for project file.
+proc osutils:xcdtk:sources {theToolKit theTargetType theSrcFileRefSection theGroupSection thePackageGuids theSrcFileGuids theGuidsMap theIncPaths} {
+  upvar $theSrcFileRefSection aSrcFileRefSection
+  upvar $theGroupSection      aGroupSection
+  upvar $thePackageGuids      aPackagesGuids
+  upvar $theSrcFileGuids      aSrcFileGuids
+  upvar $theGuidsMap          aGuidsMap
+  upvar $theIncPaths          anIncPaths
+
+  set listloc [osutils:tk:units [woklocate -u $theToolKit]]
+  set resultloc [osutils:justunix $listloc]
+  set aBuildFileSection ""
+  set aPackages [lsort -nocase $resultloc]
+  if { "$theTargetType" == "executable" } {
+    set aPackages [list "$theToolKit"]
+  }
+
+  # Generating PBXBuildFile, PBXGroup sections and groups for each package.
+  foreach fxlo $aPackages {
+    set xlo [wokinfo -n $fxlo]
+    set aPackage "${xlo}_Package"
+    set aSrcFileRefGuids ""
+    lappend anIncPaths "../../../drv/${xlo}"
+    lappend anIncPaths "../../../src/${xlo}"
+    if { ! [info exists aGuidsMap($aPackage)] } {
+      set aGuidsMap($aPackage) [OS:genGUID "xcd"]
+    }
+
+    set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
+    foreach aSrcFile [lsort $aSrcFiles] {
+      set aFileExt "sourcecode.cpp.cpp"
+
+      if { [file extension $aSrcFile] == ".c" } {
+        set aFileExt "sourcecode.c.c"
+      } elseif { [file extension $aSrcFile] == ".mm" } {
+        set aFileExt "sourcecode.cpp.objcpp"
+      }
+
+      if { ! [info exists aGuidsMap($aSrcFile)] } {
+        set aGuidsMap($aSrcFile) [OS:genGUID "xcd"]
+      }
+      set aSrcFileRef "${aSrcFile}_Ref"
+      if { ! [info exists aGuidsMap($aSrcFileRef)] } {
+        set aGuidsMap($aSrcFileRef) [OS:genGUID "xcd"]
+      }
+      if { ! [info exists written([file tail $aSrcFile])] } {
+        set written([file tail $aSrcFile]) 1
+        append aBuildFileSection  "\t\t$aGuidsMap($aSrcFile) = \{isa = PBXBuildFile; fileRef = $aGuidsMap($aSrcFileRef) ;\};\n"
+        append aSrcFileRefSection "\t\t$aGuidsMap($aSrcFileRef) = \{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = ${aFileExt}; name = [wokUtils:FILES:wtail $aSrcFile 1]; path = ../../../[wokUtils:FILES:wtail $aSrcFile 3]; sourceTree = \"<group>\"; \};\n"
+        append aSrcFileGuids      "\t\t\t\t$aGuidsMap($aSrcFile) ,\n"
+        append aSrcFileRefGuids   "\t\t\t\t$aGuidsMap($aSrcFileRef) ,\n"
+      } else {
+        puts "Warning : more than one occurences for [file tail $aSrcFile]"
+      }
+    }
+
+    append aGroupSection "\t\t$aGuidsMap($aPackage) = \{\n"
+    append aGroupSection "\t\t\tisa = PBXGroup;\n"
+    append aGroupSection "\t\t\tchildren = (\n"
+    append aGroupSection $aSrcFileRefGuids
+    append aGroupSection "\t\t\t);\n"
+    append aGroupSection "\t\t\tname = $xlo;\n"
+    append aGroupSection "\t\t\tsourceTree = \"<group>\";\n"
+    append aGroupSection "\t\t\};\n"
+
+    # Storing packages IDs for adding them later as a child of toolkit
+    append aPackagesGuids "\t\t\t\t$aGuidsMap($aPackage) ,\n"
+  }
+
+  # Removing unnecessary newline character from the end.
+  set aPackagesGuids [string replace $aPackagesGuids end end]
+
+  return $aBuildFileSection
+}
+
+# Creates folders structure and all necessary files for Xcode project.
+proc osutils:xcdtk { theOutDir theToolKit theGuidsMap {theTargetType "dylib"} } {
+  set aPBXBuildPhase "Headers"
+  set aRunOnlyForDeployment "0"
+  set aProductType "library.dynamic"
+  set anExecExtension "\t\t\t\tEXECUTABLE_EXTENSION = dylib;"
+  set anExecPrefix "\t\t\t\tEXECUTABLE_PREFIX = lib;"
+  set aWrapperExtension "\t\t\t\tWRAPPER_EXTENSION = dylib;"
+  set aTKDefines [list "CSFDB" "HAVE_WOK_CONFIG_H" "HAVE_CONFIG_H" "OCC_CONVERT_SIGNALS"]
+
+  if { "$theTargetType" == "executable" } {
+    set aPBXBuildPhase "CopyFiles"
+    set aRunOnlyForDeployment "1"
+    set aProductType "tool"
+    set anExecExtension ""
+    set anExecPrefix ""
+    set aWrapperExtension ""
+  }
+
+  set aUsername [exec whoami]
+
+  # Creation of folders for Xcode projectP.
+  set aToolkitDir "${theOutDir}/${theToolKit}.xcodeproj"
+  OS:mkdir $aToolkitDir
+  if { ! [file exists $aToolkitDir] } {
+    puts stderr "Error: Could not create project directory \"$aToolkitDir\""
+    return
+  }
+
+  set aUserDataDir "${aToolkitDir}/xcuserdata"
+  OS:mkdir $aUserDataDir
+  if { ! [file exists $aUserDataDir] } {
+    puts stderr "Error: Could not create xcuserdata directorty in \"$aToolkitDir\""
+    return
+  }
+
+  set aUserDataDir "${aUserDataDir}/${aUsername}.xcuserdatad"
+  OS:mkdir $aUserDataDir
+  if { ! [file exists $aUserDataDir] } {
+    puts stderr "Error: Could not create ${aUsername}.xcuserdatad directorty in \"$aToolkitDir\"/xcuserdata"
+    return
+  }
+
+  set aSchemesDir "${aUserDataDir}/xcschemes"
+  OS:mkdir $aSchemesDir
+  if { ! [file exists $aSchemesDir] } {
+    puts stderr "Error: Could not create xcschemes directorty in \"$aUserDataDir\""
+    return
+  }
+  # End of folders creation.
+
+  # Generating GUID for tookit.
+  upvar $theGuidsMap aGuidsMap
+  if { ! [info exists aGuidsMap($theToolKit)] } {
+    set aGuidsMap($theToolKit) [OS:genGUID "xcd"]
+  }
+
+  # Creating xcscheme file for toolkit from template.
+  set aXcschemeTmpl [osutils:readtemplate "xcscheme" "xcd"]
+  regsub -all -- {__TOOLKIT_NAME__} $aXcschemeTmpl $theToolKit aXcschemeTmpl
+  regsub -all -- {__TOOLKIT_GUID__} $aXcschemeTmpl $aGuidsMap($theToolKit) aXcschemeTmpl
+  set aXcschemeFile [open "$aSchemesDir/${theToolKit}.xcscheme"  "w"]
+  puts $aXcschemeFile $aXcschemeTmpl
+  close $aXcschemeFile
+
+  # Creating xcschememanagement.plist file for toolkit from template.
+  set aPlistTmpl [osutils:readtemplate "plist" "xcd"]
+  regsub -all -- {__TOOLKIT_NAME__} $aPlistTmpl $theToolKit aPlistTmpl
+  regsub -all -- {__TOOLKIT_GUID__} $aPlistTmpl $aGuidsMap($theToolKit) aPlistTmpl
+  set aPlistFile [open "$aSchemesDir/xcschememanagement.plist"  "w"]
+  puts $aPlistFile $aPlistTmpl
+  close $aPlistFile
+
+  # Creating project.pbxproj file for toolkit.
+  set aPbxprojFile [open "$aToolkitDir/project.pbxproj" "w"]
+  puts $aPbxprojFile "// !\$*UTF8*\$!"
+  puts $aPbxprojFile "\{"
+  puts $aPbxprojFile "\tarchiveVersion = 1;"
+  puts $aPbxprojFile "\tclasses = \{"
+  puts $aPbxprojFile "\t\};"
+  puts $aPbxprojFile "\tobjectVersion = 46;"
+  puts $aPbxprojFile "\tobjects = \{\n"
+
+  # Begin PBXBuildFile section
+  set aPackagesGuids ""
+  set aGroupSection ""
+  set aSrcFileRefSection ""
+  set aSrcFileGuids ""
+  set aDepsFileRefSection ""
+  set aDepsGuids ""
+  set aDepsRefGuids ""
+  set anIncPaths [list "../../../inc" $::env(WOK_LIBRARY)]
+  puts $aPbxprojFile [osutils:xcdtk:sources $theToolKit $theTargetType aSrcFileRefSection aGroupSection aPackagesGuids aSrcFileGuids aGuidsMap anIncPaths]
+  puts $aPbxprojFile [osutils:xcdtk:deps    $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids]
+  # End PBXBuildFile section
+
+  # Begin PBXFileReference section
+  set aToolkitLib "lib${theToolKit}.dylib"
+  set aPath "$aToolkitLib"
+  if { "$theTargetType" == "executable" } {
+    set aPath "$theToolKit"
+  }
+
+  if { ! [info exists aGuidsMap($aToolkitLib)] } {
+    set aGuidsMap($aToolkitLib) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile "\t\t$aGuidsMap($aToolkitLib) = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.${theTargetType}\"; includeInIndex = 0; path = $aPath; sourceTree = BUILT_PRODUCTS_DIR; };\n"
+  puts $aPbxprojFile $aSrcFileRefSection
+  puts $aPbxprojFile $aDepsFileRefSection
+  # End PBXFileReference section
+
+
+  # Begin PBXFrameworksBuildPhase section
+  set aTkFrameworks "${theToolKit}_Frameworks"
+  if { ! [info exists aGuidsMap($aTkFrameworks)] } {
+    set aGuidsMap($aTkFrameworks) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkFrameworks) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBXFrameworksBuildPhase;"
+  puts $aPbxprojFile "\t\t\tbuildActionMask = 2147483647;"
+  puts $aPbxprojFile "\t\t\tfiles = ("
+  puts $aPbxprojFile $aDepsGuids
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\trunOnlyForDeploymentPostprocessing = 0;"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End PBXFrameworksBuildPhase section
+
+  # Begin PBXGroup section
+  set aTkPBXGroup "${theToolKit}_PBXGroup"
+  if { ! [info exists aGuidsMap($aTkPBXGroup)] } {
+    set aGuidsMap($aTkPBXGroup) [OS:genGUID "xcd"]
+  }
+
+  set aTkSrcGroup "${theToolKit}_SrcGroup"
+  if { ! [info exists aGuidsMap($aTkSrcGroup)] } {
+    set aGuidsMap($aTkSrcGroup) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile $aGroupSection
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkPBXGroup) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBXGroup;"
+  puts $aPbxprojFile "\t\t\tchildren = ("
+  puts $aPbxprojFile $aDepsRefGuids
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkSrcGroup) ,"
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aToolkitLib) ,"
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tsourceTree = \"<group>\";"
+  puts $aPbxprojFile "\t\t\};"
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkSrcGroup) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBXGroup;"
+  puts $aPbxprojFile "\t\t\tchildren = ("
+  puts $aPbxprojFile $aPackagesGuids
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tname = \"Source files\";"
+  puts $aPbxprojFile "\t\t\tsourceTree = \"<group>\";"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End PBXGroup section
+
+  # Begin PBXHeadersBuildPhase section
+  set aTkHeaders "${theToolKit}_Headers"
+  if { ! [info exists aGuidsMap($aTkHeaders)] } {
+    set aGuidsMap($aTkHeaders) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkHeaders) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBX${aPBXBuildPhase}BuildPhase;"
+  puts $aPbxprojFile "\t\t\tbuildActionMask = 2147483647;"
+  puts $aPbxprojFile "\t\t\tfiles = ("
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\trunOnlyForDeploymentPostprocessing = ${aRunOnlyForDeployment};"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End PBXHeadersBuildPhase section
+
+  # Begin PBXNativeTarget section
+  set aTkBuildCfgListNativeTarget "${theToolKit}_BuildCfgListNativeTarget"
+  if { ! [info exists aGuidsMap($aTkBuildCfgListNativeTarget)] } {
+    set aGuidsMap($aTkBuildCfgListNativeTarget) [OS:genGUID "xcd"]
+  }
+
+  set aTkSources "${theToolKit}_Sources"
+  if { ! [info exists aGuidsMap($aTkSources)] } {
+    set aGuidsMap($aTkSources) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile "\t\t$aGuidsMap($theToolKit) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBXNativeTarget;"
+  puts $aPbxprojFile "\t\t\tbuildConfigurationList = $aGuidsMap($aTkBuildCfgListNativeTarget) ;"
+  puts $aPbxprojFile "\t\t\tbuildPhases = ("
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkSources) ,"
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkFrameworks) ,"
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkHeaders) ,"
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tbuildRules = ("
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tdependencies = ("
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tname = $theToolKit;"
+  puts $aPbxprojFile "\t\t\tproductName = $theToolKit;"
+  puts $aPbxprojFile "\t\t\tproductReference = $aGuidsMap($aToolkitLib) ;"
+  puts $aPbxprojFile "\t\t\tproductType = \"com.apple.product-type.${aProductType}\";"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End PBXNativeTarget section
+
+  # Begin PBXProject section
+  set aTkProjectObj "${theToolKit}_ProjectObj"
+  if { ! [info exists aGuidsMap($aTkProjectObj)] } {
+    set aGuidsMap($aTkProjectObj) [OS:genGUID "xcd"]
+  }
+
+  set aTkBuildCfgListProj "${theToolKit}_BuildCfgListProj"
+  if { ! [info exists aGuidsMap($aTkBuildCfgListProj)] } {
+    set aGuidsMap($aTkBuildCfgListProj) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkProjectObj) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBXProject;"
+  puts $aPbxprojFile "\t\t\tattributes = \{"
+  puts $aPbxprojFile "\t\t\t\tLastUpgradeCheck = 0430;"
+  puts $aPbxprojFile "\t\t\t\};"
+  puts $aPbxprojFile "\t\t\tbuildConfigurationList = $aGuidsMap($aTkBuildCfgListProj) ;"
+  puts $aPbxprojFile "\t\t\tcompatibilityVersion = \"Xcode 3.2\";"
+  puts $aPbxprojFile "\t\t\tdevelopmentRegion = English;"
+  puts $aPbxprojFile "\t\t\thasScannedForEncodings = 0;"
+  puts $aPbxprojFile "\t\t\tknownRegions = ("
+  puts $aPbxprojFile "\t\t\t\ten,"
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tmainGroup = $aGuidsMap($aTkPBXGroup);"
+  puts $aPbxprojFile "\t\t\tproductRefGroup = $aGuidsMap($aTkPBXGroup);"
+  puts $aPbxprojFile "\t\t\tprojectDirPath = \"\";"
+  puts $aPbxprojFile "\t\t\tprojectRoot = \"\";"
+  puts $aPbxprojFile "\t\t\ttargets = ("
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($theToolKit) ,"
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End PBXProject section
+
+  # Begin PBXSourcesBuildPhase section
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkSources) = \{"
+  puts $aPbxprojFile "\t\t\tisa = PBXSourcesBuildPhase;"
+  puts $aPbxprojFile "\t\t\tbuildActionMask = 2147483647;"
+  puts $aPbxprojFile "\t\t\tfiles = ("
+  puts $aPbxprojFile $aSrcFileGuids
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\trunOnlyForDeploymentPostprocessing = 0;"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End PBXSourcesBuildPhase section
+
+  # Begin XCBuildConfiguration section
+  set aTkDebugProject "${theToolKit}_DebugProject"
+  if { ! [info exists aGuidsMap($aTkDebugProject)] } {
+    set aGuidsMap($aTkDebugProject) [OS:genGUID "xcd"]
+  }
+
+  set aTkReleaseProject "${theToolKit}_ReleaseProject"
+  if { ! [info exists aGuidsMap($aTkReleaseProject)] } {
+    set aGuidsMap($aTkReleaseProject) [OS:genGUID "xcd"]
+  }
+
+  set aTkDebugNativeTarget "${theToolKit}_DebugNativeTarget"
+  if { ! [info exists aGuidsMap($aTkDebugNativeTarget)] } {
+    set aGuidsMap($aTkDebugNativeTarget) [OS:genGUID "xcd"]
+  }
+
+  set aTkReleaseNativeTarget "${theToolKit}_ReleaseNativeTarget"
+  if { ! [info exists aGuidsMap($aTkReleaseNativeTarget)] } {
+    set aGuidsMap($aTkReleaseNativeTarget) [OS:genGUID "xcd"]
+  }
+
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkDebugProject) = \{"
+  puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
+  puts $aPbxprojFile "\t\t\tbuildSettings = \{"
+  puts $aPbxprojFile "\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;"
+  puts $aPbxprojFile "\t\t\t\tARCHS = \"\$(ARCHS_STANDARD_64_BIT)\";"
+  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;"
+  puts $aPbxprojFile "\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;"
+  puts $aPbxprojFile "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = ("
+  puts $aPbxprojFile "\t\t\t\t\t\"DEBUG=1\","
+  puts $aPbxprojFile "\t\t\t\t\t\"\$\(inherited\)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;"
+  puts $aPbxprojFile "\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;"
+  puts $aPbxprojFile "\t\t\t\tOTHER_LDFLAGS = \"\$(CSF_OPT_LNK64)\"; "
+  puts $aPbxprojFile "\t\t\t\tONLY_ACTIVE_ARCH = YES;"
+  puts $aPbxprojFile "\t\t\t\};"
+  puts $aPbxprojFile "\t\t\tname = Debug;"
+  puts $aPbxprojFile "\t\t\};"
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkReleaseProject) = \{"
+  puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
+  puts $aPbxprojFile "\t\t\tbuildSettings = \{"
+  puts $aPbxprojFile "\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;"
+  puts $aPbxprojFile "\t\t\t\tARCHS = \"\$(ARCHS_STANDARD_64_BIT)\";"
+  puts $aPbxprojFile "\t\t\t\tCOPY_PHASE_STRIP = YES;"
+  puts $aPbxprojFile "\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";"
+  puts $aPbxprojFile "\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;"
+  puts $aPbxprojFile "\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_VERSION = com.apple.compilers.llvm.clang.1_0;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;"
+  puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;"
+  puts $aPbxprojFile "\t\t\t\tOTHER_LDFLAGS = \"\$(CSF_OPT_LNK64D)\";"
+  puts $aPbxprojFile "\t\t\t\};"
+  puts $aPbxprojFile "\t\t\tname = Release;"
+  puts $aPbxprojFile "\t\t\};"
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkDebugNativeTarget) = \{"
+  puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
+  puts $aPbxprojFile "\t\t\tbuildSettings = \{"
+  puts $aPbxprojFile "${anExecExtension}"
+  puts $aPbxprojFile "${anExecPrefix}"
+  puts $aPbxprojFile "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = ("
+  foreach aMacro $aTKDefines {
+    puts $aPbxprojFile "\t\t\t\t\t${aMacro} ,"
+  }
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tHEADER_SEARCH_PATHS = ("
+  foreach anIncPath $anIncPaths {
+    puts $aPbxprojFile "\t\t\t\t\t${anIncPath},"
+  }
+  puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_INC)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = /usr/X11/lib;"
+  puts $aPbxprojFile "\t\t\t\tOTHER_CFLAGS = ("
+  puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_CMPL)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tOTHER_CPLUSPLUSFLAGS = ("
+  puts $aPbxprojFile "\t\t\t\t\t\"\$(OTHER_CFLAGS)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tPRODUCT_NAME = \"\$(TARGET_NAME)\";"
+  set anUserHeaderSearchPath "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \""
+  foreach anIncPath $anIncPaths {
+    append anUserHeaderSearchPath " ${anIncPath}"
+  }
+  append anUserHeaderSearchPath "\";"
+  puts $aPbxprojFile $anUserHeaderSearchPath
+  puts $aPbxprojFile "${aWrapperExtension}"
+  puts $aPbxprojFile "\t\t\t\};"
+  puts $aPbxprojFile "\t\t\tname = Debug;"
+  puts $aPbxprojFile "\t\t\};"
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkReleaseNativeTarget) = \{"
+  puts $aPbxprojFile "\t\t\tisa = XCBuildConfiguration;"
+  puts $aPbxprojFile "\t\t\tbuildSettings = \{"
+  puts $aPbxprojFile "${anExecExtension}"
+  puts $aPbxprojFile "${anExecPrefix}"
+  puts $aPbxprojFile "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = ("
+  foreach aMacro $aTKDefines {
+    puts $aPbxprojFile "\t\t\t\t\t${aMacro} ,"
+  }
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tHEADER_SEARCH_PATHS = ("
+  foreach anIncPath $anIncPaths {
+    puts $aPbxprojFile "\t\t\t\t\t${anIncPath},"
+  }
+  puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_INC)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = /usr/X11/lib;"
+  puts $aPbxprojFile "\t\t\t\tOTHER_CFLAGS = ("
+  puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_CMPL)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tOTHER_CPLUSPLUSFLAGS = ("
+  puts $aPbxprojFile "\t\t\t\t\t\"\$(OTHER_CFLAGS)\","
+  puts $aPbxprojFile "\t\t\t\t);"
+  puts $aPbxprojFile "\t\t\t\tPRODUCT_NAME = \"\$(TARGET_NAME)\";"
+  puts $aPbxprojFile $anUserHeaderSearchPath
+  puts $aPbxprojFile "${aWrapperExtension}"
+  puts $aPbxprojFile "\t\t\t\};"
+  puts $aPbxprojFile "\t\t\tname = Release;"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End XCBuildConfiguration section
+
+  # Begin XCConfigurationList section
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkBuildCfgListProj) = \{"
+  puts $aPbxprojFile "\t\t\tisa = XCConfigurationList;"
+  puts $aPbxprojFile "\t\tbuildConfigurations = ("
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkDebugProject) ,"
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkReleaseProject) ,"
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tdefaultConfigurationIsVisible = 0;"
+  puts $aPbxprojFile "\t\t\tdefaultConfigurationName = Release;"
+  puts $aPbxprojFile "\t\t\};"
+  puts $aPbxprojFile "\t\t$aGuidsMap($aTkBuildCfgListNativeTarget) = \{"
+  puts $aPbxprojFile "\t\t\tisa = XCConfigurationList;"
+  puts $aPbxprojFile "\t\t\tbuildConfigurations = ("
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkDebugNativeTarget) ,"
+  puts $aPbxprojFile "\t\t\t\t$aGuidsMap($aTkReleaseNativeTarget) ,"
+  puts $aPbxprojFile "\t\t\t);"
+  puts $aPbxprojFile "\t\t\tdefaultConfigurationIsVisible = 0;"
+  puts $aPbxprojFile "\t\t\tdefaultConfigurationName = Release;"
+  puts $aPbxprojFile "\t\t\};\n"
+  # End XCConfigurationList section
+
+  puts $aPbxprojFile "\t\};"
+  puts $aPbxprojFile "\trootObject = $aGuidsMap($aTkProjectObj) ;"
+  puts $aPbxprojFile "\}"
+
+  close $aPbxprojFile
+}
+
+proc osutils:xcdx { theOutDir theExecutable theGuidsMap } {
+  set aUsername [exec whoami]
+
+  # Creating folders for Xcode project file.
+  set anExecutableDir "${theOutDir}/${theExecutable}.xcodeproj"
+  OS:mkdir $anExecutableDir
+  if { ! [file exists $anExecutableDir] } {
+    puts stderr "Error: Could not create project directory \"$anExecutableDir\""
+    return
+  }
+
+  set aUserDataDir "${anExecutableDir}/xcuserdata"
+  OS:mkdir $aUserDataDir
+  if { ! [file exists $aUserDataDir] } {
+    puts stderr "Error: Could not create xcuserdata directorty in \"$anExecutableDir\""
+    return
+  }
+
+  set aUserDataDir "${aUserDataDir}/${aUsername}.xcuserdatad"
+  OS:mkdir $aUserDataDir
+  if { ! [file exists $aUserDataDir] } {
+    puts stderr "Error: Could not create ${aUsername}.xcuserdatad directorty in \"$anExecutableDir\"/xcuserdata"
+    return
+  }
+
+  set aSchemesDir "${aUserDataDir}/xcschemes"
+  OS:mkdir $aSchemesDir
+  if { ! [file exists $aSchemesDir] } {
+    puts stderr "Error: Could not create xcschemes directorty in \"$aUserDataDir\""
+    return
+  }
+  # End folders creation. 
+
+  # Generating GUID for tookit.
+  upvar $theGuidsMap aGuidsMap
+  if { ! [info exists aGuidsMap($theExecutable)] } {
+    set aGuidsMap($theExecutable) [OS:genGUID "xcd"]
+  }
+
+  # Creating xcscheme file for toolkit from template.
+  set aXcschemeTmpl [osutils:readtemplate "xcscheme" "xcode"]
+  regsub -all -- {__TOOLKIT_NAME__} $aXcschemeTmpl $theExecutable aXcschemeTmpl
+  regsub -all -- {__TOOLKIT_GUID__} $aXcschemeTmpl $aGuidsMap($theExecutable) aXcschemeTmpl
+  set aXcschemeFile [open "$aSchemesDir/${theExecutable}.xcscheme"  "w"]
+  puts $aXcschemeFile $aXcschemeTmpl
+  close $aXcschemeFile
+
+  # Creating xcschememanagement.plist file for toolkit from template.
+  set aPlistTmpl [osutils:readtemplate "plist" "xcode"]
+  regsub -all -- {__TOOLKIT_NAME__} $aPlistTmpl $theExecutable aPlistTmpl
+  regsub -all -- {__TOOLKIT_GUID__} $aPlistTmpl $aGuidsMap($theExecutable) aPlistTmpl
+  set aPlistFile [open "$aSchemesDir/xcschememanagement.plist"  "w"]
+  puts $aPlistFile $aPlistTmpl
+  close $aPlistFile
+
+}
index 4d9e215b43fd657ad4794b853874e6b1b72774cf..19b0a193d017af723d5d3d5bcf3be7f2e8354ffc 100755 (executable)
@@ -118,8 +118,13 @@ else
   export CSF_OPT_LNK32D="$OPT_LINKER_OPTIONS"
 fi
 
-export PATH="${CASROOT}/${CASBIN}bin${CASDEB}:${PATH}"
-export LD_LIBRARY_PATH="${CASROOT}/${CASBIN}lib${CASDEB}:${LD_LIBRARY_PATH}"
+__BIN_PATH__
+__LIBS_PATH__
+export BIN_PATH
+export LIBS_PATH
+
+export PATH="${CASROOT}/${BIN_PATH}:${PATH}"
+export LD_LIBRARY_PATH="${CASROOT}/${LIBS_PATH}:${LD_LIBRARY_PATH}"
 if [ "$WOKSTATION" == "mac" ]; then
   export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}"
 fi
diff --git a/src/WOKTclLib/templates/template.plist b/src/WOKTclLib/templates/template.plist
new file mode 100755 (executable)
index 0000000..9991859
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>SchemeUserState</key>
+       <dict>
+               <key>__TOOLKIT_NAME__.xcscheme</key>
+               <dict>
+                       <key>orderHint</key>
+                       <integer>0</integer>
+               </dict>
+       </dict>
+       <key>SuppressBuildableAutocreation</key>
+       <dict>
+               <key>__TOOLKIT_GUID__</key>
+               <dict>
+                       <key>primary</key>
+                       <true/>
+               </dict>
+       </dict>
+</dict>
+</plist>
diff --git a/src/WOKTclLib/templates/template.xcscheme b/src/WOKTclLib/templates/template.xcscheme
new file mode 100755 (executable)
index 0000000..11b2528
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "__TOOLKIT_GUID__"
+               BuildableName = "lib__TOOLKIT_NAME__.dylib"
+               BlueprintName = "__TOOLKIT_NAME__"
+               ReferencedContainer = "container:__TOOLKIT_NAME__.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
diff --git a/src/WOKTclLib/templates/xcode.sh b/src/WOKTclLib/templates/xcode.sh
new file mode 100755 (executable)
index 0000000..b3cae16
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+source ./env.sh "$1"
+
+export CSF_OPT_LIB64="$CSF_OPT_LIB64:/usr/X11/lib"
+export CSF_OPT_LIB64D="$CSF_OPT_LIB64:/usr/X11/lib"
+
+open -a Xcode ./adm/mac/xcd/OCCT.xcworkspace
index fdeefd6b11232eca941411149f05a9b662548188..d856e07ec778976df44b16859ca692d51c03fd1e 100644 (file)
@@ -267,25 +267,41 @@ proc wgenprojbat {thePath theIDE} {
     if { "$theIDE" == "amk" } {
       regsub -all -- {__CASROOT__}   $anEnvTmpl "\$PWD" anEnvTmpl
       regsub -all -- {__CASBIN__}    $anEnvTmpl ""      anEnvTmpl
-      
-    } else {
-      regsub -all -- {__CASROOT__}   $anEnvTmpl "$aCasRoot"    anEnvTmpl
+      regsub -all -- {__BIN_PATH__}  $anEnvTmpl "BIN_PATH=\${CASBIN}bin\${CASDEB}"  anEnvTmpl
+      regsub -all -- {__LIBS_PATH__} $anEnvTmpl "LIBS_PATH=\${CASBIN}lib\${CASDEB}" anEnvTmpl
+    } elseif {"$theIDE" == "cbp"} {
+      regsub -all -- {__CASROOT__}   $anEnvTmpl "$aCasRoot"           anEnvTmpl
       regsub -all -- {__CASBIN__}    $anEnvTmpl "\${WOKSTATION}/cbp/" anEnvTmpl
+      regsub -all -- {__BIN_PATH__}  $anEnvTmpl "BIN_PATH=\${CASBIN}bin\${CASDEB}"  anEnvTmpl
+      regsub -all -- {__LIBS_PATH__} $anEnvTmpl "LIBS_PATH=\${CASBIN}lib\${CASDEB}" anEnvTmpl
+    } elseif {"$theIDE" == "xcd"} {
+      regsub -all -- {__CASROOT__}   $anEnvTmpl "$aCasRoot"         anEnvTmpl
+      regsub -all -- {__CASBIN__}    $anEnvTmpl "adm/mac/xcd/build" anEnvTmpl
+      regsub -all -- {__BIN_PATH__}  $anEnvTmpl {[[ ${CASDEB} == "d" ]] \&\& BIN_PATH="${CASBIN}/Debug" || BIN_PATH="${CASBIN}/Release"} anEnvTmpl
+      regsub -all -- {__LIBS_PATH__} $anEnvTmpl "LIBS_PATH=\"\$BIN_PATH\"" anEnvTmpl
     }
-    
+
     regsub -all -- {__CSF_OPT_INC__} $anEnvTmpl "$anOsIncPath" anEnvTmpl
-    
+
     if { "$::tcl_platform(platform)" != "windows" } {
+      if {"$theIDE" == "cbp"} {
+        set aReleaseLibsPath "${anOsRootPath}/${::env(WOKSTATION)}/cbp/lib"
+        set aDebugLibsPath   "${anOsRootPath}/${::env(WOKSTATION)}/cbp/libd"
+      } elseif {"$theIDE" == "xcd"} {
+        set aReleaseLibsPath "${anOsRootPath}/adm/mac/xcd/build/Release"
+        set aDebugLibsPath   "${anOsRootPath}/adm/mac/xcd/build/Debug"
+      }
+
       if { "$::ARCH" == "32"} {
-        regsub -all -- {__CSF_OPT_LIB32__}  $anEnvTmpl "${anOsRootPath}/${::env(WOKSTATION)}/cbp/lib"  anEnvTmpl
-        regsub -all -- {__CSF_OPT_LIB32D__} $anEnvTmpl "${anOsRootPath}/${::env(WOKSTATION)}/cbp/libd" anEnvTmpl
+        regsub -all -- {__CSF_OPT_LIB32__}  $anEnvTmpl "${aReleaseLibsPath}"  anEnvTmpl
+        regsub -all -- {__CSF_OPT_LIB32D__} $anEnvTmpl "${aDebugLibsPath}"    anEnvTmpl
         regsub -all -- {__CSF_OPT_LIB64__}  $anEnvTmpl "" anEnvTmpl
         regsub -all -- {__CSF_OPT_LIB64D__} $anEnvTmpl "" anEnvTmpl
       } else {
         regsub -all -- {__CSF_OPT_LIB32__}  $anEnvTmpl "" anEnvTmpl
         regsub -all -- {__CSF_OPT_LIB32D__} $anEnvTmpl "" anEnvTmpl
-        regsub -all -- {__CSF_OPT_LIB64__}  $anEnvTmpl "${anOsRootPath}/${::env(WOKSTATION)}/cbp/lib"  anEnvTmpl
-        regsub -all -- {__CSF_OPT_LIB64D__} $anEnvTmpl "${anOsRootPath}/${::env(WOKSTATION)}/cbp/libd" anEnvTmpl
+        regsub -all -- {__CSF_OPT_LIB64__}  $anEnvTmpl "${aReleaseLibsPath}"  anEnvTmpl
+        regsub -all -- {__CSF_OPT_LIB64D__} $anEnvTmpl "${aDebugLibsPath}"    anEnvTmpl
       }
     }
     set anEnvFile [open "$aBox/env.${aPlatformExt}" "w"]
@@ -300,9 +316,11 @@ proc wgenprojbat {thePath theIDE} {
     "vc7"   -
     "vc8"   -
     "vc9"   -
-    "vc10"   -
+    "vc10"  -
     "vc11"  { file copy -force -- "$::env(WOKHOME)/lib/templates/msvc.bat" "$aBox/msvc.bat" }
     "cbp"   { file copy -force -- "$::env(WOKHOME)/lib/templates/codeblocks.sh" "$aBox/codeblocks.sh" }
+    "xcd"   { file copy -force -- "$::env(WOKHOME)/lib/templates/xcode.sh" "$aBox/xcode.sh" }
+
   }
 }
 
@@ -316,7 +334,7 @@ proc removeAllOccurrencesOf { theObject theList } {
 
 # Wrapper-function to generate VS project files
 proc wgenproj { args } {
-  set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" }
+  set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" "xcd" }
   set anArgs $args
 
   # Setting default IDE.
@@ -380,7 +398,8 @@ proc wgenproj { args } {
       vc11  -  Visual Studio 2012
       cbp   -  CodeBlocks
       cmake -  CMake
-      amk   -  AutoMake"
+      amk   -  AutoMake
+      xcd   -  Xcode"
       return
   }