basalt-core 0.0.0-rc5

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.
Files changed (325) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli/basalt.d.ts +3 -0
  3. package/dist/cli/basalt.d.ts.map +1 -0
  4. package/dist/cli/basalt.js +47 -0
  5. package/dist/cli/basalt.js.map +1 -0
  6. package/dist/cli/bundle-cli.d.ts +12 -0
  7. package/dist/cli/bundle-cli.d.ts.map +1 -0
  8. package/dist/cli/bundle-cli.js +124 -0
  9. package/dist/cli/bundle-cli.js.map +1 -0
  10. package/dist/cli/bundleWithAssets.d.ts +79 -0
  11. package/dist/cli/bundleWithAssets.d.ts.map +1 -0
  12. package/dist/cli/bundleWithAssets.js +198 -0
  13. package/dist/cli/bundleWithAssets.js.map +1 -0
  14. package/dist/cli/desktop.d.ts +339 -0
  15. package/dist/cli/desktop.d.ts.map +1 -0
  16. package/dist/cli/desktop.js +1029 -0
  17. package/dist/cli/desktop.js.map +1 -0
  18. package/dist/cli/doctor.d.ts +31 -0
  19. package/dist/cli/doctor.d.ts.map +1 -0
  20. package/dist/cli/doctor.js +283 -0
  21. package/dist/cli/doctor.js.map +1 -0
  22. package/dist/cli/init.d.ts +77 -0
  23. package/dist/cli/init.d.ts.map +1 -0
  24. package/dist/cli/init.js +442 -0
  25. package/dist/cli/init.js.map +1 -0
  26. package/dist/cli/metro.d.ts +49 -0
  27. package/dist/cli/metro.d.ts.map +1 -0
  28. package/dist/cli/metro.js +148 -0
  29. package/dist/cli/metro.js.map +1 -0
  30. package/dist/cli/packageApp.d.ts +102 -0
  31. package/dist/cli/packageApp.d.ts.map +1 -0
  32. package/dist/cli/packageApp.js +319 -0
  33. package/dist/cli/packageApp.js.map +1 -0
  34. package/dist/cli/steps.d.ts +34 -0
  35. package/dist/cli/steps.d.ts.map +1 -0
  36. package/dist/cli/steps.js +53 -0
  37. package/dist/cli/steps.js.map +1 -0
  38. package/dist/metro-config.d.ts +168 -0
  39. package/dist/metro-config.d.ts.map +1 -0
  40. package/dist/metro-config.js +671 -0
  41. package/dist/metro-config.js.map +1 -0
  42. package/dist/react-native.config.d.ts +7 -0
  43. package/dist/react-native.config.d.ts.map +1 -0
  44. package/dist/react-native.config.js +80 -0
  45. package/dist/react-native.config.js.map +1 -0
  46. package/dist/src/DragSource.d.ts +52 -0
  47. package/dist/src/DragSource.d.ts.map +1 -0
  48. package/dist/src/DragSource.js +97 -0
  49. package/dist/src/DragSource.js.map +1 -0
  50. package/dist/src/DropTarget.d.ts +58 -0
  51. package/dist/src/DropTarget.d.ts.map +1 -0
  52. package/dist/src/DropTarget.js +131 -0
  53. package/dist/src/DropTarget.js.map +1 -0
  54. package/dist/src/KeyHandler.d.ts +57 -0
  55. package/dist/src/KeyHandler.d.ts.map +1 -0
  56. package/dist/src/KeyHandler.js +48 -0
  57. package/dist/src/KeyHandler.js.map +1 -0
  58. package/dist/src/Menu.d.ts +72 -0
  59. package/dist/src/Menu.d.ts.map +1 -0
  60. package/dist/src/Menu.js +179 -0
  61. package/dist/src/Menu.js.map +1 -0
  62. package/dist/src/TitleBar.d.ts +75 -0
  63. package/dist/src/TitleBar.d.ts.map +1 -0
  64. package/dist/src/TitleBar.js +236 -0
  65. package/dist/src/TitleBar.js.map +1 -0
  66. package/dist/src/Window.d.ts +87 -0
  67. package/dist/src/Window.d.ts.map +1 -0
  68. package/dist/src/Window.js +248 -0
  69. package/dist/src/Window.js.map +1 -0
  70. package/dist/src/closeRequest.d.ts +55 -0
  71. package/dist/src/closeRequest.d.ts.map +1 -0
  72. package/dist/src/closeRequest.js +134 -0
  73. package/dist/src/closeRequest.js.map +1 -0
  74. package/dist/src/index.d.ts +45 -0
  75. package/dist/src/index.d.ts.map +1 -0
  76. package/dist/src/index.js +92 -0
  77. package/dist/src/index.js.map +1 -0
  78. package/dist/src/overrides/Alert.d.ts +69 -0
  79. package/dist/src/overrides/Alert.d.ts.map +1 -0
  80. package/dist/src/overrides/Alert.js +112 -0
  81. package/dist/src/overrides/Alert.js.map +1 -0
  82. package/dist/src/overrides/BaseViewConfig.d.ts +28 -0
  83. package/dist/src/overrides/BaseViewConfig.d.ts.map +1 -0
  84. package/dist/src/overrides/BaseViewConfig.js +72 -0
  85. package/dist/src/overrides/BaseViewConfig.js.map +1 -0
  86. package/dist/src/overrides/Platform.linux.d.ts +10 -0
  87. package/dist/src/overrides/Platform.linux.d.ts.map +1 -0
  88. package/dist/src/overrides/Platform.linux.js +15 -0
  89. package/dist/src/overrides/Platform.linux.js.map +1 -0
  90. package/dist/src/overrides/Platform.macos.d.ts +10 -0
  91. package/dist/src/overrides/Platform.macos.d.ts.map +1 -0
  92. package/dist/src/overrides/Platform.macos.js +15 -0
  93. package/dist/src/overrides/Platform.macos.js.map +1 -0
  94. package/dist/src/overrides/Platform.windows.d.ts +10 -0
  95. package/dist/src/overrides/Platform.windows.d.ts.map +1 -0
  96. package/dist/src/overrides/Platform.windows.js +15 -0
  97. package/dist/src/overrides/Platform.windows.js.map +1 -0
  98. package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts +24 -0
  99. package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts.map +1 -0
  100. package/dist/src/overrides/ReactDevToolsSettingsManager.js +30 -0
  101. package/dist/src/overrides/ReactDevToolsSettingsManager.js.map +1 -0
  102. package/dist/src/overrides/RefreshControl.d.ts +52 -0
  103. package/dist/src/overrides/RefreshControl.d.ts.map +1 -0
  104. package/dist/src/overrides/RefreshControl.js +92 -0
  105. package/dist/src/overrides/RefreshControl.js.map +1 -0
  106. package/dist/src/overrides/ScrollView.d.ts +39 -0
  107. package/dist/src/overrides/ScrollView.d.ts.map +1 -0
  108. package/dist/src/overrides/ScrollView.js +59 -0
  109. package/dist/src/overrides/ScrollView.js.map +1 -0
  110. package/dist/src/overrides/Share.d.ts +96 -0
  111. package/dist/src/overrides/Share.d.ts.map +1 -0
  112. package/dist/src/overrides/Share.js +97 -0
  113. package/dist/src/overrides/Share.js.map +1 -0
  114. package/dist/src/overrides/TextInput.d.ts +81 -0
  115. package/dist/src/overrides/TextInput.d.ts.map +1 -0
  116. package/dist/src/overrides/TextInput.js +213 -0
  117. package/dist/src/overrides/TextInput.js.map +1 -0
  118. package/dist/src/overrides/View.d.ts +36 -0
  119. package/dist/src/overrides/View.d.ts.map +1 -0
  120. package/dist/src/overrides/View.js +99 -0
  121. package/dist/src/overrides/View.js.map +1 -0
  122. package/dist/src/overrides/createPlatform.d.ts +32 -0
  123. package/dist/src/overrides/createPlatform.d.ts.map +1 -0
  124. package/dist/src/overrides/createPlatform.js +84 -0
  125. package/dist/src/overrides/createPlatform.js.map +1 -0
  126. package/dist/src/overrides/setUpDeveloperTools.d.ts +28 -0
  127. package/dist/src/overrides/setUpDeveloperTools.d.ts.map +1 -0
  128. package/dist/src/overrides/setUpDeveloperTools.js +84 -0
  129. package/dist/src/overrides/setUpDeveloperTools.js.map +1 -0
  130. package/dist/src/overrides/setUpXHR.d.ts +46 -0
  131. package/dist/src/overrides/setUpXHR.d.ts.map +1 -0
  132. package/dist/src/overrides/setUpXHR.js +236 -0
  133. package/dist/src/overrides/setUpXHR.js.map +1 -0
  134. package/dist/src/quitRequest.d.ts +55 -0
  135. package/dist/src/quitRequest.d.ts.map +1 -0
  136. package/dist/src/quitRequest.js +121 -0
  137. package/dist/src/quitRequest.js.map +1 -0
  138. package/dist/src/resourcePath.d.ts +18 -0
  139. package/dist/src/resourcePath.d.ts.map +1 -0
  140. package/dist/src/resourcePath.js +31 -0
  141. package/dist/src/resourcePath.js.map +1 -0
  142. package/dist/src/responseBody.d.ts +76 -0
  143. package/dist/src/responseBody.d.ts.map +1 -0
  144. package/dist/src/responseBody.js +94 -0
  145. package/dist/src/responseBody.js.map +1 -0
  146. package/dist/src/responseHeaders.d.ts +40 -0
  147. package/dist/src/responseHeaders.d.ts.map +1 -0
  148. package/dist/src/responseHeaders.js +75 -0
  149. package/dist/src/responseHeaders.js.map +1 -0
  150. package/dist/src/titleBarState.d.ts +43 -0
  151. package/dist/src/titleBarState.d.ts.map +1 -0
  152. package/dist/src/titleBarState.js +77 -0
  153. package/dist/src/titleBarState.js.map +1 -0
  154. package/dist/src/useContextMenu.d.ts +113 -0
  155. package/dist/src/useContextMenu.d.ts.map +1 -0
  156. package/dist/src/useContextMenu.js +109 -0
  157. package/dist/src/useContextMenu.js.map +1 -0
  158. package/dist/src/useDialog.d.ts +98 -0
  159. package/dist/src/useDialog.d.ts.map +1 -0
  160. package/dist/src/useDialog.js +112 -0
  161. package/dist/src/useDialog.js.map +1 -0
  162. package/dist/src/useDisplays.d.ts +70 -0
  163. package/dist/src/useDisplays.d.ts.map +1 -0
  164. package/dist/src/useDisplays.js +118 -0
  165. package/dist/src/useDisplays.js.map +1 -0
  166. package/dist/src/useHandledKeys.d.ts +38 -0
  167. package/dist/src/useHandledKeys.d.ts.map +1 -0
  168. package/dist/src/useHandledKeys.js +70 -0
  169. package/dist/src/useHandledKeys.js.map +1 -0
  170. package/dist/src/useWindow.d.ts +140 -0
  171. package/dist/src/useWindow.d.ts.map +1 -0
  172. package/dist/src/useWindow.js +233 -0
  173. package/dist/src/useWindow.js.map +1 -0
  174. package/dist/tsconfig.tsbuildinfo +1 -0
  175. package/native/CMakeLists.txt +355 -0
  176. package/native/bootstrap.sh +613 -0
  177. package/native/cmake/CompilerFlags.cmake +49 -0
  178. package/native/cmake/Expo.cmake +125 -0
  179. package/native/cmake/ReactNativeCore.cmake +612 -0
  180. package/native/cmake/Reanimated.cmake +108 -0
  181. package/native/cmake/Skia.cmake +379 -0
  182. package/native/cmake/ThirdParty.cmake +290 -0
  183. package/native/cmake/Worklets.cmake +67 -0
  184. package/native/cmake/codegen/CMakeLists.txt +32 -0
  185. package/native/core/AppIdentity.cpp +85 -0
  186. package/native/core/AppIdentity.h +59 -0
  187. package/native/core/AppPaths.cpp +96 -0
  188. package/native/core/AppPaths.h +53 -0
  189. package/native/core/AppearanceModule.cpp +60 -0
  190. package/native/core/AppearanceModule.h +40 -0
  191. package/native/core/Backface.h +59 -0
  192. package/native/core/BlobModule.cpp +283 -0
  193. package/native/core/BlobModule.h +76 -0
  194. package/native/core/BlobRegistry.cpp +75 -0
  195. package/native/core/BlobRegistry.h +44 -0
  196. package/native/core/ColorScheme.cpp +105 -0
  197. package/native/core/ColorScheme.h +59 -0
  198. package/native/core/ComponentRegistry.h +30 -0
  199. package/native/core/ControlMetrics.h +37 -0
  200. package/native/core/CoreModules.cpp +592 -0
  201. package/native/core/CoreModules.h +308 -0
  202. package/native/core/DebuggingOverlay.cpp +106 -0
  203. package/native/core/DebuggingOverlay.h +65 -0
  204. package/native/core/DesktopControls.cpp +232 -0
  205. package/native/core/DesktopControls.h +170 -0
  206. package/native/core/DevBundle.cpp +108 -0
  207. package/native/core/DevBundle.h +69 -0
  208. package/native/core/DevMenu.cpp +99 -0
  209. package/native/core/DevMenu.h +75 -0
  210. package/native/core/DialogModule.cpp +150 -0
  211. package/native/core/DialogModule.h +51 -0
  212. package/native/core/DragAndDrop.cpp +45 -0
  213. package/native/core/DragAndDrop.h +225 -0
  214. package/native/core/ExpoImageComponent.cpp +79 -0
  215. package/native/core/ExpoImageComponent.h +80 -0
  216. package/native/core/ExpoModules.cpp +415 -0
  217. package/native/core/ExpoModules.h +115 -0
  218. package/native/core/ExpoRuntime.cpp +366 -0
  219. package/native/core/ExpoRuntime.h +42 -0
  220. package/native/core/FocusRing.h +36 -0
  221. package/native/core/FontRegistry.h +51 -0
  222. package/native/core/GestureHandlerModule.cpp +136 -0
  223. package/native/core/GestureHandlerModule.h +71 -0
  224. package/native/core/Gestures.cpp +533 -0
  225. package/native/core/Gestures.h +145 -0
  226. package/native/core/HoverTracker.cpp +69 -0
  227. package/native/core/HoverTracker.h +109 -0
  228. package/native/core/HttpClient.cpp +282 -0
  229. package/native/core/ImageBytes.cpp +205 -0
  230. package/native/core/ImageBytes.h +29 -0
  231. package/native/core/ImageCache.cpp +51 -0
  232. package/native/core/ImageCache.h +89 -0
  233. package/native/core/JsRuntimeAccess.cpp +70 -0
  234. package/native/core/JsRuntimeAccess.h +60 -0
  235. package/native/core/JsiPromise.h +51 -0
  236. package/native/core/KeyEvents.cpp +116 -0
  237. package/native/core/KeyEvents.h +144 -0
  238. package/native/core/LogBoxSurface.cpp +46 -0
  239. package/native/core/LogBoxSurface.h +68 -0
  240. package/native/core/MenuModel.h +117 -0
  241. package/native/core/MenuModule.cpp +209 -0
  242. package/native/core/MenuModule.h +66 -0
  243. package/native/core/MountingWalk.h +524 -0
  244. package/native/core/PackageModules.cpp.in +25 -0
  245. package/native/core/PackageModules.h +50 -0
  246. package/native/core/PlatformConstantsModule.cpp +63 -0
  247. package/native/core/PlatformConstantsModule.h +64 -0
  248. package/native/core/PlatformServices.h +213 -0
  249. package/native/core/PointerButtons.h +63 -0
  250. package/native/core/PullToRefresh.cpp +57 -0
  251. package/native/core/PullToRefresh.h +73 -0
  252. package/native/core/ReanimatedCompat.h +47 -0
  253. package/native/core/ReanimatedModule.cpp +203 -0
  254. package/native/core/ReanimatedModule.h +55 -0
  255. package/native/core/ScrollAnimation.cpp +59 -0
  256. package/native/core/ScrollAnimation.h +70 -0
  257. package/native/core/ScrollBounds.cpp +26 -0
  258. package/native/core/ScrollBounds.h +68 -0
  259. package/native/core/ScrollIndicator.cpp +50 -0
  260. package/native/core/ScrollIndicator.h +69 -0
  261. package/native/core/ScrollMomentum.cpp +71 -0
  262. package/native/core/ScrollMomentum.h +73 -0
  263. package/native/core/ScrollSnap.cpp +123 -0
  264. package/native/core/ScrollSnap.h +80 -0
  265. package/native/core/ShareFallback.cpp +101 -0
  266. package/native/core/ShareFallback.h +45 -0
  267. package/native/core/SkiaPictureViewComponent.cpp +11 -0
  268. package/native/core/SkiaPictureViewComponent.h +47 -0
  269. package/native/core/SourceCodeModule.cpp +55 -0
  270. package/native/core/SourceCodeModule.h +53 -0
  271. package/native/core/StatusBarModule.cpp +23 -0
  272. package/native/core/StatusBarModule.h +42 -0
  273. package/native/core/TestDialog.cpp +148 -0
  274. package/native/core/TestDialog.h +96 -0
  275. package/native/core/TestKeys.cpp +78 -0
  276. package/native/core/TestKeys.h +50 -0
  277. package/native/core/TestQuitFile.cpp +33 -0
  278. package/native/core/TestQuitFile.h +60 -0
  279. package/native/core/TestSettle.h +192 -0
  280. package/native/core/TitleBarRegions.h +31 -0
  281. package/native/core/TurboModuleProxy.cpp +51 -0
  282. package/native/core/TurboModuleProxy.h +46 -0
  283. package/native/core/UIManagerAccess.cpp +43 -0
  284. package/native/core/UIManagerAccess.h +43 -0
  285. package/native/core/WindowBoundsCache.cpp +319 -0
  286. package/native/core/WindowControl.h +235 -0
  287. package/native/core/WindowHost.h +158 -0
  288. package/native/core/WindowMethods.cpp +167 -0
  289. package/native/core/WindowMethods.h +84 -0
  290. package/native/core/WindowsModule.cpp +448 -0
  291. package/native/core/WindowsModule.h +133 -0
  292. package/native/core/WorkletsModule.cpp +199 -0
  293. package/native/core/WorkletsModule.h +57 -0
  294. package/native/core/portability_probe.cpp +210 -0
  295. package/native/tests/EventRecorder.h +124 -0
  296. package/native/tests/TestHarness.cpp +109 -0
  297. package/native/tests/TestHarness.h +89 -0
  298. package/native/tests/TreeDump.h +49 -0
  299. package/native/tests/test_app_identity.cpp +114 -0
  300. package/native/tests/test_app_paths.cpp +48 -0
  301. package/native/tests/test_appearance.cpp +107 -0
  302. package/native/tests/test_backface.cpp +79 -0
  303. package/native/tests/test_blobs.cpp +157 -0
  304. package/native/tests/test_controls.cpp +185 -0
  305. package/native/tests/test_devbundle.cpp +103 -0
  306. package/native/tests/test_drag_and_drop.cpp +143 -0
  307. package/native/tests/test_gestures.cpp +331 -0
  308. package/native/tests/test_hover.cpp +92 -0
  309. package/native/tests/test_image_cache.cpp +109 -0
  310. package/native/tests/test_js_runtime_access.cpp +137 -0
  311. package/native/tests/test_key_events.cpp +235 -0
  312. package/native/tests/test_momentum.cpp +138 -0
  313. package/native/tests/test_quit_file.cpp +104 -0
  314. package/native/tests/test_scroll_animation.cpp +120 -0
  315. package/native/tests/test_scroll_bounds.cpp +66 -0
  316. package/native/tests/test_scroll_indicator.cpp +149 -0
  317. package/native/tests/test_scroll_snap.cpp +112 -0
  318. package/native/tests/test_settle.cpp +115 -0
  319. package/native/tests/test_share.cpp +75 -0
  320. package/native/tests/test_sourcecode.cpp +62 -0
  321. package/native/tests/test_window_close.cpp +119 -0
  322. package/native/tests/test_window_limits.cpp +123 -0
  323. package/package.json +43 -0
  324. package/react-native.config.js +86 -0
  325. package/supported-versions.json +66 -0
