}
# Generates Xcode project files.
-proc OS:xcodeproj { theModules theOutDir theGuidsMap} {
+proc OS:xcodeproj { theModules theOutDir theGuidsMap theLibType thePlatform} {
upvar $theGuidsMap aGuidsMap
+ set isStatic 0
+ if { "$theLibType" == "static" } {
+ set isStatic 1
+ } elseif { "$thePlatform" == "ios" } {
+ set isStatic 1
+ }
+
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
- lappend aProjectFiles [osutils:xcdtk $theOutDir $aToolKit aGuidsMap "dylib"]
+ lappend aProjectFiles [osutils:xcdtk $theOutDir $aToolKit aGuidsMap $isStatic $thePlatform "dylib"]
}
foreach anExecutable [OS:executable ${aModule}] {
- lappend aProjectFiles [osutils:xcdtk $theOutDir $anExecutable aGuidsMap "executable"]
+ lappend aProjectFiles [osutils:xcdtk $theOutDir $anExecutable aGuidsMap $isStatic $thePlatform "executable"]
}
}
return $aProjectFiles
}
# Function to generate Xcode workspace and project files
-proc OS:MKXCD { theOutDir {theModules {}} {theAllSolution ""} } {
+proc OS:MKXCD { theOutDir {theModules {}} {theAllSolution ""} {theLibType "dynamic"} {thePlatform ""} } {
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
+ OS:xcodeproj $aModule $theOutDir ::THE_GUIDS_LIST $theLibType $thePlatform
}
# Generate single workspace "OCCT" containing projects from all modules
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 ""} } {
+proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } {
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "cbp" "cmake" "amk" "xcd"}
if { [lsearch $aSupportedIDE $theIDE] < 0 } {
"amk" { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"}
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
- OS:MKXCD $anOutDir $aModules $anAllSolution
+ OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
}
}
}
# Generates dependencies section for Xcode project files.
-proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids} {
+proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection theDepsGuids theDepsRefGuids theIsStatic} {
upvar $theGuidsMap aGuidsMap
upvar $theFileRefSection aFileRefSection
upvar $theDepsGuids aDepsGuids
}
}
+ set aLibExt "dylib"
+ if { $theIsStatic == 1 } {
+ set aLibExt "a"
+ if { "$theTargetType" != "executable" } {
+ return $aBuildFileSection
+ }
+ }
+
foreach tkx $aUsedToolKits {
set aDepLib "${tkx}_Dep"
set aDepLibRef "${tkx}_DepRef"
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"
+ append aFileRefSection "\t\t$aGuidsMap($aDepLibRef) = \{isa = PBXFileReference; lastKnownFileType = file; name = lib${tkx}.${aLibExt}; path = lib${tkx}.${aLibExt}; 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"
}
}
# Creates folders structure and all necessary files for Xcode project.
-proc osutils:xcdtk { theOutDir theToolKit theGuidsMap {theTargetType "dylib"} } {
+proc osutils:xcdtk { theOutDir theToolKit theGuidsMap theIsStatic thePlatform {theTargetType "dylib"} } {
set aPBXBuildPhase "Headers"
set aRunOnlyForDeployment "0"
set aProductType "library.dynamic"
set anExecExtension ""
set anExecPrefix ""
set aWrapperExtension ""
+ } elseif { $theIsStatic == 1 } {
+ set aProductType "library.static"
+ set anExecExtension "\t\t\t\tEXECUTABLE_EXTENSION = a;"
+ set aWrapperExtension "\t\t\t\tWRAPPER_EXTENSION = a;"
}
set aUsername [exec whoami]
set aDepsGuids ""
set aDepsRefGuids ""
set anIncPaths [list "../../../inc" $::env(WOK_LIBRARY)]
+ set anLibPaths ""
+
+ if { [info exists ::env(CSF_OPT_INC)] } {
+ set anIncCfg [split "$::env(CSF_OPT_INC)" ":"]
+ foreach anIncCfgPath $anIncCfg {
+ lappend anIncPaths $anIncCfgPath
+ }
+ }
+ if { "$::MACOSX_USE_GLX" == "true" } {
+ lappend anLibPaths "/usr/X11/lib"
+ }
+ if { [info exists ::env(CSF_OPT_LIB64)] } {
+ set anLibCfg [split "$::env(CSF_OPT_LIB64)" ":"]
+ foreach anLibCfgPath $anLibCfg {
+ lappend anLibPaths $anLibCfgPath
+ }
+ }
+
puts $aPbxprojFile [osutils:xcdtk:sources $theToolKit $theTargetType aSrcFileRefSection aGroupSection aPackagesGuids aSrcFileGuids aGuidsMap anIncPaths]
- puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids]
+ puts $aPbxprojFile [osutils:xcdtk:deps $theToolKit $theTargetType aGuidsMap aDepsFileRefSection aDepsGuids aDepsRefGuids $theIsStatic]
# End PBXBuildFile section
# Begin PBXFileReference section
set aPath "$aToolkitLib"
if { "$theTargetType" == "executable" } {
set aPath "$theToolKit"
+ } elseif { $theIsStatic == 1 } {
+ set aToolkitLib "lib${theToolKit}.a"
}
if { ! [info exists aGuidsMap($aToolkitLib)] } {
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;"
+
+ if { "$thePlatform" == "ios" } {
+ puts $aPbxprojFile "\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;"
+ puts $aPbxprojFile "\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;"
+ 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_LANGUAGE_STANDARD = \"gnu++0x\";"
+ 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;"
+ } else {
+ 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_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;"
+ if { "$thePlatform" == "ios" } {
+ puts $aPbxprojFile "\t\t\t\tONLY_ACTIVE_ARCH = NO;"
+ puts $aPbxprojFile "\t\t\t\tSDKROOT = iphoneos;"
+ } else {
+ 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;"
+
+ if { "$thePlatform" == "ios" } {
+ puts $aPbxprojFile "\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;"
+ puts $aPbxprojFile "\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;"
+ 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_LANGUAGE_STANDARD = \"gnu++0x\";"
+ 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;"
+ } else {
+ puts $aPbxprojFile "\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";"
+ 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_UNINITIALIZED_AUTOS = YES;"
puts $aPbxprojFile "\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;"
puts $aPbxprojFile "\t\t\t\tOTHER_LDFLAGS = \"\$(CSF_OPT_LNK64D)\";"
+ if { "$thePlatform" == "ios" } {
+ puts $aPbxprojFile "\t\t\t\tGCC_OPTIMIZATION_LEVEL = fast;"
+ puts $aPbxprojFile "\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 7.0;"
+ puts $aPbxprojFile "\t\t\t\tSDKROOT = iphoneos;"
+ }
puts $aPbxprojFile "\t\t\t\};"
puts $aPbxprojFile "\t\t\tname = Release;"
puts $aPbxprojFile "\t\t\};"
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);"
- if { "$::MACOSX_USE_GLX" == "true" } {
- puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = /usr/X11/lib;"
+
+ puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = ("
+ foreach anLibPath $anLibPaths {
+ puts $aPbxprojFile "\t\t\t\t\t${anLibPath},"
}
+ puts $aPbxprojFile "\t\t\t\t);"
+
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\t\t\"\$(CSF_OPT_INC)\","
puts $aPbxprojFile "\t\t\t\t);"
- if { "$::MACOSX_USE_GLX" == "true" } {
- puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = /usr/X11/lib;"
+
+ puts $aPbxprojFile "\t\t\t\tLIBRARY_SEARCH_PATHS = ("
+ foreach anLibPath $anLibPaths {
+ puts $aPbxprojFile "\t\t\t\t\t${anLibPath},"
}
+ puts $aPbxprojFile "\t\t\t\t);"
+
puts $aPbxprojFile "\t\t\t\tOTHER_CFLAGS = ("
puts $aPbxprojFile "\t\t\t\t\t\"\$(CSF_OPT_CMPL)\","
puts $aPbxprojFile "\t\t\t\t);"
# Setting default IDE.
# For Windows - Visual Studio (vc), Linux - Code Blocks (cbp), Mac OS X - Xcode (cmake).
- set anTarget ""
+ set anIde ""
switch -exact -- "$::env(WOKSTATION)" {
- "wnt" {set anTarget "$::VCVER"}
- "lin" {set anTarget "cmake"}
- "mac" {set anTarget "cmake"}
+ "wnt" {set anIde "$::VCVER"}
+ "lin" {set anIde "cmake"}
+ "mac" {set anIde "cmake"}
}
set isTargetDefault true
}
if { [set anIndex [lsearch -nocase $anArgs -ide=*]] != -1 } {
- regsub -nocase "\\-ide=" [lindex $anArgs $anIndex] "" anTarget
+ regsub -nocase "\\-ide=" [lindex $anArgs $anIndex] "" anIde
set anArgs [removeAllOccurrencesOf -ide=* $anArgs]
set isTargetDefault false
}
if { [set anIndex [lsearch -nocase $anArgs -target=*]] != -1 } {
- regsub -nocase "\\-target=" [lindex $anArgs $anIndex] "" anTarget
+ regsub -nocase "\\-target=" [lindex $anArgs $anIndex] "" anIde
set anArgs [removeAllOccurrencesOf -target=* $anArgs]
set isTargetDefault false
}
if { [llength $anArgs] == 0 && $isTargetDefault == true } {
- puts "the default \'$anTarget\' target has been applied"
+ puts "the default \'$anIde\' target has been applied"
}
set isHelpRequire false
set isHelpRequire true
}
- if { [lsearch -nocase $aSupportedTargets $anTarget] == -1} {
- puts "the \'$anTarget\' is wrong TARGET"
+ set aLibType "dynamic"
+ if { [lsearch -nocase $anArgs "-static"] != -1} {
+ set anArgs [removeAllOccurrencesOf "-static" $anArgs]
+ set aLibType "static"
+ puts "static build has been selected"
+ } elseif { [lsearch -nocase $anArgs "-dynamic"] != -1} {
+ set anArgs [removeAllOccurrencesOf "-dynamic" $anArgs]
+ set aLibType "dynamic"
+ puts "dynamic build has been selected"
+ }
+
+ set aPlatform ""
+ if { [lsearch -nocase $anArgs "-ios"] != -1} {
+ set anArgs [removeAllOccurrencesOf "-ios" $anArgs]
+ set aPlatform "ios"
+ }
+
+ if { [lsearch -nocase $aSupportedTargets $anIde] == -1} {
+ puts "the \'$anIde\' is wrong TARGET"
set isHelpRequire true
}
return
}
- puts "the \'$anTarget\' target has been applied"
+ puts "the \'$anIde\' target has been applied"
source "$::env(WOKHOME)/lib/osutils.tcl"
source "$::env(WOKHOME)/lib/OS.tcl"
# change station if it is necessary
set anOldStation "$::env(WOKSTATION)"
- if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12} $anTarget] != -1 && "$anOldStation" != "wnt"} {
+ if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12} $anIde] != -1 && "$anOldStation" != "wnt"} {
changeStationAndDependentEnvironment wnt
- } elseif { "$anTarget" == "amk" && "$anOldStation" != "lin"} {
+ } elseif { "$anIde" == "amk" && "$anOldStation" != "lin"} {
changeStationAndDependentEnvironment lin
}
wokcd $aWokCD
if { [wokinfo -x OS] } {
- OS:MKPRC "$anAdmPath" "OS" "$anTarget"
+ OS:MKPRC "$anAdmPath" "OS" "$anIde" "$aLibType" "$aPlatform"
}
if { [wokinfo -x VAS] } {
- OS:MKPRC "$anAdmPath" "VAS" "$anTarget"
+ OS:MKPRC "$anAdmPath" "VAS" "$anIde" "$aLibType" "$aPlatform"
}
- wgenprojbat "$anAdmPath" "$anTarget"
+ wgenprojbat "$anAdmPath" "$anIde"
# change back station if it is require
changeStationAndDependentEnvironment "$anOldStation"