react-native-cesium 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +12 -0
- package/README.md +308 -0
- package/ReactNativeCesium.podspec +54 -0
- package/android/CMakeLists.txt +146 -0
- package/android/build.gradle +178 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/assets/cacert.pem +3529 -0
- package/android/src/main/cpp/CesiumBridgeAndroid.cpp +487 -0
- package/android/src/main/cpp/CesiumBridgeAndroid.h +94 -0
- package/android/src/main/cpp/cpp-adapter.cpp +17 -0
- package/android/src/main/cpp/vulkan/VulkanBackend.cpp +1781 -0
- package/android/src/main/cpp/vulkan/VulkanBackend.h +190 -0
- package/android/src/main/cpp/vulkan/shaders/sky.frag +86 -0
- package/android/src/main/cpp/vulkan/shaders/sky.vert +9 -0
- package/android/src/main/cpp/vulkan/shaders/terrain.frag +144 -0
- package/android/src/main/cpp/vulkan/shaders/terrain.vert +25 -0
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/CesiumBridgeJNI.kt +84 -0
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/HybridCesiumView.kt +225 -0
- package/android/src/main/java/com/reactnativecesium/ReactNativeCesiumPackage.kt +28 -0
- package/cpp/engine/CesiumEngine.cpp +413 -0
- package/cpp/engine/CesiumEngine.hpp +90 -0
- package/cpp/engine/DeletionQueue.cpp +28 -0
- package/cpp/engine/DeletionQueue.hpp +28 -0
- package/cpp/engine/GlobeCamera.cpp +181 -0
- package/cpp/engine/GlobeCamera.hpp +64 -0
- package/cpp/engine/GltfToMesh.cpp +154 -0
- package/cpp/engine/GltfToMesh.hpp +20 -0
- package/cpp/engine/ResourcePreparer.cpp +224 -0
- package/cpp/engine/ResourcePreparer.hpp +96 -0
- package/cpp/engine/TaskProcessor.cpp +61 -0
- package/cpp/engine/TaskProcessor.hpp +43 -0
- package/cpp/engine/TileLifecycleManager.cpp +30 -0
- package/cpp/engine/TileLifecycleManager.hpp +25 -0
- package/cpp/fmt/format.h +9 -0
- package/cpp/renderer/IGPUBackend.hpp +22 -0
- package/cpp/renderer/RenderTypes.hpp +112 -0
- package/cpp/renderer/ShaderTypes.hpp +29 -0
- package/example/README.md +43 -0
- package/example/react-native-cesium-example.jpg +0 -0
- package/ios/CesiumBridge.h +55 -0
- package/ios/CesiumBridge.mm +393 -0
- package/ios/HybridCesiumView.swift +299 -0
- package/ios/ReactNativeCesium-umbrella.h +16 -0
- package/ios/metal/MetalBackend.h +82 -0
- package/ios/metal/MetalBackend.mm +839 -0
- package/ios/react_native_cesium_ensure_native.rb +12 -0
- package/ios/react_native_cesium_post_install.rb +30 -0
- package/lib/commonjs/CesiumView.js +13 -0
- package/lib/commonjs/CesiumView.js.map +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/cesium-view.nitro.js +6 -0
- package/lib/commonjs/specs/cesium-view.nitro.js.map +1 -0
- package/lib/module/CesiumView.js +9 -0
- package/lib/module/CesiumView.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/cesium-view.nitro.js +4 -0
- package/lib/module/specs/cesium-view.nitro.js.map +1 -0
- package/lib/typescript/src/CesiumView.d.ts +5 -0
- package/lib/typescript/src/CesiumView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts +43 -0
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts.map +1 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/ReactNativeCesium+autolinking.cmake +83 -0
- package/nitrogen/generated/android/ReactNativeCesium+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.cpp +58 -0
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JCameraState.hpp +81 -0
- package/nitrogen/generated/android/c++/JCesiumMetrics.hpp +81 -0
- package/nitrogen/generated/android/c++/JFunc_void_CesiumMetrics.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.cpp +178 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.hpp +83 -0
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.cpp +92 -0
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CameraState.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CesiumMetrics.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Func_void_CesiumMetrics.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/HybridCesiumViewSpec.kt +126 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/ReactNativeCesiumOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewManager.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ReactNativeCesium+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.hpp +164 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Umbrella.hpp +53 -0
- package/nitrogen/generated/ios/ReactNativeCesiumAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeCesiumAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.hpp +157 -0
- package/nitrogen/generated/ios/c++/views/HybridCesiumViewComponent.mm +167 -0
- package/nitrogen/generated/ios/swift/CameraState.swift +59 -0
- package/nitrogen/generated/ios/swift/CesiumMetrics.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_CameraState.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CesiumMetrics.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec_cxx.swift +306 -0
- package/nitrogen/generated/shared/c++/CameraState.hpp +107 -0
- package/nitrogen/generated/shared/c++/CesiumMetrics.hpp +107 -0
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.cpp +42 -0
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.hpp +90 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.cpp +182 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.hpp +122 -0
- package/nitrogen/generated/shared/json/CesiumViewConfig.json +19 -0
- package/package.json +140 -0
- package/react-native.config.js +16 -0
- package/scripts/cesium/build.mjs +901 -0
- package/scripts/cesium/clean.mjs +35 -0
- package/scripts/cesium/clone.mjs +32 -0
- package/scripts/cesium/ensure-native.mjs +116 -0
- package/scripts/cesium/vcpkg-ports/zstd/fix-emscripten-and-clang-cl.patch +31 -0
- package/scripts/cesium/vcpkg-ports/zstd/fix-windows-rc-compile.patch +13 -0
- package/scripts/cesium/vcpkg-ports/zstd/no-static-suffix.patch +13 -0
- package/scripts/cesium/vcpkg-ports/zstd/portfile.cmake +77 -0
- package/scripts/cesium/vcpkg-ports/zstd/usage +4 -0
- package/scripts/cesium/vcpkg-ports/zstd/vcpkg.json +23 -0
- package/scripts/cesium/vcpkg-triplets/arm64-ios-simulator.cmake +10 -0
- package/scripts/cesium/vcpkg-triplets/arm64-ios.cmake +14 -0
- package/src/CesiumView.tsx +13 -0
- package/src/index.ts +7 -0
- package/src/specs/cesium-view.nitro.ts +51 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Remove outputs from `yarn run build` (native prebuilts, staging, CMake build trees).
|
|
4
|
+
* Does not remove vendor/cesium-native source (`yarn update`) or vendor/vcpkg.
|
|
5
|
+
* For other ignored artifacts (e.g. `lib/`, Android `.cxx/`), run `git clean -dfX` yourself
|
|
6
|
+
* and exclude paths you need to keep (see `.gitignore`).
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, rmSync } from 'node:fs'
|
|
9
|
+
import { dirname, join } from 'node:path'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
13
|
+
const root = join(__dirname, '..', '..')
|
|
14
|
+
const cesiumSrc = join(root, 'vendor', 'cesium-native')
|
|
15
|
+
|
|
16
|
+
const paths = [
|
|
17
|
+
join(root, 'vendor', 'android'),
|
|
18
|
+
join(root, 'vendor', 'ios'),
|
|
19
|
+
join(root, 'vendor', '.cesium-staging'),
|
|
20
|
+
join(cesiumSrc, 'build-android-arm64'),
|
|
21
|
+
join(cesiumSrc, 'build-ios-device'),
|
|
22
|
+
join(cesiumSrc, 'build-ios-simulator'),
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
let removed = 0
|
|
26
|
+
for (const p of paths) {
|
|
27
|
+
if (!existsSync(p)) continue
|
|
28
|
+
rmSync(p, { recursive: true, force: true })
|
|
29
|
+
console.log(`Removed ${p}`)
|
|
30
|
+
removed++
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (removed === 0) {
|
|
34
|
+
console.log('No Cesium native build outputs to remove (already clean).')
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Clone or update CesiumGS/cesium-native at a pinned tag into vendor/cesium-native (gitignored).
|
|
4
|
+
*/
|
|
5
|
+
import { execFileSync } from 'node:child_process'
|
|
6
|
+
import { existsSync, mkdirSync } from 'node:fs'
|
|
7
|
+
import { dirname, join } from 'node:path'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
const root = join(__dirname, '..', '..')
|
|
12
|
+
const vendor = join(root, 'vendor')
|
|
13
|
+
const dest = join(vendor, 'cesium-native')
|
|
14
|
+
const repo = 'https://github.com/CesiumGS/cesium-native.git'
|
|
15
|
+
const ref = 'v0.59.0'
|
|
16
|
+
|
|
17
|
+
function run(cmd, args, opts = {}) {
|
|
18
|
+
execFileSync(cmd, args, { stdio: 'inherit', ...opts })
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
mkdirSync(vendor, { recursive: true })
|
|
22
|
+
|
|
23
|
+
if (!existsSync(dest)) {
|
|
24
|
+
run('git', ['clone', '--branch', ref, '--depth', '1', repo, dest], {
|
|
25
|
+
cwd: root,
|
|
26
|
+
})
|
|
27
|
+
console.log(`Cloned Cesium Native ${ref} into ${dest}`)
|
|
28
|
+
} else {
|
|
29
|
+
run('git', ['-C', dest, 'fetch', '--depth', '1', 'origin', 'tag', ref])
|
|
30
|
+
run('git', ['-C', dest, 'checkout', '--detach', '--force', ref])
|
|
31
|
+
console.log(`Updated Cesium Native at ${dest} to ${ref}`)
|
|
32
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* If Cesium Native vendor output is missing for the requested platform(s), run
|
|
4
|
+
* `npm|yarn run update` then `CESIUM_BUILD_ONLY=… npm|yarn run build`.
|
|
5
|
+
*
|
|
6
|
+
* Invoked from CocoaPods (podspec prepare_command) and Android Gradle (preBuild).
|
|
7
|
+
*
|
|
8
|
+
* Opt out (CI without toolchains): REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD=1 — fails fast if artifacts are still missing.
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from 'node:child_process'
|
|
11
|
+
import { existsSync } from 'node:fs'
|
|
12
|
+
import { dirname, join, resolve } from 'node:path'
|
|
13
|
+
import { fileURLToPath } from 'node:url'
|
|
14
|
+
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
16
|
+
const root = resolve(join(__dirname, '..', '..'))
|
|
17
|
+
|
|
18
|
+
const MARKER_IOS = join(root, 'vendor', 'ios', 'CesiumNative.xcframework', 'Info.plist')
|
|
19
|
+
const MARKER_ANDROID = join(
|
|
20
|
+
root,
|
|
21
|
+
'vendor',
|
|
22
|
+
'android',
|
|
23
|
+
'share',
|
|
24
|
+
'cesium-native',
|
|
25
|
+
'cmake',
|
|
26
|
+
'cesium-nativeConfig.cmake'
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
function parseArgs(argv) {
|
|
30
|
+
const want = { ios: false, android: false }
|
|
31
|
+
for (const a of argv) {
|
|
32
|
+
if (a === '--ios') want.ios = true
|
|
33
|
+
else if (a === '--android') want.android = true
|
|
34
|
+
}
|
|
35
|
+
if (!want.ios && !want.android) {
|
|
36
|
+
want.ios = true
|
|
37
|
+
want.android = true
|
|
38
|
+
}
|
|
39
|
+
return want
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function useYarn() {
|
|
43
|
+
return existsSync(join(root, 'yarn.lock'))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function runScript(name, extraEnv) {
|
|
47
|
+
const yarn = useYarn()
|
|
48
|
+
const cmd = yarn ? 'yarn' : 'npm'
|
|
49
|
+
const args = yarn ? ['run', name] : ['run', name]
|
|
50
|
+
const env = { ...process.env, ...extraEnv }
|
|
51
|
+
const r = spawnSync(cmd, args, { cwd: root, env, stdio: 'inherit' })
|
|
52
|
+
if (r.error) {
|
|
53
|
+
console.error(r.error)
|
|
54
|
+
process.exit(1)
|
|
55
|
+
}
|
|
56
|
+
const code = r.status
|
|
57
|
+
if (code !== 0) {
|
|
58
|
+
process.exit(code === null ? 1 : code)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function main() {
|
|
63
|
+
const skip = process.env.REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD === '1'
|
|
64
|
+
const want = parseArgs(process.argv.slice(2))
|
|
65
|
+
|
|
66
|
+
const needIos = want.ios && !existsSync(MARKER_IOS)
|
|
67
|
+
const needAndroid = want.android && !existsSync(MARKER_ANDROID)
|
|
68
|
+
|
|
69
|
+
if (!needIos && !needAndroid) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (skip) {
|
|
74
|
+
console.error(
|
|
75
|
+
'react-native-cesium: Cesium Native vendor output is missing, but REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD=1.\n' +
|
|
76
|
+
'Build the native libraries on a machine with the required toolchains, or unset the variable and retry.\n' +
|
|
77
|
+
`Expected iOS: ${MARKER_IOS}\n` +
|
|
78
|
+
`Expected Android: ${MARKER_ANDROID}\n` +
|
|
79
|
+
'See the package README (Build Cesium Native locally).'
|
|
80
|
+
)
|
|
81
|
+
process.exit(1)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (needIos && process.platform !== 'darwin') {
|
|
85
|
+
console.error(
|
|
86
|
+
'react-native-cesium: iOS Cesium Native output is missing; building it requires macOS with Xcode.\n' +
|
|
87
|
+
`Expected: ${MARKER_IOS}`
|
|
88
|
+
)
|
|
89
|
+
process.exit(1)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!existsSync(join(root, 'vendor', 'cesium-native'))) {
|
|
93
|
+
console.log('react-native-cesium: running package update (clone Cesium Native / vcpkg prep)…')
|
|
94
|
+
runScript('update', {})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (needIos && !existsSync(MARKER_IOS)) {
|
|
98
|
+
console.log('react-native-cesium: building Cesium Native for iOS (this can take a long time)…')
|
|
99
|
+
runScript('build', { CESIUM_BUILD_ONLY: 'ios' })
|
|
100
|
+
}
|
|
101
|
+
if (needAndroid && !existsSync(MARKER_ANDROID)) {
|
|
102
|
+
console.log('react-native-cesium: building Cesium Native for Android (this can take a long time)…')
|
|
103
|
+
runScript('build', { CESIUM_BUILD_ONLY: 'android' })
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (needIos && !existsSync(MARKER_IOS)) {
|
|
107
|
+
console.error(`react-native-cesium: iOS build finished but marker missing: ${MARKER_IOS}`)
|
|
108
|
+
process.exit(1)
|
|
109
|
+
}
|
|
110
|
+
if (needAndroid && !existsSync(MARKER_ANDROID)) {
|
|
111
|
+
console.error(`react-native-cesium: Android build finished but marker missing: ${MARKER_ANDROID}`)
|
|
112
|
+
process.exit(1)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
main()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
diff --git a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
|
|
2
|
+
index 5f381c6..f1e9b32 100644
|
|
3
|
+
--- a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
|
|
4
|
+
+++ b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
|
|
5
|
+
@@ -79,10 +79,22 @@ macro(ADD_ZSTD_COMPILATION_FLAGS)
|
|
6
|
+
endif ()
|
|
7
|
+
# Add noexecstack flags
|
|
8
|
+
# LDFLAGS
|
|
9
|
+
- EnableCompilerFlag("-Wl,-z,noexecstack" false false true)
|
|
10
|
+
- # CFLAGS & CXXFLAGS
|
|
11
|
+
- EnableCompilerFlag("-Qunused-arguments" true true false)
|
|
12
|
+
- EnableCompilerFlag("-Wa,--noexecstack" true true false)
|
|
13
|
+
+ if(MSVC)
|
|
14
|
+
+ # UNICODE SUPPORT
|
|
15
|
+
+ EnableCompilerFlag("/D_UNICODE" true true false)
|
|
16
|
+
+ EnableCompilerFlag("/DUNICODE" true true false)
|
|
17
|
+
+ # Enable asserts in Debug mode
|
|
18
|
+
+ if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
19
|
+
+ EnableCompilerFlag("/DDEBUGLEVEL=1" true true false)
|
|
20
|
+
+ endif ()
|
|
21
|
+
+ else()
|
|
22
|
+
+ if(NOT EMSCRIPTEN)
|
|
23
|
+
+ EnableCompilerFlag("-z noexecstack" false false true)
|
|
24
|
+
+ endif()
|
|
25
|
+
+ # CFLAGS & CXXFLAGS
|
|
26
|
+
+ EnableCompilerFlag("-Qunused-arguments" true true false)
|
|
27
|
+
+ EnableCompilerFlag("-Wa,--noexecstack" true true false)
|
|
28
|
+
+ endif()
|
|
29
|
+
# NOTE: Using 3 nested ifs because the variables are sometimes
|
|
30
|
+
# empty if the condition is false, and sometimes equal to false.
|
|
31
|
+
# This implicitly converts them to truthy values. There may be
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt
|
|
2
|
+
index 5d514ccb..dd79efb7 100644
|
|
3
|
+
--- a/build/cmake/lib/CMakeLists.txt
|
|
4
|
+
+++ b/build/cmake/lib/CMakeLists.txt
|
|
5
|
+
@@ -123,7 +123,7 @@ set(PUBLIC_INCLUDE_DIRS ${LIBRARY_DIR})
|
|
6
|
+
set(library_targets)
|
|
7
|
+
if (ZSTD_BUILD_SHARED)
|
|
8
|
+
add_library(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources})
|
|
9
|
+
- target_include_directories(libzstd_shared INTERFACE $<BUILD_INTERFACE:${PUBLIC_INCLUDE_DIRS}>)
|
|
10
|
+
+ target_include_directories(libzstd_shared PUBLIC $<BUILD_INTERFACE:${PUBLIC_INCLUDE_DIRS}>)
|
|
11
|
+
list(APPEND library_targets libzstd_shared)
|
|
12
|
+
if (ZSTD_MULTITHREAD_SUPPORT)
|
|
13
|
+
set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt
|
|
2
|
+
index 8234060..765f003 100644
|
|
3
|
+
--- a/build/cmake/lib/CMakeLists.txt
|
|
4
|
+
+++ b/build/cmake/lib/CMakeLists.txt
|
|
5
|
+
@@ -118,7 +118,7 @@ endif ()
|
|
6
|
+
|
|
7
|
+
# With MSVC static library needs to be renamed to avoid conflict with import library
|
|
8
|
+
if (MSVC OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MINGW))
|
|
9
|
+
- set(STATIC_LIBRARY_BASE_NAME zstd_static)
|
|
10
|
+
+ set(STATIC_LIBRARY_BASE_NAME zstd)
|
|
11
|
+
else ()
|
|
12
|
+
set(STATIC_LIBRARY_BASE_NAME zstd)
|
|
13
|
+
endif ()
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Overlay of microsoft/vcpkg ports/zstd: disable multithreaded zstd on iOS so the installed
|
|
2
|
+
# CMake package does not call find_dependency(Threads). Downstream ports (e.g. ktx) then
|
|
3
|
+
# configure without FindThreads failing on iphoneOS try_compile.
|
|
4
|
+
vcpkg_from_github(
|
|
5
|
+
OUT_SOURCE_PATH SOURCE_PATH
|
|
6
|
+
REPO facebook/zstd
|
|
7
|
+
REF "v${VERSION}"
|
|
8
|
+
SHA512 26e441267305f6e58080460f96ab98645219a90d290a533410b1b0b1d2f870721c95f8384e342ee647c5e968385a5b7e30c2d04340c37f59b3e6d86762c3260c
|
|
9
|
+
HEAD_REF dev
|
|
10
|
+
PATCHES
|
|
11
|
+
no-static-suffix.patch
|
|
12
|
+
fix-emscripten-and-clang-cl.patch
|
|
13
|
+
fix-windows-rc-compile.patch
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ZSTD_BUILD_STATIC)
|
|
17
|
+
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ZSTD_BUILD_SHARED)
|
|
18
|
+
|
|
19
|
+
if("tools" IN_LIST FEATURES)
|
|
20
|
+
set(ZSTD_BUILD_PROGRAMS 1)
|
|
21
|
+
else()
|
|
22
|
+
set(ZSTD_BUILD_PROGRAMS 0)
|
|
23
|
+
endif()
|
|
24
|
+
|
|
25
|
+
if(VCPKG_TARGET_IS_IOS)
|
|
26
|
+
set(ZSTD_MULTITHREAD_SUPPORT 0)
|
|
27
|
+
else()
|
|
28
|
+
set(ZSTD_MULTITHREAD_SUPPORT 1)
|
|
29
|
+
endif()
|
|
30
|
+
|
|
31
|
+
vcpkg_cmake_configure(
|
|
32
|
+
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
|
|
33
|
+
OPTIONS
|
|
34
|
+
-DZSTD_BUILD_SHARED=${ZSTD_BUILD_SHARED}
|
|
35
|
+
-DZSTD_BUILD_STATIC=${ZSTD_BUILD_STATIC}
|
|
36
|
+
-DZSTD_LEGACY_SUPPORT=1
|
|
37
|
+
-DZSTD_BUILD_TESTS=0
|
|
38
|
+
-DZSTD_BUILD_CONTRIB=0
|
|
39
|
+
-DZSTD_MULTITHREAD_SUPPORT=${ZSTD_MULTITHREAD_SUPPORT}
|
|
40
|
+
OPTIONS_RELEASE
|
|
41
|
+
-DZSTD_BUILD_PROGRAMS=${ZSTD_BUILD_PROGRAMS}
|
|
42
|
+
OPTIONS_DEBUG
|
|
43
|
+
-DZSTD_BUILD_PROGRAMS=OFF
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
vcpkg_cmake_install()
|
|
47
|
+
vcpkg_copy_pdbs()
|
|
48
|
+
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/zstd)
|
|
49
|
+
vcpkg_fixup_pkgconfig()
|
|
50
|
+
|
|
51
|
+
file(READ "${CURRENT_PACKAGES_DIR}/share/zstd/zstdTargets.cmake" targets)
|
|
52
|
+
if(targets MATCHES "-pthread")
|
|
53
|
+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc" " -lzstd" " -lzstd -pthread")
|
|
54
|
+
if(NOT VCPKG_BUILD_TYPE)
|
|
55
|
+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc" " -lzstd" " -lzstd -pthread")
|
|
56
|
+
endif()
|
|
57
|
+
endif()
|
|
58
|
+
|
|
59
|
+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
60
|
+
|
|
61
|
+
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
62
|
+
foreach(HEADER IN ITEMS zdict.h zstd.h zstd_errors.h)
|
|
63
|
+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${HEADER}" "defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)" "1" )
|
|
64
|
+
endforeach()
|
|
65
|
+
endif()
|
|
66
|
+
|
|
67
|
+
if(VCPKG_TARGET_IS_WINDOWS AND ZSTD_BUILD_PROGRAMS)
|
|
68
|
+
vcpkg_copy_tools(TOOL_NAMES zstd AUTO_CLEAN)
|
|
69
|
+
endif()
|
|
70
|
+
|
|
71
|
+
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
72
|
+
vcpkg_install_copyright(
|
|
73
|
+
COMMENT "ZSTD is dual licensed under BSD and GPLv2."
|
|
74
|
+
FILE_LIST
|
|
75
|
+
"${SOURCE_PATH}/LICENSE"
|
|
76
|
+
"${SOURCE_PATH}/COPYING"
|
|
77
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zstd",
|
|
3
|
+
"version": "1.5.7",
|
|
4
|
+
"description": "Zstandard - Fast real-time compression algorithm",
|
|
5
|
+
"homepage": "https://facebook.github.io/zstd/",
|
|
6
|
+
"license": "BSD-3-Clause OR GPL-2.0-only",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
{
|
|
9
|
+
"name": "vcpkg-cmake",
|
|
10
|
+
"host": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "vcpkg-cmake-config",
|
|
14
|
+
"host": true
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"features": {
|
|
18
|
+
"tools": {
|
|
19
|
+
"description": "Build zstd binary",
|
|
20
|
+
"supports": "!uwp & static"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Overlay for microsoft/vcpkg triplets/community/arm64-ios-simulator.cmake — curl's CMake can set
|
|
2
|
+
# HAVE_PIPE2 even though iOS has no pipe2(); that fails with -Werror=implicit-function-declaration.
|
|
3
|
+
#
|
|
4
|
+
# CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY: FindThreads / pthread checks (e.g. via zstd → ktx).
|
|
5
|
+
set(VCPKG_TARGET_ARCHITECTURE arm64)
|
|
6
|
+
set(VCPKG_CRT_LINKAGE dynamic)
|
|
7
|
+
set(VCPKG_LIBRARY_LINKAGE static)
|
|
8
|
+
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
|
|
9
|
+
set(VCPKG_OSX_SYSROOT iphonesimulator)
|
|
10
|
+
set(VCPKG_CMAKE_CONFIGURE_OPTIONS "-DHAVE_PIPE2=OFF;-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Overlay for microsoft/vcpkg triplets/community/arm64-ios.cmake — curl's CMake can set
|
|
2
|
+
# HAVE_PIPE2 even though iOS has no pipe2(); that fails with -Werror=implicit-function-declaration.
|
|
3
|
+
#
|
|
4
|
+
# CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY: FindThreads (pulled in via zstdConfig → ktx, etc.)
|
|
5
|
+
# fails on iOS when try_compile builds an executable; static libs avoid that toolchain quirk.
|
|
6
|
+
set(VCPKG_TARGET_ARCHITECTURE arm64)
|
|
7
|
+
set(VCPKG_CRT_LINKAGE dynamic)
|
|
8
|
+
set(VCPKG_LIBRARY_LINKAGE static)
|
|
9
|
+
set(VCPKG_CMAKE_SYSTEM_NAME iOS)
|
|
10
|
+
# vcpkg scripts/toolchains/ios.cmake only sets a sysroot for simulator archs; without this,
|
|
11
|
+
# CMake defaults CMAKE_OSX_SYSROOT to the host MacOSX SDK and Clang builds with an invalid
|
|
12
|
+
# --target=…-macabi mix (breaks ktx/astc-encoder on newer Xcode).
|
|
13
|
+
set(VCPKG_OSX_SYSROOT iphoneos)
|
|
14
|
+
set(VCPKG_CMAKE_CONFIGURE_OPTIONS "-DHAVE_PIPE2=OFF;-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getHostComponent } from 'react-native-nitro-modules'
|
|
2
|
+
import type {
|
|
3
|
+
CesiumViewProps,
|
|
4
|
+
CesiumViewMethods,
|
|
5
|
+
} from './specs/cesium-view.nitro'
|
|
6
|
+
import CesiumViewConfig from '../nitrogen/generated/shared/json/CesiumViewConfig.json'
|
|
7
|
+
|
|
8
|
+
/** For `hybridRef`, use `callback(...)` from `react-native-nitro-modules` or a ref object —
|
|
9
|
+
* unwrapped functions are turned into booleans by RN and never reach native. */
|
|
10
|
+
export const CesiumView = getHostComponent<CesiumViewProps, CesiumViewMethods>(
|
|
11
|
+
'CesiumView',
|
|
12
|
+
() => CesiumViewConfig
|
|
13
|
+
)
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HybridView,
|
|
3
|
+
HybridViewProps,
|
|
4
|
+
HybridViewMethods,
|
|
5
|
+
} from 'react-native-nitro-modules'
|
|
6
|
+
|
|
7
|
+
/** Snapshot of the native camera for persistence / sync with React state. */
|
|
8
|
+
export interface CameraState {
|
|
9
|
+
latitude: number
|
|
10
|
+
longitude: number
|
|
11
|
+
altitude: number
|
|
12
|
+
heading: number
|
|
13
|
+
pitch: number
|
|
14
|
+
roll: number
|
|
15
|
+
verticalFovDeg: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Throttled telemetry for dashboards (see `onMetrics` prop). */
|
|
19
|
+
export interface CesiumMetrics {
|
|
20
|
+
fps: number
|
|
21
|
+
tilesRendered: number
|
|
22
|
+
tilesLoading: number
|
|
23
|
+
tilesVisited: number
|
|
24
|
+
ionTokenConfigured: boolean
|
|
25
|
+
tilesetReady: boolean
|
|
26
|
+
creditsPlainText: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CesiumViewProps extends HybridViewProps {
|
|
30
|
+
ionAccessToken: string
|
|
31
|
+
ionAssetId: number
|
|
32
|
+
/** Construction-time seed camera. Use `setCamera()` for runtime updates. */
|
|
33
|
+
initialCamera: CameraState
|
|
34
|
+
pauseRendering: boolean
|
|
35
|
+
maximumScreenSpaceError: number
|
|
36
|
+
maximumSimultaneousTileLoads: number
|
|
37
|
+
loadingDescendantLimit: number
|
|
38
|
+
/** 1 = off; 2 or 4 = MSAA when supported. */
|
|
39
|
+
msaaSampleCount: number
|
|
40
|
+
ionImageryAssetId: number
|
|
41
|
+
onMetrics?: (metrics: CesiumMetrics) => void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CesiumViewMethods extends HybridViewMethods {
|
|
45
|
+
/** Returns the current native camera state. */
|
|
46
|
+
getCameraState(): Promise<CameraState>
|
|
47
|
+
/** Runtime camera control path after the view has been created. */
|
|
48
|
+
setCamera(camera: CameraState): void
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type CesiumView = HybridView<CesiumViewProps, CesiumViewMethods>
|