@mobrowser/native 2.15.0 → 2.17.0
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/cmake/MoBrowser.cmake +24 -1
- package/cmake/Protobuf.cmake +11 -3
- package/package.json +1 -1
package/cmake/MoBrowser.cmake
CHANGED
|
@@ -12,13 +12,36 @@ set(DIST_DIR ${CMAKE_BINARY_DIR}/bin)
|
|
|
12
12
|
if (OS_WIN)
|
|
13
13
|
set(MOBROWSER_SDK_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/sdk-win-x64")
|
|
14
14
|
elseif (OS_MAC)
|
|
15
|
-
|
|
15
|
+
# Follow the architecture being built for, not the host: the MoBrowser CLI
|
|
16
|
+
# cross-builds and passes the target through CMAKE_OSX_ARCHITECTURES.
|
|
17
|
+
if (CMAKE_OSX_ARCHITECTURES)
|
|
18
|
+
set(MOBROWSER_TARGET_ARCH "${CMAKE_OSX_ARCHITECTURES}")
|
|
19
|
+
else ()
|
|
20
|
+
set(MOBROWSER_TARGET_ARCH "${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
|
21
|
+
endif ()
|
|
22
|
+
if (MOBROWSER_TARGET_ARCH MATCHES "x86_64|x64")
|
|
23
|
+
set(MOBROWSER_SDK_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/sdk-darwin-x64")
|
|
24
|
+
else ()
|
|
25
|
+
set(MOBROWSER_SDK_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/sdk-darwin-arm64")
|
|
26
|
+
endif ()
|
|
16
27
|
elseif (OS_LINUX)
|
|
17
28
|
set(MOBROWSER_SDK_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/sdk-linux-x64")
|
|
18
29
|
endif ()
|
|
19
30
|
|
|
20
31
|
cmake_path(ABSOLUTE_PATH MOBROWSER_SDK_DIR NORMALIZE)
|
|
21
32
|
message(STATUS "MOBROWSER_SDK_DIR: ${MOBROWSER_SDK_DIR}")
|
|
33
|
+
|
|
34
|
+
# The SDK for the machine running the build. Build-time tools (protoc,
|
|
35
|
+
# cc_nativegen) come from here, so a cross-build doesn't need Rosetta.
|
|
36
|
+
if (OS_MAC AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
|
|
37
|
+
set(MOBROWSER_HOST_SDK_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/sdk-darwin-x64")
|
|
38
|
+
elseif (OS_MAC)
|
|
39
|
+
set(MOBROWSER_HOST_SDK_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/sdk-darwin-arm64")
|
|
40
|
+
else ()
|
|
41
|
+
set(MOBROWSER_HOST_SDK_DIR "${MOBROWSER_SDK_DIR}")
|
|
42
|
+
endif ()
|
|
43
|
+
cmake_path(ABSOLUTE_PATH MOBROWSER_HOST_SDK_DIR NORMALIZE)
|
|
44
|
+
message(STATUS "MOBROWSER_HOST_SDK_DIR: ${MOBROWSER_HOST_SDK_DIR}")
|
|
22
45
|
set(MOBROWSER_SDK_NATIVE_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/native")
|
|
23
46
|
cmake_path(ABSOLUTE_PATH MOBROWSER_SDK_NATIVE_DIR NORMALIZE)
|
|
24
47
|
|
package/cmake/Protobuf.cmake
CHANGED
|
@@ -107,9 +107,13 @@ if (MOBROWSER_USE_PREBUILT_PROTOBUF)
|
|
|
107
107
|
|
|
108
108
|
# protoc is a host tool (toolchain-independent for codegen); prefer the one
|
|
109
109
|
# bundled in the SDK (same one the TS codegen uses), falling back to the
|
|
110
|
-
# downloaded prefix's protoc.
|
|
111
|
-
|
|
110
|
+
# downloaded prefix's protoc. The prefix is built for the target, so a
|
|
111
|
+
# cross-build can't fall back to it.
|
|
112
|
+
set(MOBROWSER_PROTOC "${MOBROWSER_HOST_SDK_DIR}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}")
|
|
112
113
|
if (NOT EXISTS "${MOBROWSER_PROTOC}")
|
|
114
|
+
if (NOT MOBROWSER_HOST_SDK_DIR STREQUAL MOBROWSER_SDK_DIR)
|
|
115
|
+
message(FATAL_ERROR "protoc not found in the host SDK: ${MOBROWSER_PROTOC}")
|
|
116
|
+
endif ()
|
|
113
117
|
set(MOBROWSER_PROTOC "${MOBROWSER_PROTOBUF_SELECTED_ROOT}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}")
|
|
114
118
|
endif ()
|
|
115
119
|
if (NOT EXISTS "${MOBROWSER_PROTOC}")
|
|
@@ -219,11 +223,15 @@ foreach(dir ${PROTOBUF_IMPORT_DIRS})
|
|
|
219
223
|
list(APPEND PROTOC_ARGS --proto_path=${dir})
|
|
220
224
|
endforeach()
|
|
221
225
|
|
|
222
|
-
set(CC_NATIVEGEN_PLUGIN "${
|
|
226
|
+
set(CC_NATIVEGEN_PLUGIN "${MOBROWSER_HOST_SDK_DIR}/bin/cc_nativegen${CMAKE_EXECUTABLE_SUFFIX}")
|
|
223
227
|
|
|
224
228
|
if (MOBROWSER_USE_PREBUILT_PROTOBUF)
|
|
225
229
|
set(_protoc_command "${MOBROWSER_PROTOC}")
|
|
226
230
|
set(_protoc_depend "${MOBROWSER_PROTOC}")
|
|
231
|
+
elseif (NOT MOBROWSER_HOST_SDK_DIR STREQUAL MOBROWSER_SDK_DIR)
|
|
232
|
+
# Cross-build: the fetched protoc is built for the target and can't run here.
|
|
233
|
+
set(_protoc_command "${MOBROWSER_HOST_SDK_DIR}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}")
|
|
234
|
+
set(_protoc_depend "${_protoc_command}")
|
|
227
235
|
else ()
|
|
228
236
|
set(_protoc_command "$<TARGET_FILE:protoc>")
|
|
229
237
|
set(_protoc_depend protoc)
|
package/package.json
CHANGED