Merge remote-tracking branch 'origin/generated-readers' into tileset-metadata-take-two

This commit is contained in:
Kevin Ring 2023-08-31 09:18:29 +10:00
commit 5637a68f30
19 changed files with 385 additions and 69 deletions

View File

@ -12,6 +12,7 @@
##### Additions :tada:
- Added new constructors to `LocalHorizontalCoordinateSystem` taking ECEF<->Local transformation matrices directly.
- Unknown properties in objects read with a `JsonReader` are now stored in the `unknownProperties` property on `ExtensibleObject` by default. To ignore them, as was done in previous versions, call `setCaptureUnknownProperties` on `JsonReaderOptions`.
- Added `ValueType` type alias to `ArrayJsonHandler`, for consistency with other JSON handlers.
- Added an overload of `JsonReader::readJson` that takes a `rapidjson::Value` instead of a byte buffer. This allows a subtree of a `rapidjson::Document` to be easily and efficiently converted into statically-typed classes via `IJsonHandler`.
@ -21,11 +22,12 @@
- Added `loadMetadata` and `getMetadata` methods to `Cesium3DTilesSelection::Tileset`. They provide access to `TilesetMetadata` instance representing the metadata associated with a tileset.json.
- Added `MetadataQuery` class to make it easier to find properties with specific semantics in `TilesetMetadata`.
### v0.27.0 - 2023-09-01
##### Fixes :wrench:
- Fixed a bug where an empty error message would get propagated to a tileset's `loadErrorCallback`.
- Fixed several small build script issues to allow cesium-native to be used in Univeral Windows Platform (UWP) applications, such as those that run on Holo Lens 2.
- When KTX transcoding fails, the image will now be fully decompressed instead of returning an error.
- Fixed a bug that could cause higher-detail tiles to continue showing when zooming out quickly on a tileset that uses "additive" refinement.
### v0.26.0 - 2023-08-01

View File

@ -183,7 +183,10 @@ install(TARGETS modp_b64)
install(TARGETS httplib)
install(TARGETS csprng)
# Don't install CSPRNG when building for Universal Windows Platform
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore")
install(TARGETS csprng)
endif()
install(TARGETS GSL)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/extern/GSL/include/gsl TYPE INCLUDE)

View File