@@ -0,0 +1,355 @@
1
+ # basalt-core — everything that is not about a particular toolkit.
2
+ #
3
+ # The bedrock the platform packages stand on: React Native's C++ core, Hermes,
4
+ # the Expo runtime, the core TurboModules, networking, and the Fabric mutation
5
+ # walk. No GTK, no AppKit, no window. basalt-gtk and
6
+ # basalt-appkit each add a view layer on top of this and nothing
7
+ # else.
8
+ #
9
+ # Configured on its own it builds `basalt_core` and the probe that proves the
10
+ # claim. A platform package adds it as a subdirectory; see BASALT_CORE_DIR in
11
+ # either of theirs.
12
+
13
+ cmake_minimum_required(VERSION 3.13)
14
+ project(basalt_core CXX)
15
+
16
+ set(CMAKE_CXX_STANDARD 20)
17
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
18
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
19
+
20
+ # Executables at the top of the build tree whether this is configured directly
21
+ # or added by a wrapper, so `build/basalt_gtk` means the same thing either way.
22
+ # Every script and document here names that path.
23
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
24
+
25
+ # Where folly, fast_float, nlohmann, Hermes and the codegen output live.
26
+ #
27
+ # Not inside this directory. In a development checkout they sit at the root of
28
+ # the repository, and when an app builds a host they belong to that app, not to
29
+ # a copy of this package inside its node_modules -- npm would delete them on the
30
+ # next install, and rebuilding Hermes is not a thing to lose by accident.
31
+ # bootstrap.sh takes the same path and fills it.
32
+ if(NOT DEFINED BASALT_THIRD_PARTY)
33
+ set(BASALT_THIRD_PARTY ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
34
+ endif()
35
+ get_filename_component(BASALT_THIRD_PARTY "${BASALT_THIRD_PARTY}" ABSOLUTE)
36
+
37
+ # The test runner, which knows about no toolkit. Each platform package compiles
38
+ # it alongside its own tests and brings its own `main`; see docs/TESTING.md.
39
+ set(BASALT_TEST_HARNESS ${CMAKE_CURRENT_SOURCE_DIR}/tests/TestHarness.cpp
40
+ CACHE INTERNAL "the toolkit-free test runner")
41
+ set(BASALT_TEST_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/tests
42
+ CACHE INTERNAL "where TestHarness.h lives")
43
+
44
+ # Tests for core's own behaviour, compiled into every platform's suite.
45
+ #
46
+ # They belong to neither platform, so asserting them in one would leave the
47
+ # other unchecked and asserting them in both would be the same file twice. The
48
+ # seam they sit on top of -- what the system is actually set to -- is never
49
+ # asked about, because it differs by machine.
50
+ set(BASALT_CORE_TESTS
51
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_app_identity.cpp
52
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_app_paths.cpp
53
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_scroll_animation.cpp
54
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_backface.cpp
55
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_drag_and_drop.cpp
56
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_quit_file.cpp
57
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_settle.cpp
58
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_key_events.cpp
59
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_js_runtime_access.cpp
60
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_image_cache.cpp
61
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_scroll_bounds.cpp
62
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_scroll_indicator.cpp
63
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_scroll_snap.cpp
64
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_window_close.cpp
65
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_window_limits.cpp
66
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_appearance.cpp
67
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_blobs.cpp
68
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_controls.cpp
69
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_devbundle.cpp
70
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gestures.cpp
71
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_hover.cpp
72
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_momentum.cpp
73
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_share.cpp
74
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_sourcecode.cpp
75
+ CACHE INTERNAL "core's own tests")
76
+
77
+ # ---------------------------------------------------------------------------
78
+ # React Native's C++ core, and the half of this project that is not a toolkit.
79
+ #
80
+ # Everything from here to the end of the block is platform-independent, which is
81
+ # why it comes before either view layer rather than inside one. Needs React
82
+ # Native's C++ core and its third-party dependencies (folly, glog, boost, fmt,
83
+ # double-conversion). Enable with:
84
+ #
85
+ # cmake -B build -DRN_DIR=/path/to/react-native/packages/react-native
86
+ #
87
+ # See README.md for the current state of these targets.
88
+ # ---------------------------------------------------------------------------
89
+
90
+ if(DEFINED RN_DIR)
91
+ # RN's own CMakeLists include files by ${REACT_COMMON_DIR}/..., which a
92
+ # relative path resolves against the wrong directory. Anchor it to this repo.
93
+ get_filename_component(RN_DIR "${RN_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
94
+ if(NOT DEFINED FOLLY_DIR)
95
+ set(FOLLY_DIR ${BASALT_THIRD_PARTY}/folly)
96
+ endif()
97
+ if(NOT DEFINED FAST_FLOAT_DIR)
98
+ set(FAST_FLOAT_DIR ${BASALT_THIRD_PARTY}/fast_float)
99
+ endif()
100
+ if(NOT DEFINED NLOHMANN_JSON_DIR)
101
+ set(NLOHMANN_JSON_DIR ${BASALT_THIRD_PARTY}/nlohmann_json)
102
+ endif()
103
+ if(NOT DEFINED CODEGEN_DIR)
104
+ set(CODEGEN_DIR ${BASALT_THIRD_PARTY}/codegen)
105
+ endif()
106
+ if(NOT DEFINED HERMES_DIR)
107
+ set(HERMES_DIR ${BASALT_THIRD_PARTY}/hermes)
108
+ endif()
109
+ if(NOT DEFINED HERMES_BUILD_DIR)
110
+ set(HERMES_BUILD_DIR ${BASALT_THIRD_PARTY}/hermes-build)
111
+ endif()
112
+
113
+ # React Native's npm package omits ReactCxxPlatform, so with an installed
114
+ # React Native it is fetched into third_party at the matching version instead.
115
+ # bootstrap.sh does the fetching; this just says where to look.
116
+ if(NOT EXISTS ${RN_DIR}/ReactCxxPlatform AND EXISTS ${BASALT_THIRD_PARTY}/ReactCxxPlatform)
117
+ set(RN_CXX_PLATFORM_OVERRIDE ${BASALT_THIRD_PARTY}/ReactCxxPlatform)
118
+ message(STATUS "ReactCxxPlatform from ${RN_CXX_PLATFORM_OVERRIDE}")
119
+ endif()
120
+
121
+ # Expo's core, compiled from the app's own expo-modules-core when the build
122
+ # was pointed at one. Point BASALT_EXPO_MODULES_CORE at
123
+ # <app>/node_modules/expo-modules-core; without it an Expo app fails at its
124
+ # first import exactly as before, and a plain React Native app is unaffected.
125
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Expo.cmake)
126
+
127
+ # First: everything below spells compiler flags through the names this
128
+ # defines, because clang's command line and MSVC's share almost none of them.
129
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerFlags.cmake)
130
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ThirdParty.cmake)
131
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ReactNativeCore.cmake)
132
+
133
+ # react-native-worklets, which Reanimated is built on. After ReactNativeCore
134
+ # rather than beside Expo: it needs Hermes and React Native's own headers,
135
+ # which that file is what sets up.
136
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Worklets.cmake)
137
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Reanimated.cmake)
138
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Skia.cmake)
139
+
140
+ # ---------------------------------------------------------------------------
141
+ # basalt_core — everything that is not about a particular toolkit.
142
+ #
143
+ # A desktop platform on React Native's C++ host divides in two. One half is
144
+ # the view layer: widgets, text shaping, input, the frame clock. That half is
145
+ # GTK here and would be something else on macOS or Windows, and there is no
146
+ # sense pretending otherwise. The other half is the host wiring, the Expo
147
+ # runtime, the core modules and networking, and none of it is about Linux at
148
+ # all -- it was simply written here first.
149
+ #
150
+ # This target is the second half, and it deliberately does not link GTK. That
151
+ # is the whole point: the split is asserted by the compiler rather than by a
152
+ # directory name, so a toolkit dependency that creeps into core fails the
153
+ # build rather than quietly making core unshareable.
154
+ # ---------------------------------------------------------------------------
155
+ # What the discovered capability packages contribute, and the translation unit
156
+ # that lets core call them without naming them. Generated either way: with no
157
+ # packages it defines an empty function, so core has one thing to call rather
158
+ # than a conditional. See core/PackageModules.h.
159
+ get_property(basalt_package_installers GLOBAL PROPERTY BASALT_PACKAGE_EXPO_INSTALLERS)
160
+ get_property(basalt_package_core_sources GLOBAL PROPERTY BASALT_PACKAGE_CORE_SOURCES)
161
+ get_property(basalt_package_includes GLOBAL PROPERTY BASALT_PACKAGE_INCLUDES)
162
+
163
+ # A semicolon by character code: CMake treats `;` as a list separator, and
164
+ # escaping it as `\;` survives into the generated file rather than becoming
165
+ # one. This is the shortest way to emit C++ from CMake without fighting that.
166
+ string(ASCII 59 basalt_semicolon)
167
+ set(basalt_package_declarations "")
168
+ set(basalt_package_calls "")
169
+ foreach(installer ${basalt_package_installers})
170
+ string(APPEND basalt_package_declarations
171
+ "void ${installer}(facebook::jsi::Runtime &, facebook::jsi::Object &)${basalt_semicolon}\n")
172
+ string(APPEND basalt_package_calls
173
+ " ${installer}(runtime, modules)${basalt_semicolon}\n")
174
+ endforeach()
175
+
176
+ # And the same for a package's TurboModules. The factory has React Native's
177
+ # own provider signature, so the generated function tries each in turn and
178
+ # answers with the first that recognises the name.
179
+ get_property(basalt_package_turbo GLOBAL PROPERTY BASALT_PACKAGE_TURBO_MODULES)
180
+ set(basalt_package_turbo_declarations "")
181
+ set(basalt_package_turbo_calls "")
182
+ foreach(factory ${basalt_package_turbo})
183
+ string(APPEND basalt_package_turbo_declarations
184
+ "std::shared_ptr<facebook::react::TurboModule> ${factory}(const std::string &, const std::shared_ptr<facebook::react::CallInvoker> &)${basalt_semicolon}\n")
185
+ string(APPEND basalt_package_turbo_calls
186
+ " if (auto module = ${factory}(name, jsInvoker)) {\n return module${basalt_semicolon}\n }\n")
187
+ endforeach()
188
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/core/PackageModules.cpp.in
189
+ ${CMAKE_CURRENT_BINARY_DIR}/BasaltPackageModules.cpp @ONLY)
190
+
191
+ add_library(basalt_core STATIC
192
+ ${CMAKE_CURRENT_BINARY_DIR}/BasaltPackageModules.cpp
193
+ ${basalt_package_core_sources}
194
+ # What the app calls itself, which a generic host binary cannot know.
195
+ core/AppIdentity.cpp
196
+ # Where a packaged app's own files are, which the packager decides and an
197
+ # app should not have to work out; see the header.
198
+ core/AppPaths.cpp
199
+ # An animated scrollTo, which is a curve rather than a jump.
200
+ core/ScrollAnimation.cpp
201
+ # Where a paged or snapping scroll comes to rest.
202
+ core/DragAndDrop.cpp
203
+ core/ImageCache.cpp
204
+ core/ScrollBounds.cpp
205
+ core/ScrollIndicator.cpp
206
+ core/ScrollSnap.cpp
207
+ # `Appearance`, and the portable half of light-vs-dark.
208
+ core/AppearanceModule.cpp
209
+ # Blob, File and FileReader -- portable in full.
210
+ core/BlobModule.cpp
211
+ core/BlobRegistry.cpp
212
+ core/ColorScheme.cpp
213
+ # Clipboard, Vibration, Alert, Linking, I18nManager, AccessibilityInfo --
214
+ # the core modules ReactCxxPlatform does not provide.
215
+ core/CoreModules.cpp
216
+ # <ActivityIndicator>, <Switch>, <RefreshControl> and <Modal>: the props
217
+ # three view layers have to read identically, plus the two shadow-node
218
+ # obligations React Native leaves to Objective-C. See the header.
219
+ core/DesktopControls.cpp
220
+ # React Native's developer menu, which on a desktop is a keyboard shortcut
221
+ # into a native popup rather than a shake.
222
+ core/DevMenu.cpp
223
+ # The native file dialogs, which React Native has no API for at all.
224
+ core/DialogModule.cpp
225
+ # The application menu: the description, and the JavaScript boundary. What
226
+ # each platform does with it is in its own MenuBar file.
227
+ core/MenuModule.cpp
228
+ # React DevTools' element highlighter: the rectangles, parsed once.
229
+ core/DebuggingOverlay.cpp
230
+ core/DevBundle.cpp
231
+ core/ExpoImageComponent.cpp
232
+ core/GestureHandlerModule.cpp
233
+ core/Gestures.cpp
234
+ # Hover: the pointer-event path React Native only has on Android.
235
+ core/HoverTracker.cpp
236
+ # React Native's error inspector, which is a surface rather than a widget.
237
+ core/LogBoxSurface.cpp
238
+ core/ExpoModules.cpp
239
+ core/ExpoRuntime.cpp
240
+ # The JavaScript thread, for native code that is not a TurboModule and so
241
+ # was handed no call invoker; see the header.
242
+ core/JsRuntimeAccess.cpp
243
+ core/HttpClient.cpp
244
+ # The bytes behind an <Image>, which is the half of image loading that is
245
+ # the same on every desktop.
246
+ core/ImageBytes.cpp
247
+ core/PlatformConstantsModule.cpp
248
+ # The wheel past the top of a list, which is this platform's pull.
249
+ core/PullToRefresh.cpp
250
+ # The fling GTK hands over half-finished; see the header.
251
+ core/ScrollMomentum.cpp
252
+ # A share sheet for the desktops that have none; see the header.
253
+ core/ShareFallback.cpp
254
+ core/SourceCodeModule.cpp
255
+ # Answering a modal dialog without showing one; see the header.
256
+ core/TestDialog.cpp
257
+ # Quitting gracefully when the harness says so, rather than on a budget
258
+ # fixed before launch; see the header.
259
+ core/TestQuitFile.cpp
260
+ # What a <Canvas> from @shopify/react-native-skia mounts; see the header.
261
+ core/SkiaPictureViewComponent.cpp
262
+ # globalThis.__turboModuleProxy, which a bridgeless runtime does not get; see
263
+ # the header.
264
+ core/TurboModuleProxy.cpp
265
+ # Which view claims which key; see the header.
266
+ core/KeyEvents.cpp
267
+ # BASALT_TEST_KEY, parsed once rather than in three hosts; see the header.
268
+ core/TestKeys.cpp
269
+ core/StatusBarModule.cpp
270
+ core/ReanimatedModule.cpp
271
+ core/UIManagerAccess.cpp
272
+ # A window's size, position and full-screen state: the JavaScript boundary
273
+ # written once, over a four-function per-platform seam.
274
+ core/WindowMethods.cpp
275
+ # The bounds cache behind getBounds(), which cannot ask the toolkit.
276
+ core/WindowBoundsCache.cpp
277
+ # Opening a second window, which is opening a second surface.
278
+ core/WindowsModule.cpp
279
+ core/WorkletsModule.cpp)
280
+ target_compile_options(basalt_core PRIVATE -Wall -Wextra)
281
+ # The same upstream portability bug ReactNativeCore.cmake force-includes
282
+ # around for React Native's own targets, reaching our translation units too:
283
+ # ReactCxxPlatform's react/runtime/ReactInstanceConfig.h declares a
284
+ # `uint32_t` and includes no <cstdint>, so anything of ours that includes it
285
+ # -- core/DevMenu.cpp does -- fails to compile.
286
+ #
287
+ # PUBLIC, so the host libraries that include React Native's headers get it
288
+ # as well, for the same reason the definitions below are.
289
+ #
290
+ # Only React Native 0.86 on Linux shows it, which is why it took a release
291
+ # workflow to find. At 0.87 the header also includes <functional> and
292
+ # <memory>, which drag <cstdint> in on libstdc++; 0.86 includes only
293
+ # <string>, which does not. On a Mac libc++ supplies it either way, so the
294
+ # same app built here and on Linux disagreed about whether React Native
295
+ # compiles.
296
+ target_compile_options(basalt_core PUBLIC ${BASALT_FORCE_INCLUDE_CSTDINT_FLAG})
297
+ # The React Native version, for the version guards and PlatformConstants.
298
+ #
299
+ # ReactNativeCore.cmake also states these with add_compile_definitions, which
300
+ # is how React Native's own targets get them -- but that is directory-scoped,
301
+ # and the platform packages are sibling directories rather than children. On
302
+ # the target they travel with the link, so anything using the core has them.
303
+ target_compile_definitions(basalt_core PUBLIC
304
+ BASALT_REACT_NATIVE_VERSION="${RN_VERSION}"
305
+ BASALT_RN_MINOR=${RN_MINOR})
306
+ target_include_directories(basalt_core PUBLIC core ${basalt_package_includes})
307
+ target_include_directories(basalt_core SYSTEM PUBLIC
308
+ ${RN_DIR}/ReactCommon
309
+ ${RN_DIR}/ReactCommon/jsi
310
+ ${REACT_CXX_PLATFORM_DIR}
311
+ ${FOLLY_DIR}
312
+ ${CODEGEN_DIR}
313
+ ${CODEGEN_DIR}/react/renderer/components/FBReactNativeSpec
314
+ ${CODEGEN_DIR}/react/renderer/components
315
+ # <Switch>'s shadow node and descriptor, which React Native files under
316
+ # "iosswitch" and which are ordinary portable C++ apart from the one
317
+ # measurement core/DesktopControls.cpp supplies. Android's needs fbjni;
318
+ # this one needs nothing.
319
+ ${RN_DIR}/ReactCommon/react/renderer/components/switch/iosswitch)
320
+ # libcurl, because core/HttpClient.cpp is here. It used to be named only on
321
+ # basalt_gtk_mounting, which worked for exactly as long as the GTK host was the only
322
+ # thing linking core: the archive member goes unreferenced until something
323
+ # asks for an http client, so the missing dependency stayed invisible until
324
+ # the macOS host asked.
325
+ target_link_libraries(basalt_core PUBLIC rn_core CURL::libcurl)
326
+ if(TARGET expo_core)
327
+ target_link_libraries(basalt_core PUBLIC expo_core)
328
+ target_sources(basalt_core PUBLIC $<TARGET_OBJECTS:expo_core>)
329
+ endif()
330
+ if(TARGET reanimated_core)
331
+ target_link_libraries(basalt_core PUBLIC reanimated_core)
332
+ target_sources(basalt_core PUBLIC $<TARGET_OBJECTS:reanimated_core>)
333
+ target_compile_definitions(basalt_core PUBLIC BASALT_HAS_REANIMATED=1)
334
+ endif()
335
+ if(TARGET worklets_core)
336
+ target_link_libraries(basalt_core PUBLIC worklets_core)
337
+ target_sources(basalt_core PUBLIC $<TARGET_OBJECTS:worklets_core>)
338
+ # PUBLIC, so the hosts get it too: they are sibling directories now, and a
339
+ # directory-scoped definition would leave them compiling the provider
340
+ # without its worklets branch and quietly not offering the module.
341
+ target_compile_definitions(basalt_core PUBLIC BASALT_HAS_WORKLETS=1)
342
+ endif()
343
+
344
+ # Links the core and no toolkit. See core/portability_probe.cpp: what it
345
+ # cannot find is precisely what a new desktop platform has to provide.
346
+ #
347
+ # Capability packages contribute their own stubs: their core half is
348
+ # compiled into basalt_core, so their seams are symbols this has to satisfy,
349
+ # and the probe cannot include their headers itself -- an app installs the
350
+ # packages it wants, and core must compile in one that installed none.
351
+ get_property(basalt_package_probe_sources GLOBAL PROPERTY BASALT_PACKAGE_PROBE_SOURCES)
352
+ add_executable(basalt_core_probe core/portability_probe.cpp ${basalt_package_probe_sources})
353
+ target_link_libraries(basalt_core_probe PRIVATE basalt_core)
354
+
355
+ endif()