]> OCCT Git - occt-wok.git/commitdiff
0023574: Improve interface of wgenproj command
authoribs <ibs@opencascade.com>
Thu, 20 Dec 2012 14:08:00 +0000 (18:08 +0400)
committeribs <ibs@opencascade.com>
Thu, 20 Dec 2012 14:08:00 +0000 (18:08 +0400)
"wgenproj -h" output synopsis and some help on available options
at the end of generating projects by wgenrpoj, output indicating where to find resulting files
wgenproj now runs without args, "-target=" supports vc11 and cbp
cmk target are replaced by cmake
wgenproj -h output refactored; wgenproj -no_wprocess skips wprocess
wgenproj usage interface refactored

src/WOKTclLib/OS.tcl
src/WOKsite/wok_tclshrc.tcl

index 1d8f08cc89a7379f52e32647e9cc4eaba1755b3e..6c448c107e1c828b3e2931bed55b8a8222c9deba 100644 (file)
@@ -2968,6 +2968,8 @@ proc OS:MKVC { theOutDir {theModules {}} {theAllSolution ""} {theVcVer "vc8"} }
   if { "$theAllSolution" != "" } {
     OS:vcsolution $theVcVer $theAllSolution $theModules $theOutDir ::THE_GUIDS_LIST
   }
+  
+  puts "The Visual Studio solution and project files are stored in the $theOutDir directory"
 }
 
 # Function to generate CMake meta file
@@ -3103,6 +3105,8 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } {
   fconfigure $aFile -translation crlf
   puts $aFile [join $aFileBuff "\n"]
   close $aFile
+  
+  puts "The Cmake meta-files are stored in the $theOutDir directory"
 }
 
 # Generates Code Blocks workspace.
@@ -3201,6 +3205,8 @@ proc OS:MKAMK { theOutDir {theModules {}} theSubPath} {
 
   osutils:am:adm $theOutDir $theModules
   osutils:am:root [wokinfo -p HomeDir] $theSubPath $theModules 
+  
+  puts "The automake files are stored in the $theOutDir directory"
 }
 
 # Function to generate Code Blocks workspace and project files
@@ -3218,6 +3224,8 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
   if { "$theAllSolution" != "" } {
     OS:cworkspace $theAllSolution $theModules $theOutDir
   }
+  
+  puts "The Code Blocks workspace and project files are stored in the $theOutDir directory"
 }
 
 # Store global GUIDs map to reproduce same values on sequential calls
@@ -3226,7 +3234,7 @@ 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" "cmk" "amk" }
+  set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" }
   
   if { [lsearch $aSupportedIDE $theIDE] < 0 } {
     puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE\nSupported IDEs: [join ${aSupportedIDE} " "]"
@@ -3286,7 +3294,7 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } {
     "vc10"   -
     "vc11"  { OS:MKVC  $anOutDir $aModules $anAllSolution $theIDE }
     "cbp"   { OS:MKCBP $anOutDir $aModules $anAllSolution }
-    "cmk"   { OS:MKCMK $anOutDir $aModules $anAllSolution }
+    "cmake"   { OS:MKCMK $anOutDir $aModules $anAllSolution }
     "amk"   { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"}
   }
   
index 3245b36d1e16e4c88ab28d5f8c7cbaa09d2ce5ef..a2a19ed357b0ae8b0d3d0e90af405c19a66b8a5d 100644 (file)
@@ -302,37 +302,96 @@ proc wgenprojbat {thePath theIDE} {
   }
 }
 
+proc removeAllOccurrencesOf { theObject theList } { 
+  set aSortIndices [lsort -decreasing [lsearch -all -nocase $theList $theObject]]
+  foreach anIndex $aSortIndices {
+    set theList [lreplace $theList $anIndex $anIndex]
+  }
+  return $theList
+}
+
 # Wrapper-function to generate VS project files
 proc wgenproj { args } {
-
-  set aProcArgs $args
-
+  set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "cbp" "cmake" "amk" }  
+  set anArgs $args
+  
   # Setting default IDE.