@ -517,11 +517,13 @@ static void markTileNonRendered(
TileSelectionState::Result lastResult,
Tile& tile,
ViewUpdateResult& result) {
if (lastResult == TileSelectionState::Result::Rendered) {
if (lastResult == TileSelectionState::Result::Rendered ||
(lastResult == TileSelectionState::Result::Refined &&
tile.getRefine() == TileRefine::Add)) {
result.tilesFadingOut.insert(&tile);
TileRenderContent* pRenderContent = tile.getContent().getRenderContent();
if (pRenderContent) {
pRenderContent->setLodTransitionFadePercentage(0.0f);
result.tilesFadingOut.insert(&tile);
}
}
}
@ -1516,10 +1518,13 @@ Tileset::TraversalDetails Tileset::createTraversalDetailsForSingleTile(
const FrameState& frameState,
const Tile& tile,
const TileSelectionState& lastFrameSelectionState) {
TileSelectionState::Result lastFrameResult =
lastFrameSelectionState.getResult(frameState.lastFrameNumber);
bool isRenderable = tile.isRenderable();
bool wasRenderedLastFrame =
lastFrameSelectionState.getResult(frameState.lastFrameNumber) ==
TileSelectionState::Result::Rendered;
lastFrameResult == TileSelectionState::Result::Rendered ||
(tile.getRefine() == TileRefine::Add &&
lastFrameResult == TileSelectionState::Result::Refined);
TraversalDetails traversalDetails;
traversalDetails.allAreRenderable = isRenderable;

View File

@ -1609,3 +1609,70 @@ TEST_CASE("An unconditionally-refined tile is not rendered") {
runUnconditionallyRefinedTestCase(options);
}
}
TEST_CASE("Additive-refined tiles are added to the tilesFadingOut array") {
Cesium3DTilesSelection::registerAllTileContentTypes();
std::filesystem::path testDataPath = Cesium3DTilesSelection_TEST_DATA_DIR;
testDataPath = testDataPath / "AdditiveThreeLevels";
std::vector<std::string> files{"tileset.json", "content.b3dm"};
std::map<std::string, std::shared_ptr<SimpleAssetRequest>>
mockCompletedRequests;
for (const auto& file : files) {
std::unique_ptr<SimpleAssetResponse> mockCompletedResponse =
std::make_unique<SimpleAssetResponse>(
static_cast<uint16_t>(200),
"doesn't matter",
CesiumAsync::HttpHeaders{},
readFile(testDataPath / file));
mockCompletedRequests.insert(
{file,
std::make_shared<SimpleAssetRequest>(
"GET",
file,
CesiumAsync::HttpHeaders{},
std::move(mockCompletedResponse))});
}
std::shared_ptr<SimpleAssetAccessor> mockAssetAccessor =
std::make_shared<SimpleAssetAccessor>(std::move(mockCompletedRequests));
TilesetExternals tilesetExternals{
mockAssetAccessor,
std::make_shared<SimplePrepareRendererResource>(),
AsyncSystem(std::make_shared<SimpleTaskProcessor>()),
nullptr};
// create tileset and call updateView() to give it a chance to load
Tileset tileset(tilesetExternals, "tileset.json");
initializeTileset(tileset);
// Load until complete
ViewUpdateResult updateResult;
ViewState viewState = zoomToTileset(tileset);
while (tileset.getNumberOfTilesLoaded() == 0 ||
tileset.computeLoadProgress() < 100.0f) {
updateResult = tileset.updateView({viewState});
}
// All three tiles should be rendered.
CHECK(updateResult.tilesToRenderThisFrame.size() == 3);
// Zoom way out
std::optional<Cartographic> position = viewState.getPositionCartographic();
REQUIRE(position);
position->height += 100000;
ViewState zoomedOut = ViewState::create(
Ellipsoid::WGS84.cartographicToCartesian(*position),
viewState.getDirection(),
viewState.getUp(),
viewState.getViewportSize(),
viewState.getHorizontalFieldOfView(),
viewState.getVerticalFieldOfView());
updateResult = tileset.updateView({zoomedOut});
// Only the root tile is visible now, and the other two are fading out.
CHECK(updateResult.tilesToRenderThisFrame.size() == 1);
CHECK(updateResult.tilesFadingOut.size() == 2);
}

View File

@ -0,0 +1,63 @@
{
"asset": {
"version": "1.0",
"tilesetVersion": "1.2.3"
},
"extras": {
"name": "AdditiveThreeLevels"
},
"geometricError": 240,
"root": {
"boundingVolume": {
"region": [
-1.3197209591796106,
0.6988424218,
-1.3196390408203893,
0.6989055782,
0,
88
]
},
"geometricError": 120,
"refine": "ADD",
"content": {
"uri": "content.b3dm"
},
"children": [
{
"boundingVolume": {
"region": [
-1.3197209591796106,
0.6988424218,
-1.3196390408203893,
0.6989055782,
0,
88
]
},
"geometricError": 60,
"content": {
"uri": "content.b3dm"
},
"children": [
{
"boundingVolume": {
"region": [
-1.3197209591796106,
0.6988424218,
-1.3196390408203893,
0.6989055782,
0,
88
]
},
"geometricError": 30,
"content": {
"uri": "content.b3dm"
}
}
]
}
]
}
}

View File

@ -72,6 +72,42 @@ public:
double scaleToMeters = 1.0,
const Ellipsoid& ellipsoid = Ellipsoid::WGS84);
/**
* @brief Create a new coordinate system with a specified transformation to
* the Earth-Centered, Earth-Fixed frame. This is an advanced constructor and
* should be avoided in most cases.
*
* This constructor can be used to save/restore the state of an instance. It
* can also be used to create unusual coordinate systems that can't be created
* by the other constructors, such as coordinate systems where the axes aren't
* aligned with compass directions.
*
* @param localToEcef The transformation matrix from this coordinate system to
* the ECEF frame.
*/
explicit LocalHorizontalCoordinateSystem(const glm::dmat4& localToEcef);
/**
* @brief Create a new coordinate system with the specified transformations
* between the local frame and the Earth-Centered, Earth-Fixed frame. This is
* an advanced constructor and should be avoided in most cases.
*
* This constructor can be used to save/restore the state of an instance. It
* can also be used to create unusual coordinate systems that can't be created
* by the other constructors, such as coordinate systems where the axes aren't
* aligned with compass directions.
*
* @param localToEcef The transformation matrix from this coordinate system to
* the ECEF frame. This must be the inverse of `ecefToLocal` or behavior is
* undefined, but this is not enforced.
* @param ecefToLocal The transformation matrix from the ECEF frame to this
* coordinate system. This must be the inverse of `localToEcef` or behavior is
* undefined, but this is not enforced.
*/
LocalHorizontalCoordinateSystem(
const glm::dmat4& localToEcef,
const glm::dmat4& ecefToLocal);
/**
* @brief Gets the transformation matrix from the local horizontal coordinate
* system managed by this instance to the Earth-Centered, Earth-fixed

View File

@ -86,6 +86,17 @@ LocalHorizontalCoordinateSystem::LocalHorizontalCoordinateSystem(
this->_ecefToLocal = glm::affineInverse(this->_localToEcef);
}
CesiumGeospatial::LocalHorizontalCoordinateSystem::
LocalHorizontalCoordinateSystem(const glm::dmat4& localToEcef)
: _ecefToLocal(glm::affineInverse(localToEcef)),
_localToEcef(localToEcef) {}
CesiumGeospatial::LocalHorizontalCoordinateSystem::
LocalHorizontalCoordinateSystem(
const glm::dmat4& localToEcef,
const glm::dmat4& ecefToLocal)
: _ecefToLocal(ecefToLocal), _localToEcef(localToEcef) {}
glm::dvec3 LocalHorizontalCoordinateSystem::localPositionToEcef(
const glm::dvec3& localPosition) const noexcept {
return glm::dvec3(this->_localToEcef * glm::dvec4(localPosition, 1.0));

View File

@ -610,6 +610,12 @@ ImageReaderResult GltfReader::readImage(
errorCode =
ktxTexture2_TranscodeBasis(pTexture, transcodeTargetFormat_, 0);
if (errorCode != KTX_SUCCESS) {
transcodeTargetFormat_ = KTX_TTF_RGBA32;
transcodeTargetFormat = GpuCompressedPixelFormat::NONE;
errorCode =
ktxTexture2_TranscodeBasis(pTexture, transcodeTargetFormat_, 0);
}
if (errorCode == KTX_SUCCESS) {
image.compressedPixelFormat = transcodeTargetFormat;
image.width = static_cast<int32_t>(pTexture->baseWidth);
@ -686,7 +692,9 @@ ImageReaderResult GltfReader::readImage(
}
result.image.reset();
result.errors.emplace_back("KTX2 loading failed");
result.errors.emplace_back(
"KTX2 loading failed with error: " +
std::string(ktxErrorString(errorCode)));
return result;
} else if (isWebP(data)) {

View File

@ -609,3 +609,56 @@ TEST_CASE("Can correctly interpret mipmaps in KTX2 files") {
}
}
}
TEST_CASE("Can read unknown properties from a glTF") {
const std::string s = R"(
{
"someUnknownProperty": "test",
"asset": {
"unknownInsideKnown": "this works too"
}
}
)";
GltfReaderOptions options;
GltfReader reader;
reader.getOptions().setCaptureUnknownProperties(true);
GltfReaderResult result = reader.readGltf(
gsl::span(reinterpret_cast<const std::byte*>(s.c_str()), s.size()),
options);
REQUIRE(result.model.has_value());
auto unknownIt1 = result.model->unknownProperties.find("someUnknownProperty");
REQUIRE(unknownIt1 != result.model->unknownProperties.end());
CHECK(unknownIt1->second.getStringOrDefault("") == "test");
auto unknownIt2 =
result.model->asset.unknownProperties.find("unknownInsideKnown");
REQUIRE(unknownIt2 != result.model->asset.unknownProperties.end());
CHECK(unknownIt2->second.getStringOrDefault("") == "this works too");
}
TEST_CASE("Ignores unknown properties if requested") {
const std::string s = R"(
{
"someUnknownProperty": "test",
"asset": {
"unknownInsideKnown": "this works too"
}
}
)";
GltfReaderOptions options;
GltfReader reader;
reader.getOptions().setCaptureUnknownProperties(false);
GltfReaderResult result = reader.readGltf(
gsl::span(reinterpret_cast<const std::byte*>(s.c_str()), s.size()),
options);
REQUIRE(result.model.has_value());
CHECK(result.model->unknownProperties.empty());
CHECK(result.model->asset.unknownProperties.empty());
}

View File

@ -39,11 +39,14 @@ target_link_libraries(CesiumIonClient
CesiumAsync
CesiumUtility
PRIVATE
csprng
modp_b64
PicoSHA2
)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore")
target_link_libraries(CesiumIonClient PRIVATE csprng)
endif()
# httplib erroneously does not declare its include a `SYSTEM` include, so
# we must extract its include_directories using this function and manually
# reinclude it as 'SYSTEM'.

View File

@ -1,13 +1,14 @@
#include "CesiumIonClient/Connection.h"
#include "fillWithRandomBytes.h"
#include "parseLinkHeader.h"
#include <CesiumAsync/IAssetResponse.h>
#include <CesiumUtility/JsonHelpers.h>
#include <CesiumUtility/SpanHelper.h>
#include <CesiumUtility/Uri.h>
#include <CesiumUtility/joinToString.h>
#include <duthomhas/csprng.hpp>
#include <httplib.h>
#include <modp_b64.h>
#include <rapidjson/document.h>
@ -114,14 +115,13 @@ std::string createAuthorizationErrorHtml(
std::string redirectUrl =
Uri::resolve("http://127.0.0.1:" + std::to_string(port), redirectPath);
duthomhas::csprng rng;
std::vector<uint8_t> stateBytes(32, 0);
rng(stateBytes);
fillWithRandomBytes(stateBytes);
std::string state = encodeBase64(stateBytes);
std::vector<uint8_t> codeVerifierBytes(32, 0);
rng(codeVerifierBytes);
fillWithRandomBytes(codeVerifierBytes);
std::string codeVerifier = encodeBase64(codeVerifierBytes);

View File

@ -0,0 +1,63 @@
#define _CRT_RAND_S
#include "fillWithRandomBytes.h"
#include <cassert>
// When WINAPI_FAMILY_PARTITION && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
// is true, this is a Univeral Windows Platform build. csprng doesn't work on
// UWP. So we use the Windows-only rand_s function instead.
#ifdef WINAPI_FAMILY
#if WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || \
WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#define IS_UWP 1
#else
#define IS_UWP 0
#endif
#else
#define IS_UWP 0
#endif
#if IS_UWP
#include <cstdlib>
#else
#include <duthomhas/csprng.hpp>
#endif
namespace CesiumIonClient {
void fillWithRandomBytes(const gsl::span<uint8_t>& buffer) {
#if IS_UWP
size_t i = 0;
if (buffer.size() >= sizeof(uint32_t)) {
for (; i <= buffer.size() - sizeof(std::uint32_t);
i += sizeof(std::uint32_t)) {
std::uint32_t r;
if (rand_s(&r) != 0) {
throw std::exception("Failed to generate random numbers.");
}
std::memcpy(&buffer[i], &r, sizeof(std::uint32_t));
}
}
if (i < buffer.size()) {
assert(buffer.size() - i < sizeof(uint32_t));
std::uint32_t extra;
if (rand_s(&extra) != 0) {
throw std::exception("Failed to generate random numbers.");
}
std::uint8_t* pSource = reinterpret_cast<std::uint8_t*>(&extra);
for (; i < buffer.size(); ++i) {
buffer[i] = *pSource;
++pSource;
}
}
#else
duthomhas::csprng rng;
rng(buffer);
#endif
}
} // namespace CesiumIonClient

View File

@ -0,0 +1,9 @@
#pragma once
#include <gsl/span>
namespace CesiumIonClient {
void fillWithRandomBytes(const gsl::span<uint8_t>& buffer);
}

View File

@ -0,0 +1,34 @@
#include "../src/fillWithRandomBytes.h"
#include <catch2/catch.hpp>
using namespace CesiumIonClient;
TEST_CASE("fillWithRandomBytes") {
std::vector<size_t> sizes = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
for (size_t i = 0; i < sizes.size(); ++i) {
size_t size = sizes[i];
// Allocate an extra byte to make sure we don't overflow the buffer
std::vector<uint8_t> buffer(size + 1);
gsl::span<uint8_t> bufferSpan(buffer.data(), size);
fillWithRandomBytes(bufferSpan);
// Make sure the rest are non-zeros
for (size_t j = 0; j < size; ++j) {
// In the unlikely event the value is zero, generate some new random
// values. Repeat this up to 10 times. The chances that the random value
// at a particular position is zero ten times in a row is vanishingly
// small. We don't care if previous positions get a zero on regeneration,
// we're just trying to test for the possibility of an off-by-one error
// making a particular position _always_ zero.
for (int k = 0; buffer[j] == 0 && k < 10; ++k)
fillWithRandomBytes(bufferSpan);
CHECK(buffer[j] != 0);
}
// Make sure the last byte was not overwritten
CHECK(buffer[size] == 0);
}
}

View File

@ -43,7 +43,7 @@ template <typename T> struct ReadJsonResult {
class CESIUMJSONREADER_API JsonReader {
public:
/**
* @brief Reads JSON from a byte buffer into a statically-type class.
* @brief Reads JSON from a byte buffer into a statically-typed class.
*
* @param data The buffer from which to read JSON.
* @param handler The handler to receive the top-level JSON object. This

View File

@ -26,53 +26,6 @@ public:
}
virtual IJsonHandler& getHandler() override { return *this; }
virtual IJsonHandler* readNull() override {
return JsonObjectJsonHandler::readNull();
};
virtual IJsonHandler* readBool(bool b) override {
return JsonObjectJsonHandler::readBool(b);
}
virtual IJsonHandler* readInt32(int32_t i) override {
return JsonObjectJsonHandler::readInt32(i);
}
virtual IJsonHandler* readUint32(uint32_t i) override {
return JsonObjectJsonHandler::readUint32(i);
}
virtual IJsonHandler* readInt64(int64_t i) override {
return JsonObjectJsonHandler::readInt64(i);
}
virtual IJsonHandler* readUint64(uint64_t i) override {
return JsonObjectJsonHandler::readUint64(i);
}
virtual IJsonHandler* readDouble(double d) override {
return JsonObjectJsonHandler::readDouble(d);
}
virtual IJsonHandler* readString(const std::string_view& str) override {
return JsonObjectJsonHandler::readString(str);
}
virtual IJsonHandler* readObjectStart() override {
return JsonObjectJsonHandler::readObjectStart();
}
virtual IJsonHandler* readObjectKey(const std::string_view& str) override {
return JsonObjectJsonHandler::readObjectKey(str);
}
virtual IJsonHandler* readObjectEnd() override {
return JsonObjectJsonHandler::readObjectEnd();
}
virtual IJsonHandler* readArrayStart() override {
return JsonObjectJsonHandler::readArrayStart();
}
virtual IJsonHandler* readArrayEnd() override {
return JsonObjectJsonHandler::readArrayEnd();
}
virtual void reportWarning(
const std::string& warning,
std::vector<std::string>&& context =
std::vector<std::string>()) override {
JsonObjectJsonHandler::reportWarning(warning, std::move(context));
}
};
void JsonReaderOptions::setExtensionState(

18
extern/CMakeLists.txt vendored
View File

@ -112,13 +112,15 @@ add_subdirectory(cpp-httplib)
# CSPRNG's CMake setup is old school, and it really only has one source
# file, so set up a library manually here.
add_library(csprng CSPRNG/source/csprng.cpp)
target_include_directories(
csprng
PUBLIC
CSPRNG/source
)
set(CSPRNG_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/CSPRNG/source/duthomhas/csprng.h ${CMAKE_CURRENT_SOURCE_DIR}/CSPRNG/source/duthomhas/csprng.hpp ${CMAKE_CURRENT_SOURCE_DIR}/CSPRNG/source/duthomhas/is_iterable.hpp)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore")
add_library(csprng CSPRNG/source/csprng.cpp)
target_include_directories(
csprng
SYSTEM PUBLIC
CSPRNG/source
)
set(CSPRNG_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/CSPRNG/source/duthomhas/csprng.h ${CMAKE_CURRENT_SOURCE_DIR}/CSPRNG/source/duthomhas/csprng.hpp ${CMAKE_CURRENT_SOURCE_DIR}/CSPRNG/source/duthomhas/is_iterable.hpp)
endif()
# PicoSHA2 doesn't have CMakeLists.txt at all
add_library(PicoSHA2 INTERFACE)
@ -183,7 +185,7 @@ include(ExternalProject)
ExternalProject_Add(libjpeg-turbo
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/libjpeg-turbo"
PREFIX "libjpeg-turbo"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -B ${CMAKE_CURRENT_BINARY_DIR}/libjpeg-turbo -S ${CMAKE_CURRENT_LIST_DIR}/libjpeg-turbo -DCMAKE_INSTALL_PREFIX=${TJ_INSTALL_PREFIX} -DENABLE_SHARED=0 -DWITH_CRT_DLL=1 -G ${CMAKE_GENERATOR} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SYSTEM_PROCESSOR=$<IF:$<BOOL:${CMAKE_SYSTEM_PROCESSOR}>,${CMAKE_SYSTEM_PROCESSOR},unknown> -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} -DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI} -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX} -DCMAKE_TOOLCHAIN_FILE=${TJ_TOOLCHAIN_FILE} -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -B ${CMAKE_CURRENT_BINARY_DIR}/libjpeg-turbo -S ${CMAKE_CURRENT_LIST_DIR}/libjpeg-turbo -DCMAKE_INSTALL_PREFIX=${TJ_INSTALL_PREFIX} -DENABLE_SHARED=0 -DWITH_CRT_DLL=1 -G ${CMAKE_GENERATOR} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}" -DCMAKE_SYSTEM_PROCESSOR=$<IF:$<BOOL:${CMAKE_SYSTEM_PROCESSOR}>,${CMAKE_SYSTEM_PROCESSOR},unknown> -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} -DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI} -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX} -DCMAKE_TOOLCHAIN_FILE=${TJ_TOOLCHAIN_FILE} -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/libjpeg-turbo --config $<CONFIG> --target install
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${TJ_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}turbojpeg${CMAKE_STATIC_LIBRARY_SUFFIX}

View File

@ -16,6 +16,10 @@ if (PRIVATE_CESIUM_SQLITE)
target_compile_definitions(sqlite3 PUBLIC PRIVATE_CESIUM_SQLITE)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore")
target_compile_definitions(sqlite3 PUBLIC SQLITE_OS_WINRT)
endif()
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sqlite3/sqlite3.h CONTENT "${SQLITE3_HEADER_CONTENTS}")
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sqlite3/sqlite3.c CONTENT "${SQLITE3_SOURCE_CONTENTS}")
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sqlite3/cesium-sqlite3.h INPUT ${CMAKE_CURRENT_SOURCE_DIR}/cesium-sqlite3.h)