@mobrowser/native 2.16.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.
@@ -30,6 +30,18 @@ endif ()
30
30
 
31
31
  cmake_path(ABSOLUTE_PATH MOBROWSER_SDK_DIR NORMALIZE)
32
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}")
33
45
  set(MOBROWSER_SDK_NATIVE_DIR "${PROJECT_ROOT_DIR}/node_modules/@mobrowser/native")
34
46
  cmake_path(ABSOLUTE_PATH MOBROWSER_SDK_NATIVE_DIR NORMALIZE)
35
47
 
@@ -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
- set(MOBROWSER_PROTOC "${MOBROWSER_SDK_DIR}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}")
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 "${MOBROWSER_SDK_DIR}/bin/cc_nativegen${CMAKE_EXECUTABLE_SUFFIX}")
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobrowser/native",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "description": "Configuration files for MōBrowser native integration",
5
5
  "mobrowserSbomRelationship": "BUILD_DEPENDENCY_OF",
6
6
  "main": "cmake/MoBrowser.cmake",