Compare commits

..

1 Commits

Author SHA1 Message Date
Ashley Rogers 6a67c589f9
Merge 097ca8c26a into ab8de592a4 2025-11-03 15:35:46 -05:00
46 changed files with 123 additions and 647 deletions

View File

@ -217,70 +217,3 @@ jobs:
run: |
cd build
ctest -V
EmscriptenBuild:
strategy:
fail-fast: false
matrix:
version: [ "3.1.39", "4.0.13" ]
memory: [ "32", "64" ]
exclude:
- version: "3.1.39"
memory: "64"
name: Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory
env:
CACHE_KEY: "emscripten-${{matrix.version}}-${{matrix.memory}}"
runs-on: windows-2022
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Use NodeJS 24 for WebAssembly 64-bit memory support
if: ${{ matrix.memory == '64' }}
uses: actions/setup-node@v6
with:
node-version: '>=24'
- name: Checkout vcpkg 2025.02.14 packages for use with Emscripten 3.1.39
if: ${{ matrix.version == '3.1.39' }}
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
clean: false
ref: 2025.02.14
path: extern/vcpkg/temp
sparse-checkout-cone-mode: false
sparse-checkout: |
ports/ada-url
- name: Move overlay ports to the correct location
if: ${{ matrix.version == '3.1.39' }}
run: |
mv extern/vcpkg/temp/ports/* extern/vcpkg/ports/
- name: Add OpenSSL "no-dso" option on older Emscripten versions
if: ${{ matrix.version == '3.1.39' }}
run: |
echo "
if(PORT MATCHES "openssl")
set(VCPKG_CONFIGURE_MAKE_OPTIONS "no-dso")
endif()
" >> extern/vcpkg/triplets/wasm32-emscripten-cesium.cmake
- name: Install latest CMake 3 and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.31.6"
- name: Install nasm
uses: ilammy/setup-nasm@v1
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{matrix.version}}
- name: Verify
run: emcc -v
- name: Compile Debug Configuration
run: |
$env:VCPKG_ROOT="$env:VCPKG_INSTALLATION_ROOT"
$MEMORYPROPERTY="${{matrix.memory}}" -eq "64" ? "-DCESIUM_WASM64=ON" : ""
emcmake cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug $MEMORYPROPERTY
cmake --build build --config Debug --parallel
- name: Test Debug Configuration
run: |
node build/CesiumNativeTests/cesium-native-tests.js

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
build
build-*
doxygen
Testing
node_modules
@ -9,5 +8,7 @@ CMakeSettings.json
.cache
*.DS_Store
test.db
build-wsl
.idea
build-debug
clang-tidy.log

View File

@ -1,11 +1,5 @@
# Change Log
### v0.54.0 - 2025-11-17
##### Additions :tada:
- Cesium Native can now be built with Emscripten.
### v0.53.0 - 2025-11-03
##### Breaking Changes :mega:

View File

@ -4,14 +4,6 @@ if (NOT VCPKG_LIBRARY_LINKAGE)
set(VCPKG_LIBRARY_LINKAGE static)
endif()
get_filename_component(toolchainFile "${CMAKE_TOOLCHAIN_FILE}" NAME)
if(toolchainFile STREQUAL "Emscripten.cmake")
set(CESIUM_TARGET_WASM ON)
# Include the toolchain directly as ezvcpkg will overwrite the
# toolchain before it's loaded
include(${CMAKE_TOOLCHAIN_FILE})
endif()
# By default, Use ezvcpkg to install dependencies. But don't use
# ezvcpkg if it appears that this configuration is using vcpkg
# manifest mode already, either by building cesium-native directly,
@ -32,13 +24,6 @@ endif()
option(CESIUM_USE_EZVCPKG "use ezvcpkg helper" ${CESIUM_USE_EZVCPKG_DEFAULT})
option(CESIUM_DISABLE_CURL "Disable cesium-native's use of libcurl" OFF)
option(CESIUM_DISABLE_LIBJPEG_TURBO "Disable cesium-native's use of libjpeg-turbo. JPEG images will be decoded with STB instead." OFF)
option(CESIUM_WASM64 "Enable 64-bit WebAssembly target" OFF)
if (CESIUM_TARGET_WASM)
# Make sure curl is disabled on wasm builds, as it is not supported.
set(CESIUM_DISABLE_CURL ON)
endif()
if(CESIUM_USE_EZVCPKG)
# Keep vcpkg from running in manifset mode. It will try to because
@ -65,15 +50,6 @@ if (NOT VCPKG_TRIPLET)
elseif(DETECTED_VCPKG_TRIPLET STREQUAL "x64-windows")
# cesium-native requires static linking on Windows
set(VCPKG_TRIPLET "x64-windows-static-md")
elseif(DETECTED_VCPKG_TRIPLET STREQUAL "wasm32-emscripten")
# Use our custom triplet for wasm builds. Most importantly, this
# enables multithreading support. Also switch to 64-bit wasm if
# requested.
if (CESIUM_WASM64)
set(VCPKG_TRIPLET "wasm64-emscripten-cesium")
else()
set(VCPKG_TRIPLET "wasm32-emscripten-cesium")
endif()
else()
set(VCPKG_TRIPLET "${DETECTED_VCPKG_TRIPLET}")
endif()
@ -111,10 +87,6 @@ if (NOT VCPKG_OVERLAY_TRIPLETS)
endif()
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/triplets")
list(APPEND VCPKG_OVERLAY_TRIPLETS "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/triplets")
endif()
message(STATUS "VCPKG_OVERLAY_TRIPLETS ${VCPKG_OVERLAY_TRIPLETS}")
# These packages are used in the public headers of Cesium libraries, so we need to distribute the headers and binaries
@ -126,13 +98,13 @@ set(PACKAGES_PUBLIC asyncplusplus expected-lite fmt glm rapidjson spdlog stb ada
# 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[core] modp-base64 meshoptimizer openssl s2geometry
sqlite3 tinyxml2 libwebp zlib-ng picosha2
earcut-hpp libmorton zstd spz zlib
abseil draco ktx modp-base64 meshoptimizer openssl s2geometry
libjpeg-turbo sqlite3 tinyxml2 libwebp zlib-ng picosha2
earcut-hpp cpp-httplib[core] libmorton zstd spz zlib
)
# asmjit needed by blend2d on non-iOS platforms (iOS and Wasm don't support JIT)
if(NOT CESIUM_TARGET_WASM AND NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
# asmjit needed by blend2d on non-iOS platforms (iOS doesn't support JIT)
if(NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
list(APPEND PACKAGES_PRIVATE blend2d asmjit)
else()
# Use [core] feature to disable default jit feature.
@ -143,37 +115,16 @@ if(NOT CESIUM_DISABLE_CURL)
list(APPEND PACKAGES_PRIVATE curl)
endif()
if(NOT CESIUM_DISABLE_LIBJPEG_TURBO)
list(APPEND PACKAGES_PRIVATE libjpeg-turbo)
endif()
# We use cpp-httplib to host a local web server for OAuth2 authorization. That's not
# going to work at all on the web, and the latest versions of cpp-httplib only support
# 64-bit platforms anyway, so skip it entirely for WebAssembly builds.
if(NOT CESIUM_TARGET_WASM)
list(APPEND PACKAGES_PRIVATE "cpp-httplib[core]")
endif()
# Packages only used for testing
set(PACKAGES_TEST doctest)
if(CESIUM_TARGET_WASM)
# vcpkg will attempt to second-guess our CMAKE_C_COMPILER setting, choosing to go with the value of CC instead.
# While normally this is the correct value to go with, for wasm we need to be using emcc and em++.
# So we set CC and CXX to emcc and em++ here so vcpkg will pick them up properly.
# Does this make sense? No. Does it work? Somehow. ¯\_()_/¯
set(ENV{CC} ${CMAKE_C_COMPILER})
set(ENV{CXX} ${CMAKE_CXX_COMPILER})
endif()
if(CESIUM_USE_EZVCPKG)
set(PACKAGES_ALL ${PACKAGES_PUBLIC})
list(APPEND PACKAGES_ALL ${PACKAGES_PRIVATE})
list(APPEND PACKAGES_ALL ${PACKAGES_TEST})
ezvcpkg_fetch(
COMMIT afc0a2e01ae104a2474216a2df0e8d78516fd5af
REPO microsoft/vcpkg
COMMIT d80785c4ee1df22a4119a3451452f59e978e06aa
PACKAGES ${PACKAGES_ALL}
# Clean the build trees after building, so that we don't use a ton a disk space on the CI cache
CLEAN_BUILDTREES
@ -194,20 +145,10 @@ endif()
include("cmake/defaults.cmake")
project(cesium-native
VERSION 0.54.0
VERSION 0.53.0
LANGUAGES CXX C
)
if(CESIUM_TARGET_WASM)
if(CESIUM_WASM64)
set(CMAKE_SIZEOF_VOID_P 8)
else()
set(CMAKE_SIZEOF_VOID_P 4)
endif()
# Tells emscripten to output an HTML harness for the generated WASM
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif()
include(GNUInstallDirs)
include(CMakeDependentOption)
@ -377,7 +318,9 @@ find_package(doctest CONFIG REQUIRED)
find_package(draco CONFIG REQUIRED)
find_package(expected-lite CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(httplib CONFIG REQUIRED)
find_package(Ktx CONFIG REQUIRED)
find_package(libjpeg-turbo CONFIG REQUIRED)
find_package(libmorton CONFIG REQUIRED)
find_package(meshoptimizer CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
@ -389,8 +332,8 @@ find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(WebP CONFIG REQUIRED)
find_package(zlib-ng CONFIG REQUIRED)
# asmjit should not be included with iOS or Wasm builds as they don't support JIT compilation.
if(NOT CESIUM_TARGET_WASM AND NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
# asmjit should not be included with iOS builds as iOS doesn't support JIT compilation.
if(NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
find_package(asmjit CONFIG REQUIRED)
endif()
@ -398,14 +341,6 @@ if(NOT CESIUM_DISABLE_CURL)
find_package(CURL REQUIRED)
endif()
if(NOT CESIUM_DISABLE_LIBJPEG_TURBO)
find_package(libjpeg-turbo CONFIG REQUIRED)
endif()
if(NOT CESIUM_TARGET_WASM)
find_package(httplib CONFIG REQUIRED)
endif()
# Private Library (s2geometry)
add_subdirectory(extern EXCLUDE_FROM_ALL)

View File

@ -234,7 +234,7 @@ public:
bool isContentAvailable(
const CesiumGeometry::QuadtreeTileID& subtreeId,
const CesiumGeometry::QuadtreeTileID& tileId,
size_t contentId) const noexcept;
uint64_t contentId) const noexcept;
/**
* @brief Determines if content for a given tile in the octree is available.
@ -247,7 +247,7 @@ public:
bool isContentAvailable(
const CesiumGeometry::OctreeTileID& subtreeId,
const CesiumGeometry::OctreeTileID& tileId,
size_t contentId) const noexcept;
uint64_t contentId) const noexcept;
/**
* @brief Determines if content for a given tile in the subtree is available.
@ -262,7 +262,7 @@ public:
bool isContentAvailable(
uint32_t relativeTileLevel,
uint64_t relativeTileMortonId,
size_t contentId) const noexcept;
uint64_t contentId) const noexcept;
/**
* @brief Sets the availability state of the content for a given tile in the
@ -276,7 +276,7 @@ public:
void setContentAvailable(
const CesiumGeometry::QuadtreeTileID& subtreeId,
const CesiumGeometry::QuadtreeTileID& tileId,
size_t contentId,
uint64_t contentId,
bool isAvailable) noexcept;
/**
@ -291,7 +291,7 @@ public:
void setContentAvailable(
const CesiumGeometry::OctreeTileID& subtreeId,
const CesiumGeometry::OctreeTileID& tileId,
size_t contentId,
uint64_t contentId,
bool isAvailable) noexcept;
/**
@ -309,7 +309,7 @@ public:
void setContentAvailable(
uint32_t relativeTileLevel,
uint64_t relativeTileMortonId,
size_t contentId,
uint64_t contentId,
bool isAvailable) noexcept;
/**

View File

@ -1014,10 +1014,7 @@ void copyStringsToBuffers(
for (const auto& str : arrayMember.GetArray()) {
OffsetType byteLength = static_cast<OffsetType>(
str.GetStringLength() * sizeof(rapidjson::Value::Ch));
std::memcpy(
valueBuffer.data() + offset,
str.GetString(),
size_t(byteLength));
std::memcpy(valueBuffer.data() + offset, str.GetString(), byteLength);
std::memcpy(
offsetBuffer.data() + offsetIndex * sizeof(OffsetType),
&offset,
@ -1078,7 +1075,8 @@ void updateStringArrayProperty(
++it;
}
const size_t totalByteLength = totalCharCount * sizeof(rapidjson::Value::Ch);
const uint64_t totalByteLength =
totalCharCount * sizeof(rapidjson::Value::Ch);
std::vector<std::byte> valueBuffer;
std::vector<std::byte> stringOffsetBuffer;
PropertyComponentType stringOffsetType = PropertyComponentType::None;

View File

@ -823,7 +823,7 @@ void decodeDracoMetadata(
const std::unique_ptr<draco::PointCloud>& pPointCloud,
rapidjson::Document& batchTableJson,
PntsContent& parsedContent) {
const size_t pointsLength = parsedContent.pointsLength;
const uint64_t pointsLength = parsedContent.pointsLength;
std::vector<std::byte>& data = parsedContent.dracoBatchTableBinary;
const auto& dracoMetadataSemantics = parsedContent.dracoMetadataSemantics;

View File

@ -281,7 +281,7 @@ void SubtreeAvailability::setTileAvailable(
bool SubtreeAvailability::isContentAvailable(
const CesiumGeometry::QuadtreeTileID& subtreeId,
const CesiumGeometry::QuadtreeTileID& tileId,
size_t contentId) const noexcept {
uint64_t contentId) const noexcept {
uint64_t relativeTileMortonIdx =
ImplicitTilingUtilities::computeRelativeMortonIndex(subtreeId, tileId);
return this->isContentAvailable(
@ -293,7 +293,7 @@ bool SubtreeAvailability::isContentAvailable(
bool SubtreeAvailability::isContentAvailable(
const CesiumGeometry::OctreeTileID& subtreeId,
const CesiumGeometry::OctreeTileID& tileId,
size_t contentId) const noexcept {
uint64_t contentId) const noexcept {
uint64_t relativeTileMortonIdx =
ImplicitTilingUtilities::computeRelativeMortonIndex(subtreeId, tileId);
return this->isContentAvailable(
@ -305,7 +305,7 @@ bool SubtreeAvailability::isContentAvailable(
bool SubtreeAvailability::isContentAvailable(
uint32_t relativeTileLevel,
uint64_t relativeTileMortonId,
size_t contentId) const noexcept {
uint64_t contentId) const noexcept {
if (contentId >= this->_contentAvailability.size())
return false;
return isAvailable(
@ -317,7 +317,7 @@ bool SubtreeAvailability::isContentAvailable(
void SubtreeAvailability::setContentAvailable(
const CesiumGeometry::QuadtreeTileID& subtreeId,
const CesiumGeometry::QuadtreeTileID& tileId,
size_t contentId,
uint64_t contentId,
bool isAvailable) noexcept {
uint64_t relativeTileMortonIdx =
ImplicitTilingUtilities::computeRelativeMortonIndex(subtreeId, tileId);
@ -331,7 +331,7 @@ void SubtreeAvailability::setContentAvailable(
void SubtreeAvailability::setContentAvailable(
const CesiumGeometry::OctreeTileID& subtreeId,
const CesiumGeometry::OctreeTileID& tileId,
size_t contentId,
uint64_t contentId,
bool isAvailable) noexcept {
uint64_t relativeTileMortonIdx =
ImplicitTilingUtilities::computeRelativeMortonIndex(subtreeId, tileId);
@ -345,7 +345,7 @@ void SubtreeAvailability::setContentAvailable(
void SubtreeAvailability::setContentAvailable(
uint32_t relativeTileLevel,
uint64_t relativeTileMortonId,
size_t contentId,
uint64_t contentId,
bool isAvailable) noexcept {
if (contentId < this->_contentAvailability.size()) {
this->setAvailable(
@ -518,7 +518,7 @@ bool SubtreeAvailability::isAvailableUsingBufferView(
const SubtreeBufferViewAvailability* bufferViewAvailability =
std::get_if<SubtreeBufferViewAvailability>(&availabilityView);
const size_t byteIndex = size_t(availabilityBitIndex / 8);
const uint64_t byteIndex = availabilityBitIndex / 8;
if (byteIndex >= bufferViewAvailability->view.size()) {
return false;
}
@ -541,7 +541,7 @@ void SubtreeAvailability::setAvailableUsingBufferView(
const SubtreeBufferViewAvailability* pBufferViewAvailability =
std::get_if<SubtreeBufferViewAvailability>(&availabilityView);
const size_t byteIndex = size_t(availabilityBitIndex / 8);
const uint64_t byteIndex = availabilityBitIndex / 8;
if (byteIndex >= pBufferViewAvailability->view.size()) {
// Attempting to set an invalid tile. Assert, but otherwise ignore it.
CESIUM_ASSERT(false);

View File

@ -67,8 +67,8 @@ void markTileAvailableForQuadtree(
uint64_t availabilityBitIndex =
numOfTilesFromRootToParentLevel +
libmorton::morton2D_64_encode(tileID.x, tileID.y);
const size_t byteIndex = size_t(availabilityBitIndex / 8);
const size_t bitIndex = size_t(availabilityBitIndex % 8);
const uint64_t byteIndex = availabilityBitIndex / 8;
const uint64_t bitIndex = availabilityBitIndex % 8;
available[byteIndex] |= std::byte(1 << bitIndex);
}
@ -79,7 +79,7 @@ void markSubtreeAvailableForQuadtree(
libmorton::morton2D_64_encode(tileID.x, tileID.y);
const uint64_t byteIndex = availabilityBitIndex / 8;
const uint64_t bitIndex = availabilityBitIndex % 8;
available[(size_t)byteIndex] |= std::byte(1 << bitIndex);
available[byteIndex] |= std::byte(1 << bitIndex);
}
using SubtreeContentInput =
@ -140,17 +140,17 @@ SubtreeContent createSubtreeContent(
: 0;
std::vector<std::byte> availabilityBuffer(
size_t(bufferSize + bufferSize + subtreeBufferSize));
bufferSize + bufferSize + subtreeBufferSize);
std::span<std::byte> contentAvailabilityBuffer(
availabilityBuffer.data(),
size_t(bufferSize));
bufferSize);
std::span<std::byte> tileAvailabilityBuffer(
availabilityBuffer.data() + bufferSize,
size_t(bufferSize));
bufferSize);
std::span<std::byte> subtreeAvailabilityBuffer(
availabilityBuffer.data() + bufferSize + bufferSize,
size_t(subtreeBufferSize));
subtreeBufferSize);
SubtreeAvailability::AvailabilityView tileAvailability = std::visit(
GetAvailabilityView{tileAvailabilityBuffer, false},
@ -486,9 +486,9 @@ TEST_CASE("Test SubtreeAvailability methods") {
subtree.bufferViews[1].buffer = 1;
subtree.bufferViews[2].buffer = 2;
contentAvailabilityBuffer.resize(size_t(bufferSize));
tileAvailabilityBuffer.resize(size_t(bufferSize));
subtreeAvailabilityBuffer.resize(size_t(subtreeBufferSize));
contentAvailabilityBuffer.resize(bufferSize);
tileAvailabilityBuffer.resize(bufferSize);
subtreeAvailabilityBuffer.resize(subtreeBufferSize);
subtree.buffers[0].byteLength = subtree.bufferViews[0].byteLength =
int64_t(bufferSize);
@ -622,18 +622,18 @@ TEST_CASE("Test parsing subtree format") {
subtreeHeader.jsonByteLength = subtreeJsonBuffer.GetSize();
subtreeHeader.binaryByteLength = subtreeBuffers.buffers.size();
std::vector<std::byte> buffer(size_t(
std::vector<std::byte> buffer(
sizeof(subtreeHeader) + subtreeHeader.jsonByteLength +
subtreeHeader.binaryByteLength));
subtreeHeader.binaryByteLength);
std::memcpy(buffer.data(), &subtreeHeader, sizeof(subtreeHeader));
std::memcpy(
buffer.data() + sizeof(subtreeHeader),
subtreeJsonBuffer.GetString(),
size_t(subtreeHeader.jsonByteLength));
subtreeHeader.jsonByteLength);
std::memcpy(
buffer.data() + sizeof(subtreeHeader) + subtreeHeader.jsonByteLength,
subtreeBuffers.buffers.data(),
size_t(subtreeHeader.binaryByteLength));
subtreeHeader.binaryByteLength);
// mock the request
auto pMockResponse = std::make_unique<SimpleAssetResponse>(
@ -711,18 +711,18 @@ TEST_CASE("Test parsing subtree format") {
subtreeHeader.jsonByteLength = subtreeJsonBuffer.GetSize();
subtreeHeader.binaryByteLength = subtreeContent.buffers.size();
std::vector<std::byte> buffer(size_t(
std::vector<std::byte> buffer(
sizeof(subtreeHeader) + subtreeHeader.jsonByteLength +
subtreeHeader.binaryByteLength));
subtreeHeader.binaryByteLength);
std::memcpy(buffer.data(), &subtreeHeader, sizeof(subtreeHeader));
std::memcpy(
buffer.data() + sizeof(subtreeHeader),
subtreeJsonBuffer.GetString(),
size_t(subtreeHeader.jsonByteLength));
subtreeHeader.jsonByteLength);
std::memcpy(
buffer.data() + sizeof(subtreeHeader) + subtreeHeader.jsonByteLength,
subtreeContent.buffers.data(),
size_t(subtreeHeader.binaryByteLength));
subtreeHeader.binaryByteLength);
// mock the request
auto pMockResponse = std::make_unique<SimpleAssetResponse>(
@ -799,14 +799,14 @@ TEST_CASE("Test parsing subtree format") {
subtreeHeader.jsonByteLength = subtreeJsonBuffer.GetSize();
subtreeHeader.binaryByteLength = 0;
std::vector<std::byte> buffer(size_t(
std::vector<std::byte> buffer(
sizeof(subtreeHeader) + subtreeHeader.jsonByteLength +
subtreeHeader.binaryByteLength));
subtreeHeader.binaryByteLength);
std::memcpy(buffer.data(), &subtreeHeader, sizeof(subtreeHeader));
std::memcpy(
buffer.data() + sizeof(subtreeHeader),
subtreeJsonBuffer.GetString(),
size_t(subtreeHeader.jsonByteLength));
subtreeHeader.jsonByteLength);
// mock the request
auto pMockResponse = std::make_unique<SimpleAssetResponse>(

View File

@ -165,12 +165,12 @@ Future<ReadJsonResult<Subtree>> SubtreeFileReader::loadBinary(
}
ReadJsonResult<Subtree> result = this->_reader.readFromJson(
data.subspan(sizeof(SubtreeHeader), size_t(header->jsonByteLength)));
data.subspan(sizeof(SubtreeHeader), header->jsonByteLength));
if (result.value) {
std::span<const std::byte> binaryChunk = data.subspan(
sizeof(SubtreeHeader) + size_t(header->jsonByteLength),
size_t(header->binaryByteLength));
sizeof(SubtreeHeader) + header->jsonByteLength,
header->binaryByteLength);
if (binaryChunk.size() > 0) {
if (result.value->buffers.empty()) {
@ -207,7 +207,7 @@ Future<ReadJsonResult<Subtree>> SubtreeFileReader::loadBinary(
buffer.cesium.data = std::vector<std::byte>(
binaryChunk.begin(),
binaryChunk.begin() + ptrdiff_t(buffer.byteLength));
binaryChunk.begin() + buffer.byteLength);
}
}

View File

@ -52,7 +52,7 @@ target_link_libraries(Cesium3DTilesSelection
CesiumQuantizedMeshTerrain
CesiumRasterOverlays
CesiumUtility
spdlog::spdlog
spdlog::spdlog spdlog::spdlog_header_only
# PRIVATE
libmorton::libmorton
draco::draco

View File

@ -40,7 +40,7 @@ cesium_target_include_directories(
target_link_libraries(CesiumAsync
PUBLIC
CesiumUtility
spdlog::spdlog
spdlog::spdlog spdlog::spdlog_header_only
Async++
PRIVATE
unofficial::sqlite3::sqlite3

View File

@ -44,12 +44,6 @@ target_link_libraries(CesiumClientCommon
PRIVATE
picosha2::picosha2
modp_b64::modp_b64
httplib::httplib
OpenSSL::Crypto
)
if (NOT CESIUM_TARGET_WASM)
target_link_libraries(CesiumClientCommon
PRIVATE
httplib::httplib
)
endif()

View File

@ -13,6 +13,7 @@
#include <CesiumUtility/joinToString.h>
#include <fmt/format.h>
#include <httplib.h>
#include <modp_b64.h>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
@ -33,13 +34,6 @@
#include <utility>
#include <vector>
// Using httplib for the internal HTTP server to receive the OAuth2 redirect URI
// is certainly not going to work on the web. And cpp-httplib only supports
// 64-bit platforms, so we can't even build it for 32-bit emscripten targets.
#ifndef __EMSCRIPTEN__
#include <httplib.h>
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
@ -65,7 +59,6 @@ using namespace CesiumUtility;
namespace CesiumClientCommon {
namespace {
#ifndef __EMSCRIPTEN__
std::string encodeBase64(const std::vector<uint8_t>& bytes) {
const size_t count = modp_b64_encode_len(bytes.size());
std::string result(count, 0);
@ -79,7 +72,7 @@ std::string encodeBase64(const std::vector<uint8_t>& bytes) {
// in [RFC7636 Appendix A](https://tools.ietf.org/html/rfc7636#appendix-A)
const size_t firstPaddingIndex = result.find('=');
if (firstPaddingIndex != std::string::npos) {
result.erase(result.begin() + ptrdiff_t(firstPaddingIndex), result.end());
result.erase(result.begin() + int64_t(firstPaddingIndex), result.end());
}
std::replace(result.begin(), result.end(), '+', '-');
std::replace(result.begin(), result.end(), '/', '_');
@ -177,28 +170,17 @@ std::string createAuthorizationErrorHtml(
exception.what(),
applicationName);
}
#endif // #ifndef __EMSCRIPTEN__
} // namespace
CesiumAsync::Future<Result<OAuth2TokenResponse>> OAuth2PKCE::authorize(
const CesiumAsync::AsyncSystem& asyncSystem,
[[maybe_unused]] const std::shared_ptr<CesiumAsync::IAssetAccessor>&
pAssetAccessor,
[[maybe_unused]] const std::string& friendlyApplicationName,
[[maybe_unused]] const OAuth2ClientOptions& clientOptions,
[[maybe_unused]] const std::vector<std::string>& scopes,
[[maybe_unused]] std::function<void(const std::string&)>&& openUrlCallback,
[[maybe_unused]] const std::string& tokenEndpointUrl,
[[maybe_unused]] const std::string& authorizeBaseUrl) {
#ifdef __EMSCRIPTEN__
// Currently we just fail the authorization attempt in Emscripten / web
// builds. In theory, we can do a more web-oriented authorization flow here
// instead.
return asyncSystem.createResolvedFuture<Result<OAuth2TokenResponse>>(
Result<OAuth2TokenResponse>(
ErrorList::error("OAuth2 PKCE authorization is not supported in "
"Emscripten / WebAssembly builds.")));
#else // #ifdef __EMSCRIPTEN__
const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
const std::string& friendlyApplicationName,
const OAuth2ClientOptions& clientOptions,
const std::vector<std::string>& scopes,
std::function<void(const std::string&)>&& openUrlCallback,
const std::string& tokenEndpointUrl,
const std::string& authorizeBaseUrl) {
auto promise = asyncSystem.createPromise<Result<OAuth2TokenResponse>>();
std::shared_ptr<httplib::Server> pServer =
@ -350,7 +332,6 @@ CesiumAsync::Future<Result<OAuth2TokenResponse>> OAuth2PKCE::authorize(
openUrlCallback(authorizeUrl);
return promise.getFuture();
#endif // #ifdef __EMSCRIPTEN__ #else
}
CesiumAsync::Future<Result<OAuth2TokenResponse>>

View File

@ -2823,7 +2823,7 @@ private:
}
uint64_t totalLength = stringOffsets.back();
result.data.resize(size_t(totalLength));
result.data.resize(totalLength);
for (size_t i = 0; i < strings.size(); ++i) {
std::memcpy(
result.data.data() + stringOffsets[i],

View File

@ -44,7 +44,6 @@
#include <glm/ext/quaternion_double.hpp>
#include <glm/ext/vector_float3.hpp>
#include <glm/geometric.hpp>
#include <glm/gtc/quaternion.hpp> // NOLINT(misc-include-cleaner)
#include <glm/gtx/norm.hpp>
// Despite what clang-tidy will say, we *do* actually need this include or we'll
// get a "missing mat4_cast" error.
@ -413,7 +412,7 @@ ErrorList Model::merge(Model&& rhs) {
std::copy(
pRhsDefaultScene->nodes.begin(),
pRhsDefaultScene->nodes.end(),
newScene.nodes.begin() + ptrdiff_t(originalNodeCount));
newScene.nodes.begin() + int64_t(originalNodeCount));
// No need to update indices because they've already been updated when
// we copied them from rhs to this.

View File

@ -28,7 +28,7 @@ template <typename T>
PropertyViewStatusType checkOffsetsBuffer(
const std::span<const std::byte>& offsetBuffer,
size_t valueBufferSize,
uint64_t instanceCount,
size_t instanceCount,
bool checkBitSize,
PropertyViewStatusType offsetsNotSortedError,
PropertyViewStatusType offsetOutOfBoundsError) noexcept {

View File

@ -50,7 +50,6 @@
#include <algorithm>
#include <array>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
@ -1159,8 +1158,8 @@ void deleteBufferRange(
// Actually remove the bytes from the buffer.
pBuffer->byteLength -= bytesToRemove;
pBuffer->cesium.data.erase(
pBuffer->cesium.data.begin() + ptrdiff_t(start),
pBuffer->cesium.data.begin() + ptrdiff_t(end));
pBuffer->cesium.data.begin() + start,
pBuffer->cesium.data.begin() + end);
}
} // namespace

View File

@ -63,20 +63,6 @@ target_link_libraries(CesiumGltfReader
modp_b64::modp_b64
KTX::ktx
spz::spz
WebP::webp
WebP::webpdecoder
WebP::webp WebP::webpdecoder
$<IF:$<TARGET_EXISTS:libjpeg-turbo::turbojpeg>,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static>
)
if(CESIUM_DISABLE_LIBJPEG_TURBO)
target_compile_definitions(
CesiumGltfReader
PRIVATE
CESIUM_DISABLE_LIBJPEG_TURBO
)
else()
target_link_libraries(
CesiumGltfReader
PRIVATE
$<IF:$<TARGET_EXISTS:libjpeg-turbo::turbojpeg>,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static>
)
endif()

View File

@ -246,7 +246,7 @@ GltfReaderResult readBinaryGltf(
buffer.cesium.data = std::vector<std::byte>(
binaryChunk.begin(),
binaryChunk.begin() + (ptrdiff_t)buffer.byteLength);
binaryChunk.begin() + buffer.byteLength);
}
return result;

View File

@ -5,6 +5,7 @@
#include <CesiumUtility/Tracing.h>
#include <ktx.h>
#include <turbojpeg.h>
#include <webp/decode.h>
#include <algorithm>
@ -27,10 +28,6 @@
#define STB_IMAGE_RESIZE_STATIC
#include <stb_image_resize2.h>
#ifndef CESIUM_DISABLE_LIBJPEG_TURBO
#include <turbojpeg.h>
#endif
namespace CesiumGltfReader {
using namespace CesiumGltf;
@ -290,7 +287,6 @@ ImageReaderResult ImageDecoder::readImage(
}
{
#ifndef CESIUM_DISABLE_LIBJPEG_TURBO
tjhandle tjInstance = tjInitDecompress();
int inSubsamp, inColorspace;
if (!tjDecompressHeader3(
@ -320,9 +316,7 @@ ImageReaderResult ImageDecoder::readImage(
result.errors.emplace_back("Unable to decode JPEG");
result.pImage = nullptr;
}
} else
#endif // !CESIUM_DISABLE_LIBJPEG_TURBO
{
} else {
CESIUM_TRACE("Decode PNG");
image.bytesPerChannel = 1;
image.channels = 4;
@ -355,9 +349,7 @@ ImageReaderResult ImageDecoder::readImage(
result.errors.emplace_back(stbi_failure_reason());
}
}
#ifndef CESIUM_DISABLE_LIBJPEG_TURBO
tjDestroy(tjInstance);
#endif
}
return result;
}

View File

@ -76,7 +76,7 @@ std::unique_ptr<draco::Mesh> decodeBufferViewToDracoMesh(
const std::span<const std::byte> data(
buffer.cesium.data.data() + bufferView.byteOffset,
static_cast<size_t>(bufferView.byteLength));
static_cast<uint64_t>(bufferView.byteLength));
draco::DecoderBuffer decodeBuffer;
decodeBuffer.Init(reinterpret_cast<const char*>(data.data()), data.size());

View File

@ -613,7 +613,6 @@ TEST_CASE("Writes glb with binaryChunkByteAlignment of 8") {
REQUIRE(glbBytesExtraPadding.size() == 88);
}
#ifndef __EMSCRIPTEN__
TEST_CASE("Reports an error if asked to write a GLB larger than 4GB") {
CesiumGltf::Model model;
model.asset.version = "2.0";
@ -629,4 +628,3 @@ TEST_CASE("Reports an error if asked to write a GLB larger than 4GB") {
REQUIRE(!result.errors.empty());
CHECK(result.gltfBytes.empty());
}
#endif // __EMSCRIPTEN__

View File

@ -23,7 +23,7 @@ using namespace CesiumNativeTests;
using namespace CesiumUtility;
namespace {
const std::string REDIRECT_PATH = "/dummy/auth/path";
const std::string& REDIRECT_PATH = "/dummy/auth/path";
const int REDIRECT_PORT = 49013;
std::shared_ptr<Connection>
@ -169,4 +169,4 @@ TEST_CASE("CesiumITwinClient::Connection::geospatialFeatureCollections") {
collection.storageCrs ==
"https://www.opengis.net/def/crs/EPSG/0/32615");
}
}
}

View File

@ -38,14 +38,6 @@ cesium_glob_files(test_headers
)
set(test_include_directories ${CMAKE_CURRENT_LIST_DIR}/include)
if(CESIUM_TARGET_WASM)
target_link_options(
cesium-native-tests
PRIVATE
"-sEXIT_RUNTIME=1"
)
endif()
# Iterate through all targets, extracting their private sources and test sources / test headers
foreach(target ${cesium_native_targets})
get_target_property(target_test_sources ${target} TEST_SOURCES)
@ -83,41 +75,6 @@ foreach(target ${cesium_native_targets})
endif()
endforeach()
if(CESIUM_TARGET_WASM)
file(GLOB directories_list LIST_DIRECTORIES true "${CMAKE_SOURCE_DIR}/Cesium*")
set(FILE_PACKAGER_ARGS "")
set(TEST_DATA_FILES "")
foreach(dir ${directories_list})
if(IS_DIRECTORY ${dir}/test/data)
list(APPEND FILE_PACKAGER_ARGS "--embed" "${dir}/test/data")
file(GLOB_RECURSE data_files "${dir}/test/data/*")
list(APPEND TEST_DATA_FILES ${data_files})
endif()
endforeach()
list(APPEND FILE_PACKAGER_ARGS "--embed" "${CMAKE_SOURCE_DIR}/data")
if(CESIUM_WASM64)
list(APPEND FILE_PACKAGER_ARGS "--wasm64")
endif()
set(CESIUM_NATIVE_TESTS_DATA_OBJ ${CMAKE_CURRENT_BINARY_DIR}/cesium-native-tests-data.o)
add_custom_command(
COMMENT "Generating test data object file"
OUTPUT ${CESIUM_NATIVE_TESTS_DATA_OBJ}
COMMAND ${EMSCRIPTEN_ROOT_PATH}/tools/file_packager none.data ${FILE_PACKAGER_ARGS} --obj-output=${CESIUM_NATIVE_TESTS_DATA_OBJ}
VERBATIM
DEPENDS ${TEST_DATA_FILES}
)
target_sources(
cesium-native-tests
PRIVATE
${CESIUM_NATIVE_TESTS_DATA_OBJ}
)
endif()
target_sources(
cesium-native-tests
PRIVATE
@ -142,12 +99,9 @@ PRIVATE
target_compile_definitions(cesium-native-tests
PRIVATE
CESIUM_NATIVE_DATA_DIR=\"${CMAKE_SOURCE_DIR}/data\"
CESIUM_NATIVE_DATA_DIR=\"${CMAKE_CURRENT_LIST_DIR}/../data\"
)
include(CTest)
include(doctest)
if(NOT CESIUM_TARGET_WASM)
# doctest_discover_tests can't handle the target being an html file, so we just avoid it on a wasm build
doctest_discover_tests(cesium-native-tests)
endif()
doctest_discover_tests(cesium-native-tests)

View File

@ -43,10 +43,10 @@ std::unique_ptr<SimpleAssetResponse> readFileUri(const std::string& uri) {
if (!file) {
return response(404);
}
std::streamoff size = file.tellg();
std::streamsize size = file.tellg();
file.seekg(0, std::ios::beg);
result.resize(size_t(size));
file.read(reinterpret_cast<char*>(result.data()), std::streamsize(size));
result.resize(static_cast<size_t>(size));
file.read(reinterpret_cast<char*>(result.data()), size);
if (!file) {
return response(503);
} else {

View File

@ -12,11 +12,11 @@ std::vector<std::byte> readFile(const std::filesystem::path& fileName) {
std::ifstream file(fileName, std::ios::binary | std::ios::ate);
REQUIRE(file);
std::streamoff size = file.tellg();
std::streamsize size = file.tellg();
file.seekg(0, std::ios::beg);
std::vector<std::byte> buffer{size_t(size)};
file.read(reinterpret_cast<char*>(buffer.data()), std::streamsize(size));
std::vector<std::byte> buffer(static_cast<size_t>(size));
file.read(reinterpret_cast<char*>(buffer.data()), size);
return buffer;
}

View File

@ -506,7 +506,7 @@ void addSkirts(
westEdgeIndices.begin(),
westEdgeIndices.end(),
sortEdgeIndices.begin(),
sortEdgeIndices.begin() + ptrdiff_t(westVertexCount),
sortEdgeIndices.begin() + westVertexCount,
[&uvsAndHeights](auto lhs, auto rhs) noexcept {
return uvsAndHeights[lhs].y < uvsAndHeights[rhs].y;
});
@ -539,7 +539,7 @@ void addSkirts(
southEdgeIndices.begin(),
southEdgeIndices.end(),
sortEdgeIndices.begin(),
sortEdgeIndices.begin() + ptrdiff_t(southVertexCount),
sortEdgeIndices.begin() + southVertexCount,
[&uvsAndHeights](auto lhs, auto rhs) noexcept {
return uvsAndHeights[lhs].x > uvsAndHeights[rhs].x;
});
@ -572,7 +572,7 @@ void addSkirts(
eastEdgeIndices.begin(),
eastEdgeIndices.end(),
sortEdgeIndices.begin(),
sortEdgeIndices.begin() + ptrdiff_t(eastVertexCount),
sortEdgeIndices.begin() + eastVertexCount,
[&uvsAndHeights](auto lhs, auto rhs) noexcept {
return uvsAndHeights[lhs].y > uvsAndHeights[rhs].y;
});
@ -605,7 +605,7 @@ void addSkirts(
northEdgeIndices.begin(),
northEdgeIndices.end(),
sortEdgeIndices.begin(),
sortEdgeIndices.begin() + ptrdiff_t(northVertexCount),
sortEdgeIndices.begin() + northVertexCount,
[&uvsAndHeights](auto lhs, auto rhs) noexcept {
return uvsAndHeights[lhs].x < uvsAndHeights[rhs].x;
});
@ -754,10 +754,11 @@ QuantizedMeshMetadataResult processMetadata(
// decode position without skirt, but preallocate position buffer to include
// skirt as well
std::vector<std::byte> outputPositionsBuffer(
size_t((vertexCount + skirtVertexCount) * 3) * sizeof(float));
static_cast<uint64_t>((vertexCount + skirtVertexCount) * 3) *
sizeof(float));
std::span<float> outputPositions(
reinterpret_cast<float*>(outputPositionsBuffer.data()),
size_t((vertexCount + skirtVertexCount) * 3));
static_cast<size_t>((vertexCount + skirtVertexCount) * 3));
size_t positionOutputIndex = 0;
const glm::dvec3 center(

View File

@ -51,7 +51,6 @@ target_link_libraries(CesiumRasterOverlays
CesiumUtility
CesiumVectorData
nonstd::expected-lite
spdlog::spdlog
PRIVATE
tinyxml2::tinyxml2
)

View File

@ -591,7 +591,7 @@ RasterOverlayUtilities::upsampleGltfForRasterOverlays(
// We're assuming here that nothing references primitives by index, so we
// can remove them without any drama.
if (!keep) {
mesh.primitives.erase(mesh.primitives.begin() + ptrdiff_t(i));
mesh.primitives.erase(mesh.primitives.begin() + int64_t(i));
--i;
}
containsPrimitives |= !mesh.primitives.empty();

View File

@ -1,7 +1,6 @@
#pragma once
#include <cstddef>
#include <cstdint>
namespace CesiumUtility {
@ -18,7 +17,7 @@ struct Hash {
* @param second The second hash value.
* @return A new hash value which is a combination of the two.
*/
static size_t combine(size_t first, size_t second);
static std::size_t combine(std::size_t first, std::size_t second);
};
} // namespace CesiumUtility

