proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } {
puts stderr "Generating CMake meta project"
- set anSubPath "adm/cmake"
- set anModulesFileName "CMakeModules.txt"
- set anToolKitDepsFileName "CMakeToolKitsDeps.txt"
+ set aSubPath "adm/cmake"
+ set aModulesFileName "occt_modules.cmake"
+ set aBeingIncludedToolkits "occt_inc_toolkits.cmake"
+ set aBeingUsedToolkits "occt_toolkits.cmake"
- set anModulesTmpl [osutils:readtemplate cmake_modules "Modules of OCCT"]
- set anDepsTmpl [osutils:readtemplate cmake_dinf "toolkits and includes of OCCT"]
+ set aModulesTmpl [osutils:readtemplate cmake_modules "OCCT modules"]
+ set aToolkitsTmpl [osutils:readtemplate cmake_toolkits "toolkit dependencies"]
+ set anIncToolkitsTmpl [osutils:readtemplate cmake_inc_toolkits "toolkits including"]
# modules of occt
set aBuff [list]
foreach aModule $theModules {
lappend aBuff "SET(BUILD_${aModule} ON CACHE BOOL \"include ${aModule}\" )"
}
- regsub -all -- {__MODULE_LIST__} $anModulesTmpl [join $aBuff "\n"] anModulesTmpl
+ regsub -all -- {__MODULE_LIST__} $aModulesTmpl [join $aBuff "\n"] aModulesTmpl
# dynamic content of occt
set aBuff [list]
lappend aBuff "set(${anExecutable}_DEPS \"${aDepToolkits}\")"
}
}
- regsub -all -- {__TOOLKIT_DEPS__} $anDepsTmpl [join $aBuff "\n"] anDepsTmpl
+ regsub -all -- {__TOOLKIT_DEPS__} $aToolkitsTmpl [join $aBuff "\n"] aToolkitsTmpl
set aBuff [list]
foreach aModule $theModules {
}
lappend aBuff "endif()"
}
- regsub -all -- {__MODULE_DEPS__} $anDepsTmpl [join $aBuff "\n"] anDepsTmpl
+ regsub -all -- {__MODULE_DEPS__} $aToolkitsTmpl [join $aBuff "\n"] aToolkitsTmpl
set aBuff [list]
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
#create directory
- if {![file exists "$theOutDir/$anSubPath/$aToolKit"]} {
- file mkdir "$theOutDir/$anSubPath/$aToolKit"
+ if {![file exists "$theOutDir/$aSubPath/$aToolKit"]} {
+ file mkdir "$theOutDir/$aSubPath/$aToolKit"
}
#add directory to main cmake metafile
- lappend aBuff "IF(EXISTS \"\$\{TK_ROOT_DIR\}/$anSubPath/${aToolKit}\")"
- lappend aBuff " subdirs(\$\{TK_ROOT_DIR\}/$anSubPath/${aToolKit})"
+ lappend aBuff "IF(EXISTS \"\$\{TK_ROOT_DIR\}/$aSubPath/${aToolKit}\")"
+ lappend aBuff " add_subdirectory(\$\{TK_ROOT_DIR\}/$aSubPath/${aToolKit})"
lappend aBuff "ELSE()"
- lappend aBuff " LIST(APPEND UNSUBDIRS \"$anSubPath/${aToolKit}\")"
+ lappend aBuff " LIST(APPEND UNSUBDIRS \"$aSubPath/${aToolKit}\")"
lappend aBuff "ENDIF()"
# create cmake metafile into target subdir
- osutils:cmktk $theOutDir/$anSubPath $aToolKit false ${aModule}
+ osutils:cmktk $theOutDir/$aSubPath $aToolKit false ${aModule}
}
foreach anExecutable [OS:executable ${aModule}] {
#create directory
- if {![file exists "$theOutDir/$anSubPath/$anExecutable"]} {
- file mkdir "$theOutDir/$anSubPath/$anExecutable"
+ if {![file exists "$theOutDir/$aSubPath/$anExecutable"]} {
+ file mkdir "$theOutDir/$aSubPath/$anExecutable"
}
#add directory to main cmake metafile
- lappend aBuff "IF(EXISTS \"\$\{TK_ROOT_DIR\}/$anSubPath/${anExecutable}\")"
- lappend aBuff " subdirs(\$\{TK_ROOT_DIR\}/$anSubPath/${anExecutable})"
+ lappend aBuff "IF(EXISTS \"\$\{TK_ROOT_DIR\}/$aSubPath/${anExecutable}\")"
+ lappend aBuff " add_subdirectory(\$\{TK_ROOT_DIR\}/$aSubPath/${anExecutable})"
lappend aBuff "ELSE()"
- lappend aBuff " LIST(APPEND UNSUBDIRS \"$anSubPath/${anExecutable}\")"
+ lappend aBuff " LIST(APPEND UNSUBDIRS \"$aSubPath/${anExecutable}\")"
lappend aBuff "ENDIF()\n"
# create cmake metafile into target subdir
- osutils:cmktk $theOutDir/$anSubPath $anExecutable true ${aModule}
+ osutils:cmktk $theOutDir/$aSubPath $anExecutable true ${aModule}
}
}
- regsub -all -- {__INCLUDE_TOOLKITS__} $anDepsTmpl [join $aBuff "\n"] anDepsTmpl
+ regsub -all -- {__INCLUDE_TOOLKITS__} $anIncToolkitsTmpl [join $aBuff "\n"] anIncToolkitsTmpl
#generate cmake files
- set aFile [open [set fdsw [file join "$theOutDir/$anSubPath" $anModulesFileName]] w]
+ set aFile [open [set fdsw [file join "$theOutDir/$aSubPath" $aModulesFileName]] w]
fconfigure $aFile -translation crlf
- puts $aFile $anModulesTmpl
+ puts $aFile $aModulesTmpl
+ close $aFile
+
+ set aFile [open [set fdsw [file join "$theOutDir/$aSubPath" $aBeingUsedToolkits]] w]
+ fconfigure $aFile -translation crlf
+ puts $aFile $aToolkitsTmpl
close $aFile
- set aFile [open [set fdsw [file join "$theOutDir/$anSubPath" $anToolKitDepsFileName]] w]
+ set aFile [open [set fdsw [file join "$theOutDir/$aSubPath" $aBeingIncludedToolkits]] w]
fconfigure $aFile -translation crlf
- puts $aFile $anDepsTmpl
+ puts $aFile $anIncToolkitsTmpl
close $aFile
- puts "The Cmake meta-files are stored in the [file normalize $theOutDir/$anSubPath] directories"
+ puts "The Cmake meta-files are stored in the [file normalize $theOutDir/$aSubPath] directories"
}
# Generates Code Blocks workspace.
return [join $aLibArray " "]
}
-proc osutils:csfList { theOS theCsfMap } {
+proc osutils:csfList { theOS theCsfMap theTarget} {
upvar $theCsfMap aCsfMap
unset theCsfMap
set aCsfMap(CSF_OpenGlLibs) "opengl32.lib glu32.lib"
# -- 3rd-parties precompiled libraries
- # Note: Tcl library name depends on version and is chosen by #pragma
-# set aCsfMap(CSF_TclLibs) "tcl86.lib"
-# set aCsfMap(CSF_TclTkLibs) "tk86.lib"
+ if { "$theTarget" == "cmake" } {
+ set aCsfMap(CSF_TclLibs) "tcl\${3RDPARTY_TCL_LIBRARY_VERSION}.lib"
+ set aCsfMap(CSF_TclTkLibs) "tk\${3RDPARTY_TCL_LIBRARY_VERSION}.lib"
+ }
+
set aCsfMap(CSF_QT) "QtCore4.lib QtGui4.lib"
#-- VTK
} else {
#-- Tcl/Tk configuration
- set aCsfMap(CSF_TclLibs) "tcl8.6"
- set aCsfMap(CSF_TclTkLibs) "X11 tk8.6"
+ if { "$theTarget" == "cmake" } {
+ set aCsfMap(CSF_TclLibs) "tcl\${3RDPARTY_TCL_LIBRARY_VERSION}"
+ set aCsfMap(CSF_TclTkLibs) "X11 tk\${3RDPARTY_TK_LIBRARY_VERSION}"
+ } else {
+ set aCsfMap(CSF_TclLibs) "tcl8.6"
+ set aCsfMap(CSF_TclTkLibs) "X11 tk8.6"
+ }
if { "$theOS" == "lin" } {
set aCsfMap(CSF_ThreadLibs) "pthread rt"
}
}
-proc osutils:usedOsLibs { theToolKit theOS } {
+proc osutils:usedOsLibs { theToolKit theOS {theTarget ""}} {
set aUsedLibs [list]
- osutils:csfList $theOS anOsCsfList
+ osutils:csfList $theOS anOsCsfList $theTarget
foreach element [osutils:tk:hascsf [woklocate -p ${theToolKit}:source:EXTERNLIB [wokcd]]] {
# test if variable is not setted - continue
set anOutFileName "CMakeLists.txt"
set anCommonUsedToolKits [osutils:commonUsedTK $theToolKit]
- set anUsedWntLibs [osutils:usedOsLibs $theToolKit "wnt"]
- set anUsedUnixLibs [osutils:usedOsLibs $theToolKit "lin"]
+ set anUsedWntLibs [osutils:usedOsLibs $theToolKit "wnt" cmake]
+ set anUsedUnixLibs [osutils:usedOsLibs $theToolKit "lin" cmake]
set anUsedMacLibs [osutils:usedOsLibs $theToolKit "mac"]
set anUnits [list]
lappend aFileBuff ""
lappend aFileBuff " set_property(TARGET ${theToolKit} PROPERTY FOLDER ${theModule})"
lappend aFileBuff ""
- lappend aFileBuff " install( TARGETS ${theToolKit} DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/bin\$\{BUILD_SUFFIX\}\" )"
+ lappend aFileBuff " install( TARGETS ${theToolKit} DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/bin\$\{BUILD_POSTFIX\}\" )"
} else {
lappend aFileBuff " add_library( ${theToolKit} SHARED \$\{${theToolKit}_USED_SRCFILES\} )"
lappend aFileBuff ""
lappend aFileBuff " set_property(TARGET ${theToolKit} PROPERTY FOLDER ${theModule})"
lappend aFileBuff ""
lappend aFileBuff " install( TARGETS ${theToolKit}
- RUNTIME DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/bin\$\{BUILD_SUFFIX\}\"
- ARCHIVE DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/lib\$\{BUILD_SUFFIX\}\"
- LIBRARY DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/lib\$\{BUILD_SUFFIX\}\")"
+ RUNTIME DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/bin\$\{BUILD_POSTFIX\}\"
+ ARCHIVE DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/lib\$\{BUILD_POSTFIX\}\"
+ LIBRARY DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/lib\$\{BUILD_POSTFIX\}\")"
lappend aFileBuff ""
lappend aFileBuff " if (MSVC)"
- lappend aFileBuff " install( FILES \$\{CMAKE_BINARY_DIR\}/out/bin/Debug/${theToolKit}.pdb CONFIGURATIONS Debug
- DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/bin\$\{BUILD_SUFFIX\}\")"
+ lappend aFileBuff " install( FILES \$\{CMAKE_BINARY_DIR\}/out/bind/Debug/${theToolKit}.pdb CONFIGURATIONS Debug
+ DESTINATION \"\$\{INSTALL_DIR\}/\$\{OS_WITH_BIT\}/\$\{COMPILER\}/bin\$\{BUILD_POSTFIX\}\")"
lappend aFileBuff " endif()"
lappend aFileBuff ""
}