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)
This commit is contained in:
Vadim Zeitlin 2022-09-22 18:27:10 +02:00
parent b4cc3504be
commit ec7120a1ba
3 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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()

View File

@ -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()