react-native-cesium 1.2.14 → 1.2.16
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/README.md +2 -0
- package/android/build.gradle +6 -10
- package/android/cmake/spv_to_header.cmake +41 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -153,6 +153,8 @@ What happens on **`./gradlew`** / Android Studio build:
|
|
|
153
153
|
|
|
154
154
|
You still need a discoverable **Android NDK** (expand **Additional Android specific requirements** under [System dependencies](#system-dependencies) above) so that build can succeed.
|
|
155
155
|
|
|
156
|
+
**Maintainers:** verify Android builds with **Gradle 9.3+** (as in React Native 0.85+ templates; this repo’s example app uses the wrapper under `example/android/gradle/wrapper/`).
|
|
157
|
+
|
|
156
158
|
### Building
|
|
157
159
|
|
|
158
160
|
**Automatic (default):** assuming you have done the above and have all the required dependencies in place, when the native output is missing, the package tries to build it for you:
|
package/android/build.gradle
CHANGED
|
@@ -31,14 +31,12 @@ if (isNewArchitectureEnabled()) {
|
|
|
31
31
|
|
|
32
32
|
def reactNativeCesiumPackageDir = projectDir.parentFile
|
|
33
33
|
|
|
34
|
-
tasks.register('ensureCesiumNativeAndroid') {
|
|
34
|
+
tasks.register('ensureCesiumNativeAndroid', Exec) {
|
|
35
35
|
group 'cesium'
|
|
36
36
|
description 'If vendor/android Cesium Native is missing, runs scripts/cesium/ensure-native.mjs (update + build). Can take a long time.'
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
}
|
|
37
|
+
def marker = new File(reactNativeCesiumPackageDir, 'vendor/android/share/cesium-native/cmake/cesium-nativeConfig.cmake')
|
|
38
|
+
onlyIf { !marker.exists() }
|
|
39
|
+
doFirst {
|
|
42
40
|
if (System.getenv('REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD') == '1') {
|
|
43
41
|
throw new RuntimeException(
|
|
44
42
|
'react-native-cesium: Android Cesium Native artifacts are missing under vendor/android. ' +
|
|
@@ -46,11 +44,9 @@ tasks.register('ensureCesiumNativeAndroid') {
|
|
|
46
44
|
'Or unset REACT_NATIVE_CESIUM_SKIP_NATIVE_BUILD to allow automatic build during Gradle. See package README.'
|
|
47
45
|
)
|
|
48
46
|
}
|
|
49
|
-
project.exec {
|
|
50
|
-
workingDir reactNativeCesiumPackageDir
|
|
51
|
-
commandLine 'node', 'scripts/cesium/ensure-native.mjs', '--android'
|
|
52
|
-
}
|
|
53
47
|
}
|
|
48
|
+
workingDir reactNativeCesiumPackageDir
|
|
49
|
+
commandLine 'node', 'scripts/cesium/ensure-native.mjs', '--android'
|
|
54
50
|
}
|
|
55
51
|
|
|
56
52
|
tasks.preBuild {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# spv_to_header.cmake — Convert a .spv binary to a C header with an embedded uint32_t array.
|
|
2
|
+
# Input variables: SPV_FILE, SPV_HEADER, ARRAY_NAME
|
|
3
|
+
|
|
4
|
+
file(READ "${SPV_FILE}" SPV_DATA HEX)
|
|
5
|
+
string(LENGTH "${SPV_DATA}" SPV_HEX_LEN)
|
|
6
|
+
|
|
7
|
+
# Validate SPIR-V magic (0x07230203, little-endian on disk → "03022307")
|
|
8
|
+
string(SUBSTRING "${SPV_DATA}" 0 8 SPV_MAGIC)
|
|
9
|
+
string(TOLOWER "${SPV_MAGIC}" SPV_MAGIC_LC)
|
|
10
|
+
if(NOT SPV_MAGIC_LC STREQUAL "03022307")
|
|
11
|
+
message(FATAL_ERROR "spv_to_header: '${SPV_FILE}' does not start with the SPIR-V magic number (got '${SPV_MAGIC}'). The file may be corrupt or not a valid SPIR-V binary.")
|
|
12
|
+
endif()
|
|
13
|
+
math(EXPR SPV_BYTE_COUNT "${SPV_HEX_LEN} / 2")
|
|
14
|
+
math(EXPR SPV_WORD_COUNT "${SPV_BYTE_COUNT} / 4")
|
|
15
|
+
|
|
16
|
+
set(HEADER_CONTENT "#pragma once\n#include <cstdint>\nstatic const uint32_t ${ARRAY_NAME}[] = {\n")
|
|
17
|
+
|
|
18
|
+
set(I 0)
|
|
19
|
+
while(I LESS SPV_HEX_LEN)
|
|
20
|
+
# Read 8 hex chars (4 bytes = 1 uint32_t word, little-endian in SPIR-V)
|
|
21
|
+
string(SUBSTRING "${SPV_DATA}" ${I} 8 WORD_HEX)
|
|
22
|
+
# SPIR-V is stored little-endian; file(READ HEX) gives bytes in order,
|
|
23
|
+
# so we need to reverse byte order for the uint32_t literal.
|
|
24
|
+
string(SUBSTRING "${WORD_HEX}" 0 2 B0)
|
|
25
|
+
string(SUBSTRING "${WORD_HEX}" 2 2 B1)
|
|
26
|
+
string(SUBSTRING "${WORD_HEX}" 4 2 B2)
|
|
27
|
+
string(SUBSTRING "${WORD_HEX}" 6 2 B3)
|
|
28
|
+
set(WORD "0x${B3}${B2}${B1}${B0}")
|
|
29
|
+
|
|
30
|
+
math(EXPR NEXT_I "${I} + 8")
|
|
31
|
+
if(NEXT_I LESS SPV_HEX_LEN)
|
|
32
|
+
string(APPEND HEADER_CONTENT " ${WORD},\n")
|
|
33
|
+
else()
|
|
34
|
+
string(APPEND HEADER_CONTENT " ${WORD}\n")
|
|
35
|
+
endif()
|
|
36
|
+
set(I ${NEXT_I})
|
|
37
|
+
endwhile()
|
|
38
|
+
|
|
39
|
+
string(APPEND HEADER_CONTENT "};\nstatic const uint32_t ${ARRAY_NAME}_size = sizeof(${ARRAY_NAME});\n")
|
|
40
|
+
|
|
41
|
+
file(WRITE "${SPV_HEADER}" "${HEADER_CONTENT}")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-cesium",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
4
4
|
"description": "Experimental Cesium rendering for React Native via Nitro",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"android/fix-prefab.gradle",
|
|
42
42
|
"android/gradle.properties",
|
|
43
43
|
"android/CMakeLists.txt",
|
|
44
|
+
"android/cmake",
|
|
44
45
|
"android/src",
|
|
45
46
|
"example/react-native-cesium-example.jpg",
|
|
46
47
|
"ios/**/*.h",
|