Skip to content

Commit

Permalink
Do not require a functional vcpkg during CMake process
Browse files Browse the repository at this point in the history
Allows to simplify vendoring for offline build. Toolchain configuration
set from build scripts where vcpkg is already used.
  • Loading branch information
Cimbali committed Oct 5, 2024
1 parent 3da352d commit 9c91844
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
10 changes: 0 additions & 10 deletions internal/frontend/bridge-gui/BridgeSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ endif()

set(VCPKG_ROOT "${BRIDGE_REPO_ROOT}/extern/vcpkg")
message(STATUS "VCPKG_ROOT is ${VCPKG_ROOT}")
if (WIN32)
find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg.exe")
else()
find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg")
endif()
if (NOT VCPKG_EXE)
message(FATAL_ERROR "vcpkg is not installed. Run build.sh (macOS/Linux) or build.ps1 (Windows) first.")
endif()

# For now we support only a single architecture for macOS (ARM64 or x86_64). We need to investigate how to build universal binaries with vcpkg.
if (APPLE)
Expand All @@ -86,5 +78,3 @@ if (WIN32)
message(STATUS "Building for Intel x64 Windows computers")
set(VCPKG_TARGET_TRIPLET x64-windows)
endif()

set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain")
2 changes: 2 additions & 0 deletions internal/frontend/bridge-gui/bridge-gui/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ $buildDir=(Join-Path $scriptDir "cmake-build-$buildConfig".ToLower())
$vcpkgRoot = (Join-Path $bridgeRepoRootDir "extern/vcpkg" -Resolve)
$vcpkgExe = (Join-Path $vcpkgRoot "vcpkg.exe")
$vcpkgBootstrap = (Join-Path $vcpkgRoot "bootstrap-vcpkg.bat")
$vcpkgToolchain = (Join-Path $vcpkgRoot "scripts/buildsystems/vcpkg.cmake")

function check_exit() {
if ($? -ne $True)
Expand Down Expand Up @@ -91,6 +92,7 @@ git submodule update --init --recursive $vcpkgRoot
. $vcpkgExe install sentry-native:x64-windows grpc:x64-windows --clean-after-build
. $vcpkgExe upgrade --no-dry-run
. $cmakeExe -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE="$buildConfig" `
-DCMAKE_TOOLCHAIN_FILE="$vcpkgToolchain" `
-DBRIDGE_APP_FULL_NAME="$bridgeFullName" `
-DBRIDGE_VENDOR="$bridgeVendor" `
-DBRIDGE_REVISION="$REVISION_HASH" `
Expand Down
1 change: 1 addition & 0 deletions internal/frontend/bridge-gui/bridge-gui/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ fi

cmake \
-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DBRIDGE_APP_FULL_NAME="${BRIDGE_APP_FULL_NAME}" \
-DBRIDGE_VENDOR="${BRIDGE_VENDOR}" \
-DBRIDGE_REVISION="${BRIDGE_REVISION}" \
Expand Down

0 comments on commit 9c91844

Please sign in to comment.