diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 369b4964a..104ffdae6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: # These are specified in the Unreal Engine release notes under "IDE Version the Build farm compiles against" # and using them ensures we're compiling our plugin in the exact same way that Unreal Engine itself is compiled. cmake-generator: "Visual Studio 17 2022" - cmake-toolchain: "version=14.34" + cmake-toolchain: "14.34" cmake-platform: "x64,version=10.0.18362.0" visual-studio-version: "2022" visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.34.17.4.x86.x64,Microsoft.VisualStudio.Component.Windows10SDK.18362" @@ -166,7 +166,7 @@ jobs: # These are specified in the Unreal Engine release notes under "IDE Version the Build farm compiles against" # and using them ensures we're compiling our plugin in the exact same way that Unreal Engine itself is compiled. cmake-generator: "Visual Studio 17 2022" - cmake-toolchain: "version=14.34" + cmake-toolchain: "14.34" cmake-platform: "x64,version=10.0.18362.0" visual-studio-version: "2022" visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.34.17.4.x86.x64,Microsoft.VisualStudio.Component.Windows10SDK.18362" @@ -284,7 +284,7 @@ jobs: # These are specified in the Unreal Engine release notes under "IDE Version the Build farm compiles against" # and using them ensures we're compiling our plugin in the exact same way that Unreal Engine itself is compiled. cmake-generator: "Visual Studio 17 2022" - cmake-toolchain: "version=14.38" + cmake-toolchain: "14.38" cmake-platform: "x64,version=10.0.22621.0" visual-studio-version: "2022" visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64,Microsoft.VisualStudio.Component.Windows11SDK.22621" diff --git a/.github/workflows/buildAndroid.yml b/.github/workflows/buildAndroid.yml index bc63ba42d..9ef537767 100644 --- a/.github/workflows/buildAndroid.yml +++ b/.github/workflows/buildAndroid.yml @@ -25,6 +25,8 @@ on: android-ndk-version: required: true type: string +env: + VCPKG_BINARY_SOURCES: 'clear;x-aws,s3://cesium-builds/vcpkg/cesium-unreal-cache/,readwrite' jobs: build: runs-on: ${{ inputs.runner-label }} @@ -63,6 +65,12 @@ jobs: unreal-program-name: ${{ inputs.unreal-program-name }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: Capture AWS secrets for vcpkg cache + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_SECRET_KEY }} + aws-region: us-east-1 - name: Build cesium-native run: | # CMake gets confused by the Windows backslashes @@ -70,8 +78,9 @@ jobs: $env:ANDROID_NDK_HOME=$env:ANDROID_NDK_ROOT $env:UNREAL_ENGINE_ROOT="D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}" $env:CESIUM_VCPKG_RELEASE_ONLY="TRUE" + $env:VCPKG_ROOT="$env:VCPKG_INSTALLATION_ROOT" cd extern - cmake -B build-android -S . -G Ninja -DCMAKE_TOOLCHAIN_FILE="unreal-android-toolchain.cmake" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release + cmake -B build-android --preset=arm64-android -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release cmake --build build-android --config Release --target install -j8 cd .. rm -r -fo extern diff --git a/.github/workflows/buildApple.yml b/.github/workflows/buildApple.yml index a06dd2198..c9a94423e 100644 --- a/.github/workflows/buildApple.yml +++ b/.github/workflows/buildApple.yml @@ -21,6 +21,8 @@ on: xcode-version: required: true type: string +env: + VCPKG_BINARY_SOURCES: 'clear;x-aws,s3://cesium-builds/vcpkg/cesium-unreal-cache/,readwrite' jobs: build: runs-on: ${{ inputs.runner-label }} @@ -72,10 +74,6 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - name: Configure vcpkg caching - uses: ./.github/actions/vcpkg-cache - with: - id: ${{ inputs.upload-package-base-name }} - name: Install Unreal Engine uses: ./.github/actions/install-unreal-macos with: @@ -90,24 +88,41 @@ jobs: # Make these available to subsequent steps echo "CESIUM_UNREAL_VERSION=${CESIUM_UNREAL_VERSION}" >> $GITHUB_ENV echo "BUILD_CESIUM_UNREAL_PACKAGE_NAME=${BUILD_CESIUM_UNREAL_PACKAGE_NAME}" >> $GITHUB_ENV + echo "CESIUM_VCPKG_DIR=${HOME}/vcpkg" >> $GITHUB_ENV - name: Install nasm uses: ilammy/setup-nasm@v1.5.1 + - name: Capture AWS secrets for vcpkg cache + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_SECRET_KEY }} + aws-region: us-east-1 + - name: Install ninja + run: | + brew install ninja + - name: Install vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: ${{ env.CESIUM_VCPKG_DIR }} + vcpkgGitCommitId: d5ec528843d29e3a52d745a64b469f810b2cedbf + - name: Print output from run-vcpkg (debugging) + run: > + echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}'" - name: Build cesium-native for macOS ARM64 run: | export UNREAL_ENGINE_ROOT=$HOME/${{ inputs.unreal-program-name }} export CESIUM_VCPKG_RELEASE_ONLY=TRUE - mkdir -p extern/build-arm64 - cd extern/build-arm64 - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=arm64 - cmake --build . -j4 --target install + cd extern + cmake -B build-arm64 --preset=arm64-osx -DCMAKE_BUILD_TYPE=Release + cmake --build build-arm64 -j4 --target install - name: Build cesium-native for macOS x86_64 run: | export UNREAL_ENGINE_ROOT=$HOME/${{ inputs.unreal-program-name }} export CESIUM_VCPKG_RELEASE_ONLY=TRUE mkdir -p extern/build-x64 - cd extern/build-x64 - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=x86_64 - cmake --build . -j4 --target install + cd extern + cmake -B build-x64 --preset=x64-osx -DCMAKE_BUILD_TYPE=Release + cmake --build build-x64 -j4 --target install - name: Create universal macOS libs for cesium-native run: | mkdir -p ${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-universal-Release @@ -131,7 +146,7 @@ jobs: cd extern export UNREAL_ENGINE_ROOT=$HOME/${{ inputs.unreal-program-name }} export CESIUM_VCPKG_RELEASE_ONLY=TRUE - cmake -B build-ios -S . -GXcode -DCMAKE_TOOLCHAIN_FILE="unreal-ios-toolchain.cmake" -DCMAKE_BUILD_TYPE=Release + cmake -B build-ios --preset=arm64-ios -GXcode -DCMAKE_BUILD_TYPE=Release cmake --build build-ios -j4 --target install --config Release - name: Remove extern directory run: | @@ -145,6 +160,8 @@ jobs: - name: Print log if: ${{ failure() }} run: | + cat "/Users/runner/vcpkg/buildtrees/detect_compiler/config-arm64-osx-rel-out.log" + cat "/Users/runner/vcpkg/buildtrees/detect_compiler/config-arm64-osx-rel-err.log" cat "/Users/runner/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt" - name: Publish plugin package artifact if: ${{ success() }} diff --git a/.github/workflows/buildLinux.yml b/.github/workflows/buildLinux.yml index d614d795e..6b57f9dec 100644 --- a/.github/workflows/buildLinux.yml +++ b/.github/workflows/buildLinux.yml @@ -25,6 +25,8 @@ on: clang-version: required: true type: string +env: + VCPKG_BINARY_SOURCES: 'clear;x-aws,s3://cesium-builds/vcpkg/cesium-unreal-cache/,readwrite' jobs: build: runs-on: ${{ inputs.runner-label }} @@ -60,14 +62,12 @@ jobs: unreal-program-name: ${{ inputs.unreal-program-name }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - name: Configure vcpkg caching - uses: ./.github/actions/vcpkg-cache + - name: Capture AWS secrets for vcpkg cache + uses: aws-actions/configure-aws-credentials@v4 with: - id: ${{ inputs.upload-package-base-name }} - - name: Check out repository code - uses: actions/checkout@v4 - with: - submodules: recursive + aws-access-key-id: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_SECRET_KEY }} + aws-region: us-east-1 - name: Install Ninja and patchelf run: | sudo apt install -y ninja-build patchelf @@ -81,10 +81,11 @@ jobs: run: | export UNREAL_ENGINE_COMPILER_DIR="${LINUX_MULTIARCH_ROOT}x86_64-unknown-linux-gnu" export UNREAL_ENGINE_LIBCXX_DIR="${UNREAL_ENGINE_ROOT}/Engine/Source/ThirdParty/Unix/LibCxx" + export VCPKG_ROOT="${VCPKG_INSTALLATION_ROOT}" export CESIUM_VCPKG_RELEASE_ONLY=TRUE cd extern - cmake -B build -S . -G Ninja -DCMAKE_TOOLCHAIN_FILE="unreal-linux-toolchain.cmake" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release - cmake --build build --config Release --target install -j8 + cmake --preset linux -DCMAKE_BUILD_TYPE=Release + cmake --build out/build/linux --config Release --target install -j8 cd .. rm -rf extern - name: Make more swap space available diff --git a/.github/workflows/buildWindows.yml b/.github/workflows/buildWindows.yml index 9d6383e7b..f6e54f7ca 100644 --- a/.github/workflows/buildWindows.yml +++ b/.github/workflows/buildWindows.yml @@ -45,6 +45,8 @@ on: required: false type: string default: "x64" +env: + VCPKG_BINARY_SOURCES: 'clear;x-aws,s3://cesium-builds/vcpkg/cesium-unreal-cache/,readwrite' jobs: build: runs-on: ${{ inputs.runner-label }} @@ -69,10 +71,6 @@ jobs: if: ${{ inputs.extra-choco-packages }} run: | choco install -y ${{ inputs.extra-choco-packages }} - - name: Configure vcpkg caching - uses: ./.github/actions/vcpkg-cache - with: - id: ${{ inputs.upload-package-base-name }} - name: Set environment variables run: | $env:CESIUM_UNREAL_VERSION=$env:GITHUB_REF_NAME @@ -100,13 +98,25 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Install nasm uses: ilammy/setup-nasm@v1.5.1 + - name: Capture AWS secrets for vcpkg cache + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_INTERNAL_SERVICES_VCPKG_SECRET_KEY }} + aws-region: us-east-1 - name: Build cesium-native run: | cd extern $env:UNREAL_ENGINE_ROOT="D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}" $env:CESIUM_VCPKG_RELEASE_ONLY="TRUE" - $toolchainOption=If ("${{ inputs.cmake-toolchain }}") {"-T ${{ inputs.cmake-toolchain }}"} Else {""} - cmake -B build -S . -A "${{ inputs.cmake-platform }}" -G "${{ inputs.cmake-generator }}" $toolchainOption + $env:VCPKG_ROOT="$env:VCPKG_INSTALLATION_ROOT" + $env:CESIUM_TOOLSET_VERSION="${{ inputs.cmake-toolchain }}" + if ($env:CESIUM_TOOLSET_VERSION) { + cmake -B build -S . -T "version=${{ inputs.cmake-toolchain}}" -A "${{ inputs.cmake-platform }}" --preset Windows-CI-Versioned + } + else { + cmake -B build -S . -A "${{ inputs.cmake-platform }}" -preset Windows-CI + } cmake --build build --config Release --target install -j8 cd .. rm -r -fo extern diff --git a/.gitmodules b/.gitmodules index cd261dd04..536d5e884 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "extern/cesium-native"] - path = extern/cesium-native - url = ../cesium-native.git [submodule "extern/MikkTSpace"] path = extern/MikkTSpace url = https://github.com/mmikk/MikkTSpace.git diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index ca90598c5..536b3c636 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -6,6 +6,9 @@ project( LANGUAGES CXX C ) +# XXX Not working yet +set(CESIUM_UNREAL_NATIVE_DIRECTORY "" CACHE PATH "directory for Cesium Native source if not installed via package manager") + if (DEFINED ENV{UNREAL_ENGINE_ROOT} AND NOT UNREAL_ENGINE_ROOT) set(UNREAL_ENGINE_ROOT "$ENV{UNREAL_ENGINE_ROOT}") endif() @@ -57,6 +60,7 @@ set(PRIVATE_CESIUM_SQLITE ON) set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL) set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../Source/ThirdParty) set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-$,Debug,Release>) +set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include) # Always define NDEBUG, since Unreal does in debug anyway. # We don't want any mismatches, especially with class member ordering. @@ -105,28 +109,37 @@ if (CESIUM_USE_UNREAL_TRACING) list(APPEND CESIUM_EXTRA_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include") endif() -# vcpkg setup -set(ENV{VCPKG_OVERLAY_PORTS} "${CMAKE_CURRENT_LIST_DIR}/vcpkg-overlays") -set(ENV{VCPKG_OVERLAY_TRIPLETS} "${CMAKE_CURRENT_LIST_DIR}/vcpkg-overlays/triplets") - -include(${CMAKE_CURRENT_SOURCE_DIR}/cesium-native/cmake/detect-vcpkg-triplet.cmake) - -if (NOT VCPKG_TRIPLET) - if (DEFINED ENV{VCPKG_TRIPLET}) - set(VCPKG_TRIPLET "$ENV{VCPKG_TRIPLET}") - elseif(DETECTED_VCPKG_TRIPLET_ERROR) - message(FATAL_ERROR "${DETECTED_VCPKG_TRIPLET_ERROR}") - else() - set(VCPKG_TRIPLET "${DETECTED_VCPKG_TRIPLET}-unreal") - endif() -endif() - # Our OpenSSL is part of Unreal Engine, so need to install it. set(CESIUM_EXCLUDE_INSTALL_HEADERS openssl) set(CESIUM_EXCLUDE_INSTALL_STATIC_LIBS openssl) SET(CESIUM_DISABLE_CURL ON) -add_subdirectory(cesium-native) +if(CESIUM_UNREAL_NATIVE_DIRECTORY) + # These packages are used in the public headers of Cesium libraries, so we need to distribute the headers and binaries + # with the installation + # Note that fmt is a public dependency of the vcpkg version of spdlog + # STB and uriparser aren't technically part of the public interface, but they're used by the downstream Cesium for Unreal project + set(PACKAGES_PUBLIC asyncplusplus expected-lite fmt glm rapidjson spdlog stb uriparser) + # These packages are used in the code and produce binaries, but are not part of the public interface. Therefore we need + # to distribute the binaries for linking, but not the headers, as downstream consumers don't need them + # OpenSSL and abseil are both dependencies of s2geometry + set(PACKAGES_PRIVATE + abseil draco ktx modp-base64 meshoptimizer openssl s2geometry + libjpeg-turbo sqlite3 tinyxml2 libwebp zlib-ng picosha2 + earcut-hpp cpp-httplib[core] libmorton zstd + ) + # Packages only used for testing + set(PACKAGES_TEST catch2) + + set(PACKAGES_ALL ${PACKAGES_PUBLIC}) + list(APPEND PACKAGES_ALL ${PACKAGES_PRIVATE}) + list(APPEND PACKAGES_ALL ${PACKAGES_TEST}) + add_subdirectory("${CESIUM_UNREAL_NATIVE_DIRECTORY}" cesium-native) + # Don't build the cesium-native tests by default + set_target_properties(cesium-native-tests PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) +else() + find_package(cesium-native) +endif() # cesium-native doesn't require this header to be public, but Cesium for Unreal wants to use it. #install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cesium-native/extern/stb/stb_image_resize.h TYPE INCLUDE) @@ -149,8 +162,23 @@ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) set(CMAKE_POLICY_VERSION_MINIMUM "3.5") add_subdirectory(tidy-html5) -# Don't build the cesium-native tests by default -set_target_properties(cesium-native-tests PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) - add_subdirectory(swl-variant) install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/swl-variant/include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +if(VCPKG_INSTALLED_DIR) + set(CESIUM_VCPKG_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") + set(CESIUM_VCPKG_LIBDIR "${CESIUM_VCPKG_DIR}/$,debug/lib,lib>") + + message(STATUS "CESIUM_VCPKG_LIBDIR: ${CESIUM_VCPKG_LIBDIR}") + + install(DIRECTORY "${CESIUM_VCPKG_LIBDIR}/" + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + PATTERN libcrypto.* EXCLUDE + PATTERN libssl.* EXCLUDE + ) + + install(DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + PATTERN openssl EXCLUDE + ) +endif() diff --git a/extern/CMakePresets.json b/extern/CMakePresets.json new file mode 100644 index 000000000..c778cf8ee --- /dev/null +++ b/extern/CMakePresets.json @@ -0,0 +1,151 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "unreal-common", + "installDir": "${sourceDir}/../Source/ThirdParty", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + } + }, + { + "name": "x64-Windows", + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/../Source/ThirdParty", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_TARGET_TRIPLET": "x64-windows-unreal", + "VCPKG_HOST_TRIPLET": "x64-windows" + } + }, + { + "name": "x64-Debug-Windows", + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/../Source/ThirdParty", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_BUILD_TYPE": "Debug", + "VCPKG_TARGET_TRIPLET": "x64-windows-unreal", + "VCPKG_HOST_TRIPLET": "x64-windows" + } + }, + { + "name": "x64-Release-Windows", + "inherits": "x64-Debug-Windows", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "Windows-CI", + "generator": "Visual Studio 17 2022", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_TARGET_TRIPLET": "x64-windows-unreal", + "VCPKG_HOST_TRIPLET": "x64-windows" + } + }, + { + "name": "Windows-CI-Versioned", + "inherits": "Windows-CI", + "environment": { + "CESIUM_TOOLSET_VERSION": "$penv{CESIUM_TOOLSET_VERSION}" + } + }, + { + "name": "debug-windows-versioned", + "inherits": "x64-Debug-Windows", + "toolset": "version=14.36", + "environment": { + "CESIUM_TOOLSET_VERSION": "14.36" + } + }, + { + "name": "linux", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/../Source/ThirdParty", + "generator": "Ninja", + "condition": { + "type": "matches", + "string": "${hostSystemName}", + "regex": "^[Ll]inux" + }, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_TARGET_TRIPLET": "x64-linux-unreal", + "VCPKG_HOST_TRIPLET": "x64-linux", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/unreal-linux-toolchain.cmake" + } + }, + { + "name": "linux-debug", + "inherits": "linux", + "condition": { + "type": "matches", + "string": "${hostSystemName}", + "regex": "^[Ll]inux" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "linux-release", + "inherits": "linux", + "condition": { + "type": "matches", + "string": "${hostSystemName}", + "regex": "^[Ll]inux" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "osx-common", + "inherits": "unreal-common", + "cacheVariables": { + "CMAKE_OSX_DEPLOYMENT_TARGET": "10.15", + "CMAKE_SYSTEM_NAME": "Darwin" + } + }, + { + "name": "arm64-osx", + "inherits": "osx-common", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-osx-unreal", + "CMAKE_OSX_ARCHITECTURES": "arm64", + "CMAKE_SYSTEM_PROCESSOR": "arm64" + } + }, + { + "name": "x64-osx", + "inherits": "osx-common", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-osx-unreal", + "CMAKE_OSX_ARCHITECTURES": "x86_64", + "CMAKE_SYSTEM_PROCESSOR": "x86_64" + } + }, + { + "name": "arm64-ios", + "inherits": "unreal-common", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-ios-unreal", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/unreal-ios-toolchain.cmake" + } + }, + { + "name": "arm64-android", + "inherits": "unreal-common", + "generator": "Ninja", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-android-unreal", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/unreal-android-toolchain.cmake" + } + } + ] +} + diff --git a/extern/cesium-native b/extern/cesium-native deleted file mode 160000 index 020603bdd..000000000 --- a/extern/cesium-native +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 020603bdd4254bcdf333b08209def90468629917 diff --git a/extern/vcpkg-configuration.json b/extern/vcpkg-configuration.json new file mode 100644 index 000000000..0d14a6908 --- /dev/null +++ b/extern/vcpkg-configuration.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", + "default-registry": { + "kind": "git", + "baseline": "d5ec528843d29e3a52d745a64b469f810b2cedbf", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ], + "overlay-ports": [ + "vcpkg-overlays" + ], + "overlay-triplets": [ "vcpkg-overlays/triplets" ] +} diff --git a/extern/vcpkg-overlays/cesium-native/portfile.cmake b/extern/vcpkg-overlays/cesium-native/portfile.cmake new file mode 100644 index 000000000..058253a9f --- /dev/null +++ b/extern/vcpkg-overlays/cesium-native/portfile.cmake @@ -0,0 +1,35 @@ +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + dependencies-only CESIUM_NATIVE_DEPS_ONLY +) + +if(CESIUM_NATIVE_DEPS_ONLY) + message(STATUS "skipping installation of cesium-native") + set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + return() +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO CesiumGS/cesium-native + REF "v${VERSION}" + SHA512 c5d6146b2c4ddc299eb72c35791f2f798abfa3662b83a94ad978a698811c9a14d79bff6478bdb74582c6e137a717fe4bcf456c8470c16bb0b962094ec77466e9 + HEAD_REF vcpkg-pkg + ) + +# Rename sqlite3* symbols to cesium_sqlite3* so they don't conflict with UE's sqlite3, +# which has a bunch of limitations and is not considered public. The sqlite3 port is built this way. + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCESIUM_USE_EZVCPKG=OFF + -DPRIVATE_CESIUM_SQLITE=ON + -DCESIUM_TESTS_ENABLED=OFF + ) + +vcpkg_cmake_install() +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +vcpkg_cmake_config_fixup(CONFIG_PATH share/cesium-native/cmake PACKAGE_NAME cesium-native) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + diff --git a/extern/vcpkg-overlays/cesium-native/portfile.cmake~ b/extern/vcpkg-overlays/cesium-native/portfile.cmake~ new file mode 100644 index 000000000..4540ab24e --- /dev/null +++ b/extern/vcpkg-overlays/cesium-native/portfile.cmake~ @@ -0,0 +1,30 @@ +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + dependencies-only CESIUM_NATIVE_DEPS_ONLY +) + +if(CESIUM_NATIVE_DEPS_ONLY) + message(STATUS "skipping installation of cesium-native") + set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + return() +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO CesiumGS/cesium-native + REF 8b65a4084b5f849bd903a5032fc5c0405814be96 + SHA512 0 + HEAD_REF vcpkg-pkg + ) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCESIUM_USE_EZVCPKG=OFF + -DPRIVATE_CESIUM_SQLITE=ON + ) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/cesium-native PACKAGE_NAME cesium-native) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + diff --git a/extern/vcpkg-overlays/cesium-native/vcpkg.json b/extern/vcpkg-overlays/cesium-native/vcpkg.json new file mode 100644 index 000000000..17cda1e99 --- /dev/null +++ b/extern/vcpkg-overlays/cesium-native/vcpkg.json @@ -0,0 +1,43 @@ +{ + "name": "cesium-native", + "version-string": "0.49.0", + "features": { + "dependencies-only": { + "description": "install port's dependencies without the port" + } + }, + "dependencies": [ + "vcpkg-cmake", + "vcpkg-cmake-config", + "asyncplusplus", + "curl", + "doctest", + "expected-lite", + "fmt", + "glm", + "rapidjson", + "spdlog", + "stb", + "ada-url", + "draco", + "ktx", + "modp-base64", + "meshoptimizer", + "openssl", + "s2geometry", + "libjpeg-turbo", + "sqlite3", + "tinyxml2", + "libwebp", + "zlib-ng", + "picosha2", + "earcut-hpp", + { + "name": "cpp-httplib", + "default-features": false + }, + "libmorton", + "zstd" + ] +} + diff --git a/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake b/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake index cb2a5b2b5..26aef92c7 100644 --- a/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake +++ b/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake @@ -3,7 +3,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/shared/common.cmake") set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) -set(VCPKG_ENV_PASSTHROUGH "UNREAL_ENGINE_ROOT") +set(VCPKG_ENV_PASSTHROUGH UNREAL_ENGINE_ROOT CESIUM_TOOLSET_VERSION) set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) # Unreal Engine adds /Zp8 in 64-bit Windows builds to align structs to 8 bytes instead of the @@ -16,7 +16,12 @@ set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) # between compilation units using different versions of that flag. We compile cesium-native # with this same option to avoid super-dodgy and hard to debug issues. # https://github.com/EpicGames/UnrealEngine/blob/5.3.2-release/Engine/Source/Programs/UnrealBuildTool/Platform/Windows/VCToolChain.cs -set(VCPKG_CXX_FLAGS "/Zp8") + +# Always define NDEBUG, since Unreal does in debug anyway. +# We don't want any mismatches, especially with class member ordering. +# But still let debug builds force assertions. + +set(VCPKG_CXX_FLAGS "/Zp8 /DNDEBUG") set(VCPKG_C_FLAGS "${VCPKG_CXX_FLAGS}") # Use an unreasonable amount of force to replace /MDd (MultiThreadedDebugDLL) with /MD (MultiThreadedDLL) @@ -24,12 +29,14 @@ set(VCPKG_C_FLAGS "${VCPKG_CXX_FLAGS}") # Only CMAKE_MSVC_RUNTIME_LIBRARY would be required if all our third-party libraries used CMake 3.15+, but alas. set(VCPKG_CMAKE_CONFIGURE_OPTIONS "") list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreadedDLL") -list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_CXX_FLAGS_DEBUG:STRING=/MD /Z7 /Ob0 /Od /RTC1") -list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_C_FLAGS_DEBUG:STRING=/MD /Z7 /Ob0 /Od /RTC1") +list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_CXX_FLAGS_DEBUG:STRING=/MD /Z7 /Ob0 /Od /RTC1 /DCESIUM_FORCE_ASSERTIONS") +list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_C_FLAGS_DEBUG:STRING=/MD /Z7 /Ob0 /Od /RTC1 /DCESIUM_FORCE_ASSERTIONS") # When building official binaries on CI, use a very specific MSVC toolset version (which must be installed). # When building locally, use the default. -if(DEFINED ENV{CI}) +if(DEFINED ENV{CESIUM_TOOLSET_VERSION}) + set(VCPKG_PLATFORM_TOOLSET_VERSION "$ENV{CESIUM_TOOLSET_VERSION}") +elseif(DEFINED ENV{CI}) # Toolset version should be 14.38 on UE 5.5+, 14.34 on prior versions. set(VCPKG_PLATFORM_TOOLSET_VERSION "14.34") diff --git a/extern/vcpkg.json b/extern/vcpkg.json new file mode 100644 index 000000000..a98b0f2d1 --- /dev/null +++ b/extern/vcpkg.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "vsgcs", + "version": "0.9.0", + "default-features": [ + "cesium-native-port" + ], + "features": { + "cesium-native-port": { + "description": "Use vckpg overlay for Cesium Native", + "dependencies": [ + { + "name": "cesium-native" + } + ] + }, + "cesium-native-local": { + "description": "Use local source for Cesium Native", + "dependencies": [ + { + "name": "cesium-native", + "features": ["dependencies-only"] + } + ] + } + }, + "dependencies": [ + "vcpkg-cmake", + "vcpkg-cmake-config", + "cesium-native", + { + "name": "cpp-httplib", + "default-features": false + } + ] +} +