Skip to content

Commit

Permalink
add local vcpkg asset cache option for offline build
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz-h committed May 16, 2023
1 parent e48ecc4 commit 0bc94cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cmake-build-*/

# Bundled vcpkg
/vcpkg/
/vcpkg_assets/

# In-source-build artifacts
/CMakeFiles/
Expand Down
14 changes: 14 additions & 0 deletions cmake/megamol_vcpkg_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@ option(MEGAMOL_VCPKG_DOWNLOAD_CACHE "Download prebuilt dependency binaries if av
if (MEGAMOL_VCPKG_DOWNLOAD_CACHE)
set(ENV{VCPKG_BINARY_SOURCES} "clear;default,readwrite;http,https://vcpkg-cache.megamol.org/{triplet}-{name}-{sha},read")
endif ()

# Asset cache for offline build
set(MEGAMOL_VCPKG_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_assets" CACHE PATH "Path to vcpkg assets.")
mark_as_advanced(FORCE MEGAMOL_VCPKG_ASSETS_DIR)
if (MEGAMOL_VCPKG_SETUP_ASSET_CACHE)
file(MAKE_DIRECTORY "${MEGAMOL_VCPKG_ASSETS_DIR}")
set(ENV{X_VCPKG_ASSET_SOURCES} "x-azurl,file://${MEGAMOL_VCPKG_ASSETS_DIR}/,,readwrite")

list(APPEND VCPKG_INSTALL_OPTIONS "--only-downloads")
set(MEGAMOL_ENABLE_ALL_FEATURES ON)
set(MEGAMOL_STOP_AFTER_VCPKG ON)
elseif (IS_DIRECTORY "${MEGAMOL_VCPKG_ASSETS_DIR}")
set(ENV{X_VCPKG_ASSET_SOURCES} "x-azurl,file://${MEGAMOL_VCPKG_ASSETS_DIR}/,,read")
endif ()

0 comments on commit 0bc94cc

Please sign in to comment.