From ec7120a1bae30a797e54973333f8e36f577079b9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 Sep 2022 18:27:10 +0200 Subject: [PATCH] CMake: use output directory under wx directory in the build tree This is a combination of the following commits from master: 85105681d3 Use wxSOURCE_DIR and wxBINARY_DIR in config.cmake for consistency 1212247f3d Download WebView2 under current, and not top level, directory 3dcb7a415f Use output directory under wx directory in the build tree See #22814. (cherry picked from commit 359138321eef76af0fc62aeca084af0f940b1e4d) --- CMakeLists.txt | 2 +- build/cmake/config.cmake | 14 +++++++------- build/cmake/lib/webview/CMakeLists.txt | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a49ecd3883..9c9f78b9dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ include(build/cmake/policies.cmake NO_POLICY_SCOPE) # Initialize variables for quick access to wx root dir in sub dirs set(wxSOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(wxBINARY_DIR ${CMAKE_BINARY_DIR}) +set(wxBINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib) # parse the version number from wx/version.h and include in wxMAJOR_VERSION and wxMINOR_VERSION diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index f9d08e45f5..983bd92e6c 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -13,15 +13,15 @@ set(TOOLCHAIN_FULLNAME ${wxBUILD_FILE_ID}) macro(wx_configure_script input output) # variables used in wx-config-inplace.in - set(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}) - set(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR}) + set(abs_top_srcdir ${wxSOURCE_DIR}) + set(abs_top_builddir ${wxBINARY_DIR}) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${input} - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${output} + ${wxSOURCE_DIR}/${input} + ${wxBINARY_DIR}${CMAKE_FILES_DIRECTORY}/${output} ESCAPE_QUOTES @ONLY NEWLINE_STYLE UNIX) file(COPY - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${output} + ${wxBINARY_DIR}${CMAKE_FILES_DIRECTORY}/${output} DESTINATION ${wxCONFIG_DIR} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE @@ -80,8 +80,8 @@ function(wx_write_config_inplace) execute_process( COMMAND "${CMAKE_COMMAND}" -E ${COPY_CMD} - "${CMAKE_CURRENT_BINARY_DIR}/lib/wx/config/inplace-${TOOLCHAIN_FULLNAME}" - "${CMAKE_CURRENT_BINARY_DIR}/wx-config" + "${wxBINARY_DIR}/lib/wx/config/inplace-${TOOLCHAIN_FULLNAME}" + "${wxBINARY_DIR}/wx-config" ) endfunction() diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index 085381d785..1b7ebb0a90 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -50,7 +50,7 @@ elseif(WXMSW) set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}") set(WEBVIEW2_SHA256 "6a34bb553e18cfac7297b4031f3eac2558e439f8d16a45945c22945ac404105d") - set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}") + set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}") if(NOT EXISTS ${WEBVIEW2_PACKAGE_DIR}) unset(WEBVIEW2_PACKAGE_DIR CACHE) @@ -67,11 +67,11 @@ elseif(WXMSW) set(WEBVIEW2_PACKAGE_DIR ${WEBVIEW2_DEFAULT_PACKAGE_DIR} CACHE PATH "WebView2 SDK PATH" FORCE) file(DOWNLOAD ${WEBVIEW2_URL} - ${CMAKE_BINARY_DIR}/webview2.nuget + ${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget EXPECTED_HASH SHA256=${WEBVIEW2_SHA256}) file(MAKE_DIRECTORY ${WEBVIEW2_PACKAGE_DIR}) execute_process(COMMAND - "${CMAKE_COMMAND}" -E tar x "${CMAKE_BINARY_DIR}/webview2.nuget" + "${CMAKE_COMMAND}" -E tar x "${CMAKE_CURRENT_BINARY_DIR}/webview2.nuget" WORKING_DIRECTORY "${WEBVIEW2_PACKAGE_DIR}" ) endif()