1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0027237: genproj file does not take into account any arguments

Arguments of genproj tool are revised:
* -path option eliminated (current directory is always used);
* IDE should be always indicated by first argument (instead of -target=<ide> option);
* second argument can be used to specify non-default platform (wnt, mac, lin, ios, qnx);
* option -h, -help, --help can be used to get help
* option -static can be used to build static libs with XCode

README.txt and docs on building are updated.
codeblocks.bat is corrected to be able to detect 32-bit installation of Code::Blocks on 64-bit Windows.
Remains of support of OpenCL (obsolete) are commented out in genconf.tcl
genproj.tcl will not copy env.bat if it already exists.
This commit is contained in:
abv 2016-03-14 17:45:32 +03:00
parent 978ca537d5
commit 944d808cd0
8 changed files with 146 additions and 206 deletions

View File

@ -29,24 +29,23 @@ Packaging
You can receive certified version of OCCT code in different packages. You can receive certified version of OCCT code in different packages.
- Snapshot of Git repository: contains only bare sources of OCCT; many C++ - Snapshot of Git repository: contains C++ header and source files of OCCT,
files, HTML documentation, and project files / makefiles for building OCCT documentation sources, build scripts, and CMake project files.
need to be generated.
- Complete source archive: contains all sources of OCCT, including C++ files - Complete source archive: contains all sources of OCCT, generated HTML and PDF
generated by WOK, HTML and PDF documentation, and projects / makefiles for documentation, and ready-to-use projects for building on all officially
building on all officially supported platforms. supported platforms.
- Binary package (platform-specific): in addition to complete source archive, - Binary package (platform-specific): in addition to complete source archive,
it includes binaries of OCCT and third-party libraries built on one platform. it includes binaries of OCCT and third-party libraries built on one platform.
This package allows using OCCT immediately after installation. This package allows using OCCT immediately after installation.
Certified versions of OCCT can be downloaded from http://www.opencascade.org Certified versions of OCCT can be downloaded from http://www.opencascade.com
You can also find OCCT pre-installed on your system, or install it from You can also find OCCT pre-installed on your system, or install it from
packages provided by a third party. Note that packaging and functionality packages provided by a third party. Note that packaging and functionality
of such versions can be different from certified releases. Please consult of such versions can be different from certified releases. Please consult
documentation accompanyog your version for details. documentation accompanying your version for details.
Documentation Documentation
------------- -------------
@ -59,8 +58,8 @@ If HTML documentation is not available in your package, you can:
You need to have Tcl and Doxygen 1.8.4 (or above) installed on your system. You need to have Tcl and Doxygen 1.8.4 (or above) installed on your system.
and accessible in your environment (check environment variable PATH). and accessible in your environment (check environment variable PATH).
Run batch file *gendoc.bat* on Windows or Bash scriot *gendoc.sh* on Linux Use batch file *gendoc.bat* on Windows or Bash script *gendoc* on Linux
or Mac OS X to (re)generate documentation. or OS X to (re)generate documentation.
- Read documentation in source plain text (MarkDown) format found in - Read documentation in source plain text (MarkDown) format found in
subfolder *dox* subfolder *dox*

View File

@ -136,9 +136,9 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_TBB" == "true" } { if { "$::HAVE_TBB" == "true" } {
wokdep:SearchTBB anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs wokdep:SearchTBB anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
} }
if { "$::HAVE_OPENCL" == "true" } { # if { "$::HAVE_OPENCL" == "true" } {
wokdep:SearchOpenCL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs # wokdep:SearchOpenCL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
} # }
if { "$::HAVE_VTK" == "true" } { if { "$::HAVE_VTK" == "true" } {
wokdep:SearchVTK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs wokdep:SearchVTK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
} }
@ -384,8 +384,8 @@ checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true
ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS" ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB" ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
checkbutton .myFrame.myChecks.myOpenClCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENCL -command wokdep:gui:UpdateList #checkbutton .myFrame.myChecks.myOpenClCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENCL -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL" #ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL"
checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
ttk::label .myFrame.myChecks.myMacGLXLbl -text "Use X11 for windows drawing" ttk::label .myFrame.myChecks.myMacGLXLbl -text "Use X11 for windows drawing"
ttk::label .myFrame.myChecks.myVtkLbl -text "Use VTK" ttk::label .myFrame.myChecks.myVtkLbl -text "Use VTK"