View File

@ -1,8 +1,6 @@
#include <CesiumUtility/Hash.h>
#include <climits>
#include <cstddef>
#include <cstdint>
namespace CesiumUtility {
@ -61,50 +59,23 @@ namespace CesiumUtility {
// (https://mostlymangling.blogspot.com/2019/12/stronger-better-morer-moremur-better.html)
namespace {
template <size_t Bits> struct hash_mix_impl;
inline std::size_t mix(std::size_t x) {
std::size_t const m = 0xe9846af9b1a615d;
template <> struct hash_mix_impl<64> {
inline static uint64_t fn(uint64_t x) {
uint64_t const m = 0xe9846af9b1a615d;
x ^= x >> 32;
x *= m;
x ^= x >> 32;
x *= m;
x ^= x >> 28;
x ^= x >> 32;
x *= m;
x ^= x >> 32;
x *= m;
x ^= x >> 28;
return x;
}
};
// This function is adapted from Boost v1.86.0, `hash_mix_impl<32>` function.
//
// hash_mix for 32 bit size_t
//
// We use the "best xmxmx" implementation from
// https://github.com/skeeto/hash-prospector/issues/19
template <> struct hash_mix_impl<32> {
inline static uint32_t fn(uint32_t x) {
uint32_t const m1 = 0x21f0aaad;
uint32_t const m2 = 0x735a2d97;
x ^= x >> 16;
x *= m1;
x ^= x >> 15;
x *= m2;
x ^= x >> 15;
return x;
}
};
return x;
}
} // namespace
// This function is adapted from Boost's `hash_combine`.
size_t Hash::combine(size_t first, size_t second) {
// This will truncate bits on 32-bit builds.
return hash_mix_impl<sizeof(size_t) * CHAR_BIT>::fn(
first + size_t(0x9e3779b9) + second);
std::size_t Hash::combine(std::size_t first, std::size_t second) {
return mix(first + 0x9e3779b9 + second);
}
} // namespace CesiumUtility

View File

@ -44,7 +44,7 @@ cesium_target_include_directories(
${CMAKE_CURRENT_LIST_DIR}/src
)
if(NOT CESIUM_TARGET_WASM AND NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
if(NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
set(CESIUM_VECTOR_DATA_ASMJIT_DEPENDENCY asmjit::asmjit)
endif()

View File

@ -94,7 +94,7 @@ VectorRasterizer::VectorRasterizer(
imageHeight,
BL_FORMAT_PRGB32,
reinterpret_cast<void*>(pData),
intptr_t(imageWidth) * intptr_t(this->_imageAsset->channels));
(int64_t)imageWidth * (int64_t)this->_imageAsset->channels);
this->_context.begin(this->_image);
// Initialize the image as all transparent.

View File

@ -3,14 +3,3 @@
# else()
# add_compile_options(-Werror -Wall -Wextra -Wconversion -Wpedantic -Wshadow -Wsign-conversion)
# endif()
if(CESIUM_TARGET_WASM)
add_compile_options(-pthread -msimd128 -mnontrapping-fptoint -mbulk-memory -fwasm-exceptions -sSUPPORT_LONGJMP=wasm)
add_link_options(-pthread -sALLOW_MEMORY_GROWTH=1 -sPTHREAD_POOL_SIZE=4 -sMAXIMUM_MEMORY=4294967296 -sMIN_NODE_VERSION=200000 -sINITIAL_MEMORY=268435456 -sSTACK_SIZE=1048576 -fwasm-exceptions -mbulk-memory -mnontrapping-fptoint -msse4.2 -sWASM_BIGINT -sSUPPORT_LONGJMP=wasm -sFORCE_FILESYSTEM -sPROXY_TO_PTHREAD)
add_link_options($<$<CONFIG:Debug>:-gsource-map>)
if (CESIUM_WASM64)
add_compile_options(-sMEMORY64=1)
add_link_options(-sMEMORY64=1)
endif()
endif()

View File

@ -1,6 +1,4 @@
if(CESIUM_TARGET_WASM)
set(DETECTED_VCPKG_TRIPLET "wasm32-emscripten")
elseif(ANDROID)
if(ANDROID)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(DETECTED_VCPKG_TRIPLET "x64-android")
else()

View File

@ -161,7 +161,7 @@ macro(EZVCPKG_BOOTSTRAP)
endmacro()
macro(EZVCPKG_BUILD)
set(INSTALL_COMMAND "${EZVCPKG_EXE}" --allow-unsupported --vcpkg-root "${EZVCPKG_DIR}" install --triplet ${VCPKG_TRIPLET})
set(INSTALL_COMMAND "${EZVCPKG_EXE}" --vcpkg-root "${EZVCPKG_DIR}" install --triplet ${VCPKG_TRIPLET})
if (DEFINED VCPKG_OVERLAY_PORTS)
if (CMAKE_HOST_WIN32)

View File

@ -9,7 +9,7 @@ find_library(modp_b64_DEBUG_LIBRARIES
# 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$")
list(FILTER CMAKE_PREFIX_PATH INCLUDE REGEX "/debug")
find_library(modp_b64_DEBUG_LIBRARIES
NAMES
modpbase64
@ -18,7 +18,7 @@ find_library(modp_b64_DEBUG_LIBRARIES
set(CMAKE_PREFIX_PATH ${modpbase64SavePrefixPath})
set(modpbase64SavePrefixPath ${CMAKE_PREFIX_PATH})
list(FILTER CMAKE_PREFIX_PATH EXCLUDE REGEX "/debug$")
list(FILTER CMAKE_PREFIX_PATH EXCLUDE REGEX "/debug")
find_library(modp_b64_LIBRARIES NAMES modpbase64 libmodpbase64)
set(CMAKE_PREFIX_PATH ${modpbase64SavePrefixPath})

View File

@ -1,77 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO kring/KTX-Software # KhronosGroup/KTX-Software
REF "v${VERSION}"
SHA512 fa20457fc0f0b117f4d6b406baa338091a85bcc46f60ca440dcd483388c67c550c81da3618d70d748e12850e32e0c1d82e9e8dc8522849074f40cc455723ac97
HEAD_REF master
)
file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h")
file(REMOVE_RECURSE "${SOURCE_PATH}/external/basisu/zstd")
file(REMOVE_RECURSE "${SOURCE_PATH}/lib/basisu/zstd")
vcpkg_list(SET OPTIONS)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_acquire_msys(MSYS_ROOT
PACKAGES
bash
DIRECT_PACKAGES
# Required for "getopt"
"https://mirror.msys2.org/msys/x86_64/util-linux-2.40.2-2-x86_64.pkg.tar.zst"
bf45b16cd470f8d82a9fe03842a09da2e6c60393c11f4be0bab354655072c7a461afc015b9c07f9f5c87a0e382cd867e4f079ede0d42f1589aa99ebbb3f76309
# Required for "dos2unix"
"https://mirror.msys2.org/msys/x86_64/dos2unix-7.5.3-1-x86_64.pkg.tar.zst"
ab5f88b10577b1d195d9b7b74c1a46d9e715c5fac21e8da3d590f345294190ed1ce7fde37d765f51ba01c2f6706c077123d4c69cfd0981729fdcb3d30f85bc6d
)
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
vcpkg_list(APPEND OPTIONS "-DBASH_EXECUTABLE=${MSYS_ROOT}/usr/bin/bash.exe")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools KTX_FEATURE_TOOLS
vulkan LIBKTX_FEATURE_VK_UPLOAD
js KTX_FEATURE_JS
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DKTX_GIT_VERSION_FULL=v${VERSION}
-DKTX_FEATURE_TESTS=OFF
-DKTX_FEATURE_LOADTEST_APPS=OFF
-DKTX_FEATURE_EMBEDDED_ZSTD=OFF
-DKTX_FEATURE_EMBEDDED_TOOLS_DEPENDENCIES=OFF
-DLIBKTX_FEATURE_APPLE_FRAMEWORK=OFF
${FEATURE_OPTIONS}
${OPTIONS}
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")

View File

@ -1,46 +0,0 @@
{
"name": "ktx",
"version-semver": "4.4.2-plus-vcpkg-patches",
"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 & !uwp",
"dependencies": [
"cxxopts",
"fmt"
]
},
"vulkan": {
"description": "Build Vulkan support",
"supports": "!emscripten"
},
"js": {
"description": "Build JavaScript interface wrappers",
"supports": "emscripten"
}
},
"default-features": [
{
"name": "js",
"platform": "emscripten"
}
]
}

View File

@ -1,29 +0,0 @@
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED EMSCRIPTEN_ROOT EMSDK PATH EM_CONFIG)
if(NOT DEFINED ENV{EMSCRIPTEN_ROOT})
find_path(EMSCRIPTEN_ROOT "emcc")
else()
set(EMSCRIPTEN_ROOT "$ENV{EMSCRIPTEN_ROOT}")
endif()
if(NOT EMSCRIPTEN_ROOT)
if(NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR "The emcc compiler not found in PATH")
endif()
set(EMSCRIPTEN_ROOT "$ENV{EMSDK}/upstream/emscripten")
endif()
if(NOT EXISTS "${EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
message(FATAL_ERROR "Emscripten.cmake toolchain file not found")
endif()
set(VCPKG_TARGET_ARCHITECTURE wasm32)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Emscripten)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
# These lines are the key difference between this triplet and the wasm32-emscripten that comes with vcpkg.
# They set specific compiler and linker flags needed to use cesium-native on the web, particularly as part of Unity.
set(_configureFlags "-pthread -msimd128 -mnontrapping-fptoint -mbulk-memory -fwasm-exceptions -sSUPPORT_LONGJMP=wasm -DSIZEOF_SIZE_T=4")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DCMAKE_C_FLAGS=${_configureFlags} -DCMAKE_CXX_FLAGS=${_configureFlags} -DCMAKE_EXE_LINKER_FLAGS=${_configureFlags})

View File

@ -1,29 +0,0 @@
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED EMSCRIPTEN_ROOT EMSDK PATH EM_CONFIG)
if(NOT DEFINED ENV{EMSCRIPTEN_ROOT})
find_path(EMSCRIPTEN_ROOT "emcc")
else()
set(EMSCRIPTEN_ROOT "$ENV{EMSCRIPTEN_ROOT}")
endif()
if(NOT EMSCRIPTEN_ROOT)
if(NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR "The emcc compiler not found in PATH")
endif()
set(EMSCRIPTEN_ROOT "$ENV{EMSDK}/upstream/emscripten")
endif()
if(NOT EXISTS "${EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
message(FATAL_ERROR "Emscripten.cmake toolchain file not found")
endif()
set(VCPKG_TARGET_ARCHITECTURE wasm32)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Emscripten)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
# These lines are the key difference between this triplet and the wasm32-emscripten that comes with vcpkg.
# They set specific compiler and linker flags needed to use cesium-native on the web, particularly as part of Unity.
set(_configureFlags "-sMEMORY64=1 -pthread -msimd128 -mnontrapping-fptoint -mbulk-memory -fwasm-exceptions -sSUPPORT_LONGJMP=wasm -DSIZEOF_SIZE_T=8")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DCMAKE_C_FLAGS=${_configureFlags} -DCMAKE_CXX_FLAGS=${_configureFlags} -DCMAKE_EXE_LINKER_FLAGS=${_configureFlags})

