From 950c3d008d340664a94333beddeea2d448f4d3c5 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Sat, 2 Nov 2024 17:31:56 +0100 Subject: [PATCH 01/19] First cut as a vcpkg package This is basically the addition of the vcpkg.json manifest and vcpkg-configuration.json, which are both pretty minimal. In practice, projects will probably copy those and add overlays. --- CMakePresets.json | 12 ++ vcpkg-configuration.json | 17 +++ vcpkg-overlays/asyncplusplus/portfile.cmake | 21 +++ vcpkg-overlays/asyncplusplus/vcpkg.json | 18 +++ vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch | 122 ++++++++++++++++++ vcpkg-overlays/ktx/0002-Fix-versioning.patch | 17 +++ vcpkg-overlays/ktx/0003-mkversion.patch | 13 ++ vcpkg-overlays/ktx/0004-quirks.patch | 21 +++ .../ktx/0005-no-vendored-libs.patch | 17 +++ vcpkg-overlays/ktx/portfile.cmake | 82 ++++++++++++ vcpkg-overlays/ktx/vcpkg.json | 37 ++++++ vcpkg.json | 32 +++++ 12 files changed, 409 insertions(+) create mode 100644 CMakePresets.json create mode 100644 vcpkg-configuration.json create mode 100644 vcpkg-overlays/asyncplusplus/portfile.cmake create mode 100644 vcpkg-overlays/asyncplusplus/vcpkg.json create mode 100644 vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch create mode 100644 vcpkg-overlays/ktx/0002-Fix-versioning.patch create mode 100644 vcpkg-overlays/ktx/0003-mkversion.patch create mode 100644 vcpkg-overlays/ktx/0004-quirks.patch create mode 100644 vcpkg-overlays/ktx/0005-no-vendored-libs.patch create mode 100644 vcpkg-overlays/ktx/portfile.cmake create mode 100644 vcpkg-overlays/ktx/vcpkg.json create mode 100644 vcpkg.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..634017183 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,12 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "vcpkg", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + } + } + ] +} diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 000000000..a9cbd7b81 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,17 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "4f746bc66438fce2b900c3ba6094a483b871b045", + "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" + ] +} diff --git a/vcpkg-overlays/asyncplusplus/portfile.cmake b/vcpkg-overlays/asyncplusplus/portfile.cmake new file mode 100644 index 000000000..54b343b25 --- /dev/null +++ b/vcpkg-overlays/asyncplusplus/portfile.cmake @@ -0,0 +1,21 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Amanieu/asyncplusplus + REF 4159da79e20ad6d0eb1f13baa0f10e989edd9fba + SHA512 a7b099ce24184aa56e843d4858228196f8220374585a375a9c0d944832bd68c8aabd6b2efde5aacbb9c73f9dd8e942e97262be04550205b3fbea44d8b972d78e + HEAD_REF master +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH cmake PACKAGE_NAME async++) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg-overlays/asyncplusplus/vcpkg.json b/vcpkg-overlays/asyncplusplus/vcpkg.json new file mode 100644 index 000000000..6b5977655 --- /dev/null +++ b/vcpkg-overlays/asyncplusplus/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "asyncplusplus", + "version": "1.1", + "port-version": 2, + "description": "Async++ is a lightweight concurrency framework for C++11", + "license": "MIT", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch b/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch new file mode 100644 index 000000000..71a587bd6 --- /dev/null +++ b/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch @@ -0,0 +1,122 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9a56491..d7ca937 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -345,7 +345,6 @@ set(KTX_MAIN_SRC + lib/basisu/transcoder/basisu_transcoder.cpp + lib/basisu/transcoder/basisu_transcoder.h + lib/basisu/transcoder/basisu.h +- lib/basisu/zstd/zstd.c + lib/checkheader.c + lib/dfdutils/createdfd.c + lib/dfdutils/colourspaces.c +@@ -532,7 +531,6 @@ macro(common_libktx_settings target enable_write library_type) + $ + + $ +- $ + + $ + $ +@@ -627,6 +625,11 @@ macro(common_libktx_settings target enable_write library_type) + target_compile_definitions(${target} PUBLIC KTX_FEATURE_KTX2) + endif() + ++ # Use vcpkg zstd ++ find_package(zstd CONFIG REQUIRED) ++ set(ZSTD_LIBRARIES "$,zstd::libzstd_shared,zstd::libzstd_static>") ++ target_link_libraries(${target} PRIVATE ${ZSTD_LIBRARIES}) ++ + if(WIN32) + if(MINGW) + # Check if the Threads package is provided; if using Mingw it MIGHT be +diff --git a/cmake/KtxConfig.cmake b/cmake/KtxConfig.cmake +index 6386ba2..537bf4f 100644 +--- a/cmake/KtxConfig.cmake ++++ b/cmake/KtxConfig.cmake +@@ -1,7 +1,8 @@ + # Copyright 2015-2020 The Khronos Group Inc. + # SPDX-License-Identifier: Apache-2.0 + +-# include(CMakeFindDependencyMacro) +-# find_dependency() ++include(CMakeFindDependencyMacro) ++find_dependency(Threads) ++find_dependency(zstd CONFIG) + + include("${CMAKE_CURRENT_LIST_DIR}/KtxTargets.cmake") +diff --git a/lib/basisu/CMakeLists.txt b/lib/basisu/CMakeLists.txt +index 492233a..152ceb5 100644 +--- a/lib/basisu/CMakeLists.txt ++++ b/lib/basisu/CMakeLists.txt +@@ -145,9 +145,6 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST} + transcoder/basisu_transcoder.cpp + ) + +-if (ZSTD) +- set(BASISU_SRC_LIST ${BASISU_SRC_LIST} zstd/zstd.c) +-endif() + + if (APPLE) + set(BIN_DIRECTORY "bin_osx") +@@ -165,6 +162,10 @@ else() + target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) + endif() + ++if(ZSTD_LIBRARIES) ++ target_link_libraries(basisu ${ZSTD_LIBRARIES}) ++endif() ++ + if (NOT MSVC) + # For Non-Windows builds, let cmake try and find the system OpenCL headers/libs for us. + if (OPENCL_FOUND) +diff --git a/lib/basisu/webgl/encoder/CMakeLists.txt b/lib/basisu/webgl/encoder/CMakeLists.txt +index 588d91b..a337b13 100644 +--- a/lib/basisu/webgl/encoder/CMakeLists.txt ++++ b/lib/basisu/webgl/encoder/CMakeLists.txt +@@ -34,9 +34,6 @@ if (EMSCRIPTEN) + ) + + if (KTX2_ZSTANDARD) +- set(SRC_LIST ${SRC_LIST} +- ../../zstd/zstd.c +- ) + set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1) + else() + set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0) +@@ -55,6 +52,10 @@ if (EMSCRIPTEN) + target_compile_options(basis_encoder.js PRIVATE -fno-strict-aliasing -O3) + + target_include_directories(basis_encoder.js PRIVATE ../../transcoder) ++ ++ if(ZSTD_LIBRARIES) ++ target_link_libraries(basis_encoder.js ${ZSTD_LIBRARIES}) ++ endif() + + set_target_properties(basis_encoder.js PROPERTIES + OUTPUT_NAME "basis_encoder" +diff --git a/lib/basisu/webgl/transcoder/CMakeLists.txt b/lib/basisu/webgl/transcoder/CMakeLists.txt +index 372653d..5ebc3cf 100644 +--- a/lib/basisu/webgl/transcoder/CMakeLists.txt ++++ b/lib/basisu/webgl/transcoder/CMakeLists.txt +@@ -28,9 +28,6 @@ if (EMSCRIPTEN) + endif() + + if (KTX2_ZSTANDARD) +- set(SRC_LIST ${SRC_LIST} +- ../../zstd/zstddeclib.c +- ) + set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1) + else() + set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0) +@@ -44,6 +41,10 @@ if (EMSCRIPTEN) + target_compile_definitions(basis_transcoder.js PRIVATE NDEBUG BASISD_SUPPORT_UASTC=1 BASISD_SUPPORT_BC7=1 BASISD_SUPPORT_ATC=0 BASISD_SUPPORT_ASTC_HIGHER_OPAQUE_QUALITY=0 BASISD_SUPPORT_PVRTC2=0 BASISD_SUPPORT_FXT1=0 BASISD_SUPPORT_ETC2_EAC_RG11=0 BASISU_SUPPORT_ENCODING=0 ${KTX2_DEFINITION} ${ZSTD_DEFINITION} ) + target_compile_options(basis_transcoder.js PRIVATE -O3 -fno-strict-aliasing) + target_include_directories(basis_transcoder.js PRIVATE ../../transcoder) ++ ++ if(ZSTD_LIBRARIES) ++ target_link_libraries(basis_transcoder.js ${ZSTD_LIBRARIES}) ++ endif() + + set_target_properties(basis_transcoder.js PROPERTIES + OUTPUT_NAME "basis_transcoder" diff --git a/vcpkg-overlays/ktx/0002-Fix-versioning.patch b/vcpkg-overlays/ktx/0002-Fix-versioning.patch new file mode 100644 index 000000000..1e5098806 --- /dev/null +++ b/vcpkg-overlays/ktx/0002-Fix-versioning.patch @@ -0,0 +1,17 @@ +diff --git a/cmake/version.cmake b/cmake/version.cmake +index 4094df1a..3b2af3bb 100644 +--- a/cmake/version.cmake ++++ b/cmake/version.cmake +@@ -108,8 +108,10 @@ function(generate_version _var ) + set(${_var} "${KTX_VERSION}" PARENT_SCOPE) + endfunction() + +-# Get latest tag +-git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*) ++if (!KTX_VERSION_FULL) ++ # Get latest tag ++ git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*) ++endif() + #message("KTX full version: ${KTX_VERSION_FULL}") + + # generate_version(TOKTX_VERSION tools/toktx) diff --git a/vcpkg-overlays/ktx/0003-mkversion.patch b/vcpkg-overlays/ktx/0003-mkversion.patch new file mode 100644 index 000000000..ee8b3c4af --- /dev/null +++ b/vcpkg-overlays/ktx/0003-mkversion.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/version.cmake b/cmake/version.cmake +index 9a90622..0fc3521 100644 +--- a/cmake/version.cmake ++++ b/cmake/version.cmake +@@ -176,7 +176,7 @@ function( create_version_header dest_path target ) + add_custom_command( + OUTPUT ${version_h_output} + # On Windows this command has to be invoked by a shell in order to work +- COMMAND ${BASH_EXECUTABLE} -c "\"./mkversion\" \"-o\" \"version.h\" \"${dest_path}\"" ++ COMMAND "${BASH_EXECUTABLE}" -- ./mkversion -o version.h "${dest_path}" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMENT "Generate ${version_h_output}" + VERBATIM diff --git a/vcpkg-overlays/ktx/0004-quirks.patch b/vcpkg-overlays/ktx/0004-quirks.patch new file mode 100644 index 000000000..afc34236d --- /dev/null +++ b/vcpkg-overlays/ktx/0004-quirks.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1500844..810914e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -263,7 +263,7 @@ if(MSVC) + # ";" argument separator is problematic. Can't use a GenEx `$:/WX> ) +- add_compile_options( $,/Gz,/O2> ) ++ add_compile_options( $,,/O2> ) + # Enable UTF-8 support + add_compile_options( $<$:/utf-8> ) + add_compile_options( $<$:/utf-8> ) +@@ -946,6 +946,7 @@ if(EMSCRIPTEN) + endif() + + add_library( objUtil STATIC ++ EXCLUDE_FROM_ALL + utils/argparser.cpp + utils/argparser.h + utils/ktxapp.h diff --git a/vcpkg-overlays/ktx/0005-no-vendored-libs.patch b/vcpkg-overlays/ktx/0005-no-vendored-libs.patch new file mode 100644 index 000000000..77cdd8518 --- /dev/null +++ b/vcpkg-overlays/ktx/0005-no-vendored-libs.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d7ca937..ffcbe95 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1059,10 +1059,10 @@ endif() + # except for building the ktx library. + if((KTX_FEATURE_TOOLS OR KTX_FEATURE_TESTS) AND NOT TARGET fmt::fmt) + set(FMT_SYSTEM_HEADERS ON) +- add_subdirectory(other_projects/fmt) ++ find_package(fmt CONFIG REQUIRED) + endif() + if(KTX_FEATURE_TOOLS AND NOT TARGET cxxopts::cxxopts) +- add_subdirectory(other_projects/cxxopts) ++ find_package(cxxopts CONFIG REQUIRED) + endif() + + # Tools diff --git a/vcpkg-overlays/ktx/portfile.cmake b/vcpkg-overlays/ktx/portfile.cmake new file mode 100644 index 000000000..e563a6a9b --- /dev/null +++ b/vcpkg-overlays/ktx/portfile.cmake @@ -0,0 +1,82 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO KhronosGroup/KTX-Software + REF "v${VERSION}" + SHA512 5a89f8986464705ec36ac1becaddd0ff335e4c3c235468aaef0e963fcfeda4c0d669a086b91e61c16a3ae9e1fa5bf456dccf12cc65720e1a22e7cc0f30552541 + HEAD_REF master + PATCHES + 0001-Use-vcpkg-zstd.patch + 0002-Fix-versioning.patch + 0003-mkversion.patch + 0004-quirks.patch + 0005-no-vendored-libs.patch +) +file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h") + +vcpkg_list(SET OPTIONS) +# if(VCPKG_TARGET_IS_WINDOWS) +# vcpkg_acquire_msys(MSYS_ROOT +# PACKAGES +# bash +# DIRECT_PACKAGES +# # Required for "getopt" +# "https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst" +# da26540881cd5734072717133307e5d1a27a60468d3656885507833b80f24088c5382eaa0234b30bdd9e8484a6638b4514623f5327f10b19eed36f12158e8edb +# # Required for "dos2unix" +# "https://mirror.msys2.org/msys/x86_64/dos2unix-7.5.1-1-x86_64.pkg.tar.zst" +# 83d85e6ccea746ef9e8153a0d605e774dbe7efc0ee952804acfee4ffd7e3b0386a353b45ff989dd99bc3ce75968209fea3d246ad2af88bbb5c4eca12fc5a8f92 +# ) +# vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") +# vcpkg_list(APPEND OPTIONS "-DBASH_EXECUTABLE=${MSYS_ROOT}/usr/bin/bash.exe") +# endif() + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tools KTX_FEATURE_TOOLS + vulkan KTX_FEATURE_VK_UPLOAD +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DKTX_VERSION_FULL=v${VERSION} + -DKTX_FEATURE_TESTS=OFF + -DKTX_FEATURE_LOADTEST_APPS=OFF + -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC} + ${FEATURE_OPTIONS} + ${OPTIONS} + # Do not regenerate headers (needs more dependencies) + -DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=1 + DISABLE_PARALLEL_CONFIGURE +) + +vcpkg_cmake_install() + +if(tools IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES + ktx + toktx + ktxsc + ktxinfo + ktx2ktx2 + ktx2check + AUTO_CLEAN + ) +else() + vcpkg_copy_pdbs() +endif() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ktx) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSES/*") +file(COPY ${LICENSE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSES") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") diff --git a/vcpkg-overlays/ktx/vcpkg.json b/vcpkg-overlays/ktx/vcpkg.json new file mode 100644 index 000000000..102e28131 --- /dev/null +++ b/vcpkg-overlays/ktx/vcpkg.json @@ -0,0 +1,37 @@ +{ + "name": "ktx", + "version-semver": "4.3.0-beta1", + "port-version": 1, + "description": [ + "The Khronos KTX library and tools.", + "Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them." + ], + "homepage": "https://github.com/KhronosGroup/KTX-Software", + "license": null, + "supports": "arm64 | x64 | !windows", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zstd" + ], + "features": { + "tools": { + "description": "Build tools", + "supports": "!android", + "dependencies": [ + "cxxopts", + "fmt" + ] + }, + "vulkan": { + "description": "Build Vulkan support", + "supports": "!emscripten" + } + } +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..5fc4e8a8b --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,32 @@ +{ + "dependencies": [ + "asyncplusplus", + "catch2", + "expected-lite", + "fmt", + "glm", + "ms-gsl", + "rapidjson", + "spdlog", + "stb", + "uriparser", + "abseil", + "draco", + "ktx", + "modp-base64", + "meshoptimizer", + "openssl", + "s2geometry", + "libjpeg-turbo", + "sqlite3", + "tinyxml2", + "libwebp", + "zlib-ng", + "picosha2", + "earcut-hpp", + "cpp-httplib", + "libmorton", + "zstd" + ] +} + From 7d5f2e174819d60e20aa1f3b1f164e483f21ce16 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Sun, 3 Nov 2024 15:17:27 +0100 Subject: [PATCH 02/19] Choose BUILD_INTERFACE or INSTALL_INTERFACE in include directories Should be a no-op at this point, but will be required when we make Cesium Native installable. --- Cesium3DTiles/CMakeLists.txt | 5 +++-- Cesium3DTilesReader/CMakeLists.txt | 5 +++-- Cesium3DTilesSelection/CMakeLists.txt | 8 ++++++-- Cesium3DTilesWriter/CMakeLists.txt | 5 +++-- CesiumAsync/CMakeLists.txt | 6 ++++-- CesiumGeometry/CMakeLists.txt | 3 ++- CesiumGeospatial/CMakeLists.txt | 3 ++- CesiumGltf/CMakeLists.txt | 5 +++-- CesiumGltfContent/CMakeLists.txt | 5 +++-- CesiumGltfReader/CMakeLists.txt | 7 +++++-- CesiumGltfWriter/CMakeLists.txt | 5 +++-- CesiumIonClient/CMakeLists.txt | 3 ++- CesiumJsonReader/CMakeLists.txt | 5 +++-- CesiumJsonWriter/CMakeLists.txt | 4 +++- CesiumRasterOverlays/CMakeLists.txt | 3 ++- CesiumUtility/CMakeLists.txt | 4 +++- 16 files changed, 50 insertions(+), 26 deletions(-) diff --git a/Cesium3DTiles/CMakeLists.txt b/Cesium3DTiles/CMakeLists.txt index cc2965efd..657d5fa5b 100644 --- a/Cesium3DTiles/CMakeLists.txt +++ b/Cesium3DTiles/CMakeLists.txt @@ -44,8 +44,9 @@ cesium_target_include_directories( TARGET Cesium3DTiles PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include - ${CMAKE_CURRENT_LIST_DIR}/generated/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/Cesium3DTilesReader/CMakeLists.txt b/Cesium3DTilesReader/CMakeLists.txt index f0e9c77c6..98d83d9f2 100644 --- a/Cesium3DTilesReader/CMakeLists.txt +++ b/Cesium3DTilesReader/CMakeLists.txt @@ -45,8 +45,9 @@ cesium_target_include_directories( TARGET Cesium3DTilesReader PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include - ${CMAKE_CURRENT_LIST_DIR}/generated/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/Cesium3DTilesSelection/CMakeLists.txt b/Cesium3DTilesSelection/CMakeLists.txt index ab5d18a39..8aeece3be 100644 --- a/Cesium3DTilesSelection/CMakeLists.txt +++ b/Cesium3DTilesSelection/CMakeLists.txt @@ -33,8 +33,12 @@ cesium_target_include_directories( TARGET Cesium3DTilesSelection PUBLIC - ${CMAKE_BINARY_DIR} - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ + $ + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) diff --git a/Cesium3DTilesWriter/CMakeLists.txt b/Cesium3DTilesWriter/CMakeLists.txt index e7944d7e4..90e0bf169 100644 --- a/Cesium3DTilesWriter/CMakeLists.txt +++ b/Cesium3DTilesWriter/CMakeLists.txt @@ -45,8 +45,9 @@ cesium_target_include_directories( TARGET Cesium3DTilesWriter PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include - ${CMAKE_CURRENT_LIST_DIR}/generated/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/CesiumAsync/CMakeLists.txt b/CesiumAsync/CMakeLists.txt index 77b2bd8f9..3882d0174 100644 --- a/CesiumAsync/CMakeLists.txt +++ b/CesiumAsync/CMakeLists.txt @@ -29,10 +29,12 @@ target_sources( ) cesium_target_include_directories( - TARGET + TARGET CesiumAsync PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/ ) diff --git a/CesiumGeometry/CMakeLists.txt b/CesiumGeometry/CMakeLists.txt index 950029312..3abe0a0da 100644 --- a/CesiumGeometry/CMakeLists.txt +++ b/CesiumGeometry/CMakeLists.txt @@ -32,7 +32,8 @@ cesium_target_include_directories( TARGET CesiumGeometry PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ ) target_link_libraries(CesiumGeometry PUBLIC diff --git a/CesiumGeospatial/CMakeLists.txt b/CesiumGeospatial/CMakeLists.txt index ef89f439b..e1dccbd64 100644 --- a/CesiumGeospatial/CMakeLists.txt +++ b/CesiumGeospatial/CMakeLists.txt @@ -33,7 +33,8 @@ cesium_target_include_directories( TARGET CesiumGeospatial PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ ) target_link_libraries(CesiumGeospatial diff --git a/CesiumGltf/CMakeLists.txt b/CesiumGltf/CMakeLists.txt index 293ade01a..4b9a9f4b2 100644 --- a/CesiumGltf/CMakeLists.txt +++ b/CesiumGltf/CMakeLists.txt @@ -43,8 +43,9 @@ target_sources( target_include_directories( CesiumGltf SYSTEM PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include/ - ${CMAKE_CURRENT_LIST_DIR}/generated/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/CesiumGltfContent/CMakeLists.txt b/CesiumGltfContent/CMakeLists.txt index 52755cf69..ad54f9e80 100644 --- a/CesiumGltfContent/CMakeLists.txt +++ b/CesiumGltfContent/CMakeLists.txt @@ -45,8 +45,9 @@ cesium_target_include_directories( TARGET CesiumGltfContent PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include - ${CMAKE_CURRENT_LIST_DIR}/generated/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/CesiumGltfReader/CMakeLists.txt b/CesiumGltfReader/CMakeLists.txt index 1f2d194a4..58d5bf159 100644 --- a/CesiumGltfReader/CMakeLists.txt +++ b/CesiumGltfReader/CMakeLists.txt @@ -45,8 +45,11 @@ cesium_target_include_directories( TARGET CesiumGltfReader PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include - ${CMAKE_CURRENT_LIST_DIR}/generated/include + # Necessary for `draco/draco_features.h` + $ + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/CesiumGltfWriter/CMakeLists.txt b/CesiumGltfWriter/CMakeLists.txt index 70bd64b04..f6343553a 100644 --- a/CesiumGltfWriter/CMakeLists.txt +++ b/CesiumGltfWriter/CMakeLists.txt @@ -44,8 +44,9 @@ cesium_target_include_directories( TARGET CesiumGltfWriter PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include - ${CMAKE_CURRENT_LIST_DIR}/generated/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_LIST_DIR}/generated/src diff --git a/CesiumIonClient/CMakeLists.txt b/CesiumIonClient/CMakeLists.txt index cb2621ed5..7c7386b58 100644 --- a/CesiumIonClient/CMakeLists.txt +++ b/CesiumIonClient/CMakeLists.txt @@ -33,7 +33,8 @@ cesium_target_include_directories( TARGET CesiumIonClient PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ ) target_link_libraries(CesiumIonClient diff --git a/CesiumJsonReader/CMakeLists.txt b/CesiumJsonReader/CMakeLists.txt index 0eb5d79aa..1fa923b3b 100644 --- a/CesiumJsonReader/CMakeLists.txt +++ b/CesiumJsonReader/CMakeLists.txt @@ -32,8 +32,9 @@ cesium_target_include_directories( TARGET CesiumJsonReader PUBLIC - ${CMAKE_BINARY_DIR} - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) diff --git a/CesiumJsonWriter/CMakeLists.txt b/CesiumJsonWriter/CMakeLists.txt index 21a2ad7f2..8c0e06ee0 100644 --- a/CesiumJsonWriter/CMakeLists.txt +++ b/CesiumJsonWriter/CMakeLists.txt @@ -41,7 +41,9 @@ cesium_target_include_directories( TARGET CesiumJsonWriter PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) diff --git a/CesiumRasterOverlays/CMakeLists.txt b/CesiumRasterOverlays/CMakeLists.txt index d45b1b09f..49219eecb 100644 --- a/CesiumRasterOverlays/CMakeLists.txt +++ b/CesiumRasterOverlays/CMakeLists.txt @@ -33,7 +33,8 @@ cesium_target_include_directories( TARGET CesiumRasterOverlays PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ) diff --git a/CesiumUtility/CMakeLists.txt b/CesiumUtility/CMakeLists.txt index edbc3a0be..81e67a0e2 100644 --- a/CesiumUtility/CMakeLists.txt +++ b/CesiumUtility/CMakeLists.txt @@ -33,7 +33,9 @@ cesium_target_include_directories( TARGET CesiumUtility PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/include + $ + $ + $ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/../extern/zlib From d1b064d8fd6adb6569e3df4325759cde397d0a4d Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 6 Nov 2024 19:12:21 +0100 Subject: [PATCH 03/19] Don't add public headers to public target sources The intent is for public target sources to be compiled into consumers of a target, but that is a no-op for header files. Including the public headers, which have paths pointing inside the project, causes an error when generating an export set. --- Cesium3DTiles/CMakeLists.txt | 1 - Cesium3DTilesContent/CMakeLists.txt | 1 - Cesium3DTilesReader/CMakeLists.txt | 1 - Cesium3DTilesSelection/CMakeLists.txt | 1 - Cesium3DTilesWriter/CMakeLists.txt | 1 - CesiumAsync/CMakeLists.txt | 1 - CesiumGeometry/CMakeLists.txt | 1 - CesiumGeospatial/CMakeLists.txt | 1 - CesiumGltf/CMakeLists.txt | 1 - CesiumGltfContent/CMakeLists.txt | 1 - CesiumGltfReader/CMakeLists.txt | 1 - CesiumGltfWriter/CMakeLists.txt | 1 - CesiumIonClient/CMakeLists.txt | 1 - CesiumJsonReader/CMakeLists.txt | 1 - CesiumJsonWriter/CMakeLists.txt | 1 - CesiumQuantizedMeshTerrain/CMakeLists.txt | 1 - CesiumRasterOverlays/CMakeLists.txt | 1 - CesiumUtility/CMakeLists.txt | 1 - 18 files changed, 18 deletions(-) diff --git a/Cesium3DTiles/CMakeLists.txt b/Cesium3DTiles/CMakeLists.txt index 657d5fa5b..203295a78 100644 --- a/Cesium3DTiles/CMakeLists.txt +++ b/Cesium3DTiles/CMakeLists.txt @@ -36,7 +36,6 @@ target_sources( PRIVATE ${CESIUM_3DTILES_SOURCES} ${CESIUM_3DTILES_HEADERS} - PUBLIC ${CESIUM_3DTILES_PUBLIC_HEADERS} ) diff --git a/Cesium3DTilesContent/CMakeLists.txt b/Cesium3DTilesContent/CMakeLists.txt index 31593f077..1cec993f8 100644 --- a/Cesium3DTilesContent/CMakeLists.txt +++ b/Cesium3DTilesContent/CMakeLists.txt @@ -37,7 +37,6 @@ target_sources( PRIVATE ${CESIUM_3DTILES_CONTENT_SOURCES} ${CESIUM_3DTILES_CONTENT_HEADERS} - PUBLIC ${CESIUM_3DTILES_CONTENT_PUBLIC_HEADERS} ) diff --git a/Cesium3DTilesReader/CMakeLists.txt b/Cesium3DTilesReader/CMakeLists.txt index 98d83d9f2..214eb4ce9 100644 --- a/Cesium3DTilesReader/CMakeLists.txt +++ b/Cesium3DTilesReader/CMakeLists.txt @@ -37,7 +37,6 @@ target_sources( PRIVATE ${CESIUM_3DTILES_READER_SOURCES} ${CESIUM_3DTILES_READER_HEADERS} - PUBLIC ${CESIUM_3DTILES_READER_PUBLIC_HEADERS} ) diff --git a/Cesium3DTilesSelection/CMakeLists.txt b/Cesium3DTilesSelection/CMakeLists.txt index 8aeece3be..36d336880 100644 --- a/Cesium3DTilesSelection/CMakeLists.txt +++ b/Cesium3DTilesSelection/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources( PRIVATE ${CESIUM_3DTILES_SELECTION_SOURCES} ${CESIUM_3DTILES_SELECTION_HEADERS} - PUBLIC ${CESIUM_3DTILES_SELECTION_PUBLIC_HEADERS} ) diff --git a/Cesium3DTilesWriter/CMakeLists.txt b/Cesium3DTilesWriter/CMakeLists.txt index 90e0bf169..f931643f7 100644 --- a/Cesium3DTilesWriter/CMakeLists.txt +++ b/Cesium3DTilesWriter/CMakeLists.txt @@ -37,7 +37,6 @@ target_sources( PRIVATE ${CESIUM_3DTILES_WRITER_SOURCES} ${CESIUM_3DTILES_WRITER_HEADERS} - PUBLIC ${CESIUM_3DTILES_WRITER_PUBLIC_HEADERS} ) diff --git a/CesiumAsync/CMakeLists.txt b/CesiumAsync/CMakeLists.txt index 3882d0174..5ec79205b 100644 --- a/CesiumAsync/CMakeLists.txt +++ b/CesiumAsync/CMakeLists.txt @@ -24,7 +24,6 @@ target_sources( PRIVATE ${CESIUM_ASYNC_SOURCES} ${CESIUM_ASYNC_HEADERS} - PUBLIC ${CESIUM_ASYNC_PUBLIC_HEADERS} ) diff --git a/CesiumGeometry/CMakeLists.txt b/CesiumGeometry/CMakeLists.txt index 3abe0a0da..9353993d6 100644 --- a/CesiumGeometry/CMakeLists.txt +++ b/CesiumGeometry/CMakeLists.txt @@ -24,7 +24,6 @@ target_sources( PRIVATE ${CESIUM_GEOMETRY_SOURCES} ${CESIUM_GEOMETRY_HEADERS} - PUBLIC ${CESIUM_GEOMETRY_PUBLIC_HEADERS} ) diff --git a/CesiumGeospatial/CMakeLists.txt b/CesiumGeospatial/CMakeLists.txt index e1dccbd64..92716a5c0 100644 --- a/CesiumGeospatial/CMakeLists.txt +++ b/CesiumGeospatial/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources( PRIVATE ${CESIUM_GEOSPATIAL_SOURCES} ${CESIUM_GEOSPATIAL_HEADERS} - PUBLIC ${CESIUM_GEOSPATIAL_PUBLIC_HEADERS} ) diff --git a/CesiumGltf/CMakeLists.txt b/CesiumGltf/CMakeLists.txt index 4b9a9f4b2..90691684f 100644 --- a/CesiumGltf/CMakeLists.txt +++ b/CesiumGltf/CMakeLists.txt @@ -36,7 +36,6 @@ target_sources( PRIVATE ${CESIUM_GLTF_SOURCES} ${CESIUM_GLTF_HEADERS} - PUBLIC ${CESIUM_GLTF_PUBLIC_HEADERS} ) diff --git a/CesiumGltfContent/CMakeLists.txt b/CesiumGltfContent/CMakeLists.txt index ad54f9e80..a4bd9dea7 100644 --- a/CesiumGltfContent/CMakeLists.txt +++ b/CesiumGltfContent/CMakeLists.txt @@ -37,7 +37,6 @@ target_sources( PRIVATE ${CESIUM_GLTF_CONTENT_SOURCES} ${CESIUM_GLTF_CONTENT_HEADERS} - PUBLIC ${CESIUM_GLTF_CONTENT_PUBLIC_HEADERS} ) diff --git a/CesiumGltfReader/CMakeLists.txt b/CesiumGltfReader/CMakeLists.txt index 58d5bf159..453731a5e 100644 --- a/CesiumGltfReader/CMakeLists.txt +++ b/CesiumGltfReader/CMakeLists.txt @@ -37,7 +37,6 @@ target_sources( PRIVATE ${CESIUM_GLTF_READER_SOURCES} ${CESIUM_GLTF_READER_HEADERS} - PUBLIC ${CESIUM_GLTF_READER_PUBLIC_HEADERS} ) diff --git a/CesiumGltfWriter/CMakeLists.txt b/CesiumGltfWriter/CMakeLists.txt index f6343553a..72639378b 100644 --- a/CesiumGltfWriter/CMakeLists.txt +++ b/CesiumGltfWriter/CMakeLists.txt @@ -36,7 +36,6 @@ target_sources( PRIVATE ${CESIUM_GLTF_WRITER_SOURCES} ${CESIUM_GLTF_WRITER_HEADERS} - PUBLIC ${CESIUM_GLTF_WRITER_PUBLIC_HEADERS} ) diff --git a/CesiumIonClient/CMakeLists.txt b/CesiumIonClient/CMakeLists.txt index 7c7386b58..ef7f1136e 100644 --- a/CesiumIonClient/CMakeLists.txt +++ b/CesiumIonClient/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources( PRIVATE ${CESIUM_ION_CLIENT_SOURCES} ${CESIUM_ION_CLIENT_HEADERS} - PUBLIC ${CESIUM_ION_CLIENT_PUBLIC_HEADERS} ) diff --git a/CesiumJsonReader/CMakeLists.txt b/CesiumJsonReader/CMakeLists.txt index 1fa923b3b..5ae71fcf7 100644 --- a/CesiumJsonReader/CMakeLists.txt +++ b/CesiumJsonReader/CMakeLists.txt @@ -24,7 +24,6 @@ target_sources( PRIVATE ${CESIUM_JSON_READER_SOURCES} ${CESIUM_JSON_READER_HEADERS} - PUBLIC ${CESIUM_JSON_READER_PUBLIC_HEADERS} ) diff --git a/CesiumJsonWriter/CMakeLists.txt b/CesiumJsonWriter/CMakeLists.txt index 8c0e06ee0..b738ec487 100644 --- a/CesiumJsonWriter/CMakeLists.txt +++ b/CesiumJsonWriter/CMakeLists.txt @@ -33,7 +33,6 @@ target_sources( PRIVATE ${CESIUM_JSON_WRITER_SOURCES} ${CESIUM_JSON_WRITER_HEADERS} - PUBLIC ${CESIUM_JSON_WRITER_PUBLIC_HEADERS} ) diff --git a/CesiumQuantizedMeshTerrain/CMakeLists.txt b/CesiumQuantizedMeshTerrain/CMakeLists.txt index ddf289c47..8ea129f65 100644 --- a/CesiumQuantizedMeshTerrain/CMakeLists.txt +++ b/CesiumQuantizedMeshTerrain/CMakeLists.txt @@ -36,7 +36,6 @@ target_sources( PRIVATE ${CESIUM_QUANTIZED_MESH_TERRAIN_SOURCES} ${CESIUM_QUANTIZED_MESH_TERRAIN_HEADERS} - PUBLIC ${CESIUM_QUANTIZED_MESH_TERRAIN_PUBLIC_HEADERS} ) diff --git a/CesiumRasterOverlays/CMakeLists.txt b/CesiumRasterOverlays/CMakeLists.txt index 49219eecb..991f23fd9 100644 --- a/CesiumRasterOverlays/CMakeLists.txt +++ b/CesiumRasterOverlays/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources( PRIVATE ${CESIUM_RASTER_OVERLAYS_SOURCES} ${CESIUM_RASTER_OVERLAYS_HEADERS} - PUBLIC ${CESIUM_RASTER_OVERLAYS_PUBLIC_HEADERS} ) diff --git a/CesiumUtility/CMakeLists.txt b/CesiumUtility/CMakeLists.txt index 81e67a0e2..518d9279c 100644 --- a/CesiumUtility/CMakeLists.txt +++ b/CesiumUtility/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources( PRIVATE ${CESIUM_UTILITY_SOURCES} ${CESIUM_UTILITY_HEADERS} - PUBLIC ${CESIUM_UTILITY_PUBLIC_HEADERS} ) From b448245ee1975ef38854a34777ffaca6aaa23854 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 7 Nov 2024 00:46:12 +0100 Subject: [PATCH 04/19] Install libraries with an EXPORT target This create the CMake files that create targets in an imported package. --- CMakeLists.txt | 8 ++++++++ CesiumGeospatial/CMakeLists.txt | 2 +- cesium-nativeConfig.cmake | 1 + cmake/macros/configure_cesium_library.cmake | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 cesium-nativeConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d0ba4399..94f1facd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,3 +290,11 @@ endif() add_subdirectory(doc) + +install(EXPORT CesiumExports + FILE cesium-nativeTargets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) + +install(FILES cesium-nativeConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) + diff --git a/CesiumGeospatial/CMakeLists.txt b/CesiumGeospatial/CMakeLists.txt index 92716a5c0..373a7a716 100644 --- a/CesiumGeospatial/CMakeLists.txt +++ b/CesiumGeospatial/CMakeLists.txt @@ -40,8 +40,8 @@ target_link_libraries(CesiumGeospatial PUBLIC CesiumGeometry CesiumUtility - earcut PRIVATE + $ s2::s2 ) diff --git a/cesium-nativeConfig.cmake b/cesium-nativeConfig.cmake new file mode 100644 index 000000000..9c0375e60 --- /dev/null +++ b/cesium-nativeConfig.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/cesium-nativeTargets.cmake) diff --git a/cmake/macros/configure_cesium_library.cmake b/cmake/macros/configure_cesium_library.cmake index a4ed0b3b3..35cc6fd6b 100644 --- a/cmake/macros/configure_cesium_library.cmake +++ b/cmake/macros/configure_cesium_library.cmake @@ -42,6 +42,11 @@ function(configure_cesium_library targetName) ${capitalizedTargetName}_BUILDING ) + install(TARGETS ${targetName} + EXPORT CesiumExports + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + if(CESIUM_INSTALL_HEADERS) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX} From 35ca323936dd0260c0546e71f3036391fc8dcd48 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 7 Nov 2024 00:47:59 +0100 Subject: [PATCH 05/19] Run in manifest mode --- CMakePresets.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakePresets.json b/CMakePresets.json index 634017183..c6d65c80f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,7 +5,8 @@ "name": "vcpkg", "binaryDir": "${sourceDir}/build", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_MANIFEST_MODE": true } } ] From f7edb582bcd7dd2e42493c4325eddd76ad8d7a1b Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 12 Nov 2024 23:57:03 +0100 Subject: [PATCH 06/19] Don't install dependency headers and librarys in manifest mode --- CMakeLists.txt | 4 ++-- CMakePresets.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94f1facd8..ea5cacd45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ cmake_dependent_option( OFF ) -if(CESIUM_INSTALL_STATIC_LIBS OR CESIUM_INSTALL_HEADERS) +if(CESIUM_INSTALL_STATIC_LIBS OR CESIUM_INSTALL_HEADERS AND NOT VCPKG_MANIFEST_MODE) foreach(PACKAGE ${PACKAGES_PUBLIC}) string(REGEX REPLACE "\[.*\]" "" PACKAGE ${PACKAGE}) set(PACKAGE_DIR ${PACKAGE_BASE_DIR}/${PACKAGE}_${VCPKG_TRIPLET}) @@ -138,7 +138,7 @@ if(CESIUM_INSTALL_STATIC_LIBS OR CESIUM_INSTALL_HEADERS) endforeach() endif() -if(CESIUM_INSTALL_STATIC_LIBS) +if(CESIUM_INSTALL_STATIC_LIBS AND NOT VCPKG_MANIFEST_MODE) foreach(PACKAGE ${PACKAGES_PRIVATE}) set(PACKAGE_DIR ${PACKAGE_BASE_DIR}/${PACKAGE}_${VCPKG_TRIPLET}) message(DEBUG "PACKAGE_DIR ${PACKAGE_DIR}") diff --git a/CMakePresets.json b/CMakePresets.json index c6d65c80f..9f73954f0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -6,7 +6,6 @@ "binaryDir": "${sourceDir}/build", "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "VCPKG_MANIFEST_MODE": true } } ] From 0b4b1d7bc6e1c29e8a25809f2880a4f9aa985606 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Sun, 17 Nov 2024 10:56:29 +0100 Subject: [PATCH 07/19] find modules for external dependencies Add a find module for zlib-ng, which can be installed and included by a config package. Other find modules may be necessary too. --- CMakeLists.txt | 8 ++++++++ CMakePresets.json | 2 +- cmake/modules/Findzlib-ng.cmake | 30 ++++++++++++++++++++++++++++++ extern/CMakeLists.txt | 9 --------- 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 cmake/modules/Findzlib-ng.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ea5cacd45..7b795e5ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,6 +205,7 @@ if(CESIUM_ENABLE_CLANG_TIDY) endif() # Add Modules +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/extern/cmake-modules/") if (CESIUM_COVERAGE_ENABLED AND NOT MSVC) include(CodeCoverage) @@ -238,6 +239,13 @@ list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_BUILD_DIR}") # However, for some of the vcpkg built libraries where they don't provide a prope cmake config file, we have to declare # and imporeted library target ourselves. This is the case for modp_b64::modp_b64, picosha2::picosha2 and earcut. In # these cases, we *do* have the somewhat ugly and verbose details in the extern/CMakeLists.txt file. +# +# XXX Above comment should be obsoleted by these first calls to +# find_package, which resolve to our own modules that provide +# targets. If needed, they can be installed with CMake config files +# etc. +find_package(zlib-ng REQUIRED) + find_package(Async++ CONFIG REQUIRED) find_package(Catch2 CONFIG REQUIRED) find_package(draco CONFIG REQUIRED) diff --git a/CMakePresets.json b/CMakePresets.json index 9f73954f0..208af7c12 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,7 +5,7 @@ "name": "vcpkg", "binaryDir": "${sourceDir}/build", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" } } ] diff --git a/cmake/modules/Findzlib-ng.cmake b/cmake/modules/Findzlib-ng.cmake new file mode 100644 index 000000000..e2c92e74a --- /dev/null +++ b/cmake/modules/Findzlib-ng.cmake @@ -0,0 +1,30 @@ + +find_library(zlib-ng_LIBRARIES NAMES zlibstatic-ng z-ng zlib-ng) +find_library(zlib-ng_DEBUG_LIBRARIES + NAMES + "zlibstatic-ngd" + "z-ngd" + "zlib-ngd" + ) + +find_path(zlib-ng_INCLUDE_DIRS NAMES zlib-ng.h) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(zlib-ng + FOUND_VAR + zlib-ng_FOUND + REQUIRED_VARS + zlib-ng_LIBRARIES + zlib-ng_INCLUDE_DIRS + ) + +mark_as_advanced(zlib-ng_LIBRARIES zlib-ng_INCLUDE_DIRS) + +if(zlib-ng_FOUND AND NOT TARGET zlib-ng::zlib-ng) + add_library(zlib-ng::zlib-ng UNKNOWN IMPORTED) + set_target_properties(zlib-ng::zlib-ng PROPERTIES + IMPORTED_LOCATION "${zlib-ng_LIBRARIES}" + IMPORTED_LOCATION_DEBUG "${zlib-ng_DEBUG_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${zlib-ng_INCLUDE_DIRS}") +endif() diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index ebf81e478..ef6a6ec91 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -34,12 +34,3 @@ add_library(picosha2::picosha2 IMPORTED INTERFACE GLOBAL) set_target_properties(picosha2::picosha2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_BUILD_DIR}/include" ) - -find_library(ZLIB_NG_RELEASE_LIB NAMES zlibstatic-ng z-ng PATHS ${PACKAGE_BUILD_DIR}/lib NO_DEFAULT_PATH) -find_library(ZLIB_NG_DEBUG_LIB NAMES zlibstatic-ngd z-ng PATHS ${PACKAGE_BUILD_DIR}/debug/lib NO_DEFAULT_PATH) -add_library(zlib-ng::zlib-ng STATIC IMPORTED GLOBAL) -target_include_directories(zlib-ng::zlib-ng INTERFACE "${PACKAGE_BUILD_DIR}/include") -set_target_properties(zlib-ng::zlib-ng PROPERTIES - IMPORTED_LOCATION "${ZLIB_NG_RELEASE_LIB}" - IMPORTED_LOCATION_DEBUG "${ZLIB_NG_DEBUG_LIB}" -) From e83d66634f77f38e9e684310eb24e8a5a28f20ac Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Sun, 17 Nov 2024 15:40:54 +0100 Subject: [PATCH 08/19] cleanup for ezvckpg use and VCPKG_MANIFEST_MODE VCPKG_MANIFEST_MODE isn't available before project() is called, so define a new variable CESIUM_USE_EZVCPKG to control the early loading of ezvcpkg. --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b795e5ca..af100f5d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,9 @@ if (NOT VCPKG_LIBRARY_LINKAGE) set(VCPKG_LIBRARY_LINKAGE static) endif() -if(NOT VCPKG_MANIFEST_MODE) +option(CESIUM_USE_EZVCPKG "use ezvcpkg helper" OFF) + +if(CESIUM_USE_EZVCPKG) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ezvcpkg/ezvcpkg.cmake) endif() @@ -58,7 +60,7 @@ set(PACKAGES_PRIVATE # Packages only used for testing set(PACKAGES_TEST catch2) -if(NOT VCPKG_MANIFEST_MODE) +if(CESIUM_USE_EZVCPKG) set(PACKAGES_ALL ${PACKAGES_PUBLIC}) list(APPEND PACKAGES_ALL ${PACKAGES_PRIVATE}) list(APPEND PACKAGES_ALL ${PACKAGES_TEST}) @@ -95,7 +97,7 @@ include(CMakeDependentOption) set(PACKAGE_BASE_DIR "${EZVCPKG_PACKAGES_DIR}") set(PACKAGE_BUILD_DIR "${EZVCPKG_DIR}") -if(VCPKG_MANIFEST_MODE) +if(NOT EZVCPKG_PACKAGES_DIR) set(PACKAGE_BUILD_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TRIPLET}/") set(PACKAGE_BASE_DIR "$ENV{VCPKG_ROOT}/packages") endif() @@ -116,7 +118,7 @@ cmake_dependent_option( OFF ) -if(CESIUM_INSTALL_STATIC_LIBS OR CESIUM_INSTALL_HEADERS AND NOT VCPKG_MANIFEST_MODE) +if(CESIUM_INSTALL_STATIC_LIBS OR CESIUM_INSTALL_HEADERS AND EZVCPKG_PACKAGES_DIR) foreach(PACKAGE ${PACKAGES_PUBLIC}) string(REGEX REPLACE "\[.*\]" "" PACKAGE ${PACKAGE}) set(PACKAGE_DIR ${PACKAGE_BASE_DIR}/${PACKAGE}_${VCPKG_TRIPLET}) From 2357827474422e0662ffb0081ce4cf47967c7a2e Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Sun, 17 Nov 2024 17:25:30 +0100 Subject: [PATCH 09/19] Config file that satisfies external dependencies --- CMakeLists.txt | 13 +++++++++++-- cmake/config/Config.cmake.in | 26 ++++++++++++++++++++++++++ vcpkg.json | 2 -- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 cmake/config/Config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index af100f5d7..25d3f22a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,10 +301,19 @@ endif() add_subdirectory(doc) +include(CMakePackageConfigHelpers) + install(EXPORT CesiumExports FILE cesium-nativeTargets.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) -install(FILES cesium-nativeConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) +install(FILES + "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/Findzlib-ng.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native") +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/cesium-nativeConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native") + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cesium-nativeConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) diff --git a/cmake/config/Config.cmake.in b/cmake/config/Config.cmake.in new file mode 100644 index 000000000..3a995500a --- /dev/null +++ b/cmake/config/Config.cmake.in @@ -0,0 +1,26 @@ +@PACKAGE-INIT@ + +include(CMakeFindDependencyMacro) + +find_dependency(zlib-ng REQUIRED) + +find_dependency(Async++ CONFIG REQUIRED) +find_dependency(Catch2 CONFIG REQUIRED) +find_dependency(draco CONFIG REQUIRED) +find_dependency(expected-lite CONFIG REQUIRED) +find_dependency(glm CONFIG REQUIRED) +find_dependency(meshoptimizer CONFIG REQUIRED) +find_dependency(Microsoft.GSL REQUIRED) +find_dependency(httplib CONFIG REQUIRED) +find_dependency(Ktx CONFIG REQUIRED) +find_dependency(libmorton CONFIG REQUIRED) +find_dependency(libjpeg-turbo CONFIG REQUIRED) +find_dependency(OpenSSL REQUIRED) +find_dependency(s2 CONFIG REQUIRED) +find_dependency(spdlog CONFIG REQUIRED) +find_dependency(tinyxml2 CONFIG REQUIRED) +find_dependency(unofficial-sqlite3 CONFIG REQUIRED) +find_dependency(uriparser CONFIG REQUIRED char wchar_t) +find_dependency(WebP CONFIG REQUIRED) + +include("${CMAKE_CURRENT_LIST_DIR}/cesium-nativeTargets.cmake") diff --git a/vcpkg.json b/vcpkg.json index 5fc4e8a8b..c4223c261 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,14 +3,12 @@ "asyncplusplus", "catch2", "expected-lite", - "fmt", "glm", "ms-gsl", "rapidjson", "spdlog", "stb", "uriparser", - "abseil", "draco", "ktx", "modp-base64", From 4872250dc4a915c1a04edc15f6f82aeaee5d4eb1 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 18 Nov 2024 12:42:51 +0100 Subject: [PATCH 10/19] Temporarily set CMAKE_PREFIX_PATH to find zlib-ng debug library --- cmake/modules/Findzlib-ng.cmake | 49 ++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/cmake/modules/Findzlib-ng.cmake b/cmake/modules/Findzlib-ng.cmake index e2c92e74a..d516d6f32 100644 --- a/cmake/modules/Findzlib-ng.cmake +++ b/cmake/modules/Findzlib-ng.cmake @@ -1,30 +1,47 @@ find_library(zlib-ng_LIBRARIES NAMES zlibstatic-ng z-ng zlib-ng) find_library(zlib-ng_DEBUG_LIBRARIES - NAMES - "zlibstatic-ngd" - "z-ngd" - "zlib-ngd" - ) + NAMES + "zlibstatic-ngd" + "z-ngd" + "zlib-ngd" + ) + +# vcpkg specific locations for debug libraries if they are not already found +set(zlibngSavePrefixPath ${CMAKE_PREFIX_PATH}) +list(FILTER CMAKE_PREFIX_PATH INCLUDE REGEX "/debug") +find_library(zlib-ng_DEBUG_LIBRARIES + NAMES + zlibstatic + z-ng + zlib-ng + ) +set(CMAKE_PREFIX_PATH ${zlibngSavePrefixPath}) find_path(zlib-ng_INCLUDE_DIRS NAMES zlib-ng.h) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(zlib-ng - FOUND_VAR - zlib-ng_FOUND - REQUIRED_VARS - zlib-ng_LIBRARIES - zlib-ng_INCLUDE_DIRS - ) + FOUND_VAR + zlib-ng_FOUND + REQUIRED_VARS + zlib-ng_LIBRARIES + zlib-ng_INCLUDE_DIRS + ) mark_as_advanced(zlib-ng_LIBRARIES zlib-ng_INCLUDE_DIRS) if(zlib-ng_FOUND AND NOT TARGET zlib-ng::zlib-ng) - add_library(zlib-ng::zlib-ng UNKNOWN IMPORTED) - set_target_properties(zlib-ng::zlib-ng PROPERTIES - IMPORTED_LOCATION "${zlib-ng_LIBRARIES}" - IMPORTED_LOCATION_DEBUG "${zlib-ng_DEBUG_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${zlib-ng_INCLUDE_DIRS}") + add_library(zlib-ng::zlib-ng UNKNOWN IMPORTED) + set_target_properties(zlib-ng::zlib-ng PROPERTIES + IMPORTED_LOCATION "${zlib-ng_LIBRARIES}" + IMPORTED_LOCATION_DEBUG "${zlib-ng_DEBUG_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${zlib-ng_INCLUDE_DIRS}" + ) + if(zlib-ng_DEBUG_LIBRARIES) + set_target_properties(zlib-ng::zlib-ng PROPERTIES + IMPORTED_LOCATION_DEBUG "${zlib-ng_DEBUG_LIBRARIES}" + ) + endif() endif() From 32a7ea36ca1e24e643a262f475804debd1582aa2 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 18 Nov 2024 12:48:27 +0100 Subject: [PATCH 11/19] CMake preset for multi config testing --- CMakePresets.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 208af7c12..b2c943df6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -3,9 +3,19 @@ "configurePresets": [ { "name": "vcpkg", - "binaryDir": "${sourceDir}/build", + "binaryDir": "${sourceDir}/build", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "vcpkg-ninja", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_BUILD_TYPE": "Release" } } ] From 6546d407e6579123a02a876cf580a0dfff7fe9a4 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 18 Nov 2024 13:18:01 +0100 Subject: [PATCH 12/19] Change CMAKE_MODULE_PATH to find Findzlib-ng.cmake --- cmake/config/Config.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/config/Config.cmake.in b/cmake/config/Config.cmake.in index 3a995500a..5fa477e30 100644 --- a/cmake/config/Config.cmake.in +++ b/cmake/config/Config.cmake.in @@ -1,5 +1,7 @@ @PACKAGE-INIT@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + include(CMakeFindDependencyMacro) find_dependency(zlib-ng REQUIRED) From b4fbda7d6600c0869ae713e740918d11ddbfb15e Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 18 Nov 2024 15:26:57 +0100 Subject: [PATCH 13/19] Find module for modp_b64 --- CMakeLists.txt | 2 ++ cmake/config/Config.cmake.in | 1 + cmake/modules/Findmodp_b64.cmake | 46 ++++++++++++++++++++++++++++++++ cmake/modules/Findzlib-ng.cmake | 1 - extern/CMakeLists.txt | 14 ---------- 5 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 cmake/modules/Findmodp_b64.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 25d3f22a5..9bb4e0422 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,7 @@ list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_BUILD_DIR}") # targets. If needed, they can be installed with CMake config files # etc. find_package(zlib-ng REQUIRED) +find_package(modp_b64 REQUIRED) find_package(Async++ CONFIG REQUIRED) find_package(Catch2 CONFIG REQUIRED) @@ -309,6 +310,7 @@ install(EXPORT CesiumExports install(FILES "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/Findzlib-ng.cmake" + "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/Findmodp_b64.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native") configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/Config.cmake.in diff --git a/cmake/config/Config.cmake.in b/cmake/config/Config.cmake.in index 5fa477e30..3f3795806 100644 --- a/cmake/config/Config.cmake.in +++ b/cmake/config/Config.cmake.in @@ -5,6 +5,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") include(CMakeFindDependencyMacro) find_dependency(zlib-ng REQUIRED) +find_dependency(modp_b64 REQUIRED) find_dependency(Async++ CONFIG REQUIRED) find_dependency(Catch2 CONFIG REQUIRED) diff --git a/cmake/modules/Findmodp_b64.cmake b/cmake/modules/Findmodp_b64.cmake new file mode 100644 index 000000000..852f31cca --- /dev/null +++ b/cmake/modules/Findmodp_b64.cmake @@ -0,0 +1,46 @@ +# Yes, on non-windows platforms the name of the library really is liblibmodpbase64.a +# Don't ask me, I didn't do it. + +find_library(modp_b64_LIBRARIES NAMES modpbase64 libmodpbase64) +find_library(modp_b64_DEBUG_LIBRARIES + NAMES + modpbase64d + libmodpbase64d + ) + +# vcpkg specific locations for debug libraries if they are not already found +set(modpbase64SavePrefixPath ${CMAKE_PREFIX_PATH}) +list(FILTER CMAKE_PREFIX_PATH INCLUDE REGEX "/debug") +find_library(modp_b64_DEBUG_LIBRARIES + NAMES + modpbase64 + libmodpbase64 + ) +set(CMAKE_PREFIX_PATH ${modpbase64SavePrefixPath}) + +find_path(modp_b64_INCLUDE_DIRS NAMES modp_b64.h) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(modp_b64 + FOUND_VAR + modp_b64_FOUND + REQUIRED_VARS + modp_b64_LIBRARIES + modp_b64_INCLUDE_DIRS + ) + +mark_as_advanced(modp_b64_LIBRARIES modp_b64_INCLUDE_DIRS) + +if(modp_b64_FOUND AND NOT TARGET modp_b64::modp_b64) + add_library(modp_b64::modp_b64 UNKNOWN IMPORTED) + set_target_properties(modp_b64::modp_b64 PROPERTIES + IMPORTED_LOCATION "${modp_b64_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${modp_b64_INCLUDE_DIRS}" + ) + if(modp_b64_DEBUG_LIBRARIES) + set_target_properties(modp_b64::modp_b64 PROPERTIES + IMPORTED_LOCATION_DEBUG "${modp_b64_DEBUG_LIBRARIES}" + ) + endif() +endif() diff --git a/cmake/modules/Findzlib-ng.cmake b/cmake/modules/Findzlib-ng.cmake index d516d6f32..ed291c19d 100644 --- a/cmake/modules/Findzlib-ng.cmake +++ b/cmake/modules/Findzlib-ng.cmake @@ -36,7 +36,6 @@ if(zlib-ng_FOUND AND NOT TARGET zlib-ng::zlib-ng) add_library(zlib-ng::zlib-ng UNKNOWN IMPORTED) set_target_properties(zlib-ng::zlib-ng PROPERTIES IMPORTED_LOCATION "${zlib-ng_LIBRARIES}" - IMPORTED_LOCATION_DEBUG "${zlib-ng_DEBUG_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${zlib-ng_INCLUDE_DIRS}" ) if(zlib-ng_DEBUG_LIBRARIES) diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index ef6a6ec91..2ff824bf1 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -15,20 +15,6 @@ add_library(earcut INTERFACE) find_path(EARCUT_HPP_INCLUDE_DIRS "mapbox/earcut.hpp") target_include_directories(earcut INTERFACE "${EARCUT_HPP_INCLUDE_DIRS}") - - -# Allow the catch2 cmake include to be found -list(APPEND CMAKE_MODULE_PATH "${PACKAGE_BUILD_DIR}/share/Catch2") -# Modp_b64 doesn't contain a CMake config, so we construct a fake import library here -add_library(modp_b64::modp_b64 STATIC IMPORTED GLOBAL) -set_target_properties(modp_b64::modp_b64 PROPERTIES - INCLUDE_DIRECTORIES "${PACKAGE_BUILD_DIR}/include" - # Yes, on non-windows platforms the name of the library really is liblibmodpbase64.a - # Don't ask me, I didn't do it. - IMPORTED_LOCATION "${PACKAGE_BUILD_DIR}/lib/${EXTERN_LIB_PREFIX}libmodpbase64.${EXTERN_LIB_SUFFIX}" - IMPORTED_LOCATION_DEBUG "${PACKAGE_BUILD_DIR}/debug/lib/${EXTERN_LIB_PREFIX}libmodpbase64.${EXTERN_LIB_SUFFIX}" -) - # picosha2 also doesn't contain a CMake config, so we construct a fake header-only import library here add_library(picosha2::picosha2 IMPORTED INTERFACE GLOBAL) set_target_properties(picosha2::picosha2 PROPERTIES From 132d211a9d732a25fa16780aebc48b645d2718d6 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 25 Nov 2024 00:24:58 +0100 Subject: [PATCH 14/19] Remove ktx overlay Individual integrations can add their own overlay if they need it. --- vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch | 122 ------------------ vcpkg-overlays/ktx/0002-Fix-versioning.patch | 17 --- vcpkg-overlays/ktx/0003-mkversion.patch | 13 -- vcpkg-overlays/ktx/0004-quirks.patch | 21 --- .../ktx/0005-no-vendored-libs.patch | 17 --- vcpkg-overlays/ktx/portfile.cmake | 82 ------------ vcpkg-overlays/ktx/vcpkg.json | 37 ------ 7 files changed, 309 deletions(-) delete mode 100644 vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch delete mode 100644 vcpkg-overlays/ktx/0002-Fix-versioning.patch delete mode 100644 vcpkg-overlays/ktx/0003-mkversion.patch delete mode 100644 vcpkg-overlays/ktx/0004-quirks.patch delete mode 100644 vcpkg-overlays/ktx/0005-no-vendored-libs.patch delete mode 100644 vcpkg-overlays/ktx/portfile.cmake delete mode 100644 vcpkg-overlays/ktx/vcpkg.json diff --git a/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch b/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch deleted file mode 100644 index 71a587bd6..000000000 --- a/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch +++ /dev/null @@ -1,122 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9a56491..d7ca937 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -345,7 +345,6 @@ set(KTX_MAIN_SRC - lib/basisu/transcoder/basisu_transcoder.cpp - lib/basisu/transcoder/basisu_transcoder.h - lib/basisu/transcoder/basisu.h -- lib/basisu/zstd/zstd.c - lib/checkheader.c - lib/dfdutils/createdfd.c - lib/dfdutils/colourspaces.c -@@ -532,7 +531,6 @@ macro(common_libktx_settings target enable_write library_type) - $ - - $ -- $ - - $ - $ -@@ -627,6 +625,11 @@ macro(common_libktx_settings target enable_write library_type) - target_compile_definitions(${target} PUBLIC KTX_FEATURE_KTX2) - endif() - -+ # Use vcpkg zstd -+ find_package(zstd CONFIG REQUIRED) -+ set(ZSTD_LIBRARIES "$,zstd::libzstd_shared,zstd::libzstd_static>") -+ target_link_libraries(${target} PRIVATE ${ZSTD_LIBRARIES}) -+ - if(WIN32) - if(MINGW) - # Check if the Threads package is provided; if using Mingw it MIGHT be -diff --git a/cmake/KtxConfig.cmake b/cmake/KtxConfig.cmake -index 6386ba2..537bf4f 100644 ---- a/cmake/KtxConfig.cmake -+++ b/cmake/KtxConfig.cmake -@@ -1,7 +1,8 @@ - # Copyright 2015-2020 The Khronos Group Inc. - # SPDX-License-Identifier: Apache-2.0 - --# include(CMakeFindDependencyMacro) --# find_dependency() -+include(CMakeFindDependencyMacro) -+find_dependency(Threads) -+find_dependency(zstd CONFIG) - - include("${CMAKE_CURRENT_LIST_DIR}/KtxTargets.cmake") -diff --git a/lib/basisu/CMakeLists.txt b/lib/basisu/CMakeLists.txt -index 492233a..152ceb5 100644 ---- a/lib/basisu/CMakeLists.txt -+++ b/lib/basisu/CMakeLists.txt -@@ -145,9 +145,6 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST} - transcoder/basisu_transcoder.cpp - ) - --if (ZSTD) -- set(BASISU_SRC_LIST ${BASISU_SRC_LIST} zstd/zstd.c) --endif() - - if (APPLE) - set(BIN_DIRECTORY "bin_osx") -@@ -165,6 +162,10 @@ else() - target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) - endif() - -+if(ZSTD_LIBRARIES) -+ target_link_libraries(basisu ${ZSTD_LIBRARIES}) -+endif() -+ - if (NOT MSVC) - # For Non-Windows builds, let cmake try and find the system OpenCL headers/libs for us. - if (OPENCL_FOUND) -diff --git a/lib/basisu/webgl/encoder/CMakeLists.txt b/lib/basisu/webgl/encoder/CMakeLists.txt -index 588d91b..a337b13 100644 ---- a/lib/basisu/webgl/encoder/CMakeLists.txt -+++ b/lib/basisu/webgl/encoder/CMakeLists.txt -@@ -34,9 +34,6 @@ if (EMSCRIPTEN) - ) - - if (KTX2_ZSTANDARD) -- set(SRC_LIST ${SRC_LIST} -- ../../zstd/zstd.c -- ) - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1) - else() - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0) -@@ -55,6 +52,10 @@ if (EMSCRIPTEN) - target_compile_options(basis_encoder.js PRIVATE -fno-strict-aliasing -O3) - - target_include_directories(basis_encoder.js PRIVATE ../../transcoder) -+ -+ if(ZSTD_LIBRARIES) -+ target_link_libraries(basis_encoder.js ${ZSTD_LIBRARIES}) -+ endif() - - set_target_properties(basis_encoder.js PROPERTIES - OUTPUT_NAME "basis_encoder" -diff --git a/lib/basisu/webgl/transcoder/CMakeLists.txt b/lib/basisu/webgl/transcoder/CMakeLists.txt -index 372653d..5ebc3cf 100644 ---- a/lib/basisu/webgl/transcoder/CMakeLists.txt -+++ b/lib/basisu/webgl/transcoder/CMakeLists.txt -@@ -28,9 +28,6 @@ if (EMSCRIPTEN) - endif() - - if (KTX2_ZSTANDARD) -- set(SRC_LIST ${SRC_LIST} -- ../../zstd/zstddeclib.c -- ) - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1) - else() - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0) -@@ -44,6 +41,10 @@ if (EMSCRIPTEN) - target_compile_definitions(basis_transcoder.js PRIVATE NDEBUG BASISD_SUPPORT_UASTC=1 BASISD_SUPPORT_BC7=1 BASISD_SUPPORT_ATC=0 BASISD_SUPPORT_ASTC_HIGHER_OPAQUE_QUALITY=0 BASISD_SUPPORT_PVRTC2=0 BASISD_SUPPORT_FXT1=0 BASISD_SUPPORT_ETC2_EAC_RG11=0 BASISU_SUPPORT_ENCODING=0 ${KTX2_DEFINITION} ${ZSTD_DEFINITION} ) - target_compile_options(basis_transcoder.js PRIVATE -O3 -fno-strict-aliasing) - target_include_directories(basis_transcoder.js PRIVATE ../../transcoder) -+ -+ if(ZSTD_LIBRARIES) -+ target_link_libraries(basis_transcoder.js ${ZSTD_LIBRARIES}) -+ endif() - - set_target_properties(basis_transcoder.js PROPERTIES - OUTPUT_NAME "basis_transcoder" diff --git a/vcpkg-overlays/ktx/0002-Fix-versioning.patch b/vcpkg-overlays/ktx/0002-Fix-versioning.patch deleted file mode 100644 index 1e5098806..000000000 --- a/vcpkg-overlays/ktx/0002-Fix-versioning.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/cmake/version.cmake b/cmake/version.cmake -index 4094df1a..3b2af3bb 100644 ---- a/cmake/version.cmake -+++ b/cmake/version.cmake -@@ -108,8 +108,10 @@ function(generate_version _var ) - set(${_var} "${KTX_VERSION}" PARENT_SCOPE) - endfunction() - --# Get latest tag --git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*) -+if (!KTX_VERSION_FULL) -+ # Get latest tag -+ git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*) -+endif() - #message("KTX full version: ${KTX_VERSION_FULL}") - - # generate_version(TOKTX_VERSION tools/toktx) diff --git a/vcpkg-overlays/ktx/0003-mkversion.patch b/vcpkg-overlays/ktx/0003-mkversion.patch deleted file mode 100644 index ee8b3c4af..000000000 --- a/vcpkg-overlays/ktx/0003-mkversion.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmake/version.cmake b/cmake/version.cmake -index 9a90622..0fc3521 100644 ---- a/cmake/version.cmake -+++ b/cmake/version.cmake -@@ -176,7 +176,7 @@ function( create_version_header dest_path target ) - add_custom_command( - OUTPUT ${version_h_output} - # On Windows this command has to be invoked by a shell in order to work -- COMMAND ${BASH_EXECUTABLE} -c "\"./mkversion\" \"-o\" \"version.h\" \"${dest_path}\"" -+ COMMAND "${BASH_EXECUTABLE}" -- ./mkversion -o version.h "${dest_path}" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMENT "Generate ${version_h_output}" - VERBATIM diff --git a/vcpkg-overlays/ktx/0004-quirks.patch b/vcpkg-overlays/ktx/0004-quirks.patch deleted file mode 100644 index afc34236d..000000000 --- a/vcpkg-overlays/ktx/0004-quirks.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1500844..810914e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -263,7 +263,7 @@ if(MSVC) - # ";" argument separator is problematic. Can't use a GenEx `$:/WX> ) -- add_compile_options( $,/Gz,/O2> ) -+ add_compile_options( $,,/O2> ) - # Enable UTF-8 support - add_compile_options( $<$:/utf-8> ) - add_compile_options( $<$:/utf-8> ) -@@ -946,6 +946,7 @@ if(EMSCRIPTEN) - endif() - - add_library( objUtil STATIC -+ EXCLUDE_FROM_ALL - utils/argparser.cpp - utils/argparser.h - utils/ktxapp.h diff --git a/vcpkg-overlays/ktx/0005-no-vendored-libs.patch b/vcpkg-overlays/ktx/0005-no-vendored-libs.patch deleted file mode 100644 index 77cdd8518..000000000 --- a/vcpkg-overlays/ktx/0005-no-vendored-libs.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d7ca937..ffcbe95 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1059,10 +1059,10 @@ endif() - # except for building the ktx library. - if((KTX_FEATURE_TOOLS OR KTX_FEATURE_TESTS) AND NOT TARGET fmt::fmt) - set(FMT_SYSTEM_HEADERS ON) -- add_subdirectory(other_projects/fmt) -+ find_package(fmt CONFIG REQUIRED) - endif() - if(KTX_FEATURE_TOOLS AND NOT TARGET cxxopts::cxxopts) -- add_subdirectory(other_projects/cxxopts) -+ find_package(cxxopts CONFIG REQUIRED) - endif() - - # Tools diff --git a/vcpkg-overlays/ktx/portfile.cmake b/vcpkg-overlays/ktx/portfile.cmake deleted file mode 100644 index e563a6a9b..000000000 --- a/vcpkg-overlays/ktx/portfile.cmake +++ /dev/null @@ -1,82 +0,0 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO KhronosGroup/KTX-Software - REF "v${VERSION}" - SHA512 5a89f8986464705ec36ac1becaddd0ff335e4c3c235468aaef0e963fcfeda4c0d669a086b91e61c16a3ae9e1fa5bf456dccf12cc65720e1a22e7cc0f30552541 - HEAD_REF master - PATCHES - 0001-Use-vcpkg-zstd.patch - 0002-Fix-versioning.patch - 0003-mkversion.patch - 0004-quirks.patch - 0005-no-vendored-libs.patch -) -file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h") - -vcpkg_list(SET OPTIONS) -# if(VCPKG_TARGET_IS_WINDOWS) -# vcpkg_acquire_msys(MSYS_ROOT -# PACKAGES -# bash -# DIRECT_PACKAGES -# # Required for "getopt" -# "https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst" -# da26540881cd5734072717133307e5d1a27a60468d3656885507833b80f24088c5382eaa0234b30bdd9e8484a6638b4514623f5327f10b19eed36f12158e8edb -# # Required for "dos2unix" -# "https://mirror.msys2.org/msys/x86_64/dos2unix-7.5.1-1-x86_64.pkg.tar.zst" -# 83d85e6ccea746ef9e8153a0d605e774dbe7efc0ee952804acfee4ffd7e3b0386a353b45ff989dd99bc3ce75968209fea3d246ad2af88bbb5c4eca12fc5a8f92 -# ) -# vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") -# vcpkg_list(APPEND OPTIONS "-DBASH_EXECUTABLE=${MSYS_ROOT}/usr/bin/bash.exe") -# endif() - -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC) - -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - tools KTX_FEATURE_TOOLS - vulkan KTX_FEATURE_VK_UPLOAD -) - -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DKTX_VERSION_FULL=v${VERSION} - -DKTX_FEATURE_TESTS=OFF - -DKTX_FEATURE_LOADTEST_APPS=OFF - -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC} - ${FEATURE_OPTIONS} - ${OPTIONS} - # Do not regenerate headers (needs more dependencies) - -DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=1 - DISABLE_PARALLEL_CONFIGURE -) - -vcpkg_cmake_install() - -if(tools IN_LIST FEATURES) - vcpkg_copy_tools( - TOOL_NAMES - ktx - toktx - ktxsc - ktxinfo - ktx2ktx2 - ktx2check - AUTO_CLEAN - ) -else() - vcpkg_copy_pdbs() -endif() - -vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ktx) - -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") -endif() - -file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSES/*") -file(COPY ${LICENSE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSES") -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") diff --git a/vcpkg-overlays/ktx/vcpkg.json b/vcpkg-overlays/ktx/vcpkg.json deleted file mode 100644 index 102e28131..000000000 --- a/vcpkg-overlays/ktx/vcpkg.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "ktx", - "version-semver": "4.3.0-beta1", - "port-version": 1, - "description": [ - "The Khronos KTX library and tools.", - "Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them." - ], - "homepage": "https://github.com/KhronosGroup/KTX-Software", - "license": null, - "supports": "arm64 | x64 | !windows", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - }, - "zstd" - ], - "features": { - "tools": { - "description": "Build tools", - "supports": "!android", - "dependencies": [ - "cxxopts", - "fmt" - ] - }, - "vulkan": { - "description": "Build Vulkan support", - "supports": "!emscripten" - } - } -} From c6d7ae3d883d0965b29ae1ed2896ed30b49e63fe Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Fri, 29 Nov 2024 11:57:44 +0100 Subject: [PATCH 15/19] Smarter defaults for using ezvcpkg Also, try to make sure that vcpkg actually uses the desired triplet. --- CMakeLists.txt | 30 +++++++++++++++++++++++++++++- CMakePresets.json | 3 ++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bb4e0422..b97c67c04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,23 @@ if (NOT VCPKG_LIBRARY_LINKAGE) set(VCPKG_LIBRARY_LINKAGE static) endif() -option(CESIUM_USE_EZVCPKG "use ezvcpkg helper" OFF) +# Don't use ezvcpkg if it appears that this configuration is using +# vcpkg already, either by building cesium-native directly, +# or via a higher level project that has added cesium-native as a +# subdirectory and using vcpkg to statisfy its dependencies, +# presumably in manifest mode. + +set(CESIUM_USE_EZVCPKG_DEFAULT ON) +if (VCPKG_MANIFEST_MODE) + set(CESIUM_USE_EZVCPKG_DEFAULT OFF) +elseif (CMAKE_TOOLCHAIN_FILE) + get_filename_component(toolchainFile "${CMAKE_TOOLCHAIN_FILE}" NAME) + if(toolchainFile STREQUAL "vcpkg.cmake") + set(CESIUM_USE_EZVCPKG_DEFAULT OFF) + endif() +endif() + +option(CESIUM_USE_EZVCPKG "use ezvcpkg helper" ${CESIUM_USE_EZVCPKG_DEFAULT}) if(CESIUM_USE_EZVCPKG) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ezvcpkg/ezvcpkg.cmake) @@ -12,6 +28,14 @@ endif() include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect-vcpkg-triplet.cmake) +# Note: VCPKG_TRIPLET is not used by vcpkg! The relevant variables are +# VCPKG_TARGET_TRIPLET and VCPKG_HOST_TRIPLET. ezvcpkg and our custom +# installation code use VCPKG_TRIPLET, so we initialize it. + +if (VCPKG_TARGET_TRIPLET) + set(VCPKG_TRIPLET "${VCPKG_TARGET_TRIPLET}") +endif() + if (NOT VCPKG_TRIPLET) if (DEFINED ENV{VCPKG_TRIPLET}) set(VCPKG_TRIPLET "$ENV{VCPKG_TRIPLET}") @@ -23,9 +47,13 @@ if (NOT VCPKG_TRIPLET) else() set(VCPKG_TRIPLET "${DETECTED_VCPKG_TRIPLET}") endif() + if (NOT CESIUM_USE_EZVCPKG) + set(VCPKG_TARGET_TRIPLET "${VCPKG_TRIPLET}") + endif() endif() message(STATUS "VCPKG_TRIPLET ${VCPKG_TRIPLET}") +message(STATUS "VCPKG_TARGET_TRIPLET ${VCPKG_TARGET_TRIPLET}") if (NOT VCPKG_OVERLAY_PORTS) if (DEFINED ENV{VCPKG_OVERLAY_PORTS}) diff --git a/CMakePresets.json b/CMakePresets.json index b2c943df6..727f32795 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -4,13 +4,14 @@ { "name": "vcpkg", "binaryDir": "${sourceDir}/build", + "generator": "Ninja", "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "vcpkg-ninja", + "name": "vcpkg-ninja-multi", "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/build", "cacheVariables": { From 9bbe80adec833dd87af934e672f18117c95f6840 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 5 Dec 2024 15:34:56 +0100 Subject: [PATCH 16/19] Add minimal docs to the README --- CMakePresets.json | 6 ++++-- README.md | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 727f32795..144509fe7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,7 +7,8 @@ "generator": "Ninja", "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "CMAKE_BUILD_TYPE": "Release" + "CMAKE_BUILD_TYPE": "Release", + "CESIUM_USE_EZVCPKG": "OFF" } }, { @@ -16,7 +17,8 @@ "binaryDir": "${sourceDir}/build", "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "CMAKE_BUILD_TYPE": "Release" + "CMAKE_BUILD_TYPE": "Release", + "CESIUM_USE_EZVCPKG": "OFF" } } ] diff --git a/README.md b/README.md index e910d3ad9..030c71634 100644 --- a/README.md +++ b/README.md @@ -123,3 +123,21 @@ cd ../.. * `npm run generate-3d-tiles` * `npm run generate-quantized-mesh-terrain` * On Windows, the line endings of the generated files will be different than those checked into the repo. Just `git add` them and git will fix the line endings (no need to commit). + +#### `vcpkg` Manifest Mode + +Experimental support for the +[vcpkg](https://github.com/microsoft/vcpkg) package manager is +included. The easiest way to use is it is via one of the CMake presets +in `CMakePresets.json`. For example: + +```bash +cmake --preset vcpkg +cmake --build build +``` + +While a `vcpkg` build of Cesium Native itself is cool, it is more +interesting to include it in another project using `vcpkg`. For an +example, see the +[vcpkg-build](https://github.com/timoore/vsgCs/tree/vcpkg-build) +branch of the vsgCs project. From 6c1b1edd4ee388f6372dcfe1c33de6839696e5b4 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 5 Dec 2024 17:13:48 +0100 Subject: [PATCH 17/19] Workaround for an -Werror=restrict warning from gcc 12 --- Cesium3DTilesSelection/src/TileID.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cesium3DTilesSelection/src/TileID.cpp b/Cesium3DTilesSelection/src/TileID.cpp index 06ba0c2ff..5d4129da8 100644 --- a/Cesium3DTilesSelection/src/TileID.cpp +++ b/Cesium3DTilesSelection/src/TileID.cpp @@ -15,14 +15,14 @@ TileIdUtilities::createTileIdString(const TileID& tileId) { std::string operator()(const CesiumGeometry::QuadtreeTileID& quadtreeTileId) { // Strings of the form "L10-X23-Y144" - return "L" + std::to_string(quadtreeTileId.level) + "-" + "X" + + return std::string("L") + std::to_string(quadtreeTileId.level) + "-" + "X" + std::to_string(quadtreeTileId.x) + "-" + "Y" + std::to_string(quadtreeTileId.y); } std::string operator()(const CesiumGeometry::OctreeTileID& octreeTileId) { // Strings of the form "L10-X23-Y144-Z42" - return "L" + std::to_string(octreeTileId.level) + "-" + "X" + + return std::string("L") + std::to_string(octreeTileId.level) + "-" + "X" + std::to_string(octreeTileId.x) + "-" + "Y" + std::to_string(octreeTileId.y) + "-" + "Z" + std::to_string(octreeTileId.z); @@ -31,7 +31,7 @@ TileIdUtilities::createTileIdString(const TileID& tileId) { std::string operator()( const CesiumGeometry::UpsampledQuadtreeNode& upsampledQuadtreeNode) { // Strings of the form "upsampled-L10-X23-Y144" - return "upsampled-L" + + return std::string("upsampled-L") + std::to_string(upsampledQuadtreeNode.tileID.level) + "-" + "X" + std::to_string(upsampledQuadtreeNode.tileID.x) + "-" + "Y" + std::to_string(upsampledQuadtreeNode.tileID.y); From 8b65a4084b5f849bd903a5032fc5c0405814be96 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 5 Dec 2024 19:01:34 +0100 Subject: [PATCH 18/19] run format --- Cesium3DTilesSelection/src/TileID.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cesium3DTilesSelection/src/TileID.cpp b/Cesium3DTilesSelection/src/TileID.cpp index 5d4129da8..d9de2b46e 100644 --- a/Cesium3DTilesSelection/src/TileID.cpp +++ b/Cesium3DTilesSelection/src/TileID.cpp @@ -15,8 +15,8 @@ TileIdUtilities::createTileIdString(const TileID& tileId) { std::string operator()(const CesiumGeometry::QuadtreeTileID& quadtreeTileId) { // Strings of the form "L10-X23-Y144" - return std::string("L") + std::to_string(quadtreeTileId.level) + "-" + "X" + - std::to_string(quadtreeTileId.x) + "-" + "Y" + + return std::string("L") + std::to_string(quadtreeTileId.level) + "-" + + "X" + std::to_string(quadtreeTileId.x) + "-" + "Y" + std::to_string(quadtreeTileId.y); } From a248a46069c01e358ce5209e0fb743fe89d502bb Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 10 Dec 2024 15:54:53 +0100 Subject: [PATCH 19/19] Change install destination of config files In the Cesium for Unreal build, CMAKE_INSTALL_LIBDIR contains a generator expression, which the install(EXPORT ...) command doesn't process correctly. So, install the configuration files such as "cesium-nativeTargets.cmake" in ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake, which is a perfectly fine location. These files aren't used by the Cesium Unreal build anyway. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b97c67c04..47223f119 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -334,16 +334,16 @@ include(CMakePackageConfigHelpers) install(EXPORT CesiumExports FILE cesium-nativeTargets.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) + DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake) install(FILES "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/Findzlib-ng.cmake" "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/Findmodp_b64.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native") + DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake) configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/cesium-nativeConfig.cmake" - INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native") + INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cesium-nativeConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cesium-native) + DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake)