]> OCCT Git - occt-wok.git/commitdiff
0024054: Move the dynamic part of main CMakeLists.txt to adm/cmake folder
authoribs <ibs@opencascade.com>
Mon, 1 Jul 2013 11:23:37 +0000 (15:23 +0400)
committerbugmaster <bugmaster@opencascade.com>
Wed, 17 Jul 2013 07:52:52 +0000 (11:52 +0400)
src/WOKTclLib/OS.tcl
src/WOKTclLib/templates/template.cmake_dinf [new file with mode: 0644]
src/WOKTclLib/templates/template.cmake_modules [new file with mode: 0644]

index 770503a5b254113b1e5e0dbad3047d9a014edd7a..5ea733c5f3a9844012fb73185ab160b0618c38c3 100755 (executable)
@@ -2981,21 +2981,20 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } {
   puts stderr "Generating CMake meta project"
 
   set anSubPath "adm/cmake"
-  set anOutFileName "CMakeLists.txt"
-  set aProjectName $theAllSolution
+  set anModulesFileName "CMakeModules.txt"
+  set anToolKitDepsFileName "CMakeToolKitsDeps.txt"
 
-  set theProjTmpl [osutils:readtemplate cmake "CMake main meta-project"]
-
-  regsub -all -- {__PROJECT_NAME__} $theProjTmpl $aProjectName theProjTmpl
-  regsub -all -- {__BITNESS__}      $theProjTmpl $::env(ARCH) theProjTmpl
-  regsub -all -- {__WOK_LIB_PATH__} $theProjTmpl [file normalize $::env(WOK_LIBRARY)] theProjTmpl
+  set anModulesTmpl [osutils:readtemplate cmake_modules "Modules of OCCT"]
+  set anDepsTmpl [osutils:readtemplate cmake_dinf "toolkits and includes of OCCT"]
 
+  # modules of occt
   set aBuff [list]
   foreach aModule $theModules {
     lappend aBuff "SET(BUILD_${aModule} ON CACHE BOOL \"include ${aModule}\"  )"
   }
-  regsub -all -- {__MODULE_LIST__}  $theProjTmpl  [join $aBuff "\n"] theProjTmpl
+  regsub -all -- {__MODULE_LIST__}  $anModulesTmpl  [join $aBuff "\n"] anModulesTmpl
 
+  # dynamic content of occt
   set aBuff [list]
   foreach aModule $theModules {
     foreach aToolKit [${aModule}:toolkits] {
@@ -3007,7 +3006,7 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } {
       lappend aBuff "set(${anExecutable}_DEPS \"${aDepToolkits}\")"
     }
   }
-  regsub -all -- {__TOOLKIT_DEPS__} $theProjTmpl  [join $aBuff "\n"] theProjTmpl
+  regsub -all -- {__TOOLKIT_DEPS__} $anDepsTmpl  [join $aBuff "\n"] anDepsTmpl
 
   set aBuff [list]
   foreach aModule $theModules {
@@ -3027,7 +3026,7 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } {
     }
     lappend aBuff "endif()"
   }
-  regsub -all -- {__MODULE_DEPS__}  $theProjTmpl  [join $aBuff "\n"] theProjTmpl
+  regsub -all -- {__MODULE_DEPS__}  $anDepsTmpl  [join $aBuff "\n"] anDepsTmpl
 
   set aBuff [list]
   foreach aModule $theModules {
@@ -3056,15 +3055,20 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } {
       osutils:cmktk $theOutDir/$anSubPath $anExecutable true ${aModule}
     }
   }
-  regsub -all -- {__INCLUDE_TOOLKITS__} $theProjTmpl  [join $aBuff "\n"] theProjTmpl
+  regsub -all -- {__INCLUDE_TOOLKITS__} $anDepsTmpl  [join $aBuff "\n"] anDepsTmpl
 
-  #generate cmake meta file
-  set aFile [open [set fdsw [file join $theOutDir $anOutFileName]] w]
+  #generate cmake files
+  set aFile [open [set fdsw [file join "$theOutDir/$anSubPath" $anModulesFileName]] w]
+  fconfigure $aFile -translation crlf
+  puts $aFile $anModulesTmpl
+  close $aFile
+  
+  set aFile [open [set fdsw [file join "$theOutDir/$anSubPath" $anToolKitDepsFileName]] w]
   fconfigure $aFile -translation crlf
-  puts $aFile $theProjTmpl
+  puts $aFile $anDepsTmpl
   close $aFile
 
-  puts "The Cmake meta-files are stored in the [file normalize $theOutDir] and [file normalize $theOutDir/$anSubPath] directories"
+  puts "The Cmake meta-files are stored in the [file normalize $theOutDir/$anSubPath] directories"
 }
 
 # Generates Code Blocks workspace.
diff --git a/src/WOKTclLib/templates/template.cmake_dinf b/src/WOKTclLib/templates/template.cmake_dinf
new file mode 100644 (file)
index 0000000..45aeb27
--- /dev/null
@@ -0,0 +1,17 @@
+
+# dynamic content of OCCT
+
+__TOOLKIT_DEPS__
+
+__MODULE_DEPS__
+
+list( APPEND USED_TOOLKITS ${BUILD_TOOLKITS})
+
+foreach( TOOLKIT ${USED_TOOLKITS} )
+ set(TurnONthe${TOOLKIT} ON)
+ foreach( TK ${${TOOLKIT}_DEPS})
+   set(TurnONthe${TK} ON)
+ endforeach()
+endforeach()
+
+__INCLUDE_TOOLKITS__
\ No newline at end of file
diff --git a/src/WOKTclLib/templates/template.cmake_modules b/src/WOKTclLib/templates/template.cmake_modules
new file mode 100644 (file)
index 0000000..5effb76
--- /dev/null
@@ -0,0 +1,4 @@
+
+# Modules of OCCT
+
+__MODULE_LIST__
\ No newline at end of file