View File

@ -1,6 +1,6 @@
{
"name": "cesium-native",
"version": "0.54.0",
"version": "0.53.0",
"description": "Cesium 3D Geospatial for C++",
"main": "index.js",
"directories": {
@ -12,8 +12,7 @@
"generate-gltf": "cd tools/generate-classes && npm run generate-gltf && cd ../.. && npm run format",
"generate-3d-tiles": "cd tools/generate-classes && npm run generate-3d-tiles && cd ../.. && npm run format",
"generate-quantized-mesh-terrain": "cd tools/generate-classes && npm run generate-quantized-mesh-terrain && cd ../.. && npm run format",
"conform-includes": "node tools/conform-includes.js",
"test-wasm": "node tools/test-wasm-server"
"conform-includes": "node tools/conform-includes.js"
},
"repository": {
"type": "git",
@ -32,7 +31,6 @@
"homepage": "https://github.com/CesiumGS/cesium-native#readme",
"devDependencies": {
"clang-format": "^1.5.0",
"doxygen-awesome-css": "https://github.com/jothepro/doxygen-awesome-css#v2.3.4",
"express": "^5.1.0"
"doxygen-awesome-css": "https://github.com/jothepro/doxygen-awesome-css#v2.3.4"
}
}

View File

@ -1,56 +0,0 @@
const express = require("express");
const fs = require("fs");
const app = express();
const port = 3123;
app.use(express.static("./", {
setHeaders: (res, path, stat) => {
res.set("Cross-Origin-Opener-Policy", "same-origin");
res.set("Cross-Origin-Embedder-Policy", "require-corp");
}
}));
const emsdk = process.env.EMSDK;
if (emsdk && emsdk.length > 0) {
console.log(`Using emsdk at: ${emsdk}`);
app.use("/emsdk/emscripten", express.static(`${emsdk}/upstream/emscripten`, {
setHeaders: (res, path, stat) => {
res.set("Cross-Origin-Opener-Policy", "same-origin");
res.set("Cross-Origin-Embedder-Policy", "require-corp");
}
}));
app.use("/emsdk/upstream", express.static(`${emsdk}/upstream`, {
setHeaders: (res, path, stat) => {
res.set("Cross-Origin-Opener-Policy", "same-origin");
res.set("Cross-Origin-Embedder-Policy", "require-corp");
}
}));
} else {
console.log("Not mapping emsdk path because EMSDK environment variable is not set.");
}
const ezvcpkg = process.env.EZVCPKG_BASEDIR;
if (!ezvcpkg || ezvcpkg.length === 0) {
ezvcpkg = `${process.env.HOME ?? ""}/.ezvcpkg`;
}
if (fs.existsSync(ezvcpkg)) {
console.log(`Using ezvcpkg at: ${ezvcpkg}`);
app.use("/ezvcpkg", express.static(ezvcpkg, {
setHeaders: (res, path, stat) => {
res.set("Cross-Origin-Opener-Policy", "same-origin");
res.set("Cross-Origin-Embedder-Policy", "require-corp");
}
}));
} else {
console.log("Not mapping ezvcpkg path because EZVCPKG_BASEDIR environment variable is not set or directory does not exist.");
}
app.listen(port, () => {
console.log(`listening on port ${port}`);
});

View File

@ -1,7 +1,7 @@
{
"default-registry": {
"kind": "git",
"baseline": "afc0a2e01ae104a2474216a2df0e8d78516fd5af",
"baseline": "d80785c4ee1df22a4119a3451452f59e978e06aa",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [

View File

@ -2,10 +2,7 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"asyncplusplus",
{
"name": "curl",
"platform": "!wasm32"
},
"curl",
"doctest",
"expected-lite",
"glm",
@ -27,10 +24,7 @@
"zlib-ng",
"picosha2",
"earcut-hpp",
{
"name": "cpp-httplib",
"platform": "!wasm32"
},
"cpp-httplib",
"libmorton",
"zstd",
{
@ -39,13 +33,13 @@
"features": [
{
"name": "jit",
"platform": "!ios&!wasm32"
"platform": "!ios"
}
]
},
{
"name": "asmjit",
"platform": "!ios&!wasm32"
"platform": "!ios"
},
"spz",
"zlib"