From 787fc0414a97072bbc8da4594a891db7b5c701c9 Mon Sep 17 00:00:00 2001 From: ibs Date: Mon, 24 Jun 2013 15:21:14 +0400 Subject: [PATCH] 0023957: Provide CMakeLists.txt file in root folder of OCCT --- src/WOKTclLib/OS.tcl | 23 +++++++++--------- src/WOKTclLib/templates/template.cmake | 32 +++++++++++++------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/WOKTclLib/OS.tcl b/src/WOKTclLib/OS.tcl index b7d3c0a..770503a 100755 --- a/src/WOKTclLib/OS.tcl +++ b/src/WOKTclLib/OS.tcl @@ -2980,6 +2980,7 @@ proc OS:MKVC { theOutDir {theModules {}} {theAllSolution ""} {theVcVer "vc8"} } proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { puts stderr "Generating CMake meta project" + set anSubPath "adm/cmake" set anOutFileName "CMakeLists.txt" set aProjectName $theAllSolution @@ -2988,8 +2989,6 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { 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 - regsub -all -- {__CASROOT_DIR__} $theProjTmpl "../.." theProjTmpl - set aBuff [list] foreach aModule $theModules { @@ -3034,27 +3033,27 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { foreach aModule $theModules { foreach aToolKit [${aModule}:toolkits] { #create directory - if {![file exists "$theOutDir/$aToolKit"]} { - file mkdir "$theOutDir/$aToolKit" + if {![file exists "$theOutDir/$anSubPath/$aToolKit"]} { + file mkdir "$theOutDir/$anSubPath/$aToolKit" } #add directory to main cmake metafile - lappend aBuff "subdirs(${aToolKit})" + lappend aBuff "subdirs($anSubPath/${aToolKit})" # create cmake metafile into target subdir - osutils:cmktk $theOutDir $aToolKit false ${aModule} + osutils:cmktk $theOutDir/$anSubPath $aToolKit false ${aModule} } foreach anExecutable [OS:executable ${aModule}] { #create directory - if {![file exists "$theOutDir/$anExecutable"]} { - file mkdir "$theOutDir/$anExecutable" + if {![file exists "$theOutDir/$anSubPath/$anExecutable"]} { + file mkdir "$theOutDir/$anSubPath/$anExecutable" } #add directory to main cmake metafile - lappend aBuff "subdirs(${anExecutable})" + lappend aBuff "subdirs($anSubPath/${anExecutable})" # create cmake metafile into target subdir - osutils:cmktk $theOutDir $anExecutable true ${aModule} + osutils:cmktk $theOutDir/$anSubPath $anExecutable true ${aModule} } } regsub -all -- {__INCLUDE_TOOLKITS__} $theProjTmpl [join $aBuff "\n"] theProjTmpl @@ -3065,7 +3064,7 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { puts $aFile $theProjTmpl close $aFile - puts "The Cmake meta-files are stored in the $theOutDir directory" + puts "The Cmake meta-files are stored in the [file normalize $theOutDir] and [file normalize $theOutDir/$anSubPath] directories" } # Generates Code Blocks workspace. @@ -3363,7 +3362,7 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } { "vc10" - "vc11" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE } "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution } - "cmake" { OS:MKCMK "${anOutRoot}/${theIDE}" $aModules $anAllSolution } + "cmake" { OS:MKCMK "${anOutRoot}/.." $aModules $anAllSolution } "amk" { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"} "xcd" { set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000" diff --git a/src/WOKTclLib/templates/template.cmake b/src/WOKTclLib/templates/template.cmake index 7d4c12f..4173bc7 100644 --- a/src/WOKTclLib/templates/template.cmake +++ b/src/WOKTclLib/templates/template.cmake @@ -91,17 +91,17 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/bin) # RESOURCES -install(DIRECTORY "__CASROOT_DIR__/src/DrawResources" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/StdResource" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/SHMessage" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/Textures" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/XSMessage" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/TObj" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/XSTEPResource" DESTINATION "${INSTALL_DIR}/res" ) -install(DIRECTORY "__CASROOT_DIR__/src/XmlOcafResource" DESTINATION "${INSTALL_DIR}/res" ) - -install(FILES "__CASROOT_DIR__/src/UnitsAPI/Lexi_Expr.dat" DESTINATION "${INSTALL_DIR}/res/UnitsAPI" ) -install(FILES "__CASROOT_DIR__/src/UnitsAPI/Units.dat" DESTINATION "${INSTALL_DIR}/res/UnitsAPI" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/DrawResources" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/StdResource" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/SHMessage" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/Textures" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSMessage" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/TObj" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSTEPResource" DESTINATION "${INSTALL_DIR}/res" ) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XmlOcafResource" DESTINATION "${INSTALL_DIR}/res" ) + +install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Lexi_Expr.dat" DESTINATION "${INSTALL_DIR}/res/UnitsAPI" ) +install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Units.dat" DESTINATION "${INSTALL_DIR}/res/UnitsAPI" ) IF("${BUILD_TYPE}" STREQUAL "Release") SET(BUILD_SUFFIX "") @@ -489,14 +489,14 @@ IF("${INSTALL_DIR}" STREQUAL "") MESSAGE(FATAL_ERROR "INSTALL_DIR is empty") ELSE() # INC DIRECTORY - install(DIRECTORY __CASROOT_DIR__/inc DESTINATION "${INSTALL_DIR}" ) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/inc DESTINATION "${INSTALL_DIR}" ) # DRAW.BAT or DRAW.SH - install(FILES draw.${SCRIPT_EXT} DESTINATION "${INSTALL_DIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + install(FILES "${CMAKE_SOURCE_DIR}/adm/cmake/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) - configure_file(env.${SCRIPT_EXT}.in env.${SCRIPT_EXT} @ONLY) + configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.${SCRIPT_EXT}.in" env.${SCRIPT_EXT} @ONLY) install(FILES "${__PROJECT_NAME___BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" ) ENDIF() @@ -504,9 +504,9 @@ IF(MSVC AND "${BUILD_TYPE}" STREQUAL "Debug") SET(RUN_PROJECT "start __PROJECT_NAME__.sln") SET(BIN_DIR_POSTFIX "out\\bin\\Debug") SET(RESOURCE_DIR_PREFIX "%CASROOT%\\src") - SET(CASROOT_DEFINITION "set \"CASROOT=__CASROOT_DIR__\"") + SET(CASROOT_DEFINITION "set \"CASROOT=${CMAKE_SOURCE_DIR}\"") - configure_file(env.bat.in __PROJECT_NAME__.bat @ONLY) + configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.bat.in" __PROJECT_NAME__.bat @ONLY) ENDIF() __TOOLKIT_DEPS__ -- 2.39.5