-  # For Windows - Visual Studio (vc), Linux - Code Blocks (cbp), Mac OS X - Xcode (cmk).
-  set anIDE ""
+  # For Windows - Visual Studio (vc), Linux - Code Blocks (cbp), Mac OS X - Xcode (cmake).
+  set anTarget ""
   switch -exact -- "$::env(WOKSTATION)" {
-    "wnt"   {set anIDE "$::VCVER"}
-    "lin"   {set anIDE "cbp"}
-    "mac"   {set anIDE "cmk"}
+    "wnt"   {set anTarget "$::VCVER"}
+    "lin"   {set anTarget "cbp"}
+    "mac"   {set anTarget "cmake"}
   }
 
-  # Getting from arguments the name of IDE, for which we should generate project files.
-  set anIndex [lsearch $aProcArgs -IDE=*]
-  if {$anIndex >= 0} {
-    set anIDE     [lindex $aProcArgs $anIndex]
-    set anIDE     [string map {-IDE= ""} $anIDE]
-    set aProcArgs [lreplace $aProcArgs $anIndex $anIndex]
+  set isTargetDefault true
+  set willWProcessStart true
+  if { [lsearch -nocase $anArgs -no_wprocess] != -1 } {
+    set anArgs [removeAllOccurrencesOf -no_wprocess $anArgs]
+    set willWProcessStart false
+  }  
+  
+  if { [set anIndex [lsearch -nocase $anArgs -ide=*]] != -1 } {
+    regsub -nocase "\\-ide=" [lindex $anArgs $anIndex] "" anTarget
+    set anArgs [removeAllOccurrencesOf -ide=* $anArgs]
+    set isTargetDefault false
   }
+  
+  if { [set anIndex [lsearch -nocase $anArgs -target=*]] != -1 } {
+    regsub -nocase "\\-target=" [lindex $anArgs $anIndex] "" anTarget
+    set anArgs [removeAllOccurrencesOf -target=* $anArgs]
+    set isTargetDefault false
+  }
+  
+  if { [llength $anArgs] == 0 && $isTargetDefault == true } {
+    puts "the default \'$anTarget\' target has been applied"
+  }
+  
+  set isHelpRequire false  
+  if { [lsearch -nocase $anArgs -h] != -1} {
+    set anArgs [removeAllOccurrencesOf -h $anArgs]
+    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 "wgenproj: unrecognized option \'$anArg\'"
+    }
+  }
+
+  if {  $isHelpRequire == true } {
+    puts "usage: wgenproj \[ -target=<TARGET> \] \[ -no_wprocess \]
+    -no_wprocess - skip wprocess
+    TARGET: 
+      vc8   -  Visual Studio 2005
+      vc9   -  Visual Studio 2008
+      vc10  -  Visual Studio 2010
+      vc11  -  Visual Studio 2012
+      cbp   -  CodeBlocks
+      cmake -  CMake 
+      amk   -  AutoMake"
+      return
+  }
+
+  puts "the \'$anTarget\' target has been applied"
+  
   # create the inc directory. The directory should be created by wprocess function.
   wokcd -P Home
   file mkdir [file join [pwd] inc]
   #
-  
-  if { "$aProcArgs" != "" } {
-    wprocess $aProcArgs -DGroups=Src,Xcpp
-  } else {
+
+  if { $willWProcessStart == true } {
+    puts "run wprocess -DGroups=Src,Xcpp"
     wprocess -DGroups=Src,Xcpp
+  } else {
+    puts "skip wprocess"
   }
   source "$::env(WOKHOME)/lib/osutils.tcl"
   source "$::env(WOKHOME)/lib/OS.tcl"
@@ -342,12 +401,12 @@ proc wgenproj { args } {
   wokcd $aWokCD
 
   if { [wokinfo -x OS] } {
-    OS:MKPRC "$anAdmPath" "OS"  "$anIDE"
+    OS:MKPRC "$anAdmPath" "OS"  "$anTarget"
   }
   if { [wokinfo -x VAS] } {
-    OS:MKPRC "$anAdmPath" "VAS" "$anIDE"
+    OS:MKPRC "$anAdmPath" "VAS" "$anTarget"
   }
-  wgenprojbat "$anAdmPath" "$anIDE"
+  wgenprojbat "$anAdmPath" "$anTarget"
 }
 
 # Function to prepare environment