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,178 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath "com.android.tools.build:gradle:8.8.0"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Cesium Native vendor/android is arm64-v8a only (`yarn run build` / ensure-native). Do not follow the app’s
|
|
13
|
+
// reactNativeArchitectures list: a typical RN template sets all ABIs and CMake would run for
|
|
14
|
+
// armeabi-v7a/x86/… and fail (no matching libs). The JNI library is only built for arm64.
|
|
15
|
+
def cesiumNativeAbiFilters() {
|
|
16
|
+
return ["arm64-v8a"]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
def isNewArchitectureEnabled() {
|
|
20
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apply plugin: "com.android.library"
|
|
24
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
25
|
+
apply from: '../nitrogen/generated/android/ReactNativeCesium+autolinking.gradle'
|
|
26
|
+
apply from: "./fix-prefab.gradle"
|
|
27
|
+
|
|
28
|
+
if (isNewArchitectureEnabled()) {
|
|
29
|
+
apply plugin: "com.facebook.react"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def reactNativeCesiumPackageDir = projectDir.parentFile
|
|
33
|
+
|
|
34
|
+
tasks.register('ensureCesiumNativeAndroid') {
|
|
35
|
+
group 'cesium'
|
|
36
|
+
description 'If vendor/android Cesium Native is missing, runs scripts/cesium/ensure-native.mjs (update + build). Can take a long time.'
|
|
37
|
+
doLast {
|
|
38
|
+
def marker = new File(reactNativeCesiumPackageDir, 'vendor/android/share/cesium-native/cmake/cesium-nativeConfig.cmake')
|
|
39
|
+
if (marker.exists()) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (System.getenv('REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD') == '1') {
|
|
43
|
+
throw new RuntimeException(
|
|
44
|
+
'react-native-cesium: Android Cesium Native artifacts are missing under vendor/android. ' +
|
|
45
|
+
'Install the Android NDK (ANDROID_NDK_HOME), then from node_modules/react-native-cesium run: npm run update && CESIUM_BUILD_ONLY=android npm run build. ' +
|
|
46
|
+
'Or unset REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD to allow automatic build during Gradle. See package README.'
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
project.exec {
|
|
50
|
+
workingDir reactNativeCesiumPackageDir
|
|
51
|
+
commandLine 'node', 'scripts/cesium/ensure-native.mjs', '--android'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
tasks.preBuild {
|
|
57
|
+
dependsOn 'ensureCesiumNativeAndroid'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def getExtOrDefault(name) {
|
|
61
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["ReactNativeCesium_" + name]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def getExtOrIntegerDefault(name) {
|
|
65
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["ReactNativeCesium_" + name]).toInteger()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
android {
|
|
69
|
+
namespace "com.reactnativecesium"
|
|
70
|
+
|
|
71
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
72
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
73
|
+
|
|
74
|
+
defaultConfig {
|
|
75
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
76
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
77
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
78
|
+
|
|
79
|
+
externalNativeBuild {
|
|
80
|
+
cmake {
|
|
81
|
+
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
82
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
83
|
+
abiFilters (*cesiumNativeAbiFilters())
|
|
84
|
+
|
|
85
|
+
buildTypes {
|
|
86
|
+
debug {
|
|
87
|
+
cppFlags "-O1 -g"
|
|
88
|
+
}
|
|
89
|
+
release {
|
|
90
|
+
cppFlags "-O2"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
externalNativeBuild {
|
|
98
|
+
cmake {
|
|
99
|
+
path "CMakeLists.txt"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
packagingOptions {
|
|
104
|
+
excludes = [
|
|
105
|
+
"META-INF",
|
|
106
|
+
"META-INF/**",
|
|
107
|
+
"**/libc++_shared.so",
|
|
108
|
+
"**/libfbjni.so",
|
|
109
|
+
"**/libjsi.so",
|
|
110
|
+
"**/libfolly_json.so",
|
|
111
|
+
"**/libfolly_runtime.so",
|
|
112
|
+
"**/libglog.so",
|
|
113
|
+
"**/libhermes.so",
|
|
114
|
+
"**/libhermes-executor-debug.so",
|
|
115
|
+
"**/libhermes_executor.so",
|
|
116
|
+
"**/libreactnative.so",
|
|
117
|
+
"**/libreactnativejni.so",
|
|
118
|
+
"**/libturbomodulejsijni.so",
|
|
119
|
+
"**/libreact_nativemodule_core.so",
|
|
120
|
+
"**/libjscexecutor.so"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
buildFeatures {
|
|
125
|
+
buildConfig true
|
|
126
|
+
prefab true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
buildTypes {
|
|
130
|
+
release {
|
|
131
|
+
minifyEnabled false
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
lintOptions {
|
|
136
|
+
disable "GradleCompatible"
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
compileOptions {
|
|
140
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
141
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
sourceSets {
|
|
145
|
+
main {
|
|
146
|
+
if (isNewArchitectureEnabled()) {
|
|
147
|
+
java.srcDirs += [
|
|
148
|
+
// React Codegen files
|
|
149
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
repositories {
|
|
157
|
+
mavenCentral()
|
|
158
|
+
google()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
dependencies {
|
|
163
|
+
// For < 0.71, this will be from the local maven repo
|
|
164
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
165
|
+
//noinspection GradleDynamicVersion
|
|
166
|
+
implementation "com.facebook.react:react-native:+"
|
|
167
|
+
|
|
168
|
+
// Add a dependency on NitroModules
|
|
169
|
+
implementation project(":react-native-nitro-modules")
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (isNewArchitectureEnabled()) {
|
|
173
|
+
react {
|
|
174
|
+
jsRootDir = file("../src/")
|
|
175
|
+
libraryName = "ReactNativeCesium"
|
|
176
|
+
codegenJavaPackageName = "com.reactnativecesium"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
tasks.configureEach { task ->
|
|
2
|
+
// Make sure that we generate our prefab publication file only after having built the native library
|
|
3
|
+
// so that not a header publication file, but a full configuration publication will be generated, which
|
|
4
|
+
// will include the .so file
|
|
5
|
+
|
|
6
|
+
def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
|
|
7
|
+
def matcher = task.name =~ prefabConfigurePattern
|
|
8
|
+
if (matcher.matches()) {
|
|
9
|
+
def variantName = matcher[0][1]
|
|
10
|
+
task.outputs.upToDateWhen { false }
|
|
11
|
+
task.dependsOn("externalNativeBuild${variantName}")
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
afterEvaluate {
|
|
16
|
+
def abis = cesiumNativeAbiFilters()
|
|
17
|
+
rootProject.allprojects.each { proj ->
|
|
18
|
+
if (proj === rootProject) return
|
|
19
|
+
|
|
20
|
+
def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
|
|
21
|
+
config.dependencies.any { dep ->
|
|
22
|
+
dep.group == project.group && dep.name == project.name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!dependsOnThisLib && proj != project) return
|
|
26
|
+
|
|
27
|
+
if (!proj.plugins.hasPlugin('com.android.application') && !proj.plugins.hasPlugin('com.android.library')) {
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants
|
|
32
|
+
// Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
|
|
33
|
+
// generate a libnameConfig.cmake file that will contain our native library (.so).
|
|
34
|
+
// See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
|
|
35
|
+
variants.all { variant ->
|
|
36
|
+
def variantName = variant.name
|
|
37
|
+
abis.each { abi ->
|
|
38
|
+
def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
|
|
39
|
+
if (!searchDir.exists()) return
|
|
40
|
+
def matches = []
|
|
41
|
+
searchDir.eachDir { randomDir ->
|
|
42
|
+
def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
|
|
43
|
+
if (prefabFile.exists()) matches << prefabFile
|
|
44
|
+
}
|
|
45
|
+
matches.each { prefabConfig ->
|
|
46
|
+
prefabConfig.setLastModified(System.currentTimeMillis())
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
<!-- Optional: declares Vulkan may be used; not required so the app still installs on devices without Vulkan. -->
|
|
3
|
+
<uses-feature android:name="android.hardware.vulkan.level" android:required="false" />
|
|
4
|
+
<uses-feature android:name="android.hardware.vulkan.version" android:required="false" />
|
|
5
|
+
</manifest>
|