From: ibs Date: Mon, 1 Jul 2013 11:23:37 +0000 (+0400) Subject: 0024054: Move the dynamic part of main CMakeLists.txt to adm/cmake folder X-Git-Tag: V6_7_1~40 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=82fa428077e029c633022b26e3ab3d987f9635b2;p=occt-wok.git 0024054: Move the dynamic part of main CMakeLists.txt to adm/cmake folder --- diff --git a/src/WOKTclLib/OS.tcl b/src/WOKTclLib/OS.tcl index 770503a..5ea733c 100755 --- a/src/WOKTclLib/OS.tcl +++ b/src/WOKTclLib/OS.tcl @@ -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 index 0000000..45aeb27 --- /dev/null +++ b/src/WOKTclLib/templates/template.cmake_dinf @@ -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 index 0000000..5effb76 --- /dev/null +++ b/src/WOKTclLib/templates/template.cmake_modules @@ -0,0 +1,4 @@ + +# Modules of OCCT + +__MODULE_LIST__ \ No newline at end of file