View File

@ -16,30 +16,18 @@
# ======================================================================= # =======================================================================
# This script defines Tcl command genproj generating project files for # This script defines Tcl command genproj generating project files for
# different IDEs: # different IDEs and platforms. Run it with -help to get synopsis.
# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd"
#
# Example:
# genproj -path=D:/occt -target=vc10
# genproj -target=xcd -ios -static
# ======================================================================= # =======================================================================
source [file join [file dirname [info script]] genconfdeps.tcl] source [file join [file dirname [info script]] genconfdeps.tcl]
set path "" # the script is assumed to be run from CASROOT (or dependent Products root)
set path [file normalize .]
set THE_CASROOT "" set THE_CASROOT ""
set fBranch "" set fBranch ""
if { [info exists ::env(CASROOT)] } { if { [info exists ::env(CASROOT)] } {
set THE_CASROOT "$::env(CASROOT)" set THE_CASROOT "$::env(CASROOT)"
} }
switch -exact -- "$tcl_platform(platform)" {
"windows" {set targetStation "wnt"}
"unix" {set targetStation "lin"}
}
switch -exact -- "$tcl_platform(os)" {
"Darwin" {set targetStation "mac"}
}
proc _get_options { platform type branch } { proc _get_options { platform type branch } {
set res "" set res ""
@ -121,84 +109,56 @@ proc osutils:findSrcSubPath {theSubPath} {
} }
# Wrapper-function to generate VS project files # Wrapper-function to generate VS project files
proc genproj { args } { proc genproj {theIDE args} {
global path THE_CASROOT targetStation set aSupportedIDEs { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" } set aSupportedPlatforms { "wnt" "lin" "mac" "ios" "qnx" }
set anArgs $args
# Setting default IDE.
set anTarget ""
set aCmpl "gcc"
switch -exact -- "$targetStation" {
"wnt" {set anTarget "$::env(VCVER)"}
"lin" {set anTarget "cbp"}
"mac" {set anTarget "xcd"}
}
set isTargetDefault true
if { [set anIndex [lsearch -nocase $anArgs -target=*]] != -1 } {
regsub -nocase "\\-target=" [lindex $anArgs $anIndex] "" anTarget
set anArgs [removeAllOccurrencesOf -target=* $anArgs]
set isTargetDefault false
}
if { [set anIndex [lsearch -nocase $anArgs -path=*]] != -1} {
regsub -nocase "\\-path=" [lindex $anArgs $anIndex] "" path
set anArgs [removeAllOccurrencesOf -path=* $anArgs]
puts "Starting work with \"$path\""
}
if { [llength $anArgs] == 0 && $isTargetDefault == true } {
puts "the default \'$anTarget\' target has been applied"
}
set isHelpRequire false set isHelpRequire false
if { [lsearch -nocase $anArgs -h] != -1} {
set anArgs [removeAllOccurrencesOf -h $anArgs] # check IDE argument
if { $theIDE == "-h" || $theIDE == "-help" || $theIDE == "--help" } {
set isHelpRequire true
} elseif { [lsearch -exact $aSupportedIDEs $theIDE] < 0 } {
puts "Error: genproj: unrecognized IDE \"$theIDE\""
set isHelpRequire true set isHelpRequire true
} }
if {$path == ""} { # choice of compiler for Code::Blocks, currently hard-coded
set isHelpRequire true set aCmpl "gcc"
# Determine default platform: wnt for vc*, mac for xcd, current for cbp
if { [regexp "^vc" $theIDE] } {
set aPlatform "wnt"
} elseif { $theIDE == "xcd" || $::tcl_platform(os) == "Darwin" } {
set aPlatform "mac"
} elseif { $::tcl_platform(platform) == "windows" } {
set aPlatform "wnt"
} elseif { $::tcl_platform(platform) == "unix" } {
set aPlatform "lin"
} }
# Check optional arguments
set aLibType "dynamic" set aLibType "dynamic"
if { [lsearch -nocase $anArgs "-static"] != -1} { foreach arg $args {
set anArgs [removeAllOccurrencesOf "-static" $anArgs] if { $arg == "-h" || $arg == "-help" || $arg == "--help" } {
set aLibType "static" set isHelpRequire true
puts "static build has been selected" } elseif { [lsearch -exact $aSupportedPlatforms $arg] >= 0 } {
} elseif { [lsearch -nocase $anArgs "-dynamic"] != -1} { set aPlatform $arg
set anArgs [removeAllOccurrencesOf "-dynamic" $anArgs] } elseif { $arg == "-static" } {
set aLibType "dynamic" set aLibType "static"
puts "dynamic build has been selected" puts "Static build has been selected"
} } elseif { $arg == "-dynamic" } {
set aLibType "dynamic"
set aPlatform "" puts "Dynamic build has been selected"
if { [lsearch -nocase $anArgs "-ios"] != -1} { } else {
set anArgs [removeAllOccurrencesOf "-ios" $anArgs] puts "Error: genproj: unrecognized option \"$arg\""
set aPlatform "ios" set isHelpRequire true
}
if { [lsearch -nocase $aSupportedTargets $anTarget] == -1} {
puts "the \'$anTarget\' is wrong TARGET"
set isHelpRequire true
}
if {[llength $anArgs] > 0} {
set isHelpRequire true
foreach anArg $anArgs {
puts "genproj: unrecognized option \'$anArg\'"
} }
} }
if { $isHelpRequire == true } { if { $isHelpRequire == true } {
puts "usage: genproj \[ -target=<TARGET> \] \[ -path=<PATH> \] puts "usage: genproj IDE \[Platform\] \[-static\] \[-h|-help|--help\]
PATH: IDE must be one of:
path to the project
TARGET:
vc8 - Visual Studio 2005 vc8 - Visual Studio 2005
vc9 - Visual Studio 2008 vc9 - Visual Studio 2008
vc10 - Visual Studio 2010 vc10 - Visual Studio 2010
@ -206,54 +166,60 @@ proc genproj { args } {
vc12 - Visual Studio 2013 vc12 - Visual Studio 2013
vc14 - Visual Studio 2015 vc14 - Visual Studio 2015
cbp - CodeBlocks cbp - CodeBlocks
xcd - XCode" xcd - XCode
return
Platform (optional, only for CodeBlocks and XCode):
wnt - Windows
lin - Linux
mac - OS X
ios - iOS
qnx - QNX
Option -static can be used with XCode to build static libraries
"
return
} }
if {!$isTargetDefault} { if { ! [info exists aPlatform] } {
puts "the \'$anTarget\' target has been applied" puts "Error: genproj: Cannon identify default platform, please specify!"
return
} }
set anAdmPath "$path/adm" puts "Preparing to generate $theIDE projects for $aPlatform platform..."
OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" "$aCmpl" # path to where to generate projects, hardcoded from current dir
set anAdmPath [file normalize "${::path}/adm"]
genprojbat "$anTarget" OS:MKPRC "$anAdmPath" "$theIDE" "$aLibType" "$aPlatform" "$aCmpl"
genprojbat "$theIDE" $aPlatform
} }
proc genprojbat {theIDE} { proc genprojbat {theIDE thePlatform} {
set aTargetPlatform "lin"
if { "$::tcl_platform(platform)" == "windows" } {
set aTargetPlatform "wnt"
}
if {[regexp {(vc)[0-9]*$} $theIDE] == 1} {
set aTargetPlatform wnt
} elseif {"$theIDE" == "xcd"} {
set aTargetPlatform mac
}
set aTargetPlatformExt sh set aTargetPlatformExt sh
if { "$aTargetPlatform" == "wnt" } { if { $thePlatform == "wnt" } {
set aTargetPlatformExt bat set aTargetPlatformExt bat
} }
if {"$theIDE" != "cmake"} { if {"$theIDE" != "cmake"} {
set anEnvTmplFile [open "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}" "r"] # copy env.bat/sh only if not yet present
set anEnvTmpl [read $anEnvTmplFile] if { ! [file exists "$::path/env.${aTargetPlatformExt}"] } {
close $anEnvTmplFile set anEnvTmplFile [open "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}" "r"]
set anEnvTmpl [read $anEnvTmplFile]
close $anEnvTmplFile
set aCasRoot "" set aCasRoot ""
if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } { if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
set aCasRoot [relativePath "$::path" "$::THE_CASROOT"] set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
}
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
set anEnvFile [open "$::path/env.${aTargetPlatformExt}" "w"]
puts $anEnvFile $anEnvTmpl
close $anEnvFile
} }
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
set anEnvFile [open "$::path/env.${aTargetPlatformExt}" "w"]
puts $anEnvFile $anEnvTmpl
close $anEnvFile
file copy -force -- "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}" file copy -force -- "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
} }
@ -264,6 +230,9 @@ proc genprojbat {theIDE} {
"cbp" { "cbp" {
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh"
file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat" 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"
} }
"xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" } "xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" }
} }
@ -289,22 +258,14 @@ set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS # @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS
# @param theCmpl Compiler option (msvc or gcc) # @param theCmpl Compiler option (msvc or gcc)
proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } { proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
global path targetStation global path
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "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} " "]"
return
}
set anOutRoot $theOutDir set anOutRoot $theOutDir
if { $anOutRoot == "" } { if { $anOutRoot == "" } {
error "Error : \"theOutDir\" is not initialized" error "Error : \"theOutDir\" is not initialized"
} }
# Create output directory # Create output directory
set aWokStation "$targetStation" set aWokStation "$thePlatform"
if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12 vc14} $theIDE] != -1 } { if { [lsearch -exact {vc7 vc8 vc9 vc10 vc11 vc12 vc14} $theIDE] != -1 } {
set aWokStation "msvc" set aWokStation "msvc"
} }
@ -350,7 +311,7 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
# collect all required header files # collect all required header files
puts "Collecting required header files into $path/inc ..." puts "Collecting required header files into $path/inc ..."
osutils:collectinc $aModules $path/inc $targetStation osutils:collectinc $aModules $path/inc
# Generating project files for the selected IDE # Generating project files for the selected IDE
switch -exact -- "$theIDE" { switch -exact -- "$theIDE" {
@ -361,7 +322,7 @@ proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
"vc11" - "vc11" -
"vc12" - "vc12" -
"vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE } "vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $theCmpl } "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
"xcd" { "xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000" set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
@ -606,7 +567,6 @@ proc osutils:tk:eatpk { EXTERNLIB } {
# Define libraries to link using only EXTERNLIB file # Define libraries to link using only EXTERNLIB file
proc LibToLink {theTKit} { proc LibToLink {theTKit} {
global path
regexp {^.*:([^:]+)$} $theTKit dummy theTKit regexp {^.*:([^:]+)$} $theTKit dummy theTKit
set type [_get_type $theTKit] set type [_get_type $theTKit]
if {$type != "t" && $type != "x"} { if {$type != "t" && $type != "x"} {
@ -652,9 +612,8 @@ proc OS:genGUID { {theIDE "vc"} } {
} }
# collect all include file that required for theModules in theOutDir # collect all include file that required for theModules in theOutDir
proc osutils:collectinc {theModules theIncPath theTargetStation} { proc osutils:collectinc {theModules theIncPath} {
global path global path
set aCasRoot [file normalize $path] set aCasRoot [file normalize $path]
set anIncPath [file normalize $theIncPath] set anIncPath [file normalize $theIncPath]
@ -1051,12 +1010,10 @@ proc wokUtils:FILES:FileToString { fin } {
return {} return {}
} }
} }
# List extensions of compilable files in OCCT
proc osutils:compilable { } { # List extensions of compilable files in OCCT
global targetStation proc osutils:compilable {thePlatform} {
set aWokStation "$targetStation" if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } {
if { "$aWokStation" == "mac" } {
return [list .c .cxx .cpp .mm] return [list .c .cxx .cpp .mm]
} }
return [list .c .cxx .cpp] return [list .c .cxx .cpp]
@ -1463,7 +1420,7 @@ proc osutils:readtemplate:rc {theOutDir theToolKit} {
proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } { proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } {
if { $theProjTmpl == {} } {set theProjTmpl [osutils:vcproj:readtemplate $theVcVer 0]} if { $theProjTmpl == {} } {set theProjTmpl [osutils:vcproj:readtemplate $theVcVer 0]}
set l_compilable [osutils:compilable] set l_compilable [osutils:compilable wnt]
regsub -all -- {__TKNAM__} $theProjTmpl $theToolKit theProjTmpl regsub -all -- {__TKNAM__} $theProjTmpl $theToolKit theProjTmpl
upvar $theGuidsMap aGuidsMap upvar $theGuidsMap aGuidsMap
@ -1509,7 +1466,7 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {}
set fxloparam "" set fxloparam ""
foreach fxlo $resultloc { foreach fxlo $resultloc {
set xlo $fxlo set xlo $fxlo
set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0] set aSrcFiles [osutils:tk:files $xlo wnt]
set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx $fxlo] set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx $fxlo]
if {$fxlo_cmplrs_options_cxx == ""} { if {$fxlo_cmplrs_options_cxx == ""} {
set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx b] set fxlo_cmplrs_options_cxx [_get_options wnt cmplrs_cxx b]
@ -1615,24 +1572,16 @@ proc osutils:tk:loadunit { loc map } {
} }
# Returns the list of all compilable files name in a toolkit, or devunit of any type # Returns the list of all compilable files name in a toolkit, or devunit of any type
# Call unit filter on units name to accept or reject a unit
# Tfiles lists for each unit the type of file that can be compiled. # Tfiles lists for each unit the type of file that can be compiled.
proc osutils:tk:files { tkloc {l_compilable {} } {justail 1} {unitfilter {}} } { proc osutils:tk:files { tkloc thePlatform } {
set Tfiles(source,nocdlpack) {source pubinclude} set Tfiles(source,nocdlpack) {source pubinclude}
set Tfiles(source,toolkit) {} set Tfiles(source,toolkit) {}
set Tfiles(source,executable) {source pubinclude} set Tfiles(source,executable) {source pubinclude}
set listloc [concat [osutils:tk:units $tkloc] $tkloc] set listloc [concat [osutils:tk:units $tkloc] $tkloc]
#puts " listloc = $listloc" #puts " listloc = $listloc"
if { $l_compilable == {} } {
set l_comp [list .c .cxx .cpp] set l_comp [osutils:compilable $thePlatform]
} else { set resultloc $listloc
set l_comp [$l_compilable]
}
if { $unitfilter == {} } {
set resultloc $listloc
} else {
set resultloc [$unitfilter $listloc]
}
set lret {} set lret {}
foreach loc $resultloc { foreach loc $resultloc {
set utyp [_get_type $loc] set utyp [_get_type $loc]
@ -1656,15 +1605,7 @@ proc osutils:tk:files { tkloc {l_compilable {} } {justail 1} {unitfilter {}} }
foreach f $map($type) { foreach f $map($type) {
#puts $f #puts $f
if { [lsearch $l_comp [file extension $f]] != -1 } { if { [lsearch $l_comp [file extension $f]] != -1 } {
if { $justail == 1 } { lappend lret $f
if {$type == "source"} {
if {[lsearch $lret "@top_srcdir@/src/$loc/[file tail $f]"] == -1} {
lappend lret @top_srcdir@/src/$loc/[file tail $f]
}
}
} else {
lappend lret $f
}
} }
} }
} }
@ -1675,14 +1616,14 @@ proc osutils:tk:files { tkloc {l_compilable {} } {justail 1} {unitfilter {}} }
# Generate Visual Studio project file for executable # Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } { proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } } {
set aVcFiles {} set aVcFiles {}
foreach f [osutils:tk:files $theToolKit osutils:compilable 0] { foreach f [osutils:tk:files $theToolKit wnt] {
if { $theProjTmpl == {} } { if { $theProjTmpl == {} } {
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer 1] set aProjTmpl [osutils:vcproj:readtemplate $theVcVer 1]
} else { } else {
set aProjTmpl $theProjTmpl set aProjTmpl $theProjTmpl
} }
set aProjName [file rootname [file tail $f]] set aProjName [file rootname [file tail $f]]
set l_compilable [osutils:compilable] set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
upvar $theGuidsMap aGuidsMap upvar $theGuidsMap aGuidsMap
@ -1875,13 +1816,13 @@ proc osutils:justunix { listloc } {
####### CODEBLOCK ################################################################### ####### CODEBLOCK ###################################################################
# Function to generate Code Blocks workspace and project files # Function to generate Code Blocks workspace and project files
proc OS:MKCBP { theOutDir theModules theAllSolution theCmpl } { proc OS:MKCBP { theOutDir theModules theAllSolution thePlatform theCmpl } {
puts stderr "Generating project files for Code Blocks" puts stderr "Generating project files for Code Blocks"
# Generate projects for toolkits and separate workspace for each module # Generate projects for toolkits and separate workspace for each module
foreach aModule $theModules { foreach aModule $theModules {
OS:cworkspace $aModule $aModule $theOutDir OS:cworkspace $aModule $aModule $theOutDir
OS:cbp $theCmpl $aModule $theOutDir OS:cbp $theCmpl $aModule $theOutDir $thePlatform
} }
# Generate single workspace "OCCT" containing projects from all modules # Generate single workspace "OCCT" containing projects from all modules
@ -1893,32 +1834,29 @@ proc OS:MKCBP { theOutDir theModules theAllSolution theCmpl } {
} }
# Generate Code Blocks projects # Generate Code Blocks projects
proc OS:cbp { theCmpl theModules theOutDir } { proc OS:cbp { theCmpl theModules theOutDir thePlatform } {
set aProjectFiles {} set aProjectFiles {}
foreach aModule $theModules { foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] { foreach aToolKit [${aModule}:toolkits] {
lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit ] lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit $thePlatform]
} }
foreach anExecutable [OS:executable ${aModule}] { foreach anExecutable [OS:executable ${aModule}] {
lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable] lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable $thePlatform]
} }
} }
return $aProjectFiles return $aProjectFiles
} }
# Generate Code::Blocks project file for ToolKit # Generate Code::Blocks project file for ToolKit
proc osutils:cbptk { theCmpl theOutDir theToolKit } { proc osutils:cbptk { theCmpl theOutDir theToolKit thePlatform} {
set aUsedLibs [list] set aUsedLibs [list]
set aFrameworks [list] set aFrameworks [list]
set anIncPaths [list] set anIncPaths [list]
set aTKDefines [list] set aTKDefines [list]
set aTKSrcFiles [list] set aTKSrcFiles [list]
global path targetStation
set aWokStation "$targetStation"
# collect list of referred libraries to link with # collect list of referred libraries to link with
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks osutils:usedOsLibs $theToolKit $thePlatform aUsedLibs aFrameworks
set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
foreach tkx $aDepToolkits { foreach tkx $aDepToolkits {
lappend aUsedLibs "${tkx}" lappend aUsedLibs "${tkx}"
@ -1931,7 +1869,7 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit } {
set listloc $theToolKit set listloc $theToolKit
} }
if { "$aWokStation" == "wnt" } { if { $thePlatform == "wnt" } {
set resultloc [osutils:justwnt $listloc] set resultloc [osutils:justwnt $listloc]
} else { } else {
set resultloc [osutils:justunix $listloc] set resultloc [osutils:justunix $listloc]
@ -1939,7 +1877,7 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit } {
if [array exists written] { unset written } if [array exists written] { unset written }
foreach fxlo $resultloc { foreach fxlo $resultloc {
set xlo $fxlo set xlo $fxlo
set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0] set aSrcFiles [osutils:tk:files $xlo $thePlatform]
foreach aSrcFile [lsort $aSrcFiles] { foreach aSrcFile [lsort $aSrcFiles] {
if { ![info exists written([file tail $aSrcFile])] } { if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1 set written([file tail $aSrcFile]) 1
@ -1950,12 +1888,12 @@ proc osutils:cbptk { theCmpl theOutDir theToolKit } {
} }
# macros for correct DLL exports # macros for correct DLL exports
if { "$aWokStation" == "wnt" } { if { $thePlatform == "wnt" } {
lappend aTKDefines "__${xlo}_DLL" lappend aTKDefines "__${xlo}_DLL"
} }
} }
return [osutils:cbp $theCmpl $theOutDir $theToolKit $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines] return [osutils:cbp $theCmpl $theOutDir $theToolKit $thePlatform $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
} }
# Generates Code Blocks workspace. # Generates Code Blocks workspace.
@ -2028,13 +1966,12 @@ proc OS:cworkspace { theSolName theModules theOutDir } {
} }
# Generate Code::Blocks project file for Executable # Generate Code::Blocks project file for Executable
proc osutils:cbpx { theCmpl theOutDir theToolKit } { proc osutils:cbpx { theCmpl theOutDir theToolKit thePlatform } {
global path targetStation global path
set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)" set aWokArch "$::env(ARCH)"
set aCbpFiles {} set aCbpFiles {}
foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] { foreach aSrcFile [osutils:tk:files $theToolKit $thePlatform] {
# collect list of referred libraries to link with # collect list of referred libraries to link with
set aUsedLibs [list] set aUsedLibs [list]
set aFrameworks [list] set aFrameworks [list]
@ -2043,7 +1980,7 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit } {
set aTKSrcFiles [list] set aTKSrcFiles [list]
set aProjName [file rootname [file tail $aSrcFile]] set aProjName [file rootname [file tail $aSrcFile]]
osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks osutils:usedOsLibs $theToolKit $thePlatform aUsedLibs aFrameworks
set aDepToolkits [LibToLinkX $theToolKit $aProjName] set aDepToolkits [LibToLinkX $theToolKit $aProjName]
foreach tkx $aDepToolkits { foreach tkx $aDepToolkits {
@ -2070,14 +2007,14 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit } {
} }
# macros for correct DLL exports # macros for correct DLL exports
if { "$aWokStation" == "wnt" } { if { $thePlatform == "wnt" } {
lappend aTKDefines "__${theToolKit}_DLL" lappend aTKDefines "__${theToolKit}_DLL"
} }
# common include paths # common include paths
lappend anIncPaths "../../../inc" lappend anIncPaths "../../../inc"
lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable] lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $thePlatform $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable]
} }
return $aCbpFiles return $aCbpFiles
@ -2093,9 +2030,8 @@ proc osutils:cbpx { theCmpl theOutDir theToolKit } {
# @param theIncPaths - header search paths # @param theIncPaths - header search paths
# @param theDefines - compiler macro definitions # @param theDefines - compiler macro definitions
# @param theIsExe - flag to indicate executable / library target # @param theIsExe - flag to indicate executable / library target
proc osutils:cbp { theCmpl theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } { proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
global targetStation set aWokStation $thePlatform
set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)" set aWokArch "$::env(ARCH)"
set aCmplCbp "gcc" set aCmplCbp "gcc"
@ -2469,7 +2405,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection
set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit] set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit]
if { "$theTargetType" == "executable" } { if { "$theTargetType" == "executable" } {
set aFile [osutils:tk:files $theToolKit osutils:compilable 0] set aFile [osutils:tk:files $theToolKit mac]
set aProjName [file rootname [file tail $aFile]] set aProjName [file rootname [file tail $aFile]]
set aDepToolkits [LibToLinkX $theToolKit $aProjName] set aDepToolkits [LibToLinkX $theToolKit $aProjName]
} }
@ -2535,7 +2471,7 @@ proc osutils:xcdtk:sources {theToolKit theTargetType theSrcFileRefSection theGro
set aGuidsMap($aPackage) [OS:genGUID "xcd"] set aGuidsMap($aPackage) [OS:genGUID "xcd"]
} }
set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0] set aSrcFiles [osutils:tk:files $xlo mac]
foreach aSrcFile [lsort $aSrcFiles] { foreach aSrcFile [lsort $aSrcFiles] {
set aFileExt "sourcecode.cpp.cpp" set aFileExt "sourcecode.cpp.cpp"

View File

@ -11,6 +11,7 @@ if not "%4" == "" (
) )
if "%CB_PATH%"=="" if exist "%PROGRAMFILES%\CodeBlocks" set "CB_PATH=%PROGRAMFILES%\CodeBlocks\codeblocks.exe" if "%CB_PATH%"=="" if exist "%PROGRAMFILES%\CodeBlocks" set "CB_PATH=%PROGRAMFILES%\CodeBlocks\codeblocks.exe"
if "%CB_PATH%"=="" if exist "%PROGRAMFILES(x86)%\CodeBlocks" set "CB_PATH=%PROGRAMFILES(x86)%\CodeBlocks\codeblocks.exe"
if "%CB_PATH%"=="" set "CB_PATH=codeblocks.exe" if "%CB_PATH%"=="" set "CB_PATH=codeblocks.exe"
set "CASBIN=wnt\cbp" set "CASBIN=wnt\cbp"

View File

@ -6,7 +6,7 @@ Building with Code::Blocks {#occt_dev_guides__building_code_blocks}
@section build_codeblocks_intro General @section build_codeblocks_intro General
This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using project files generated by OCCT legacy tool **genproj**. This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using project files generated by OCCT legacy tool **genproj**.
It can be an alternative to use of CMake build system (see @ref occt_dev_guides__building_cmake) for all supported platforms. It can be used as an alternative to CMake build system (see @ref occt_dev_guides__building_cmake) for all supported platforms.
@section build_codeblocks_3rdparty Third-party libraries @section build_codeblocks_3rdparty Third-party libraries
@ -34,11 +34,11 @@ Click "Save" to store the specified configuration in *custom.sh* or *custom.bat*
@section build_codeblocks_gen Projects generation @section build_codeblocks_gen Projects generation
Launch **genproj** tool with option *-target=cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files: Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files:
~~~~~ ~~~~~
$ cd /dev/OCCT/opencascade-7.0.0 $ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj.sh -target=cbp $ ./genproj cbp
~~~~~ ~~~~~
The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*. The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*.

View File

@ -43,7 +43,7 @@ For instance, in Terminal application:
~~~~~ ~~~~~
$ cd /dev/OCCT/opencascade-7.0.0 $ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj.sh $ ./genproj
~~~~~ ~~~~~
@section build_xcode_build Building @section build_xcode_build Building

View File

@ -37,7 +37,8 @@ source "${aScriptPath}/custom.sh"
if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi
tclsh "${aScriptPath}/adm/start.tcl" genproj -path="${aScriptPath}" -target=${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5 cd $aScriptPath
tclsh "./adm/start.tcl" genproj ${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5
export PATH="$anOldPath" export PATH="$anOldPath"
export LD_LIBRARY_PATH="$anOldLd" export LD_LIBRARY_PATH="$anOldLd"

View File

@ -2,6 +2,9 @@
rem Helper script to run generation of VS projects on Windows. rem Helper script to run generation of VS projects on Windows.
rem Running it requires that Tcl should be in the PATH rem Running it requires that Tcl should be in the PATH
rem Optional arguments: IDE OS
rem IDE can be vc10, vc11, vc12, vc14, cbp, or xcd
rem OS can be wnt, mac, or lin
SET "OLD_PATH=%PATH%" SET "OLD_PATH=%PATH%"
@ -17,7 +20,7 @@ if not exist "%~dp0custom.bat" (
) )
if exist "%~dp0env.bat" ( if exist "%~dp0env.bat" (
call "%~dp0env.bat" call "%~dp0env.bat" %1
) )
rem find Tcl rem find Tcl
@ -39,5 +42,5 @@ if not defined TCL_FOUND (
) )
cd %~dp0 cd %~dp0
%TCL_EXEC% %~dp0adm/start.tcl genproj -path=. -target=%VCVER% %TCL_EXEC% %~dp0adm/start.tcl genproj %VCVER% %2 %3 %4 %5
SET "PATH=%OLD_PATH%" SET "PATH=%OLD_PATH%"