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.
- package/LICENSE +21 -0
- package/dist/cli/basalt.d.ts +3 -0
- package/dist/cli/basalt.d.ts.map +1 -0
- package/dist/cli/basalt.js +47 -0
- package/dist/cli/basalt.js.map +1 -0
- package/dist/cli/bundle-cli.d.ts +12 -0
- package/dist/cli/bundle-cli.d.ts.map +1 -0
- package/dist/cli/bundle-cli.js +124 -0
- package/dist/cli/bundle-cli.js.map +1 -0
- package/dist/cli/bundleWithAssets.d.ts +79 -0
- package/dist/cli/bundleWithAssets.d.ts.map +1 -0
- package/dist/cli/bundleWithAssets.js +198 -0
- package/dist/cli/bundleWithAssets.js.map +1 -0
- package/dist/cli/desktop.d.ts +339 -0
- package/dist/cli/desktop.d.ts.map +1 -0
- package/dist/cli/desktop.js +1029 -0
- package/dist/cli/desktop.js.map +1 -0
- package/dist/cli/doctor.d.ts +31 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +283 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/init.d.ts +77 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +442 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/metro.d.ts +49 -0
- package/dist/cli/metro.d.ts.map +1 -0
- package/dist/cli/metro.js +148 -0
- package/dist/cli/metro.js.map +1 -0
- package/dist/cli/packageApp.d.ts +102 -0
- package/dist/cli/packageApp.d.ts.map +1 -0
- package/dist/cli/packageApp.js +319 -0
- package/dist/cli/packageApp.js.map +1 -0
- package/dist/cli/steps.d.ts +34 -0
- package/dist/cli/steps.d.ts.map +1 -0
- package/dist/cli/steps.js +53 -0
- package/dist/cli/steps.js.map +1 -0
- package/dist/metro-config.d.ts +168 -0
- package/dist/metro-config.d.ts.map +1 -0
- package/dist/metro-config.js +671 -0
- package/dist/metro-config.js.map +1 -0
- package/dist/react-native.config.d.ts +7 -0
- package/dist/react-native.config.d.ts.map +1 -0
- package/dist/react-native.config.js +80 -0
- package/dist/react-native.config.js.map +1 -0
- package/dist/src/DragSource.d.ts +52 -0
- package/dist/src/DragSource.d.ts.map +1 -0
- package/dist/src/DragSource.js +97 -0
- package/dist/src/DragSource.js.map +1 -0
- package/dist/src/DropTarget.d.ts +58 -0
- package/dist/src/DropTarget.d.ts.map +1 -0
- package/dist/src/DropTarget.js +131 -0
- package/dist/src/DropTarget.js.map +1 -0
- package/dist/src/KeyHandler.d.ts +57 -0
- package/dist/src/KeyHandler.d.ts.map +1 -0
- package/dist/src/KeyHandler.js +48 -0
- package/dist/src/KeyHandler.js.map +1 -0
- package/dist/src/Menu.d.ts +72 -0
- package/dist/src/Menu.d.ts.map +1 -0
- package/dist/src/Menu.js +179 -0
- package/dist/src/Menu.js.map +1 -0
- package/dist/src/TitleBar.d.ts +75 -0
- package/dist/src/TitleBar.d.ts.map +1 -0
- package/dist/src/TitleBar.js +236 -0
- package/dist/src/TitleBar.js.map +1 -0
- package/dist/src/Window.d.ts +87 -0
- package/dist/src/Window.d.ts.map +1 -0
- package/dist/src/Window.js +248 -0
- package/dist/src/Window.js.map +1 -0
- package/dist/src/closeRequest.d.ts +55 -0
- package/dist/src/closeRequest.d.ts.map +1 -0
- package/dist/src/closeRequest.js +134 -0
- package/dist/src/closeRequest.js.map +1 -0
- package/dist/src/index.d.ts +45 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +92 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/overrides/Alert.d.ts +69 -0
- package/dist/src/overrides/Alert.d.ts.map +1 -0
- package/dist/src/overrides/Alert.js +112 -0
- package/dist/src/overrides/Alert.js.map +1 -0
- package/dist/src/overrides/BaseViewConfig.d.ts +28 -0
- package/dist/src/overrides/BaseViewConfig.d.ts.map +1 -0
- package/dist/src/overrides/BaseViewConfig.js +72 -0
- package/dist/src/overrides/BaseViewConfig.js.map +1 -0
- package/dist/src/overrides/Platform.linux.d.ts +10 -0
- package/dist/src/overrides/Platform.linux.d.ts.map +1 -0
- package/dist/src/overrides/Platform.linux.js +15 -0
- package/dist/src/overrides/Platform.linux.js.map +1 -0
- package/dist/src/overrides/Platform.macos.d.ts +10 -0
- package/dist/src/overrides/Platform.macos.d.ts.map +1 -0
- package/dist/src/overrides/Platform.macos.js +15 -0
- package/dist/src/overrides/Platform.macos.js.map +1 -0
- package/dist/src/overrides/Platform.windows.d.ts +10 -0
- package/dist/src/overrides/Platform.windows.d.ts.map +1 -0
- package/dist/src/overrides/Platform.windows.js +15 -0
- package/dist/src/overrides/Platform.windows.js.map +1 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts +24 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts.map +1 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.js +30 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.js.map +1 -0
- package/dist/src/overrides/RefreshControl.d.ts +52 -0
- package/dist/src/overrides/RefreshControl.d.ts.map +1 -0
- package/dist/src/overrides/RefreshControl.js +92 -0
- package/dist/src/overrides/RefreshControl.js.map +1 -0
- package/dist/src/overrides/ScrollView.d.ts +39 -0
- package/dist/src/overrides/ScrollView.d.ts.map +1 -0
- package/dist/src/overrides/ScrollView.js +59 -0
- package/dist/src/overrides/ScrollView.js.map +1 -0
- package/dist/src/overrides/Share.d.ts +96 -0
- package/dist/src/overrides/Share.d.ts.map +1 -0
- package/dist/src/overrides/Share.js +97 -0
- package/dist/src/overrides/Share.js.map +1 -0
- package/dist/src/overrides/TextInput.d.ts +81 -0
- package/dist/src/overrides/TextInput.d.ts.map +1 -0
- package/dist/src/overrides/TextInput.js +213 -0
- package/dist/src/overrides/TextInput.js.map +1 -0
- package/dist/src/overrides/View.d.ts +36 -0
- package/dist/src/overrides/View.d.ts.map +1 -0
- package/dist/src/overrides/View.js +99 -0
- package/dist/src/overrides/View.js.map +1 -0
- package/dist/src/overrides/createPlatform.d.ts +32 -0
- package/dist/src/overrides/createPlatform.d.ts.map +1 -0
- package/dist/src/overrides/createPlatform.js +84 -0
- package/dist/src/overrides/createPlatform.js.map +1 -0
- package/dist/src/overrides/setUpDeveloperTools.d.ts +28 -0
- package/dist/src/overrides/setUpDeveloperTools.d.ts.map +1 -0
- package/dist/src/overrides/setUpDeveloperTools.js +84 -0
- package/dist/src/overrides/setUpDeveloperTools.js.map +1 -0
- package/dist/src/overrides/setUpXHR.d.ts +46 -0
- package/dist/src/overrides/setUpXHR.d.ts.map +1 -0
- package/dist/src/overrides/setUpXHR.js +236 -0
- package/dist/src/overrides/setUpXHR.js.map +1 -0
- package/dist/src/quitRequest.d.ts +55 -0
- package/dist/src/quitRequest.d.ts.map +1 -0
- package/dist/src/quitRequest.js +121 -0
- package/dist/src/quitRequest.js.map +1 -0
- package/dist/src/resourcePath.d.ts +18 -0
- package/dist/src/resourcePath.d.ts.map +1 -0
- package/dist/src/resourcePath.js +31 -0
- package/dist/src/resourcePath.js.map +1 -0
- package/dist/src/responseBody.d.ts +76 -0
- package/dist/src/responseBody.d.ts.map +1 -0
- package/dist/src/responseBody.js +94 -0
- package/dist/src/responseBody.js.map +1 -0
- package/dist/src/responseHeaders.d.ts +40 -0
- package/dist/src/responseHeaders.d.ts.map +1 -0
- package/dist/src/responseHeaders.js +75 -0
- package/dist/src/responseHeaders.js.map +1 -0
- package/dist/src/titleBarState.d.ts +43 -0
- package/dist/src/titleBarState.d.ts.map +1 -0
- package/dist/src/titleBarState.js +77 -0
- package/dist/src/titleBarState.js.map +1 -0
- package/dist/src/useContextMenu.d.ts +113 -0
- package/dist/src/useContextMenu.d.ts.map +1 -0
- package/dist/src/useContextMenu.js +109 -0
- package/dist/src/useContextMenu.js.map +1 -0
- package/dist/src/useDialog.d.ts +98 -0
- package/dist/src/useDialog.d.ts.map +1 -0
- package/dist/src/useDialog.js +112 -0
- package/dist/src/useDialog.js.map +1 -0
- package/dist/src/useDisplays.d.ts +70 -0
- package/dist/src/useDisplays.d.ts.map +1 -0
- package/dist/src/useDisplays.js +118 -0
- package/dist/src/useDisplays.js.map +1 -0
- package/dist/src/useHandledKeys.d.ts +38 -0
- package/dist/src/useHandledKeys.d.ts.map +1 -0
- package/dist/src/useHandledKeys.js +70 -0
- package/dist/src/useHandledKeys.js.map +1 -0
- package/dist/src/useWindow.d.ts +140 -0
- package/dist/src/useWindow.d.ts.map +1 -0
- package/dist/src/useWindow.js +233 -0
- package/dist/src/useWindow.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/native/CMakeLists.txt +355 -0
- package/native/bootstrap.sh +613 -0
- package/native/cmake/CompilerFlags.cmake +49 -0
- package/native/cmake/Expo.cmake +125 -0
- package/native/cmake/ReactNativeCore.cmake +612 -0
- package/native/cmake/Reanimated.cmake +108 -0
- package/native/cmake/Skia.cmake +379 -0
- package/native/cmake/ThirdParty.cmake +290 -0
- package/native/cmake/Worklets.cmake +67 -0
- package/native/cmake/codegen/CMakeLists.txt +32 -0
- package/native/core/AppIdentity.cpp +85 -0
- package/native/core/AppIdentity.h +59 -0
- package/native/core/AppPaths.cpp +96 -0
- package/native/core/AppPaths.h +53 -0
- package/native/core/AppearanceModule.cpp +60 -0
- package/native/core/AppearanceModule.h +40 -0
- package/native/core/Backface.h +59 -0
- package/native/core/BlobModule.cpp +283 -0
- package/native/core/BlobModule.h +76 -0
- package/native/core/BlobRegistry.cpp +75 -0
- package/native/core/BlobRegistry.h +44 -0
- package/native/core/ColorScheme.cpp +105 -0
- package/native/core/ColorScheme.h +59 -0
- package/native/core/ComponentRegistry.h +30 -0
- package/native/core/ControlMetrics.h +37 -0
- package/native/core/CoreModules.cpp +592 -0
- package/native/core/CoreModules.h +308 -0
- package/native/core/DebuggingOverlay.cpp +106 -0
- package/native/core/DebuggingOverlay.h +65 -0
- package/native/core/DesktopControls.cpp +232 -0
- package/native/core/DesktopControls.h +170 -0
- package/native/core/DevBundle.cpp +108 -0
- package/native/core/DevBundle.h +69 -0
- package/native/core/DevMenu.cpp +99 -0
- package/native/core/DevMenu.h +75 -0
- package/native/core/DialogModule.cpp +150 -0
- package/native/core/DialogModule.h +51 -0
- package/native/core/DragAndDrop.cpp +45 -0
- package/native/core/DragAndDrop.h +225 -0
- package/native/core/ExpoImageComponent.cpp +79 -0
- package/native/core/ExpoImageComponent.h +80 -0
- package/native/core/ExpoModules.cpp +415 -0
- package/native/core/ExpoModules.h +115 -0
- package/native/core/ExpoRuntime.cpp +366 -0
- package/native/core/ExpoRuntime.h +42 -0
- package/native/core/FocusRing.h +36 -0
- package/native/core/FontRegistry.h +51 -0
- package/native/core/GestureHandlerModule.cpp +136 -0
- package/native/core/GestureHandlerModule.h +71 -0
- package/native/core/Gestures.cpp +533 -0
- package/native/core/Gestures.h +145 -0
- package/native/core/HoverTracker.cpp +69 -0
- package/native/core/HoverTracker.h +109 -0
- package/native/core/HttpClient.cpp +282 -0
- package/native/core/ImageBytes.cpp +205 -0
- package/native/core/ImageBytes.h +29 -0
- package/native/core/ImageCache.cpp +51 -0
- package/native/core/ImageCache.h +89 -0
- package/native/core/JsRuntimeAccess.cpp +70 -0
- package/native/core/JsRuntimeAccess.h +60 -0
- package/native/core/JsiPromise.h +51 -0
- package/native/core/KeyEvents.cpp +116 -0
- package/native/core/KeyEvents.h +144 -0
- package/native/core/LogBoxSurface.cpp +46 -0
- package/native/core/LogBoxSurface.h +68 -0
- package/native/core/MenuModel.h +117 -0
- package/native/core/MenuModule.cpp +209 -0
- package/native/core/MenuModule.h +66 -0
- package/native/core/MountingWalk.h +524 -0
- package/native/core/PackageModules.cpp.in +25 -0
- package/native/core/PackageModules.h +50 -0
- package/native/core/PlatformConstantsModule.cpp +63 -0
- package/native/core/PlatformConstantsModule.h +64 -0
- package/native/core/PlatformServices.h +213 -0
- package/native/core/PointerButtons.h +63 -0
- package/native/core/PullToRefresh.cpp +57 -0
- package/native/core/PullToRefresh.h +73 -0
- package/native/core/ReanimatedCompat.h +47 -0
- package/native/core/ReanimatedModule.cpp +203 -0
- package/native/core/ReanimatedModule.h +55 -0
- package/native/core/ScrollAnimation.cpp +59 -0
- package/native/core/ScrollAnimation.h +70 -0
- package/native/core/ScrollBounds.cpp +26 -0
- package/native/core/ScrollBounds.h +68 -0
- package/native/core/ScrollIndicator.cpp +50 -0
- package/native/core/ScrollIndicator.h +69 -0
- package/native/core/ScrollMomentum.cpp +71 -0
- package/native/core/ScrollMomentum.h +73 -0
- package/native/core/ScrollSnap.cpp +123 -0
- package/native/core/ScrollSnap.h +80 -0
- package/native/core/ShareFallback.cpp +101 -0
- package/native/core/ShareFallback.h +45 -0
- package/native/core/SkiaPictureViewComponent.cpp +11 -0
- package/native/core/SkiaPictureViewComponent.h +47 -0
- package/native/core/SourceCodeModule.cpp +55 -0
- package/native/core/SourceCodeModule.h +53 -0
- package/native/core/StatusBarModule.cpp +23 -0
- package/native/core/StatusBarModule.h +42 -0
- package/native/core/TestDialog.cpp +148 -0
- package/native/core/TestDialog.h +96 -0
- package/native/core/TestKeys.cpp +78 -0
- package/native/core/TestKeys.h +50 -0
- package/native/core/TestQuitFile.cpp +33 -0
- package/native/core/TestQuitFile.h +60 -0
- package/native/core/TestSettle.h +192 -0
- package/native/core/TitleBarRegions.h +31 -0
- package/native/core/TurboModuleProxy.cpp +51 -0
- package/native/core/TurboModuleProxy.h +46 -0
- package/native/core/UIManagerAccess.cpp +43 -0
- package/native/core/UIManagerAccess.h +43 -0
- package/native/core/WindowBoundsCache.cpp +319 -0
- package/native/core/WindowControl.h +235 -0
- package/native/core/WindowHost.h +158 -0
- package/native/core/WindowMethods.cpp +167 -0
- package/native/core/WindowMethods.h +84 -0
- package/native/core/WindowsModule.cpp +448 -0
- package/native/core/WindowsModule.h +133 -0
- package/native/core/WorkletsModule.cpp +199 -0
- package/native/core/WorkletsModule.h +57 -0
- package/native/core/portability_probe.cpp +210 -0
- package/native/tests/EventRecorder.h +124 -0
- package/native/tests/TestHarness.cpp +109 -0
- package/native/tests/TestHarness.h +89 -0
- package/native/tests/TreeDump.h +49 -0
- package/native/tests/test_app_identity.cpp +114 -0
- package/native/tests/test_app_paths.cpp +48 -0
- package/native/tests/test_appearance.cpp +107 -0
- package/native/tests/test_backface.cpp +79 -0
- package/native/tests/test_blobs.cpp +157 -0
- package/native/tests/test_controls.cpp +185 -0
- package/native/tests/test_devbundle.cpp +103 -0
- package/native/tests/test_drag_and_drop.cpp +143 -0
- package/native/tests/test_gestures.cpp +331 -0
- package/native/tests/test_hover.cpp +92 -0
- package/native/tests/test_image_cache.cpp +109 -0
- package/native/tests/test_js_runtime_access.cpp +137 -0
- package/native/tests/test_key_events.cpp +235 -0
- package/native/tests/test_momentum.cpp +138 -0
- package/native/tests/test_quit_file.cpp +104 -0
- package/native/tests/test_scroll_animation.cpp +120 -0
- package/native/tests/test_scroll_bounds.cpp +66 -0
- package/native/tests/test_scroll_indicator.cpp +149 -0
- package/native/tests/test_scroll_snap.cpp +112 -0
- package/native/tests/test_settle.cpp +115 -0
- package/native/tests/test_share.cpp +75 -0
- package/native/tests/test_sourcecode.cpp +62 -0
- package/native/tests/test_window_close.cpp +119 -0
- package/native/tests/test_window_limits.cpp +123 -0
- package/package.json +43 -0
- package/react-native.config.js +86 -0
- package/supported-versions.json +66 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# react-native-reanimated, compiled from the app's own copy.
|
|
2
|
+
#
|
|
3
|
+
# The same arrangement as Worklets.cmake, which this needs: Reanimated 4 is a
|
|
4
|
+
# layer on react-native-worklets, and its animations run in the worklet runtime
|
|
5
|
+
# that package provides.
|
|
6
|
+
#
|
|
7
|
+
# Reanimated's portable C++ is portable to exactly two platforms. Unlike
|
|
8
|
+
# worklets, it branches on `ANDROID` and `__APPLE__` in about ninety places, and
|
|
9
|
+
# a few of those decide a *type* rather than an implementation -- on a third
|
|
10
|
+
# platform the type is simply never declared and the struct that uses it does
|
|
11
|
+
# not compile. `ReanimatedCompat.h` is force-included ahead of everything to
|
|
12
|
+
# fill those in; see its header for what and why.
|
|
13
|
+
|
|
14
|
+
if(NOT DEFINED BASALT_REANIMATED)
|
|
15
|
+
return()
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
if(NOT TARGET worklets_core)
|
|
19
|
+
message(FATAL_ERROR
|
|
20
|
+
"BASALT_REANIMATED needs BASALT_WORKLETS too: Reanimated 4 is built "
|
|
21
|
+
"on react-native-worklets and does not compile without it.")
|
|
22
|
+
endif()
|
|
23
|
+
|
|
24
|
+
get_filename_component(REANIMATED_DIR "${BASALT_REANIMATED}" ABSOLUTE)
|
|
25
|
+
set(REANIMATED_CPP_DIR ${REANIMATED_DIR}/Common/cpp)
|
|
26
|
+
|
|
27
|
+
if(NOT EXISTS ${REANIMATED_CPP_DIR}/reanimated/NativeModules/ReanimatedModuleProxy.cpp)
|
|
28
|
+
message(FATAL_ERROR
|
|
29
|
+
"no react-native-reanimated C++ at ${REANIMATED_CPP_DIR}.\n"
|
|
30
|
+
"BASALT_REANIMATED should name an installed react-native-reanimated, "
|
|
31
|
+
"the one in the app's node_modules.")
|
|
32
|
+
endif()
|
|
33
|
+
|
|
34
|
+
file(READ ${REANIMATED_DIR}/package.json REANIMATED_PACKAGE_JSON)
|
|
35
|
+
string(JSON REANIMATED_VERSION GET "${REANIMATED_PACKAGE_JSON}" version)
|
|
36
|
+
|
|
37
|
+
# Reanimated's own codegen artifacts.
|
|
38
|
+
#
|
|
39
|
+
# Its C++ includes `react/renderer/components/rnreanimated/Props.h`, which does
|
|
40
|
+
# not exist in the package: React Native generates it from the TypeScript specs
|
|
41
|
+
# during a library's native build, and there is no such build here. So this runs
|
|
42
|
+
# the same generator React Native's own Gradle and CocoaPods scripts run,
|
|
43
|
+
# against the package's own codegenConfig, at configure time.
|
|
44
|
+
#
|
|
45
|
+
# It is the first time this project has run codegen for something other than
|
|
46
|
+
# React Native itself, and it is what a real autolinking step would do.
|
|
47
|
+
set(REANIMATED_CODEGEN ${CMAKE_BINARY_DIR}/codegen-reanimated)
|
|
48
|
+
set(REANIMATED_CODEGEN_JNI ${REANIMATED_CODEGEN}/android/app/build/generated/source/codegen/jni)
|
|
49
|
+
set(REANIMATED_CODEGEN_STAMP ${REANIMATED_CODEGEN}/.version)
|
|
50
|
+
|
|
51
|
+
if(NOT EXISTS ${REANIMATED_CODEGEN_STAMP} OR
|
|
52
|
+
NOT "${REANIMATED_VERSION}" STREQUAL "$CACHE{BASALT_REANIMATED_CODEGEN_VERSION}")
|
|
53
|
+
message(STATUS "Generating codegen artifacts for reanimated ${REANIMATED_VERSION}")
|
|
54
|
+
file(REMOVE_RECURSE ${REANIMATED_CODEGEN})
|
|
55
|
+
execute_process(
|
|
56
|
+
COMMAND node scripts/generate-codegen-artifacts.js
|
|
57
|
+
-p ${REANIMATED_DIR} -t android -o ${REANIMATED_CODEGEN} -s library -f
|
|
58
|
+
WORKING_DIRECTORY ${RN_DIR}
|
|
59
|
+
RESULT_VARIABLE REANIMATED_CODEGEN_RESULT
|
|
60
|
+
OUTPUT_QUIET)
|
|
61
|
+
if(NOT EXISTS ${REANIMATED_CODEGEN_JNI}/react/renderer/components/rnreanimated/Props.h)
|
|
62
|
+
message(FATAL_ERROR
|
|
63
|
+
"codegen produced no rnreanimated artifacts in ${REANIMATED_CODEGEN} "
|
|
64
|
+
"(exit ${REANIMATED_CODEGEN_RESULT})")
|
|
65
|
+
endif()
|
|
66
|
+
file(WRITE ${REANIMATED_CODEGEN_STAMP} "${REANIMATED_VERSION}")
|
|
67
|
+
set(BASALT_REANIMATED_CODEGEN_VERSION ${REANIMATED_VERSION}
|
|
68
|
+
CACHE INTERNAL "the reanimated the codegen artifacts were generated from")
|
|
69
|
+
endif()
|
|
70
|
+
|
|
71
|
+
# Only the *component* artifacts -- the props, shadow nodes and descriptors
|
|
72
|
+
# Reanimated's own C++ includes.
|
|
73
|
+
#
|
|
74
|
+
# Not `rnreanimated-generated.cpp` or `rnworklets-generated.cpp`, which are the
|
|
75
|
+
# JNI half of a TurboModule spec and include <ReactCommon/JavaTurboModule.h>.
|
|
76
|
+
# The modules themselves are hand-written here (core/WorkletsModule.h says why),
|
|
77
|
+
# and neither one needs Java.
|
|
78
|
+
#
|
|
79
|
+
# Not FBReactNativeSpec either, which comes out of the same run because codegen
|
|
80
|
+
# walks the dependency tree and which third_party/codegen already builds.
|
|
81
|
+
# Compiling this copy too is two definitions of every symbol in it.
|
|
82
|
+
file(GLOB REANIMATED_CODEGEN_SRC CONFIGURE_DEPENDS
|
|
83
|
+
${REANIMATED_CODEGEN_JNI}/react/renderer/components/rnreanimated/*.cpp)
|
|
84
|
+
|
|
85
|
+
file(GLOB_RECURSE REANIMATED_SRC CONFIGURE_DEPENDS ${REANIMATED_CPP_DIR}/reanimated/*.cpp)
|
|
86
|
+
list(APPEND REANIMATED_SRC ${REANIMATED_CODEGEN_SRC})
|
|
87
|
+
|
|
88
|
+
add_library(reanimated_core OBJECT ${REANIMATED_SRC})
|
|
89
|
+
target_include_directories(reanimated_core SYSTEM PUBLIC
|
|
90
|
+
${REANIMATED_CPP_DIR}
|
|
91
|
+
${REANIMATED_CODEGEN_JNI}
|
|
92
|
+
${CMAKE_CURRENT_SOURCE_DIR}/core
|
|
93
|
+
${RN_DIR}/ReactCommon
|
|
94
|
+
${RN_DIR}/ReactCommon/jsi
|
|
95
|
+
${RN_DIR}/ReactCommon/callinvoker
|
|
96
|
+
${RN_DIR}/ReactCommon/cxxreact
|
|
97
|
+
${RN_DIR}/ReactCommon/jsiexecutor
|
|
98
|
+
${RN_DIR}/ReactCommon/runtimeexecutor
|
|
99
|
+
${RN_DIR}/ReactCommon/yoga
|
|
100
|
+
${FOLLY_DIR})
|
|
101
|
+
target_link_libraries(reanimated_core worklets_core folly_runtime glog hermes-engine::hermesvm)
|
|
102
|
+
# Somebody else's sources, held to somebody else's warning set.
|
|
103
|
+
target_compile_options(reanimated_core PRIVATE -w
|
|
104
|
+
-include ${CMAKE_CURRENT_SOURCE_DIR}/core/ReanimatedCompat.h)
|
|
105
|
+
target_compile_definitions(reanimated_core PUBLIC
|
|
106
|
+
REANIMATED_VERSION=${REANIMATED_VERSION})
|
|
107
|
+
|
|
108
|
+
message(STATUS "Reanimated from ${REANIMATED_DIR}")
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# @shopify/react-native-skia, compiled from the app's own copy.
|
|
2
|
+
#
|
|
3
|
+
# The same arrangement as Worklets.cmake and for the same reason: the package
|
|
4
|
+
# ships its portable half as C++ over JSI, so the app's copy compiles at the
|
|
5
|
+
# app's version and nothing is vendored or pinned. What it does not ship for a
|
|
6
|
+
# desktop is the host half -- and here that half is unusually small, because the
|
|
7
|
+
# package's own division of labour happens to suit us.
|
|
8
|
+
#
|
|
9
|
+
# ## What is borrowed and what is replaced
|
|
10
|
+
#
|
|
11
|
+
# Of the fourteen Objective-C++ sources in `apple/`, seven touch React Native and
|
|
12
|
+
# seven do not, and the seven that do are precisely the ones a host would write
|
|
13
|
+
# anyway:
|
|
14
|
+
#
|
|
15
|
+
# borrowed MetalContext, MetalWindowContext, MetalLayerColorSpace,
|
|
16
|
+
# SkiaCVPixelBufferUtils, RNSkAppleVideo, RNSkAppleView,
|
|
17
|
+
# RNSkMetalCanvasProvider
|
|
18
|
+
# replaced RNSkiaModule and SkiaManager (the TurboModule),
|
|
19
|
+
# RNSkApplePlatformContext (its *header* takes an RCTBridge and
|
|
20
|
+
# builds a screenshot service from bridge.uiManager, so it cannot be
|
|
21
|
+
# used as-is even though its .mm touches React in one place),
|
|
22
|
+
# ViewScreenshotService, SkiaUIView, SkiaPictureView,
|
|
23
|
+
# SkiaPictureViewManager
|
|
24
|
+
#
|
|
25
|
+
# MetalContext is the reason this is small. It is React-free and already offers
|
|
26
|
+
# MakeOffscreen, MakeImageFromBuffer, getDirectContext and -- for later --
|
|
27
|
+
# MakeWindow(CALayer *), which takes a layer rather than a React view. So a
|
|
28
|
+
# `<Canvas>` needs to hand over its own layer and nothing more.
|
|
29
|
+
#
|
|
30
|
+
# ## Three platforms, two of which build their own Skia
|
|
31
|
+
#
|
|
32
|
+
# Skia's binaries are per platform and the ones published are Apple's and
|
|
33
|
+
# Android's. macOS uses the published xcframeworks; Windows and Linux each
|
|
34
|
+
# build archives from source, laid out the way the package lays out Android's,
|
|
35
|
+
# by scripts/build_skia_windows.sh and scripts/build_skia_linux.sh.
|
|
36
|
+
#
|
|
37
|
+
# The three differ in more than a path, and each difference below says which
|
|
38
|
+
# platform it belongs to and why.
|
|
39
|
+
|
|
40
|
+
if(NOT DEFINED BASALT_SKIA)
|
|
41
|
+
return()
|
|
42
|
+
endif()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
get_filename_component(SKIA_DIR "${BASALT_SKIA}" ABSOLUTE)
|
|
46
|
+
set(SKIA_CPP_DIR ${SKIA_DIR}/cpp)
|
|
47
|
+
set(SKIA_APPLE_DIR ${SKIA_DIR}/apple)
|
|
48
|
+
|
|
49
|
+
# Where each platform's archives are.
|
|
50
|
+
#
|
|
51
|
+
# macos is the package's own layout, filled by its podspec or install-skia.
|
|
52
|
+
# windows and linux are ours, because nothing publishes binaries for either:
|
|
53
|
+
# both mirror the package's android layout -- libs/<platform>/<arch> -- and are
|
|
54
|
+
# what scripts/build_skia_windows.sh and scripts/build_skia_linux.sh write.
|
|
55
|
+
if(APPLE)
|
|
56
|
+
set(SKIA_LIBS_DIR ${SKIA_DIR}/libs/macos)
|
|
57
|
+
elseif(WIN32)
|
|
58
|
+
set(SKIA_LIBS_DIR ${SKIA_DIR}/libs/windows/x86_64)
|
|
59
|
+
else()
|
|
60
|
+
# CMAKE_SYSTEM_PROCESSOR rather than a fixed name: these are ELF archives
|
|
61
|
+
# and an aarch64 host cannot link an x86_64 one. It matches `uname -m`,
|
|
62
|
+
# which is what scripts/build_skia_linux.sh names its output after.
|
|
63
|
+
set(SKIA_LIBS_DIR ${SKIA_DIR}/libs/linux/${CMAKE_SYSTEM_PROCESSOR})
|
|
64
|
+
endif()
|
|
65
|
+
|
|
66
|
+
if(NOT EXISTS ${SKIA_CPP_DIR}/rnskia/RNSkManager.cpp)
|
|
67
|
+
message(FATAL_ERROR
|
|
68
|
+
"no @shopify/react-native-skia C++ at ${SKIA_CPP_DIR}.\n"
|
|
69
|
+
"BASALT_SKIA should name an installed @shopify/react-native-skia, "
|
|
70
|
+
"the one in the app's node_modules.")
|
|
71
|
+
endif()
|
|
72
|
+
|
|
73
|
+
# The binaries are not in the package's `files`: they are downloaded, by the
|
|
74
|
+
# podspec on a normal install or by the package's own install-skia script. So
|
|
75
|
+
# their absence is a thing that happens, and it has to say so rather than fail
|
|
76
|
+
# later in the link with a hundred undefined Skia symbols.
|
|
77
|
+
if(APPLE AND NOT EXISTS ${SKIA_LIBS_DIR}/libskia.xcframework)
|
|
78
|
+
message(FATAL_ERROR
|
|
79
|
+
"no Skia binaries at ${SKIA_LIBS_DIR}.\n"
|
|
80
|
+
"They are downloaded rather than published, so a fresh checkout of an "
|
|
81
|
+
"app may not have them yet. Run the app's pod install, or "
|
|
82
|
+
"`yarn install-skia` inside ${SKIA_DIR}.")
|
|
83
|
+
endif()
|
|
84
|
+
if(WIN32 AND NOT EXISTS ${SKIA_LIBS_DIR}/skia.lib)
|
|
85
|
+
message(FATAL_ERROR
|
|
86
|
+
"no Skia binaries at ${SKIA_LIBS_DIR}.\n"
|
|
87
|
+
"Nobody publishes any for Windows: the package ships Apple and Android "
|
|
88
|
+
"archives and nothing else. Build them with scripts/build_skia_windows.sh, "
|
|
89
|
+
"which puts them here.")
|
|
90
|
+
endif()
|
|
91
|
+
if(NOT APPLE AND NOT WIN32 AND NOT EXISTS ${SKIA_LIBS_DIR}/libskia.a)
|
|
92
|
+
message(FATAL_ERROR
|
|
93
|
+
"no Skia binaries at ${SKIA_LIBS_DIR}.\n"
|
|
94
|
+
"Nobody publishes any for Linux either. Build them with "
|
|
95
|
+
"scripts/build_skia_linux.sh, in WSL2 or on a Linux machine, and copy "
|
|
96
|
+
"its libs/linux/x86_64 here.")
|
|
97
|
+
endif()
|
|
98
|
+
|
|
99
|
+
file(READ ${SKIA_DIR}/package.json SKIA_PACKAGE_JSON)
|
|
100
|
+
string(JSON SKIA_VERSION GET "${SKIA_PACKAGE_JSON}" version)
|
|
101
|
+
|
|
102
|
+
# Every prebuilt archive the package imports on Apple, each a universal slice.
|
|
103
|
+
# Named rather than globbed: a missing one is a link error in somebody else's
|
|
104
|
+
# symbols, and a list says which we expected.
|
|
105
|
+
#
|
|
106
|
+
# **Dependents before dependencies, so libskia is last.** A static archive is
|
|
107
|
+
# searched once, in the order given, and only for symbols already undefined. With
|
|
108
|
+
# libskia first the link failed on `skjson::DOM::DOM` referenced from
|
|
109
|
+
# libskottie.a -- skjson lives inside libskia, which the linker had already
|
|
110
|
+
# walked past. There is no --start-group on Apple's ld, so the order is the fix.
|
|
111
|
+
set(SKIA_LINK_LIBRARIES "")
|
|
112
|
+
if(APPLE)
|
|
113
|
+
set(SKIA_ARCHIVES
|
|
114
|
+
skottie svg skparagraph sksg skshaper
|
|
115
|
+
skunicode_libgrapheme skunicode_core skia)
|
|
116
|
+
foreach(archive ${SKIA_ARCHIVES})
|
|
117
|
+
file(GLOB slice ${SKIA_LIBS_DIR}/lib${archive}.xcframework/macos-*/lib${archive}.a)
|
|
118
|
+
if(NOT slice)
|
|
119
|
+
message(FATAL_ERROR
|
|
120
|
+
"no macOS slice for lib${archive} under ${SKIA_LIBS_DIR}")
|
|
121
|
+
endif()
|
|
122
|
+
list(GET slice 0 slice)
|
|
123
|
+
list(APPEND SKIA_LINK_LIBRARIES ${slice})
|
|
124
|
+
endforeach()
|
|
125
|
+
elseif(WIN32)
|
|
126
|
+
# The same order and the same reason -- dependents first, skia last -- and
|
|
127
|
+
# two differences that are the platform's, not a preference. The unicode
|
|
128
|
+
# backend is the first, and it is immediately below.
|
|
129
|
+
#
|
|
130
|
+
# The bundled third-party archives are the second, and they are named. The
|
|
131
|
+
# published Apple
|
|
132
|
+
# xcframeworks carry theirs inside; a source build emits libpng, libjpeg,
|
|
133
|
+
# libwebp, zlib, expat, harfbuzz, icu and wuffs as archives of their own, and
|
|
134
|
+
# leaving them out is a link error in somebody else's symbols. After skia,
|
|
135
|
+
# because skia is what refers to them.
|
|
136
|
+
# skunicode_libgrapheme, which is also what the published Apple archives use,
|
|
137
|
+
# and not skunicode_icu -- for a reason specific to this platform.
|
|
138
|
+
#
|
|
139
|
+
# ThirdParty.cmake links Windows' own icu.lib on purpose: the operating
|
|
140
|
+
# system has ICU and vendoring a second copy is what that comment declines to
|
|
141
|
+
# do. Skia's ICU-backed skunicode carries a static ICU inside it, and the two
|
|
142
|
+
# export the same unsuffixed names, so a host that links both gets
|
|
143
|
+
#
|
|
144
|
+
# lld-link: error: duplicate symbol: ures_getByKey
|
|
145
|
+
# >>> defined at skunicode_icu.lib(icu.uresbund.obj)
|
|
146
|
+
# >>> defined at icu.dll
|
|
147
|
+
#
|
|
148
|
+
# Neither side is wrong, and dropping either ICU loses something real. The
|
|
149
|
+
# libgrapheme backend needs no ICU at all, which is presumably why Shopify
|
|
150
|
+
# ships it on Apple. icu_bidi.lib is left out for the same reason: the
|
|
151
|
+
# system's ICU supplies ubidi_*.
|
|
152
|
+
set(SKIA_ARCHIVES
|
|
153
|
+
skottie svg skparagraph sksg skshaper
|
|
154
|
+
skunicode_libgrapheme skunicode_core skia
|
|
155
|
+
harfbuzz libpng libjpeg libwebp libwebp_sse41 zlib expat wuffs)
|
|
156
|
+
foreach(archive ${SKIA_ARCHIVES})
|
|
157
|
+
set(lib ${SKIA_LIBS_DIR}/${archive}.lib)
|
|
158
|
+
if(NOT EXISTS ${lib})
|
|
159
|
+
# Not fatal for the bundled ones: which third-party archives a Skia build
|
|
160
|
+
# emits depends on its GN args -- a build with skia_use_dng_sdk=false has
|
|
161
|
+
# no dng_sdk.lib and needs none -- so a missing one is only wrong if
|
|
162
|
+
# something later asks for its symbols, which the link will say plainly.
|
|
163
|
+
if(archive MATCHES "^(skottie|svg|skparagraph|sksg|skshaper|skunicode_libgrapheme|skunicode_core|skia)$")
|
|
164
|
+
message(FATAL_ERROR "no ${archive}.lib under ${SKIA_LIBS_DIR}")
|
|
165
|
+
endif()
|
|
166
|
+
continue()
|
|
167
|
+
endif()
|
|
168
|
+
list(APPEND SKIA_LINK_LIBRARIES ${lib})
|
|
169
|
+
endforeach()
|
|
170
|
+
else()
|
|
171
|
+
# Linux: the same nine the package's android/CMakeLists.txt imports, and no
|
|
172
|
+
# more. Dependents first and skia last, as everywhere else here.
|
|
173
|
+
#
|
|
174
|
+
# **ICU, and why this is the opposite of the Windows choice above.** That
|
|
175
|
+
# one cannot use skunicode_icu because basalt links the operating system's
|
|
176
|
+
# ICU through icu.lib and the two export the same unsuffixed names. Here
|
|
177
|
+
# nothing does: ThirdParty.cmake names icu only under `if(WIN32)`, because
|
|
178
|
+
# on Linux Hermes is a shared libhermesvm.so that records its own ICU
|
|
179
|
+
# dependency and resolves it at load time. So the collision has no second
|
|
180
|
+
# party, and Linux gets the fuller backend -- ICU's line breaking and bidi
|
|
181
|
+
# rather than libgrapheme's grapheme clusters alone.
|
|
182
|
+
#
|
|
183
|
+
# **And no third-party archives.** The Windows build emits libpng, libjpeg,
|
|
184
|
+
# harfbuzz and the rest beside libskia and they have to be named; this one
|
|
185
|
+
# folds them into libskia.a, so naming them would be naming files that do
|
|
186
|
+
# not exist. Not a configuration difference anybody chose -- it is what the
|
|
187
|
+
# two builds happen to emit -- so it is checked rather than assumed: every
|
|
188
|
+
# name below is required, and a missing one is fatal.
|
|
189
|
+
set(SKIA_ARCHIVES
|
|
190
|
+
skottie svg skparagraph sksg skshaper
|
|
191
|
+
skunicode_icu skunicode_core jsonreader skia)
|
|
192
|
+
foreach(archive ${SKIA_ARCHIVES})
|
|
193
|
+
set(lib ${SKIA_LIBS_DIR}/lib${archive}.a)
|
|
194
|
+
if(NOT EXISTS ${lib})
|
|
195
|
+
message(FATAL_ERROR "no lib${archive}.a under ${SKIA_LIBS_DIR}")
|
|
196
|
+
endif()
|
|
197
|
+
list(APPEND SKIA_LINK_LIBRARIES ${lib})
|
|
198
|
+
endforeach()
|
|
199
|
+
endif()
|
|
200
|
+
|
|
201
|
+
file(GLOB_RECURSE SKIA_PORTABLE_SRC CONFIGURE_DEPENDS
|
|
202
|
+
${SKIA_CPP_DIR}/api/*.cpp
|
|
203
|
+
${SKIA_CPP_DIR}/jsi/*.cpp
|
|
204
|
+
${SKIA_CPP_DIR}/rnskia/*.cpp)
|
|
205
|
+
|
|
206
|
+
# Dawn is Skia's WebGPU backend, for the Graphite renderer. It needs Dawn's own
|
|
207
|
+
# headers, which the package downloads separately and only for a Graphite build,
|
|
208
|
+
# so on Ganesh these do not compile at all -- `webgpu/webgpu_cpp.h` not found.
|
|
209
|
+
# Ganesh over Metal is what the published Apple binaries are built for.
|
|
210
|
+
list(FILTER SKIA_PORTABLE_SRC EXCLUDE REGEX "/RNDawn")
|
|
211
|
+
|
|
212
|
+
# The package's vendored copy of Skia's own SkottieUtils stays compiled, and
|
|
213
|
+
# see the link options below for what that costs on Windows: it is the only
|
|
214
|
+
# definition of RNSkia::CustomPropertyManager, which the package's Skottie API
|
|
215
|
+
# needs, and it also redefines six skottie::PropertyObserver methods that
|
|
216
|
+
# skottie.lib defines.
|
|
217
|
+
|
|
218
|
+
# Skia's JSON reader, which Skottie parses Lottie files with. Compiled rather
|
|
219
|
+
# than imported: Android links a libjsonreader.a and no such archive is published
|
|
220
|
+
# for Apple, so on this platform it is source. The symptom of leaving it out is
|
|
221
|
+
# `skjson::DOM::DOM` undefined from libskottie -- a missing definition in
|
|
222
|
+
# somebody else's archive, which reads like a link-order problem and is not.
|
|
223
|
+
list(APPEND SKIA_PORTABLE_SRC
|
|
224
|
+
${SKIA_CPP_DIR}/skia/modules/jsonreader/SkJSONReader.cpp)
|
|
225
|
+
|
|
226
|
+
# The Apple sources that do not reach React. Named one by one on purpose: a glob
|
|
227
|
+
# would pull in SkiaUIView and RNSkiaModule the moment somebody upgraded the
|
|
228
|
+
# package, and the failure would be a wall of missing RCT headers rather than
|
|
229
|
+
# "this file is ours to write".
|
|
230
|
+
#
|
|
231
|
+
# Transitively, which is the part that caught me out. RNSkAppleView.mm mentions
|
|
232
|
+
# no RCT symbol and does not compile, because it includes
|
|
233
|
+
# RNSkApplePlatformContext.h, whose first line is <React/RCTBridge+Private.h>.
|
|
234
|
+
# Grepping the .mm files says seven are free; compiling them says six. So this
|
|
235
|
+
# list is the one that builds, not the one that reads as though it should.
|
|
236
|
+
#
|
|
237
|
+
# RNSkAppleView is therefore ours as well, and that is where `<Canvas>` will
|
|
238
|
+
# come in: RNSkMetalCanvasProvider below is the part that actually draws, and it
|
|
239
|
+
# is free, so what we owe is the view that owns a layer.
|
|
240
|
+
if(APPLE)
|
|
241
|
+
set(SKIA_APPLE_SRC
|
|
242
|
+
${SKIA_APPLE_DIR}/MetalContext.mm
|
|
243
|
+
${SKIA_APPLE_DIR}/MetalLayerColorSpace.mm
|
|
244
|
+
${SKIA_APPLE_DIR}/MetalWindowContext.mm
|
|
245
|
+
${SKIA_APPLE_DIR}/RNSkAppleVideo.mm
|
|
246
|
+
${SKIA_APPLE_DIR}/RNSkMetalCanvasProvider.mm
|
|
247
|
+
${SKIA_APPLE_DIR}/SkiaCVPixelBufferUtils.mm)
|
|
248
|
+
else()
|
|
249
|
+
# Nothing of the package's own on Windows or Linux. Its non-portable halves
|
|
250
|
+
# are the Apple one above and an Android one that is JNI throughout -- the
|
|
251
|
+
# platform context, the GL canvas provider and the window context all take
|
|
252
|
+
# jobjects. So the whole host half on those two is basalt's: Win32Skia* in
|
|
253
|
+
# the win32 package, GtkSkia* in the gtk one.
|
|
254
|
+
set(SKIA_APPLE_SRC "")
|
|
255
|
+
endif()
|
|
256
|
+
|
|
257
|
+
# Objective-C++, because six of the sources below are .mm. Asked for here rather
|
|
258
|
+
# than assumed: this file is included from the *core* package, which is otherwise
|
|
259
|
+
# plain C++, and the AppKit package that enables OBJCXX for its own sources is a
|
|
260
|
+
# sibling that configures later. In this repository's own build something had
|
|
261
|
+
# already enabled it and this was invisible; configuring from an app -- which is
|
|
262
|
+
# a different top-level CMakeLists -- failed with `Missing variable is:
|
|
263
|
+
# CMAKE_OBJCXX_COMPILE_OBJECT`, which names the language and not the file.
|
|
264
|
+
#
|
|
265
|
+
# Idempotent, so the AppKit package asking again costs nothing.
|
|
266
|
+
#
|
|
267
|
+
# Apple only: there is not one .mm in the Windows set, and asking for a
|
|
268
|
+
# language no compiler here provides fails the configure outright.
|
|
269
|
+
if(APPLE)
|
|
270
|
+
enable_language(OBJCXX)
|
|
271
|
+
endif()
|
|
272
|
+
|
|
273
|
+
add_library(skia_core OBJECT ${SKIA_PORTABLE_SRC} ${SKIA_APPLE_SRC})
|
|
274
|
+
# SYSTEM, and warnings off: somebody else's sources held to somebody else's
|
|
275
|
+
# warning set. This project's -Wall -Wextra -Werror is about its own code.
|
|
276
|
+
target_include_directories(skia_core SYSTEM PUBLIC
|
|
277
|
+
${SKIA_CPP_DIR}
|
|
278
|
+
${SKIA_CPP_DIR}/api
|
|
279
|
+
${SKIA_CPP_DIR}/jsi
|
|
280
|
+
${SKIA_CPP_DIR}/rnskia
|
|
281
|
+
${SKIA_CPP_DIR}/utils
|
|
282
|
+
${SKIA_CPP_DIR}/skia
|
|
283
|
+
${SKIA_CPP_DIR}/skia/include
|
|
284
|
+
${SKIA_CPP_DIR}/skia/modules
|
|
285
|
+
${SKIA_APPLE_DIR}
|
|
286
|
+
${RN_DIR}/ReactCommon
|
|
287
|
+
${RN_DIR}/ReactCommon/jsi
|
|
288
|
+
${RN_DIR}/ReactCommon/callinvoker
|
|
289
|
+
${RN_DIR}/ReactCommon/cxxreact
|
|
290
|
+
${RN_DIR}/ReactCommon/runtimeexecutor
|
|
291
|
+
${FOLLY_DIR})
|
|
292
|
+
if(APPLE)
|
|
293
|
+
target_compile_options(skia_core PRIVATE -w -fobjc-arc)
|
|
294
|
+
target_compile_definitions(skia_core PUBLIC
|
|
295
|
+
SK_METAL=1
|
|
296
|
+
SK_GANESH=1
|
|
297
|
+
SKIA_VERSION=\"${SKIA_VERSION}\")
|
|
298
|
+
target_link_libraries(skia_core ${SKIA_LINK_LIBRARIES}
|
|
299
|
+
"-framework Metal"
|
|
300
|
+
"-framework MetalKit"
|
|
301
|
+
"-framework QuartzCore"
|
|
302
|
+
"-framework CoreGraphics"
|
|
303
|
+
"-framework CoreText"
|
|
304
|
+
"-framework CoreVideo"
|
|
305
|
+
"-framework CoreMedia"
|
|
306
|
+
"-framework AVFoundation"
|
|
307
|
+
"-framework Foundation")
|
|
308
|
+
elseif(WIN32)
|
|
309
|
+
# /w rather than -w, and no ARC: the same "somebody else's warnings are not
|
|
310
|
+
# this project's business" as above, spelled the way clang-cl takes it.
|
|
311
|
+
target_compile_options(skia_core PRIVATE /w)
|
|
312
|
+
# No SK_METAL. SK_GANESH alone is Skia's CPU-and-GL configuration, which is
|
|
313
|
+
# what the Windows archives are built as -- and this host draws with the
|
|
314
|
+
# raster half of it for now; see win32/Win32SkiaContext.h.
|
|
315
|
+
target_compile_definitions(skia_core PUBLIC
|
|
316
|
+
SK_GANESH=1
|
|
317
|
+
SKIA_VERSION=\"${SKIA_VERSION}\")
|
|
318
|
+
# What Skia's Windows backend reaches for. DirectWrite and Direct2D for
|
|
319
|
+
# fonts, opengl32 for the GL backend the archives carry, and the COM and GDI
|
|
320
|
+
# pieces its font and image code uses.
|
|
321
|
+
target_link_libraries(skia_core ${SKIA_LINK_LIBRARIES}
|
|
322
|
+
dwrite d2d1 opengl32 user32 gdi32 ole32 oleaut32 uuid usp10 windowscodecs)
|
|
323
|
+
|
|
324
|
+
# /FORCE:MULTIPLE, for one overlap that cannot be resolved any other way.
|
|
325
|
+
#
|
|
326
|
+
# The package vendors a copy of Skia's SkottieUtils at
|
|
327
|
+
# cpp/api/third_party/. That file is the only definition of
|
|
328
|
+
# RNSkia::CustomPropertyManager, which its Skottie API needs, and its header
|
|
329
|
+
# also defines six skottie::PropertyObserver methods out of line -- which
|
|
330
|
+
# skottie.lib's SkottieProperty.obj defines too.
|
|
331
|
+
#
|
|
332
|
+
# Neither half can go. Dropping the vendored file loses
|
|
333
|
+
# CustomPropertyManager: 42 undefined symbols. Dropping the archive member
|
|
334
|
+
# loses the 32 others it carries -- PropertyHandle's instantiations,
|
|
335
|
+
# TextPropertyValue's operators -- which skottie itself uses.
|
|
336
|
+
#
|
|
337
|
+
# Apple never sees this: ld pulls an archive member only when it still needs
|
|
338
|
+
# one, and by then the vendored object has defined those six, so
|
|
339
|
+
# SkottieProperty.obj is never pulled. lld-link pulls it for the other 32 and
|
|
340
|
+
# then reports the six as duplicates. The two definitions are the same Skia
|
|
341
|
+
# source, so either is right and first-wins is correct -- objects precede
|
|
342
|
+
# libraries on the command line, which makes the winner the vendored one, the
|
|
343
|
+
# same one Apple ends up with.
|
|
344
|
+
#
|
|
345
|
+
# The cost is that a genuine duplicate would also be demoted to a warning
|
|
346
|
+
# here. LNK4006 in a build log is the thing to read if something linked and
|
|
347
|
+
# then behaved as though it had two of something.
|
|
348
|
+
target_link_options(skia_core INTERFACE /FORCE:MULTIPLE)
|
|
349
|
+
else()
|
|
350
|
+
target_compile_options(skia_core PRIVATE -w)
|
|
351
|
+
# SK_GANESH alone, as on Windows: the archives are built skia_use_gl=true
|
|
352
|
+
# with Graphite and Dawn off, so this is Skia's CPU-and-GL configuration.
|
|
353
|
+
target_compile_definitions(skia_core PUBLIC
|
|
354
|
+
SK_GANESH=1
|
|
355
|
+
SKIA_VERSION=\"${SKIA_VERSION}\")
|
|
356
|
+
# What this Skia reaches outside its own archives.
|
|
357
|
+
#
|
|
358
|
+
# A short list, because the build bundles almost everything -- libpng,
|
|
359
|
+
# libjpeg, libwebp, zlib, expat, harfbuzz and ICU are all inside libskia.a
|
|
360
|
+
# and libskunicode_icu.a. What it deliberately does not bundle is freetype
|
|
361
|
+
# and fontconfig: skia_use_system_freetype2=true and skia_use_fontconfig=true,
|
|
362
|
+
# because a GTK host already links pango and cairo, which drag in freetype,
|
|
363
|
+
# and two freetypes in one process is a crash rather than a tidiness
|
|
364
|
+
# complaint. pkg-config rather than find_library so the include paths come
|
|
365
|
+
# with them, and so a machine with them somewhere unusual still works.
|
|
366
|
+
find_package(PkgConfig REQUIRED)
|
|
367
|
+
pkg_check_modules(SKIA_SYSTEM REQUIRED IMPORTED_TARGET fontconfig freetype2)
|
|
368
|
+
# GL and EGL for the Ganesh backend the archives carry; dl and pthread
|
|
369
|
+
# because a static Skia asks for both and nothing else on the line will.
|
|
370
|
+
target_link_libraries(skia_core ${SKIA_LINK_LIBRARIES}
|
|
371
|
+
PkgConfig::SKIA_SYSTEM
|
|
372
|
+
GL EGL dl pthread)
|
|
373
|
+
# No /FORCE:MULTIPLE counterpart, and none needed. The SkottieUtils overlap
|
|
374
|
+
# the Windows branch describes is lld-link's alone: GNU ld, like Apple's,
|
|
375
|
+
# pulls an archive member only while a symbol is still undefined, and by the
|
|
376
|
+
# time it reaches skottie the vendored object has defined those six.
|
|
377
|
+
endif()
|
|
378
|
+
|
|
379
|
+
message(STATUS "Skia ${SKIA_VERSION} from ${SKIA_DIR}")
|