From: kgv Date: Mon, 1 Apr 2019 20:44:20 +0000 (+0300) Subject: 0030339: Configuration - add project files for qmake X-Git-Tag: V7_4_0_beta~185 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=refs%2Fheads%2FIR-2019-04-05 0030339: Configuration - add project files for qmake Added adm/qmake/Occt.pro for building OCCT using Qt Creator. genproj/genconf scripts have been extended with an option defining project format. Draw_Appli now tries resolving CASROOT/DRAWDEFAULT/CSF_OCCTResourcePath/CSF_OCCTSamplesPath locations within usual OCCT development/installation environment. Added missing TKShHealing dependency to TKDraw/DRAWEXE (inherited from TKMesh). OSD_Process::ExecutableFolder() - added method returning executable folder. --- diff --git a/adm/.gitignore b/adm/.gitignore new file mode 100644 index 0000000000..1aaaf52ff1 --- /dev/null +++ b/adm/.gitignore @@ -0,0 +1 @@ +/build-* diff --git a/adm/genconf.tcl b/adm/genconf.tcl index 42975effb7..2b4642755f 100644 --- a/adm/genconf.tcl +++ b/adm/genconf.tcl @@ -30,10 +30,30 @@ set aRowIter 0 set aCheckRowIter 0 frame .myFrame -padx 5 -pady 5 pack .myFrame -fill both -expand 1 +frame .myFrame.myPrjFrame frame .myFrame.myVsFrame frame .myFrame.myHxxChecks frame .myFrame.myChecks +# project file format +set SYS_PRJFMT_LIST {} +set SYS_PRJNAME_LIST {} +if { "$::tcl_platform(platform)" == "windows" } { + lappend ::SYS_PRJFMT_LIST "vcxproj" + lappend ::SYS_PRJNAME_LIST "Visual Studio (.vcxproj)" +} +if { "$tcl_platform(os)" == "Darwin" } { + lappend ::SYS_PRJFMT_LIST "xcd" + lappend ::SYS_PRJNAME_LIST "XCode (.xcd)" +} +lappend ::SYS_PRJFMT_LIST "cbp" +lappend ::SYS_PRJNAME_LIST "Code Blocks (.cbp)" +lappend ::SYS_PRJFMT_LIST "pro" +lappend ::SYS_PRJNAME_LIST "Qt Creator (.pro)" + +set aPrjIndex [lsearch $::SYS_PRJFMT_LIST $::PRJFMT] +set ::PRJNAME [lindex $::SYS_PRJNAME_LIST $aPrjIndex] + set SYS_VS_LIST {} set SYS_VC_LIST {} set SYS_VCVARS_LIST {} @@ -101,6 +121,7 @@ proc wokdep:gui:Close {} { } proc wokdep:gui:SwitchConfig {} { + set ::PRJFMT [lindex $::SYS_PRJFMT_LIST [.myFrame.myPrjFrame.myPrjCombo current]] set ::VCVER [lindex $::SYS_VC_LIST [.myFrame.myVsFrame.myVsCombo current]] set ::VCVARS [lindex $::SYS_VCVARS_LIST [.myFrame.myVsFrame.myVsCombo current]] @@ -390,6 +411,8 @@ proc wokdep:gui:Show64Bitness { theRowIter } { } # Header +ttk::label .myFrame.myPrjFrame.myPrjLbl -text "Project format:" -padding {5 5 20 5} +ttk::combobox .myFrame.myPrjFrame.myPrjCombo -values $SYS_PRJNAME_LIST -state readonly -textvariable PRJNAME -width 40 ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5} ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40 ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6 @@ -494,6 +517,10 @@ ttk::button .myFrame.myClose -text "Close" -command wokdep:gui:Close # Create grid # Header +grid .myFrame.myPrjFrame -row $aRowIter -column 0 -columnspan 10 -sticky w +grid .myFrame.myPrjFrame.myPrjLbl -row 0 -column 0 +grid .myFrame.myPrjFrame.myPrjCombo -row 0 -column 1 +incr aRowIter if { "$tcl_platform(platform)" == "windows" } { grid .myFrame.myVsFrame -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myVsFrame.myVsLbl -row 0 -column 0 @@ -592,6 +619,9 @@ grid .myFrame.mySave -row $aRowIter -column 4 -columnspan 2 grid .myFrame.myClose -row $aRowIter -column 6 -columnspan 2 # Bind events +bind .myFrame.myPrjFrame.myPrjCombo <> { + wokdep:gui:SwitchConfig +} bind .myFrame.myVsFrame.myVsCombo <> { wokdep:gui:SwitchConfig } diff --git a/adm/genconfdeps.tcl b/adm/genconfdeps.tcl index e2010b90ef..50d2c7ff9e 100644 --- a/adm/genconfdeps.tcl +++ b/adm/genconfdeps.tcl @@ -27,8 +27,10 @@ if { "$tcl_platform(platform)" == "unix" } { set SYS_EXE_SUFFIX "" if { "$tcl_platform(os)" == "Darwin" } { set SYS_LIB_SUFFIX "dylib" + set PRJFMT "xcd" } else { set SYS_LIB_SUFFIX "so" + set PRJFMT "cbp" } set VCVER "gcc" set VCVARS "" @@ -39,6 +41,7 @@ if { "$tcl_platform(platform)" == "unix" } { set SYS_EXE_SUFFIX ".exe" set VCVER "vc10" set VCVARS "" + set PRJFMT "vcxproj" } set SHORTCUT_HEADERS "ShortCut" @@ -82,7 +85,7 @@ if { "$tcl_platform(platform)" != "windows" } { set HAVE_D3D "" set HAVE_RelWithDebInfo "" } -foreach anEnvIter {ARCH VCVER VCVARS PRODUCTS_PATH} { +foreach anEnvIter {ARCH VCVER VCVARS PRJFMT PRODUCTS_PATH} { if { [info exists ::env(${anEnvIter})] } { set ${anEnvIter} "$::env(${anEnvIter})" } @@ -1118,15 +1121,33 @@ proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64 return "$isFound" } +# Returns OCCT version string from file Standard_Version.hxx (if available) +proc wokdep:DetectCasVersion {} { + set occt_ver 7.0.0 + set aCasRoot [file normalize [file dirname [info script]]] + set filename "${aCasRoot}/src/Standard/Standard_Version.hxx" + if { [file exists $filename] } { + set fh [open $filename "r"] + set fh_loaded [read $fh] + close $fh + regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver + } else { + puts "Error: file '$filename' not found" + } + return $occt_ver +} + # Generate (override) custom environment file proc wokdep:SaveCustom {} { + set aGenInfo "This environment file was generated by genconf.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]" if { "$::tcl_platform(platform)" == "windows" } { set aCustomFilePath "./custom.bat" set aFile [open $aCustomFilePath "w"] puts $aFile "@echo off" - puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]" + puts $aFile "rem $aGenInfo" puts $aFile "" + puts $aFile "set PRJFMT=$::PRJFMT" puts $aFile "set VCVER=$::VCVER" puts $aFile "set ARCH=$::ARCH" puts $aFile "set VCVARS=$::VCVARS" @@ -1175,9 +1196,10 @@ proc wokdep:SaveCustom {} { set aCustomFilePath "./custom.sh" set aFile [open $aCustomFilePath "w"] puts $aFile "#!/bin/bash" - puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]" + puts $aFile "# $aGenInfo" puts $aFile "" + puts $aFile "export PRJFMT=$::PRJFMT" puts $aFile "export ARCH=$::ARCH" puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS" @@ -1211,6 +1233,52 @@ proc wokdep:SaveCustom {} { close $aFile } - puts "Configuration saved to file '$aCustomFilePath'" + + if { "$::PRJFMT" == "pro" } { + set aCasVer [wokdep:DetectCasVersion] + set aCustomFilePath "./adm/qmake/custom.auto.pri" + set aFile [open $aCustomFilePath "w"] + puts $aFile "# $aGenInfo" + + puts $aFile "" + puts $aFile "VERSION=$aCasVer" + puts $aFile "PRODUCTS_PATH=\"$::PRODUCTS_PATH\"" + + puts $aFile "" + puts $aFile "# Optional 3rd-parties switches" + foreach anEnvIter $::THE_ENV_VARIABLES { + set aName ${anEnvIter} + set aValue [set ::${anEnvIter}] + if { "$aValue" == "true" } { + puts $aFile "CONFIG += ${aName}" + } else { + #puts $aFile "CONFIG -= ${aName}" + } + } + + puts $aFile "" + puts $aFile "# Additional headers search paths" + foreach anIncPath $::CSF_OPT_INC { + puts $aFile "INCLUDEPATH += \"${anIncPath}\"" + } + + puts $aFile "" + puts $aFile "# Additional libraries search paths" + foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] { + puts $aFile "LIBS += -L\"${aLibPath}\"" + } + + if { "$::tcl_platform(platform)" == "windows" } { + puts $aFile "" + puts $aFile "# Additional DLLs search paths" + foreach aDllPath [set ::CSF_OPT_BIN$::ARCH] { + puts $aFile "LIBS += -L\"${aDllPath}\"" + } + } + + puts $aFile "" + close $aFile + puts "Configuration saved to file '$aCustomFilePath'" + } } diff --git a/adm/genproj.tcl b/adm/genproj.tcl index 9039a5a2a1..b51804ae94 100644 --- a/adm/genproj.tcl +++ b/adm/genproj.tcl @@ -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" "cbp" "xcd" "pro"} set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" } set isHelpRequire false @@ -314,6 +314,7 @@ proc genproj {theFormat args} { vc141 - Visual Studio 2017 cbp - CodeBlocks xcd - XCode + pro - Qt Creator Platform (optional): wnt - Windows Desktop @@ -395,9 +396,14 @@ proc genprojbat {theFormat thePlatform} { "cbp" { file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat" + # Code::Blocks 16.01 does not create directory for import libs, help him - file mkdir "$::path/$thePlatform/cbp/lib" - file mkdir "$::path/$thePlatform/cbp/libd" + set aPlatformAndCompiler "${thePlatform}/gcc" + if { "$thePlatform" == "mac" || "$thePlatform" == "ios" } { + set aPlatformAndCompiler "${thePlatform}/clang" + } + file mkdir "$::path/${aPlatformAndCompiler}/lib" + file mkdir "$::path/${aPlatformAndCompiler}/libd" } "xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" } } @@ -472,15 +478,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 +488,19 @@ 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 + } + + # generate one solution for all projects if complete OS or VAS is processed + set anAllSolution "OCCT" + + wokUtils:FILES:mkdir $anOutDir + if { ![file exists $anOutDir] } { + puts stderr "Error: Could not create output directory \"$anOutDir\"" + return + } + # Generating project files for the selected format switch -exact -- "$theFormat" { "vc7" - @@ -2295,6 +2305,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 } @@ -2351,17 +2365,17 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs # Release target configuration puts $aFile "\t\t\t" if { "$theIsExe" == "true" } { - puts $aFile "\t\t\t\t