@ng-native/desktop 0.0.0-stage → 0.23.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/LICENSE +21 -0
- package/README.md +51 -2
- package/app.plugin.cjs +17 -0
- package/bin/app-config.mjs +168 -0
- package/bin/autolink.mjs +224 -0
- package/bin/cli.mjs +158 -0
- package/bin/host.mjs +427 -0
- package/bin/ng-native-desktop.mjs +4 -0
- package/bin/package.mjs +971 -0
- package/bin/plist.mjs +68 -0
- package/bin/prebuilt.mjs +328 -0
- package/bin/toolchain.mjs +192 -0
- package/native/CMakeLists.txt +276 -0
- package/native/appkit/CMakeLists.txt +109 -0
- package/native/appkit/address-search.h +26 -0
- package/native/appkit/address-search.mm +277 -0
- package/native/appkit/animation-frames.h +14 -0
- package/native/appkit/animation-frames.mm +106 -0
- package/native/appkit/app-info.h +12 -0
- package/native/appkit/app-info.mm +98 -0
- package/native/appkit/app-updater.mm +128 -0
- package/native/appkit/app-windows.h +81 -0
- package/native/appkit/app-windows.mm +318 -0
- package/native/appkit/appkit-backend.h +73 -0
- package/native/appkit/appkit-backend.mm +276 -0
- package/native/appkit/apple-authentication.h +19 -0
- package/native/appkit/apple-authentication.mm +248 -0
- package/native/appkit/apple-button-view.h +10 -0
- package/native/appkit/apple-button-view.mm +37 -0
- package/native/appkit/apple-id-button.h +16 -0
- package/native/appkit/apple-id-button.mm +50 -0
- package/native/appkit/audio.h +16 -0
- package/native/appkit/audio.mm +275 -0
- package/native/appkit/battery.h +13 -0
- package/native/appkit/battery.mm +92 -0
- package/native/appkit/bookmarks.h +17 -0
- package/native/appkit/bookmarks.mm +145 -0
- package/native/appkit/calendar.h +25 -0
- package/native/appkit/calendar.mm +660 -0
- package/native/appkit/camera-view.h +15 -0
- package/native/appkit/camera-view.mm +130 -0
- package/native/appkit/camera.h +39 -0
- package/native/appkit/camera.mm +362 -0
- package/native/appkit/cg-canvas.h +17 -0
- package/native/appkit/cg-canvas.mm +518 -0
- package/native/appkit/component-view.h +17 -0
- package/native/appkit/crypto.h +19 -0
- package/native/appkit/crypto.mm +78 -0
- package/native/appkit/desktop-expo.h +29 -0
- package/native/appkit/desktop-expo.mm +385 -0
- package/native/appkit/expo-image-drawing.h +46 -0
- package/native/appkit/expo-image-drawing.mm +131 -0
- package/native/appkit/expo-image-view.h +15 -0
- package/native/appkit/expo-image-view.mm +182 -0
- package/native/appkit/expo-ui-renderer.h +68 -0
- package/native/appkit/expo-ui-renderer.mm +101 -0
- package/native/appkit/expo-ui-view.h +26 -0
- package/native/appkit/expo-ui-view.mm +134 -0
- package/native/appkit/expo-ui.swift +1284 -0
- package/native/appkit/file-system.h +16 -0
- package/native/appkit/file-system.mm +140 -0
- package/native/appkit/fonts.h +12 -0
- package/native/appkit/fonts.mm +48 -0
- package/native/appkit/geocoder.h +19 -0
- package/native/appkit/geocoder.mm +101 -0
- package/native/appkit/glass-effect.h +22 -0
- package/native/appkit/glass-effect.mm +63 -0
- package/native/appkit/glass-view.h +8 -0
- package/native/appkit/glass-view.mm +65 -0
- package/native/appkit/header-toolbar.h +60 -0
- package/native/appkit/header-toolbar.mm +629 -0
- package/native/appkit/host-view.h +54 -0
- package/native/appkit/host-view.mm +1200 -0
- package/native/appkit/image-manipulator.h +14 -0
- package/native/appkit/image-manipulator.mm +191 -0
- package/native/appkit/image-request.h +22 -0
- package/native/appkit/image-request.mm +62 -0
- package/native/appkit/image-view.h +8 -0
- package/native/appkit/image-view.mm +142 -0
- package/native/appkit/input-replay.h +25 -0
- package/native/appkit/input-replay.mm +418 -0
- package/native/appkit/language-model.h +14 -0
- package/native/appkit/language-model.mm +99 -0
- package/native/appkit/language-model.swift +472 -0
- package/native/appkit/local-authentication.h +15 -0
- package/native/appkit/local-authentication.mm +133 -0
- package/native/appkit/location.h +16 -0
- package/native/appkit/location.mm +214 -0
- package/native/appkit/main.mm +1515 -0
- package/native/appkit/map-view.h +15 -0
- package/native/appkit/map-view.mm +109 -0
- package/native/appkit/maps.h +35 -0
- package/native/appkit/maps.mm +343 -0
- package/native/appkit/menu-bar.h +22 -0
- package/native/appkit/menu-bar.mm +208 -0
- package/native/appkit/modal-focus.h +16 -0
- package/native/appkit/modal-focus.mm +26 -0
- package/native/appkit/modal-host-view.h +79 -0
- package/native/appkit/modal-host-view.mm +442 -0
- package/native/appkit/native-controls.h +22 -0
- package/native/appkit/native-controls.mm +431 -0
- package/native/appkit/network-state.h +12 -0
- package/native/appkit/network-state.mm +64 -0
- package/native/appkit/network.h +14 -0
- package/native/appkit/network.mm +396 -0
- package/native/appkit/notifications.h +19 -0
- package/native/appkit/notifications.mm +309 -0
- package/native/appkit/photo-library.h +33 -0
- package/native/appkit/photo-library.mm +548 -0
- package/native/appkit/pointer-buttons.h +32 -0
- package/native/appkit/presentation-label.h +15 -0
- package/native/appkit/presentation-label.mm +12 -0
- package/native/appkit/presented-screen.h +19 -0
- package/native/appkit/presented-screen.mm +181 -0
- package/native/appkit/printing.h +42 -0
- package/native/appkit/printing.mm +393 -0
- package/native/appkit/push.h +19 -0
- package/native/appkit/push.mm +81 -0
- package/native/appkit/red-box.h +26 -0
- package/native/appkit/red-box.mm +387 -0
- package/native/appkit/screen-capture.h +21 -0
- package/native/appkit/screen-capture.mm +92 -0
- package/native/appkit/scroll-view.h +13 -0
- package/native/appkit/scroll-view.mm +251 -0
- package/native/appkit/scrollers.h +25 -0
- package/native/appkit/scrollers.mm +43 -0
- package/native/appkit/search-field.h +34 -0
- package/native/appkit/search-field.mm +291 -0
- package/native/appkit/search-toolbar-item.h +19 -0
- package/native/appkit/search-toolbar-item.mm +269 -0
- package/native/appkit/share-picker.h +34 -0
- package/native/appkit/share-picker.mm +121 -0
- package/native/appkit/split-view.h +77 -0
- package/native/appkit/split-view.mm +1206 -0
- package/native/appkit/store-review.h +13 -0
- package/native/appkit/store-review.mm +28 -0
- package/native/appkit/surface-view.h +45 -0
- package/native/appkit/surface-view.mm +558 -0
- package/native/appkit/svg-view.h +17 -0
- package/native/appkit/svg-view.mm +57 -0
- package/native/appkit/symbol-drawing.h +24 -0
- package/native/appkit/symbol-drawing.mm +117 -0
- package/native/appkit/symbol-view.h +8 -0
- package/native/appkit/symbol-view.mm +33 -0
- package/native/appkit/system-access.h +34 -0
- package/native/appkit/system-access.mm +210 -0
- package/native/appkit/system.h +24 -0
- package/native/appkit/system.mm +403 -0
- package/native/appkit/test-launch.h +36 -0
- package/native/appkit/test-launch.mm +115 -0
- package/native/appkit/text-input-field.h +76 -0
- package/native/appkit/text-input-field.mm +444 -0
- package/native/appkit/text-layout.h +58 -0
- package/native/appkit/text-layout.mm +477 -0
- package/native/appkit/text-recognition.h +13 -0
- package/native/appkit/text-recognition.mm +102 -0
- package/native/appkit/tracking.h +13 -0
- package/native/appkit/tracking.mm +51 -0
- package/native/appkit/tray-and-dock.h +45 -0
- package/native/appkit/tray-and-dock.mm +130 -0
- package/native/appkit/undo.h +23 -0
- package/native/appkit/undo.mm +125 -0
- package/native/appkit/updates.h +17 -0
- package/native/appkit/updates.mm +71 -0
- package/native/appkit/video-view.h +10 -0
- package/native/appkit/video-view.mm +42 -0
- package/native/appkit/video.h +38 -0
- package/native/appkit/video.mm +404 -0
- package/native/appkit/web-browser.h +12 -0
- package/native/appkit/web-browser.mm +97 -0
- package/native/appkit/web-view-component.h +9 -0
- package/native/appkit/web-view-component.mm +56 -0
- package/native/appkit/web-view.h +31 -0
- package/native/appkit/web-view.mm +394 -0
- package/native/cmake/libraries/react-native-reanimated.cmake +45 -0
- package/native/cmake/libraries/react-native-worklets.cmake +46 -0
- package/native/cmake/libraries.cmake +109 -0
- package/native/cmake/linked-modules.cmake +112 -0
- package/native/cmake/react-native.cmake +175 -0
- package/native/cmake/runtime-dependencies.cmake +34 -0
- package/native/cmake/swift.cmake +43 -0
- package/native/cmake/third-party.cmake +74 -0
- package/native/core/include/ngn/absent-views.h +27 -0
- package/native/core/include/ngn/accessibility.h +140 -0
- package/native/core/include/ngn/address-search.h +69 -0
- package/native/core/include/ngn/animation-frames.h +39 -0
- package/native/core/include/ngn/app-info.h +52 -0
- package/native/core/include/ngn/app-menus.h +146 -0
- package/native/core/include/ngn/app-windows.h +181 -0
- package/native/core/include/ngn/apple-authentication.h +116 -0
- package/native/core/include/ngn/asset.h +28 -0
- package/native/core/include/ngn/audio.h +125 -0
- package/native/core/include/ngn/back-swipe.h +112 -0
- package/native/core/include/ngn/battery.h +48 -0
- package/native/core/include/ngn/bytes.h +59 -0
- package/native/core/include/ngn/calendar.h +180 -0
- package/native/core/include/ngn/camera.h +128 -0
- package/native/core/include/ngn/control-sizes.h +111 -0
- package/native/core/include/ngn/core-modules.h +105 -0
- package/native/core/include/ngn/crypto.h +38 -0
- package/native/core/include/ngn/default-menu.h +91 -0
- package/native/core/include/ngn/desktop-expo.h +193 -0
- package/native/core/include/ngn/desktop-modal.h +109 -0
- package/native/core/include/ngn/desktop-props.h +75 -0
- package/native/core/include/ngn/desktop-view-props.h +110 -0
- package/native/core/include/ngn/dev-server.h +33 -0
- package/native/core/include/ngn/download.h +24 -0
- package/native/core/include/ngn/expo-image.h +192 -0
- package/native/core/include/ngn/expo-ui.h +133 -0
- package/native/core/include/ngn/file-system.h +274 -0
- package/native/core/include/ngn/focus-order.h +63 -0
- package/native/core/include/ngn/fonts.h +64 -0
- package/native/core/include/ngn/gestures.h +305 -0
- package/native/core/include/ngn/glass.h +67 -0
- package/native/core/include/ngn/header-bar.h +112 -0
- package/native/core/include/ngn/host-state.h +243 -0
- package/native/core/include/ngn/image-manipulator.h +70 -0
- package/native/core/include/ngn/input-dispatcher.h +211 -0
- package/native/core/include/ngn/input-script.h +56 -0
- package/native/core/include/ngn/input.h +112 -0
- package/native/core/include/ngn/key-value-store.h +41 -0
- package/native/core/include/ngn/language-model.h +69 -0
- package/native/core/include/ngn/launch-frame.h +47 -0
- package/native/core/include/ngn/launch-settings.h +98 -0
- package/native/core/include/ngn/layout-animations.h +24 -0
- package/native/core/include/ngn/library-components.h +13 -0
- package/native/core/include/ngn/library-glue.h +53 -0
- package/native/core/include/ngn/live-regions.h +54 -0
- package/native/core/include/ngn/local-authentication.h +74 -0
- package/native/core/include/ngn/location.h +89 -0
- package/native/core/include/ngn/maps.h +226 -0
- package/native/core/include/ngn/module-registry.h +51 -0
- package/native/core/include/ngn/mounting-backend.h +96 -0
- package/native/core/include/ngn/mounting-manager.h +155 -0
- package/native/core/include/ngn/native-controls.h +161 -0
- package/native/core/include/ngn/native-module.h +109 -0
- package/native/core/include/ngn/network-state.h +44 -0
- package/native/core/include/ngn/network.h +100 -0
- package/native/core/include/ngn/notifications.h +185 -0
- package/native/core/include/ngn/photo-library.h +130 -0
- package/native/core/include/ngn/printing.h +69 -0
- package/native/core/include/ngn/processes.h +114 -0
- package/native/core/include/ngn/red-box.h +119 -0
- package/native/core/include/ngn/reload-thread.h +258 -0
- package/native/core/include/ngn/runtime.h +161 -0
- package/native/core/include/ngn/safe-areas.h +77 -0
- package/native/core/include/ngn/screen-capture.h +35 -0
- package/native/core/include/ngn/screen-presentation.h +85 -0
- package/native/core/include/ngn/screen-stacks.h +80 -0
- package/native/core/include/ngn/scrollers.h +106 -0
- package/native/core/include/ngn/sharing.h +39 -0
- package/native/core/include/ngn/spawn-rules.h +78 -0
- package/native/core/include/ngn/splash-screen.h +41 -0
- package/native/core/include/ngn/split-view.h +270 -0
- package/native/core/include/ngn/sqlite.h +38 -0
- package/native/core/include/ngn/store-review.h +26 -0
- package/native/core/include/ngn/surface-book.h +101 -0
- package/native/core/include/ngn/svg.h +393 -0
- package/native/core/include/ngn/symbol.h +90 -0
- package/native/core/include/ngn/system.h +102 -0
- package/native/core/include/ngn/tabs-host.h +171 -0
- package/native/core/include/ngn/text-input.h +125 -0
- package/native/core/include/ngn/text-measurer.h +38 -0
- package/native/core/include/ngn/text-recognition.h +55 -0
- package/native/core/include/ngn/tracking.h +34 -0
- package/native/core/include/ngn/tray-and-dock.h +107 -0
- package/native/core/include/ngn/undo.h +37 -0
- package/native/core/include/ngn/updates.h +253 -0
- package/native/core/include/ngn/video.h +126 -0
- package/native/core/include/ngn/view-box.h +126 -0
- package/native/core/include/ngn/view-transform.h +26 -0
- package/native/core/include/ngn/view-tree.h +85 -0
- package/native/core/include/ngn/web-browser.h +45 -0
- package/native/core/include/ngn/web-view.h +133 -0
- package/native/core/include/ngn/worklet-host.h +98 -0
- package/native/core/src/absent-views.cpp +41 -0
- package/native/core/src/accessibility.cpp +374 -0
- package/native/core/src/animation-frames.cpp +49 -0
- package/native/core/src/app-menus.cpp +352 -0
- package/native/core/src/app-windows.cpp +444 -0
- package/native/core/src/back-swipe.cpp +91 -0
- package/native/core/src/bytes.cpp +158 -0
- package/native/core/src/control-sizes.cpp +232 -0
- package/native/core/src/default-menu.cpp +96 -0
- package/native/core/src/desktop-modal.cpp +162 -0
- package/native/core/src/desktop-view-props.cpp +80 -0
- package/native/core/src/dev-server-helper.cpp +152 -0
- package/native/core/src/dev-server.cpp +103 -0
- package/native/core/src/download.cpp +53 -0
- package/native/core/src/expo-image.cpp +548 -0
- package/native/core/src/expo-ui.cpp +203 -0
- package/native/core/src/focus-order.cpp +441 -0
- package/native/core/src/gestures.cpp +1806 -0
- package/native/core/src/glass.cpp +49 -0
- package/native/core/src/header-bar.cpp +104 -0
- package/native/core/src/host-services.cpp +50 -0
- package/native/core/src/host-state.cpp +61 -0
- package/native/core/src/input-dispatcher.cpp +727 -0
- package/native/core/src/input-script.cpp +123 -0
- package/native/core/src/key-value-store.cpp +169 -0
- package/native/core/src/launch-settings.cpp +148 -0
- package/native/core/src/layout-animations.cpp +62 -0
- package/native/core/src/libraries/RNCWebViewSpec.cpp +80 -0
- package/native/core/src/libraries/react-native-reanimated.cpp +216 -0
- package/native/core/src/libraries/react-native-worklets.cpp +192 -0
- package/native/core/src/libraries/rnscreens.cpp +125 -0
- package/native/core/src/libraries/rnsvg.cpp +345 -0
- package/native/core/src/libraries/safeareacontext.cpp +70 -0
- package/native/core/src/libraries/worklets-idle-frames.js +70 -0
- package/native/core/src/library-glue.cpp +35 -0
- package/native/core/src/live-regions.cpp +122 -0
- package/native/core/src/module-registry.cpp +50 -0
- package/native/core/src/modules/accessibility-manager.cpp +98 -0
- package/native/core/src/modules/address-search.cpp +219 -0
- package/native/core/src/modules/alert-manager.cpp +140 -0
- package/native/core/src/modules/app-info.cpp +74 -0
- package/native/core/src/modules/app-modules.cpp +405 -0
- package/native/core/src/modules/apple-authentication.cpp +188 -0
- package/native/core/src/modules/asset.cpp +111 -0
- package/native/core/src/modules/async-storage.cpp +192 -0
- package/native/core/src/modules/audio.cpp +541 -0
- package/native/core/src/modules/battery.cpp +88 -0
- package/native/core/src/modules/calendar.cpp +457 -0
- package/native/core/src/modules/camera.cpp +221 -0
- package/native/core/src/modules/core-modules.cpp +62 -0
- package/native/core/src/modules/crypto.cpp +117 -0
- package/native/core/src/modules/desktop-expo.cpp +527 -0
- package/native/core/src/modules/file-system.cpp +941 -0
- package/native/core/src/modules/fonts.cpp +163 -0
- package/native/core/src/modules/image-loader.cpp +105 -0
- package/native/core/src/modules/image-manipulator.cpp +305 -0
- package/native/core/src/modules/language-model.cpp +195 -0
- package/native/core/src/modules/local-authentication.cpp +140 -0
- package/native/core/src/modules/location.cpp +186 -0
- package/native/core/src/modules/maps.cpp +500 -0
- package/native/core/src/modules/network-state.cpp +72 -0
- package/native/core/src/modules/networking.cpp +387 -0
- package/native/core/src/modules/notifications.cpp +549 -0
- package/native/core/src/modules/photo-library.cpp +371 -0
- package/native/core/src/modules/printing.cpp +201 -0
- package/native/core/src/modules/screen-capture.cpp +71 -0
- package/native/core/src/modules/sharing.cpp +59 -0
- package/native/core/src/modules/splash-screen.cpp +70 -0
- package/native/core/src/modules/sqlite.cpp +421 -0
- package/native/core/src/modules/store-review.cpp +23 -0
- package/native/core/src/modules/text-recognition.cpp +107 -0
- package/native/core/src/modules/tracking.cpp +46 -0
- package/native/core/src/modules/undo.cpp +59 -0
- package/native/core/src/modules/video.cpp +366 -0
- package/native/core/src/modules/web-browser.cpp +100 -0
- package/native/core/src/modules/web-socket.cpp +266 -0
- package/native/core/src/mounting-manager.cpp +380 -0
- package/native/core/src/native-controls.cpp +129 -0
- package/native/core/src/native-module.cpp +250 -0
- package/native/core/src/network.cpp +219 -0
- package/native/core/src/posix-launcher.cpp +366 -0
- package/native/core/src/processes.cpp +324 -0
- package/native/core/src/red-box-errors.js +83 -0
- package/native/core/src/red-box.cpp +306 -0
- package/native/core/src/runtime.cpp +422 -0
- package/native/core/src/safe-areas.cpp +130 -0
- package/native/core/src/screen-presentation.cpp +61 -0
- package/native/core/src/screen-stacks.cpp +254 -0
- package/native/core/src/scrollers.cpp +181 -0
- package/native/core/src/spawn-rules.cpp +292 -0
- package/native/core/src/split-view.cpp +343 -0
- package/native/core/src/svg.cpp +1883 -0
- package/native/core/src/symbol.cpp +94 -0
- package/native/core/src/tabs-host.cpp +234 -0
- package/native/core/src/text-input.cpp +126 -0
- package/native/core/src/text-layout-manager.cpp +63 -0
- package/native/core/src/tray-and-dock.cpp +154 -0
- package/native/core/src/updates.cpp +965 -0
- package/native/core/src/view-box.cpp +788 -0
- package/native/core/src/view-transform.cpp +45 -0
- package/native/core/src/view-tree.cpp +234 -0
- package/native/core/src/web-view.cpp +143 -0
- package/native/core/src/worklet-host.cpp +10 -0
- package/native/scripts/build-hermes.sh +44 -0
- package/native/scripts/build.sh +171 -0
- package/native/scripts/cache-dir.sh +18 -0
- package/native/scripts/codegen-library.sh +193 -0
- package/native/scripts/compiler-launcher.sh +17 -0
- package/native/scripts/fetch.sh +174 -0
- package/native/scripts/hermes-built.sh +10 -0
- package/native/scripts/host-dir.sh +16 -0
- package/native/scripts/macos-target.sh +8 -0
- package/native/scripts/make-prebuilt.mjs +360 -0
- package/native/scripts/prebuilt-host-cache.mjs +158 -0
- package/native/shim/openssl/sha.h +22 -0
- package/native/shim/view-platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +37 -0
- package/package.json +70 -3
- package/prebuilt.json +33 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Autolinked native code: the libraries and app modules bin/autolink.mjs lists in the app's
|
|
2
|
+
# link.json, which scripts/build.sh passes as NGN_DESKTOP_LINK.
|
|
3
|
+
#
|
|
4
|
+
# - A library's CMake fragment (its `macos.cmakeDir`, `desktop` by default) declares the target its
|
|
5
|
+
# `macos.cmakeTarget` names. The build gives that target React Native's headers, JSI and folly,
|
|
6
|
+
# the host's appkit/component-view.h, and the codegen of the library's specs when its
|
|
7
|
+
# package.json has a codegenConfig: the `<Name>JSI.h` its C++ module implements, and its Fabric
|
|
8
|
+
# components' props, events and shadow nodes, which scripts/build.sh also compiles in and
|
|
9
|
+
# registers through cmake/libraries.cmake, as on Android.
|
|
10
|
+
# - An app module's `modules/<name>/macos/` folder either has a CMakeLists.txt declaring the target
|
|
11
|
+
# its expo-module.config.json names, or is compiled whole: every .cpp, .mm, .m and .c in it.
|
|
12
|
+
#
|
|
13
|
+
# Either way the code registers its TurboModules itself as it loads, the way React Native's iOS
|
|
14
|
+
# host takes a C++ module: registerCxxModuleToGlobalModuleMap (ReactCommon/CxxTurboModuleUtils.h)
|
|
15
|
+
# from a static initializer or `+load`. The registry asks that map after the host's own modules
|
|
16
|
+
# (ngn/module-registry.h). Each target links whole, so nothing that only registers is dropped.
|
|
17
|
+
#
|
|
18
|
+
# NGN_LINKED is what the binary links: every target above (static ones whole), or nothing. A list
|
|
19
|
+
# rather than an interface target, since an object library's objects reach only what links it
|
|
20
|
+
# directly.
|
|
21
|
+
set(NGN_DESKTOP_LINK "" CACHE FILEPATH "The app's link.json from bin/autolink.mjs")
|
|
22
|
+
set(NGN_LINK_CODEGEN "" CACHE STRING "<package>|<dir> for each linked library's module codegen")
|
|
23
|
+
|
|
24
|
+
add_library(ngn_module_api INTERFACE)
|
|
25
|
+
target_link_libraries(ngn_module_api INTERFACE react_native)
|
|
26
|
+
# A library's views include appkit/component-view.h, and through it the core's headers.
|
|
27
|
+
if(NGN_BACKEND STREQUAL "appkit")
|
|
28
|
+
target_include_directories(ngn_module_api INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/appkit ${CMAKE_CURRENT_SOURCE_DIR}/core/include)
|
|
29
|
+
endif()
|
|
30
|
+
|
|
31
|
+
set(NGN_LINKED "")
|
|
32
|
+
|
|
33
|
+
macro(ngn_link_target target)
|
|
34
|
+
target_link_libraries(${target} PRIVATE ngn_module_api)
|
|
35
|
+
get_target_property(_type ${target} TYPE)
|
|
36
|
+
if(_type STREQUAL "STATIC_LIBRARY")
|
|
37
|
+
list(APPEND NGN_LINKED "$<LINK_LIBRARY:WHOLE_ARCHIVE,${target}>")
|
|
38
|
+
else()
|
|
39
|
+
list(APPEND NGN_LINKED ${target})
|
|
40
|
+
endif()
|
|
41
|
+
endmacro()
|
|
42
|
+
|
|
43
|
+
if(NGN_DESKTOP_LINK)
|
|
44
|
+
if(NOT EXISTS ${NGN_DESKTOP_LINK})
|
|
45
|
+
message(FATAL_ERROR "NGN_DESKTOP_LINK names ${NGN_DESKTOP_LINK}, which does not exist")
|
|
46
|
+
endif()
|
|
47
|
+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${NGN_DESKTOP_LINK})
|
|
48
|
+
file(READ ${NGN_DESKTOP_LINK} _link)
|
|
49
|
+
string(JSON _version GET "${_link}" version)
|
|
50
|
+
if(NOT _version EQUAL 1)
|
|
51
|
+
message(FATAL_ERROR "${NGN_DESKTOP_LINK} is version ${_version}; this host reads version 1")
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
string(JSON _count LENGTH "${_link}" libraries)
|
|
55
|
+
if(_count GREATER 0)
|
|
56
|
+
math(EXPR _last "${_count} - 1")
|
|
57
|
+
foreach(i RANGE ${_last})
|
|
58
|
+
string(JSON _name GET "${_link}" libraries ${i} name)
|
|
59
|
+
string(JSON _target GET "${_link}" libraries ${i} cmakeTarget)
|
|
60
|
+
string(JSON _dir GET "${_link}" libraries ${i} cmakeDir)
|
|
61
|
+
string(MAKE_C_IDENTIFIER "${_name}" _id)
|
|
62
|
+
add_subdirectory(${_dir} ${CMAKE_BINARY_DIR}/linked/${_id})
|
|
63
|
+
if(NOT TARGET ${_target})
|
|
64
|
+
message(FATAL_ERROR "${_name}'s ${_dir}/CMakeLists.txt declares no target ${_target}, which its expo-module.config.json names")
|
|
65
|
+
endif()
|
|
66
|
+
foreach(_entry ${NGN_LINK_CODEGEN})
|
|
67
|
+
string(REPLACE "|" ";" _pair "${_entry}")
|
|
68
|
+
list(GET _pair 0 _for)
|
|
69
|
+
list(GET _pair 1 _codegen)
|
|
70
|
+
if(_for STREQUAL _name)
|
|
71
|
+
file(GLOB _spec_dirs LIST_DIRECTORIES true ${_codegen}/codegen/react/renderer/components/*)
|
|
72
|
+
target_include_directories(${_target} SYSTEM PRIVATE ${_codegen}/codegen ${_spec_dirs})
|
|
73
|
+
endif()
|
|
74
|
+
endforeach()
|
|
75
|
+
ngn_link_target(${_target})
|
|
76
|
+
endforeach()
|
|
77
|
+
endif()
|
|
78
|
+
|
|
79
|
+
string(JSON _count LENGTH "${_link}" appModules)
|
|
80
|
+
if(_count GREATER 0)
|
|
81
|
+
math(EXPR _last "${_count} - 1")
|
|
82
|
+
foreach(i RANGE ${_last})
|
|
83
|
+
string(JSON _name GET "${_link}" appModules ${i} name)
|
|
84
|
+
string(JSON _dir GET "${_link}" appModules ${i} dir)
|
|
85
|
+
string(JSON _target_type TYPE "${_link}" appModules ${i} cmakeTarget)
|
|
86
|
+
string(MAKE_C_IDENTIFIER "${_name}" _id)
|
|
87
|
+
if(_target_type STREQUAL "STRING")
|
|
88
|
+
string(JSON _target GET "${_link}" appModules ${i} cmakeTarget)
|
|
89
|
+
if(NOT EXISTS ${_dir}/CMakeLists.txt)
|
|
90
|
+
message(FATAL_ERROR "The app module ${_name} names the CMake target ${_target} without a ${_dir}/CMakeLists.txt")
|
|
91
|
+
endif()
|
|
92
|
+
add_subdirectory(${_dir} ${CMAKE_BINARY_DIR}/linked/app-${_id})
|
|
93
|
+
if(NOT TARGET ${_target})
|
|
94
|
+
message(FATAL_ERROR "${_dir}/CMakeLists.txt declares no target ${_target}, which the app module ${_name} names")
|
|
95
|
+
endif()
|
|
96
|
+
else()
|
|
97
|
+
file(GLOB_RECURSE _srcs CONFIGURE_DEPENDS ${_dir}/*.cpp ${_dir}/*.mm ${_dir}/*.m ${_dir}/*.c)
|
|
98
|
+
if(NOT _srcs)
|
|
99
|
+
message(WARNING "The app module ${_name} has no sources in ${_dir}, so nothing is compiled for it")
|
|
100
|
+
continue()
|
|
101
|
+
endif()
|
|
102
|
+
set(_target ngn_app_module_${_id})
|
|
103
|
+
add_library(${_target} OBJECT ${_srcs})
|
|
104
|
+
target_include_directories(${_target} PRIVATE ${_dir})
|
|
105
|
+
if(APPLE)
|
|
106
|
+
target_compile_options(${_target} PRIVATE $<$<COMPILE_LANGUAGE:OBJC,OBJCXX>:-fobjc-arc>)
|
|
107
|
+
endif()
|
|
108
|
+
endif()
|
|
109
|
+
ngn_link_target(${_target})
|
|
110
|
+
endforeach()
|
|
111
|
+
endif()
|
|
112
|
+
endif()
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# React Native's C++ core: ReactCommon from the installed react-native package (RN_DIR) and
|
|
2
|
+
# ReactCxxPlatform from the matching git tag in the cache.
|
|
3
|
+
#
|
|
4
|
+
# Two sets. The renderer set (Fabric, Yoga, the components, TurboModule plumbing) is toolkit-free
|
|
5
|
+
# and needs no JavaScript engine: the core and its tests build on it alone, on any OS. The runtime
|
|
6
|
+
# set adds Hermes, the JSI executor and ReactCxxPlatform's ReactHost, for a host that runs a bundle.
|
|
7
|
+
#
|
|
8
|
+
# The directory list (the transitive closure of what ReactHost needs), the iOS TextInput variant,
|
|
9
|
+
# and dropping the stub TextLayoutManager.cpp follow Basalt
|
|
10
|
+
# 0.2.9's ReactNativeCore.cmake (MIT, Copyright (c) 2026 Vince Vella), which mirrors Fantom.
|
|
11
|
+
|
|
12
|
+
set(REACT_COMMON_DIR ${RN_DIR}/ReactCommon)
|
|
13
|
+
set(REACT_ANDROID_DIR ${RN_DIR}/ReactAndroid)
|
|
14
|
+
set(REACT_CXX_PLATFORM_DIR ${NGN_SOURCES}/react-native/packages/react-native/ReactCxxPlatform)
|
|
15
|
+
|
|
16
|
+
include(${REACT_COMMON_DIR}/cmake-utils/internal/react-native-platform-selector.cmake)
|
|
17
|
+
|
|
18
|
+
# The shim's view traits replace the cxx platform's (shim/view-platform), so they come first; they
|
|
19
|
+
# read the core's desktop props.
|
|
20
|
+
include_directories(BEFORE SYSTEM
|
|
21
|
+
${CMAKE_CURRENT_LIST_DIR}/../shim/view-platform
|
|
22
|
+
${CMAKE_CURRENT_LIST_DIR}/../core/include)
|
|
23
|
+
include_directories(SYSTEM
|
|
24
|
+
${REACT_COMMON_DIR}/react/renderer/graphics/platform/cxx
|
|
25
|
+
${REACT_COMMON_DIR}/react/renderer/components/view/platform/cxx
|
|
26
|
+
${REACT_COMMON_DIR}/react/renderer/textlayoutmanager/platform/cxx
|
|
27
|
+
${REACT_COMMON_DIR}/react/renderer/imagemanager/platform/cxx
|
|
28
|
+
${REACT_COMMON_DIR}/react/utils/platform/cxx
|
|
29
|
+
${REACT_COMMON_DIR}/runtimeexecutor/platform/cxx
|
|
30
|
+
${REACT_CXX_PLATFORM_DIR})
|
|
31
|
+
|
|
32
|
+
set(RN_RENDERER_DIRS
|
|
33
|
+
callinvoker cxxreact devtoolsruntimesettings jserrorhandler jsiexecutor
|
|
34
|
+
jsinspector-modern jsinspector-modern/cdp jsinspector-modern/network
|
|
35
|
+
jsinspector-modern/tracing jsitooling logger oscompat react/bridging react/cxxstableapi
|
|
36
|
+
react/debug react/featureflags react/nativemodule/core react/nativemodule/defaults
|
|
37
|
+
react/nativemodule/devtoolsruntimesettings react/nativemodule/dom
|
|
38
|
+
react/nativemodule/featureflags react/nativemodule/idlecallbacks
|
|
39
|
+
react/nativemodule/intersectionobserver react/nativemodule/microtasks
|
|
40
|
+
react/nativemodule/mutationobserver react/nativemodule/resizeobserver
|
|
41
|
+
react/nativemodule/viewtransition react/nativemodule/webperformance
|
|
42
|
+
react/performance/cdpmetrics react/performance/timeline react/renderer/animated
|
|
43
|
+
react/renderer/animationbackend react/renderer/attributedstring react/renderer/bridging
|
|
44
|
+
react/renderer/componentregistry react/renderer/componentregistry/native
|
|
45
|
+
react/renderer/components/image react/renderer/components/legacyviewmanagerinterop
|
|
46
|
+
react/renderer/components/modal react/renderer/components/root
|
|
47
|
+
react/renderer/components/scrollview react/renderer/components/text
|
|
48
|
+
react/renderer/components/view react/renderer/consistency react/renderer/core
|
|
49
|
+
react/renderer/css react/renderer/debug react/renderer/dom react/renderer/graphics
|
|
50
|
+
react/renderer/imagemanager react/renderer/leakchecker react/renderer/mapbuffer
|
|
51
|
+
react/renderer/mounting react/renderer/observers/events
|
|
52
|
+
react/renderer/observers/intersection react/renderer/observers/mutation
|
|
53
|
+
react/renderer/observers/resize react/renderer/runtimescheduler react/renderer/scheduler
|
|
54
|
+
react/renderer/telemetry react/renderer/textlayoutmanager react/renderer/uimanager
|
|
55
|
+
react/renderer/uimanager/consistency react/renderer/viewtransition react/timing react/utils
|
|
56
|
+
reactperflogger runtimeexecutor yoga)
|
|
57
|
+
set(RN_RUNTIME_DIRS hermes/executor hermes/inspector-modern react/runtime react/runtime/hermes)
|
|
58
|
+
|
|
59
|
+
set(rn_dirs ${RN_RENDERER_DIRS})
|
|
60
|
+
if(NGN_WITH_RUNTIME)
|
|
61
|
+
list(APPEND rn_dirs ${RN_RUNTIME_DIRS})
|
|
62
|
+
endif()
|
|
63
|
+
foreach(dir ${rn_dirs})
|
|
64
|
+
if(NOT EXISTS ${REACT_COMMON_DIR}/${dir}/CMakeLists.txt)
|
|
65
|
+
message(FATAL_ERROR "react-native has no ReactCommon/${dir}: the directory list needs updating")
|
|
66
|
+
endif()
|
|
67
|
+
add_subdirectory(${REACT_COMMON_DIR}/${dir} ReactCommon/${dir})
|
|
68
|
+
endforeach()
|
|
69
|
+
add_library(yoga ALIAS yogacore)
|
|
70
|
+
|
|
71
|
+
# The core implements TextLayoutManager (src/text-layout-manager.cpp) over a backend's
|
|
72
|
+
# TextMeasurer, so React Native's stub leaves the build and its header stays.
|
|
73
|
+
get_target_property(_tlm react_renderer_textlayoutmanager SOURCES)
|
|
74
|
+
list(FILTER _tlm EXCLUDE REGEX "platform/cxx/react/renderer/textlayoutmanager/TextLayoutManager.cpp$")
|
|
75
|
+
set_target_properties(react_renderer_textlayoutmanager PROPERTIES SOURCES "${_tlm}")
|
|
76
|
+
|
|
77
|
+
# React Native's component codegen (FBReactNativeSpec), generated by scripts/fetch.sh.
|
|
78
|
+
set(CODEGEN_DIR ${NGN_SOURCES}/codegen)
|
|
79
|
+
file(GLOB codegen_SRC CONFIGURE_DEPENDS ${CODEGEN_DIR}/react/renderer/components/FBReactNativeSpec/*.cpp)
|
|
80
|
+
add_library(react_codegen_rncore OBJECT ${codegen_SRC})
|
|
81
|
+
target_include_directories(react_codegen_rncore SYSTEM PUBLIC ${CODEGEN_DIR}
|
|
82
|
+
${CODEGEN_DIR}/react/renderer/components/FBReactNativeSpec ${CODEGEN_DIR}/react/renderer/components)
|
|
83
|
+
target_link_libraries(react_codegen_rncore jsi react_nativemodule_core rrc_view)
|
|
84
|
+
target_compile_options(react_codegen_rncore PRIVATE -fexceptions -frtti)
|
|
85
|
+
|
|
86
|
+
# TextInput from React Native's iOS variant: portable C++ (Android's needs fbjni).
|
|
87
|
+
set(TI ${REACT_COMMON_DIR}/react/renderer/components/textinput)
|
|
88
|
+
file(GLOB ti_SRC ${TI}/*.cpp ${TI}/platform/ios/react/renderer/components/iostextinput/*.cpp)
|
|
89
|
+
add_library(rn_textinput OBJECT ${ti_SRC})
|
|
90
|
+
target_include_directories(rn_textinput SYSTEM PUBLIC ${TI} ${TI}/platform/ios ${REACT_COMMON_DIR})
|
|
91
|
+
target_link_libraries(rn_textinput glog folly_runtime jsi react_debug react_renderer_attributedstring
|
|
92
|
+
react_renderer_componentregistry react_renderer_core react_renderer_graphics
|
|
93
|
+
react_renderer_imagemanager react_renderer_mounting react_renderer_textlayoutmanager
|
|
94
|
+
react_renderer_uimanager react_utils rrc_image rrc_text rrc_view yoga)
|
|
95
|
+
target_compile_options(rn_textinput PRIVATE -fexceptions -frtti -Wno-unknown-pragmas)
|
|
96
|
+
|
|
97
|
+
# jsi, which React Native's own CMakeLists makes a shared library (Android's layout). Here it is
|
|
98
|
+
# an object library like the rest, so it links in statically.
|
|
99
|
+
file(GLOB jsi_SRC CONFIGURE_DEPENDS ${REACT_COMMON_DIR}/jsi/jsi/*.cpp)
|
|
100
|
+
add_library(jsi OBJECT ${jsi_SRC})
|
|
101
|
+
target_include_directories(jsi PUBLIC ${REACT_COMMON_DIR}/jsi)
|
|
102
|
+
target_link_libraries(jsi folly_runtime glog)
|
|
103
|
+
|
|
104
|
+
if(NGN_WITH_RUNTIME)
|
|
105
|
+
foreach(dir coremodules devsupport http io logging nativemodule profiling renderer/scheduler
|
|
106
|
+
renderer/uimanager runtime threading utils)
|
|
107
|
+
add_subdirectory(${REACT_CXX_PLATFORM_DIR}/react/${dir} ReactCxxPlatform/${dir})
|
|
108
|
+
endforeach()
|
|
109
|
+
# The core's src/dev-server-helper.cpp replaces upstream's, which hard-codes `android` as the
|
|
110
|
+
# bundle's and the HMR client's platform. Its header stays.
|
|
111
|
+
get_target_property(_dsh react_cxx_platform_react_devsupport SOURCES)
|
|
112
|
+
list(FILTER _dsh EXCLUDE REGEX "/devsupport/DevServerHelper.cpp$")
|
|
113
|
+
set_target_properties(react_cxx_platform_react_devsupport PROPERTIES SOURCES "${_dsh}")
|
|
114
|
+
|
|
115
|
+
# ReactHost makes its Scheduler with no animation delegate, so layout animations (and the
|
|
116
|
+
# engine's transitions of sizes and places, which rely on them) do nothing. The build compiles a
|
|
117
|
+
# copy that makes it through the core's ngn::makeScheduler (ngn/layout-animations.h), with React
|
|
118
|
+
# Native's LayoutAnimationDriver; the pattern must match, or the build stops.
|
|
119
|
+
set(_rh_src ${REACT_CXX_PLATFORM_DIR}/react/runtime/ReactHost.cpp)
|
|
120
|
+
file(READ ${_rh_src} _rh)
|
|
121
|
+
set(_rh_from "std::make_unique<Scheduler>(toolbox, nullptr, schedulerDelegate.get());")
|
|
122
|
+
string(FIND "${_rh}" "${_rh_from}" _rh_at)
|
|
123
|
+
if(_rh_at EQUAL -1)
|
|
124
|
+
message(FATAL_ERROR "ReactHost.cpp no longer makes its Scheduler as cmake/react-native.cmake expects")
|
|
125
|
+
endif()
|
|
126
|
+
string(REPLACE "${_rh_from}" "ngn::makeScheduler(toolbox, schedulerDelegate.get());" _rh "${_rh}")
|
|
127
|
+
string(REPLACE "#include \"ReactHost.h\"" "#include \"ReactHost.h\"\n#include \"ngn/layout-animations.h\"" _rh "${_rh}")
|
|
128
|
+
file(WRITE ${CMAKE_BINARY_DIR}/generated/ReactHost.cpp.in "${_rh}")
|
|
129
|
+
configure_file(${CMAKE_BINARY_DIR}/generated/ReactHost.cpp.in ${CMAKE_BINARY_DIR}/generated/ReactHost.cpp COPYONLY)
|
|
130
|
+
get_target_property(_rhs react_cxx_platform_react_runtime SOURCES)
|
|
131
|
+
list(FILTER _rhs EXCLUDE REGEX "/runtime/ReactHost.cpp$")
|
|
132
|
+
list(APPEND _rhs ${CMAKE_BINARY_DIR}/generated/ReactHost.cpp)
|
|
133
|
+
set_target_properties(react_cxx_platform_react_runtime PROPERTIES SOURCES "${_rhs}")
|
|
134
|
+
target_include_directories(react_cxx_platform_react_runtime PRIVATE ${REACT_CXX_PLATFORM_DIR}/react/runtime
|
|
135
|
+
${CMAKE_CURRENT_SOURCE_DIR}/core/include)
|
|
136
|
+
endif()
|
|
137
|
+
|
|
138
|
+
# React Native's layout animation driver, an object library like the rest (its own CMakeLists
|
|
139
|
+
# makes a static library that wants Android's glog_init).
|
|
140
|
+
file(GLOB animations_SRC CONFIGURE_DEPENDS ${REACT_COMMON_DIR}/react/renderer/animations/*.cpp)
|
|
141
|
+
add_library(rn_animations OBJECT ${animations_SRC})
|
|
142
|
+
target_link_libraries(rn_animations folly_runtime glog jsi react_debug react_renderer_componentregistry
|
|
143
|
+
react_renderer_core react_renderer_debug react_renderer_graphics react_renderer_mounting
|
|
144
|
+
react_renderer_uimanager rrc_view yoga)
|
|
145
|
+
|
|
146
|
+
# Every React Native object library, as one static archive: a binary takes only the objects it
|
|
147
|
+
# references, so the core tests link without Hermes even though some objects mention it.
|
|
148
|
+
function(ngn_collect_targets dir out)
|
|
149
|
+
get_property(ts DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
|
|
150
|
+
get_property(subs DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
|
|
151
|
+
foreach(s ${subs})
|
|
152
|
+
ngn_collect_targets(${s} sub)
|
|
153
|
+
list(APPEND ts ${sub})
|
|
154
|
+
endforeach()
|
|
155
|
+
set(${out} ${ts} PARENT_SCOPE)
|
|
156
|
+
endfunction()
|
|
157
|
+
ngn_collect_targets(${CMAKE_CURRENT_SOURCE_DIR} _all_targets)
|
|
158
|
+
set(RN_OBJECT_LIBRARIES)
|
|
159
|
+
foreach(t ${_all_targets})
|
|
160
|
+
get_target_property(type ${t} TYPE)
|
|
161
|
+
if(type STREQUAL "OBJECT_LIBRARY")
|
|
162
|
+
list(APPEND RN_OBJECT_LIBRARIES ${t})
|
|
163
|
+
target_compile_options(${t} PRIVATE -include cstdint -w)
|
|
164
|
+
endif()
|
|
165
|
+
endforeach()
|
|
166
|
+
target_compile_options(yogacore PRIVATE -include cstdint -w)
|
|
167
|
+
|
|
168
|
+
add_library(react_native STATIC)
|
|
169
|
+
# Linked directly, an object library's objects go into the archive, and its include directories,
|
|
170
|
+
# definitions and link dependencies carry on to whatever links the archive.
|
|
171
|
+
target_link_libraries(react_native PUBLIC ${RN_OBJECT_LIBRARIES})
|
|
172
|
+
target_link_libraries(react_native PUBLIC yogacore folly_runtime glog fmt double-conversion boost fast_float)
|
|
173
|
+
# The modal component is a static library upstream, not an object library.
|
|
174
|
+
target_link_libraries(react_native PUBLIC rrc_modal)
|
|
175
|
+
target_compile_options(rrc_modal PRIVATE -include cstdint -w)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# What the runtime half needs beyond the renderer: Hermes, built statically by
|
|
2
|
+
# scripts/build-hermes.sh, and the one OpenSSL call React Native's dev-server helper makes.
|
|
3
|
+
|
|
4
|
+
if(NOT IS_DIRECTORY "${NGN_HERMES_BUILD}")
|
|
5
|
+
message(FATAL_ERROR "NGN_HERMES_BUILD is not set to a directory; build through scripts/build.sh")
|
|
6
|
+
endif()
|
|
7
|
+
|
|
8
|
+
# --- Hermes, static ------------------------------------------------------------------------------
|
|
9
|
+
# React Native's CMakeLists link hermes-engine::hermesvm (0.87 and later) or ::libhermes (before).
|
|
10
|
+
# GLOBAL, since React Native's directories are siblings of this one.
|
|
11
|
+
set(HERMES_SRC ${NGN_SOURCES}/hermes)
|
|
12
|
+
set(_hermes_link ${NGN_HERMES_BUILD}/lib/libhermesvm_a.a)
|
|
13
|
+
# Hermes's own Boost.Context (renamed hoost), which its stack executor runs on, is a library of
|
|
14
|
+
# its own beside the archive.
|
|
15
|
+
file(GLOB _hermes_context ${NGN_HERMES_BUILD}/external/boost/*/libs/context/libboost_context.a)
|
|
16
|
+
list(APPEND _hermes_link ${_hermes_context})
|
|
17
|
+
if(APPLE)
|
|
18
|
+
# Intl is built over Foundation, as in React Native's Apple builds.
|
|
19
|
+
list(APPEND _hermes_link "-framework Foundation")
|
|
20
|
+
endif()
|
|
21
|
+
foreach(alias hermesvm libhermes)
|
|
22
|
+
add_library(hermes-engine::${alias} INTERFACE IMPORTED GLOBAL)
|
|
23
|
+
set_target_properties(hermes-engine::${alias} PROPERTIES INTERFACE_LINK_LIBRARIES "${_hermes_link}")
|
|
24
|
+
endforeach()
|
|
25
|
+
# React Native's hermes targets include <hermes/hermes.h> without a target that carries the path.
|
|
26
|
+
include_directories(SYSTEM ${HERMES_SRC}/API ${HERMES_SRC}/public ${NGN_HERMES_BUILD}/lib/config)
|
|
27
|
+
|
|
28
|
+
# --- OpenSSL::Crypto -----------------------------------------------------------------------------
|
|
29
|
+
# ReactCxxPlatform's DevServerHelper hashes a device id with SHA256_Init/Update/Final and nothing
|
|
30
|
+
# else from OpenSSL. A shim header maps those onto the system's own SHA-256 rather than building
|
|
31
|
+
# OpenSSL for one hash.
|
|
32
|
+
add_library(OpenSSL::Crypto INTERFACE IMPORTED GLOBAL)
|
|
33
|
+
set_target_properties(OpenSSL::Crypto PROPERTIES
|
|
34
|
+
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/shim)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# The AppKit backend's Swift: what only Swift can call (Foundation Models, and SwiftUI for
|
|
2
|
+
# `@expo/ui`), compiled by swiftc for each architecture and joined with lipo into one object, which
|
|
3
|
+
# a target takes as a source with ngn_link_swift. CMake's own Swift support is not used: it does not build one Swift object for
|
|
4
|
+
# several architectures, which a universal host needs.
|
|
5
|
+
execute_process(COMMAND xcrun --find swiftc OUTPUT_VARIABLE NGN_SWIFTC OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
|
|
6
|
+
execute_process(COMMAND xcrun --show-sdk-path OUTPUT_VARIABLE _ngn_sdk OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
|
|
7
|
+
get_filename_component(_ngn_swift_toolchain "${NGN_SWIFTC}/../.." ABSOLUTE)
|
|
8
|
+
|
|
9
|
+
set(_ngn_swift_archs ${CMAKE_OSX_ARCHITECTURES})
|
|
10
|
+
if(NOT _ngn_swift_archs)
|
|
11
|
+
set(_ngn_swift_archs ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
|
12
|
+
endif()
|
|
13
|
+
set(_ngn_swift_sources ${CMAKE_CURRENT_SOURCE_DIR}/appkit/language-model.swift ${CMAKE_CURRENT_SOURCE_DIR}/appkit/expo-ui.swift)
|
|
14
|
+
set(_ngn_swift_objects)
|
|
15
|
+
foreach(arch ${_ngn_swift_archs})
|
|
16
|
+
set(_object ${CMAKE_CURRENT_BINARY_DIR}/swift/ngn-swift-${arch}.o)
|
|
17
|
+
add_custom_command(OUTPUT ${_object}
|
|
18
|
+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/swift
|
|
19
|
+
COMMAND ${NGN_SWIFTC} -c -parse-as-library -wmo $<IF:$<CONFIG:Debug>,-Onone,-O> -g
|
|
20
|
+
-sdk ${_ngn_sdk} -target ${arch}-apple-macos${CMAKE_OSX_DEPLOYMENT_TARGET}
|
|
21
|
+
-module-name NGNSwift ${_ngn_swift_sources} -o ${_object}
|
|
22
|
+
DEPENDS ${_ngn_swift_sources}
|
|
23
|
+
VERBATIM)
|
|
24
|
+
list(APPEND _ngn_swift_objects ${_object})
|
|
25
|
+
endforeach()
|
|
26
|
+
set(NGN_SWIFT_OBJECT ${CMAKE_CURRENT_BINARY_DIR}/swift/ngn-swift.o)
|
|
27
|
+
add_custom_command(OUTPUT ${NGN_SWIFT_OBJECT}
|
|
28
|
+
COMMAND lipo -create ${_ngn_swift_objects} -output ${NGN_SWIFT_OBJECT}
|
|
29
|
+
DEPENDS ${_ngn_swift_objects}
|
|
30
|
+
VERBATIM)
|
|
31
|
+
add_custom_target(ngn_swift DEPENDS ${NGN_SWIFT_OBJECT})
|
|
32
|
+
|
|
33
|
+
# Links the Swift object into `target`: the runtime is the OS's, found at link time in the SDK and
|
|
34
|
+
# the toolchain's back-deployment libraries, and Foundation Models is weak, so the binary still
|
|
35
|
+
# starts on a macOS without it.
|
|
36
|
+
function(ngn_link_swift target)
|
|
37
|
+
add_dependencies(${target} ngn_swift)
|
|
38
|
+
target_sources(${target} PRIVATE ${NGN_SWIFT_OBJECT})
|
|
39
|
+
set_source_files_properties(${NGN_SWIFT_OBJECT} PROPERTIES EXTERNAL_OBJECT TRUE GENERATED TRUE)
|
|
40
|
+
target_link_options(${target} PRIVATE
|
|
41
|
+
-L${_ngn_sdk}/usr/lib/swift -L${_ngn_swift_toolchain}/lib/swift/macosx
|
|
42
|
+
-Wl,-rpath,/usr/lib/swift -Wl,-weak_framework,FoundationModels)
|
|
43
|
+
endfunction()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# The libraries React Native's own CMakeLists link against, by the target names they use (glog,
|
|
2
|
+
# fmt, double-conversion, boost, fast_float, folly_runtime, nlohmann_json), built here from the
|
|
3
|
+
# pinned sources scripts/fetch.sh puts in the cache, and linked statically. Nothing comes from the
|
|
4
|
+
# system or Homebrew.
|
|
5
|
+
#
|
|
6
|
+
# The folly source list and flags mirror React Native's Fantom tester
|
|
7
|
+
# (private/react-native-fantom/tester/third-party/folly), by way of Basalt 0.2.9's ThirdParty.cmake
|
|
8
|
+
# (MIT, Copyright (c) 2026 Vince Vella).
|
|
9
|
+
|
|
10
|
+
set(BUILD_SHARED_LIBS OFF)
|
|
11
|
+
# double-conversion asks for a CMake older than 3.5, which CMake 4 refuses without this.
|
|
12
|
+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
|
13
|
+
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
|
14
|
+
|
|
15
|
+
# --- glog 0.7.1 ----------------------------------------------------------------------------------
|
|
16
|
+
set(WITH_GFLAGS OFF CACHE BOOL "" FORCE)
|
|
17
|
+
set(WITH_GTEST OFF CACHE BOOL "" FORCE)
|
|
18
|
+
set(WITH_UNWIND none CACHE STRING "" FORCE)
|
|
19
|
+
set(WITH_PKGCONFIG OFF CACHE BOOL "" FORCE)
|
|
20
|
+
add_subdirectory(${NGN_SOURCES}/glog third-party/glog EXCLUDE_FROM_ALL SYSTEM)
|
|
21
|
+
# glog's build tree exports its whole src/ directory, internal headers included, and its internal
|
|
22
|
+
# demangle.h makes folly think libiberty is present. Consumers get the public headers only, as an
|
|
23
|
+
# installed glog gives them.
|
|
24
|
+
file(GLOB _glog_public ${NGN_SOURCES}/glog/src/glog/*.h)
|
|
25
|
+
file(COPY ${_glog_public} DESTINATION ${CMAKE_BINARY_DIR}/glog-include/glog)
|
|
26
|
+
set(_glog_include "$<BUILD_INTERFACE:${glog_BINARY_DIR}>;$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/glog-include>")
|
|
27
|
+
set_target_properties(glog PROPERTIES
|
|
28
|
+
INTERFACE_INCLUDE_DIRECTORIES "${_glog_include}"
|
|
29
|
+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_glog_include}")
|
|
30
|
+
# glog 0.7 refuses its headers unless this says they are consumed the supported way.
|
|
31
|
+
target_compile_definitions(glog INTERFACE GLOG_USE_GLOG_EXPORT)
|
|
32
|
+
# React Native's Android build installs signal handlers through glog_init. A desktop host has
|
|
33
|
+
# nothing for it to do, as in Fantom.
|
|
34
|
+
add_library(glog_init INTERFACE)
|
|
35
|
+
|
|
36
|
+
# --- fmt 12.1.0 ----------------------------------------------------------------------------------
|
|
37
|
+
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
|
|
38
|
+
add_subdirectory(${NGN_SOURCES}/fmt third-party/fmt EXCLUDE_FROM_ALL SYSTEM)
|
|
39
|
+
|
|
40
|
+
# --- double-conversion 3.3.1 ---------------------------------------------------------------------
|
|
41
|
+
add_subdirectory(${NGN_SOURCES}/double-conversion third-party/double-conversion EXCLUDE_FROM_ALL SYSTEM)
|
|
42
|
+
|
|
43
|
+
# --- boost 1.83.0, headers only ------------------------------------------------------------------
|
|
44
|
+
add_library(boost INTERFACE)
|
|
45
|
+
target_include_directories(boost SYSTEM INTERFACE ${NGN_SOURCES}/boost)
|
|
46
|
+
|
|
47
|
+
# --- fast_float, nlohmann_json (header-only) -----------------------------------------------------
|
|
48
|
+
add_library(fast_float INTERFACE)
|
|
49
|
+
target_include_directories(fast_float SYSTEM INTERFACE ${NGN_SOURCES}/fast_float/include)
|
|
50
|
+
add_library(nlohmann_json INTERFACE)
|
|
51
|
+
target_include_directories(nlohmann_json SYSTEM INTERFACE ${NGN_SOURCES}/nlohmann_json/include)
|
|
52
|
+
|
|
53
|
+
# --- doctest (the core tests) --------------------------------------------------------------------
|
|
54
|
+
add_library(doctest INTERFACE)
|
|
55
|
+
target_include_directories(doctest SYSTEM INTERFACE ${NGN_SOURCES}/doctest)
|
|
56
|
+
|
|
57
|
+
# --- folly_runtime -------------------------------------------------------------------------------
|
|
58
|
+
set(folly_FLAGS -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_CFG_NO_COROUTINES=1
|
|
59
|
+
-DFOLLY_MOBILE=0 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1)
|
|
60
|
+
set(folly_runtime_SRC
|
|
61
|
+
Conv.cpp Demangle.cpp FileUtil.cpp Format.cpp ScopeGuard.cpp SharedMutex.cpp String.cpp
|
|
62
|
+
Unicode.cpp concurrency/CacheLocality.cpp container/detail/F14Table.cpp
|
|
63
|
+
detail/FileUtilDetail.cpp detail/Futex.cpp detail/SplitStringSimd.cpp
|
|
64
|
+
detail/UniqueInstance.cpp hash/SpookyHashV2.cpp io/IOBuf.cpp json/dynamic.cpp
|
|
65
|
+
json/json_pointer.cpp json/json.cpp lang/CString.cpp lang/Exception.cpp lang/SafeAssert.cpp
|
|
66
|
+
lang/ToAscii.cpp memory/SanitizeAddress.cpp memory/detail/MallocImpl.cpp net/NetOps.cpp
|
|
67
|
+
portability/SysUio.cpp synchronization/SanitizeThread.cpp synchronization/ParkingLot.cpp
|
|
68
|
+
system/AtFork.cpp system/ThreadId.cpp system/ThreadName.cpp)
|
|
69
|
+
list(TRANSFORM folly_runtime_SRC PREPEND ${NGN_SOURCES}/folly/folly/)
|
|
70
|
+
add_library(folly_runtime STATIC ${folly_runtime_SRC})
|
|
71
|
+
target_compile_options(folly_runtime PRIVATE -fexceptions -frtti -Wno-sign-compare)
|
|
72
|
+
target_compile_options(folly_runtime PUBLIC ${folly_FLAGS})
|
|
73
|
+
target_include_directories(folly_runtime SYSTEM PUBLIC ${NGN_SOURCES}/folly)
|
|
74
|
+
target_link_libraries(folly_runtime PUBLIC glog double-conversion boost fmt fast_float)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// The views a desktop host has no counterpart for, by Fabric name, each with the reason. The view
|
|
2
|
+
// registry (MountingManager::hasComponent, which JavaScript reads as
|
|
3
|
+
// `__nativeComponentRegistry__hasComponent`) answers false for each, so the element reports itself
|
|
4
|
+
// absent, and one committed anyway mounts as a plain view (UnimplementedNativeView) whose children
|
|
5
|
+
// still show. A library compiled into the host that declares one (react-native-keyboard-controller)
|
|
6
|
+
// has it left out of the registry. The community views `slider`, `picker` and `masked-view` are
|
|
7
|
+
// here too: their libraries ship no macOS code, and `@expo/ui`'s SwiftUI slider and picker are
|
|
8
|
+
// the macOS ones.
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include <optional>
|
|
12
|
+
#include <string_view>
|
|
13
|
+
#include <vector>
|
|
14
|
+
|
|
15
|
+
namespace ngn {
|
|
16
|
+
|
|
17
|
+
struct AbsentView {
|
|
18
|
+
std::string_view name;
|
|
19
|
+
std::string_view reason;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const std::vector<AbsentView> &absentViews();
|
|
23
|
+
|
|
24
|
+
// Why the view `name` is absent here, or nothing for a view that is not.
|
|
25
|
+
std::optional<std::string_view> absentReason(std::string_view name);
|
|
26
|
+
|
|
27
|
+
} // namespace ngn
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// What assistive technology is told about a view, from React Native's accessibility props, in
|
|
2
|
+
// terms any desktop toolkit has: a role, a subrole that refines it, and a spoken role description
|
|
3
|
+
// for a role the toolkit lacks (a heading or an alert is a group described as one). The backend
|
|
4
|
+
// maps the role and subrole to its own (NSAccessibility on macOS).
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
8
|
+
#include <react/renderer/mounting/ShadowView.h>
|
|
9
|
+
|
|
10
|
+
#include <optional>
|
|
11
|
+
#include <string>
|
|
12
|
+
#include <vector>
|
|
13
|
+
|
|
14
|
+
namespace ngn {
|
|
15
|
+
|
|
16
|
+
class ViewTree;
|
|
17
|
+
|
|
18
|
+
enum class AxRole {
|
|
19
|
+
Group,
|
|
20
|
+
Button,
|
|
21
|
+
Link,
|
|
22
|
+
Image,
|
|
23
|
+
StaticText,
|
|
24
|
+
CheckBox,
|
|
25
|
+
RadioButton,
|
|
26
|
+
RadioGroup,
|
|
27
|
+
Slider,
|
|
28
|
+
TextField,
|
|
29
|
+
List,
|
|
30
|
+
Menu,
|
|
31
|
+
MenuItem,
|
|
32
|
+
MenuBar,
|
|
33
|
+
ProgressIndicator,
|
|
34
|
+
ComboBox,
|
|
35
|
+
TabGroup,
|
|
36
|
+
Toolbar,
|
|
37
|
+
ScrollBar,
|
|
38
|
+
Table,
|
|
39
|
+
Row,
|
|
40
|
+
Cell,
|
|
41
|
+
Incrementor,
|
|
42
|
+
// AppKit's heading role from macOS 26; a group described as a heading before it.
|
|
43
|
+
Heading,
|
|
44
|
+
LevelIndicator,
|
|
45
|
+
Outline,
|
|
46
|
+
ScrollArea,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
enum class AxSubrole { None, Switch, Toggle, Tab, SearchField, OutlineRow };
|
|
50
|
+
|
|
51
|
+
// A custom action an assistive technology lists by its label and sends back by its name.
|
|
52
|
+
struct AxAction {
|
|
53
|
+
std::string name;
|
|
54
|
+
std::string label;
|
|
55
|
+
bool operator==(const AxAction &other) const = default;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
struct AxInfo {
|
|
59
|
+
// Whether the view is an element of its own, or its children are read in its place.
|
|
60
|
+
bool element{false};
|
|
61
|
+
AxRole role{AxRole::Group};
|
|
62
|
+
AxSubrole subrole{AxSubrole::None};
|
|
63
|
+
// Spoken in place of the toolkit's name for the role; empty for the toolkit's own.
|
|
64
|
+
std::string roleDescription;
|
|
65
|
+
std::string label;
|
|
66
|
+
std::string hint;
|
|
67
|
+
std::string value;
|
|
68
|
+
// Whether the view is read as one element, its text and images part of it rather than elements
|
|
69
|
+
// of their own: an `accessible` view, as on iOS, and a control or heading.
|
|
70
|
+
bool hidesChildren{false};
|
|
71
|
+
// A landmark role (banner, main, navigation, complementary, contentinfo, form, region). `search` is
|
|
72
|
+
// React Native's search field, not ARIA's landmark.
|
|
73
|
+
bool landmark{false};
|
|
74
|
+
// A heading's level, from 1.
|
|
75
|
+
std::optional<int> level;
|
|
76
|
+
bool disabled{false};
|
|
77
|
+
bool selected{false};
|
|
78
|
+
// 0 unchecked, 1 checked, 2 mixed; nothing for a view that is not checkable.
|
|
79
|
+
std::optional<int> checked;
|
|
80
|
+
// Nothing for a view that neither expands nor collapses.
|
|
81
|
+
std::optional<bool> expanded;
|
|
82
|
+
// The declared actions AppKit has no verb of its own for, in their order.
|
|
83
|
+
std::vector<AxAction> customActions;
|
|
84
|
+
// Whether the view offers AppKit's press (VoiceOver's VO-Space), increment and decrement, and
|
|
85
|
+
// cancel (Escape).
|
|
86
|
+
bool offersPress{false};
|
|
87
|
+
bool offersIncrement{false};
|
|
88
|
+
bool offersCancel{false};
|
|
89
|
+
|
|
90
|
+
bool operator==(const AxInfo &other) const = default;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// The role name React Native goes by: `role` (ARIA) when set, else `accessibilityRole`.
|
|
94
|
+
std::string roleName(const facebook::react::ViewProps &props);
|
|
95
|
+
|
|
96
|
+
AxInfo accessibilityInfo(const facebook::react::ViewProps &props);
|
|
97
|
+
|
|
98
|
+
// A Paragraph's: static text whose value is the string it shows, unless a role says otherwise, and
|
|
99
|
+
// an element only when it says something.
|
|
100
|
+
AxInfo paragraphAccessibilityInfo(const facebook::react::ViewProps &props, const std::string &text);
|
|
101
|
+
|
|
102
|
+
// The string a Paragraph shows, from its state; empty for any other view.
|
|
103
|
+
std::string paragraphText(const facebook::react::ShadowView &view);
|
|
104
|
+
// The same from a Paragraph's state.
|
|
105
|
+
std::string paragraphText(const facebook::react::State::Shared &state);
|
|
106
|
+
|
|
107
|
+
// VoiceOver's rotors the host fills: its own Headings list has nothing in it before macOS 26, and
|
|
108
|
+
// AppKit has no landmark role or links list for a drawn view.
|
|
109
|
+
enum class AxRotor { Headings, Links, Landmarks };
|
|
110
|
+
|
|
111
|
+
// The rotors a view is listed on: none for one that is no element.
|
|
112
|
+
std::vector<AxRotor> rotorsOf(const AxInfo &info);
|
|
113
|
+
|
|
114
|
+
// The views on rotor `kind` under `root` (a container's root), in tree order, as VoiceOver lists
|
|
115
|
+
// them: a view not drawn (display: none, or a covered screen) is skipped with what it holds, as is
|
|
116
|
+
// another container's root; one that hides its children is listed but not looked into.
|
|
117
|
+
std::vector<facebook::react::Tag> rotorItems(const ViewTree &tree, facebook::react::Tag root, AxRotor kind);
|
|
118
|
+
|
|
119
|
+
// The item a rotor moves to, of `count` in tree order, from `current` (the item VoiceOver is on, if
|
|
120
|
+
// it is on one), forwards or back. Nothing past either end.
|
|
121
|
+
std::optional<size_t> rotorStep(size_t count, std::optional<size_t> current, bool forward);
|
|
122
|
+
// The same through a search's filter: `matches` says, for every item in tree order, whether its
|
|
123
|
+
// label has the text typed. The search starts from `current`, which need not match itself, and
|
|
124
|
+
// moves to the next item in the direction that does.
|
|
125
|
+
std::optional<size_t> rotorStep(const std::vector<bool> &matches, std::optional<size_t> current, bool forward);
|
|
126
|
+
|
|
127
|
+
// AppKit's standard actions on a view.
|
|
128
|
+
enum class AxVerb { Press, Increment, Decrement, Cancel };
|
|
129
|
+
|
|
130
|
+
// What one of them sends, as React Native iOS decides: its accessibility tap or escape when the
|
|
131
|
+
// view listens, a declared action (`activate`, `increment`, `decrement`, `escape`) when the view
|
|
132
|
+
// listens for actions, and for a press with neither, a click (iOS's synthesized tap).
|
|
133
|
+
struct AxDispatch {
|
|
134
|
+
enum class Kind { None, Tap, Escape, Action, Click } kind{Kind::None};
|
|
135
|
+
std::string action;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
AxDispatch axDispatch(const facebook::react::ViewProps &props, AxVerb verb);
|
|
139
|
+
|
|
140
|
+
} // namespace ngn
|