@geastack/apple 0.2.31 → 0.2.33
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/dist/index.js +8 -0
- package/generated/ActivityKit.d.ts +1 -0
- package/generated/AppKit.d.ts +1 -0
- package/generated/Foundation.d.ts +1 -0
- package/generated/Metal.d.ts +16 -0
- package/generated/MetalKit.d.ts +1 -0
- package/generated/SwiftData.d.ts +2 -0
- package/generated/UIKit.d.ts +1 -0
- package/package.json +6 -7
- package/targets/ios/Info.plist.in +1 -0
- package/targets/ios/build-ios.sh +14 -2
- package/targets/ios/generate-xcode-project.mjs +23 -3
- package/targets/ios/main/ios_http.mm +181 -0
- package/targets/ios/main/ios_main.mm +6 -1
- package/targets/ios/main/ios_microphone.mm +117 -0
- package/targets/ios/main/ios_websocket.mm +34 -0
- package/targets/macos/README.md +8 -3
- package/targets/macos/build-macos.sh +93 -200
- package/targets/macos/main/font_registry.mm +11 -16
- package/targets/macos/main/macos_app_platform.mm +77 -34
- package/targets/macos/main/macos_display.mm +16 -10
- package/targets/macos/main/macos_main.mm +35 -53
- package/targets/macos/main/macos_prerender.h +3 -1
- package/targets/macos/runtime-glyphs.mjs +1 -1
- package/targets/ios/main/ios_apps.c +0 -28
- package/targets/macos/generate-resident-entry.mjs +0 -80
- package/targets/macos/generate-resident-registry.mjs +0 -141
- package/targets/macos/main/macos_apps.c +0 -31
package/targets/macos/README.md
CHANGED
|
@@ -117,9 +117,14 @@ runs the measurement harness (offline render, RMS + measured frequency);
|
|
|
117
117
|
|
|
118
118
|
Also implemented in `main/`: HTTP(S) `fetch` over `NSURLSession`
|
|
119
119
|
(`macos_network.mm`), battery level from IOKit power sources and pointer
|
|
120
|
-
input as touch (`macos_sensors.cpp`), timers (`macos_timers.mm`),
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
input as touch (`macos_sensors.cpp`), timers (`macos_timers.mm`), and the
|
|
121
|
+
`runDeviceCommand` shell escape hatch (`macos_device_control.mm`).
|
|
122
|
+
|
|
123
|
+
One build is one app: a single app never compiles, includes or links GeaOS.
|
|
124
|
+
GeaOS is a separate product with its own build; `GEA_GEAOS=1` requests that
|
|
125
|
+
build, which adds the GeaOS sources and include root from core's source
|
|
126
|
+
manifest, `-DGEA_GEAOS=1`, and `macos_app_platform.mm` (the GeaOS app host
|
|
127
|
+
that launches other apps' bundles).
|
|
123
128
|
|
|
124
129
|
Stubbed in `main/macos_sensors.cpp`: the accelerometer/gyroscope (tilt 0,
|
|
125
130
|
gravity on Z) and the embedded memory diagnostics (all zeros).
|
|
@@ -167,15 +167,23 @@ GEA_PLUGIN="${GEA_PLUGIN:-$(resolve_gea_package @geastack/geatsc-plugin-gea)}"
|
|
|
167
167
|
GEA_HOST_DIR="${GEA_HOST_DIR:-$GEA_CORE/../host}"
|
|
168
168
|
GEA_ENGINE_DIR="${GEA_ENGINE_DIR:-$GEA_CORE/../engine}"
|
|
169
169
|
GEA_ELEMENTS_DIR="${GEA_ELEMENTS_DIR:-$GEA_CORE/../elements}"
|
|
170
|
-
GEA_GEAOS_PACKAGE_DIR="${GEA_GEAOS_PACKAGE_DIR:-$GEA_CORE/../geaos}"
|
|
171
170
|
GEA_ENGINE="$GEA_ENGINE_DIR"
|
|
172
|
-
GEA_GEAOS="$GEA_GEAOS_PACKAGE_DIR"
|
|
173
171
|
# The source manifest reads these from the ENVIRONMENT: gea_sources.sh is now a
|
|
174
172
|
# front end for gea_sources.mjs, which CMake has to read on Windows where there
|
|
175
173
|
# is no bash, so it runs as a child process. A plain shell variable never
|
|
176
174
|
# reaches it, and the include roots come back empty -- every framework header
|
|
177
175
|
# (app.h, display.h, pixel.h) then goes missing at the first compile.
|
|
178
|
-
export GEA_CORE GEA_HOST_DIR GEA_ENGINE_DIR GEA_ELEMENTS_DIR
|
|
176
|
+
export GEA_CORE GEA_HOST_DIR GEA_ENGINE_DIR GEA_ELEMENTS_DIR
|
|
177
|
+
# A single app never compiles, includes or links GeaOS. GEA_GEAOS=1 requests a
|
|
178
|
+
# GeaOS build instead: it adds the manifest's geaos sources and include root,
|
|
179
|
+
# -DGEA_GEAOS=1 and the macOS GeaOS app host (main/macos_app_platform.mm).
|
|
180
|
+
GEAOS_BUILD=0
|
|
181
|
+
if [[ "${GEA_GEAOS:-0}" == "1" ]]; then
|
|
182
|
+
GEAOS_BUILD=1
|
|
183
|
+
GEA_GEAOS_PACKAGE_DIR="${GEA_GEAOS_PACKAGE_DIR:-$GEA_CORE/../geaos}"
|
|
184
|
+
[[ -f "$GEA_GEAOS_PACKAGE_DIR/geaos.h" ]] || { echo "GEA_GEAOS=1 but no @geastack/geaos at $GEA_GEAOS_PACKAGE_DIR (set GEA_GEAOS_PACKAGE_DIR)" >&2; exit 1; }
|
|
185
|
+
export GEA_GEAOS_PACKAGE_DIR
|
|
186
|
+
fi
|
|
179
187
|
# Shared component CSS (and the @font-face files it references). This was one
|
|
180
188
|
# `lib/gea-embedded/components` tree before the split; each package that ships
|
|
181
189
|
# components now carries its own, so both have to be named or the bundle
|
|
@@ -385,7 +393,7 @@ resolve_app_meta() {
|
|
|
385
393
|
|
|
386
394
|
# Resolve an app's source directory from package.json `gea` metadata. By the
|
|
387
395
|
# time later bundle/resource stages call this, generate_app has populated the
|
|
388
|
-
# parent-shell cache for
|
|
396
|
+
# parent-shell cache for the app.
|
|
389
397
|
resolve_app_dir() {
|
|
390
398
|
local id="$1"
|
|
391
399
|
local root _entry _runtime _name
|
|
@@ -412,7 +420,7 @@ fi
|
|
|
412
420
|
timing_mark bootstrap
|
|
413
421
|
|
|
414
422
|
# Cheap read-only equivalent of the post-generation finalizer for no-op cache
|
|
415
|
-
# validation. Avoiding a Node process per
|
|
423
|
+
# validation. Avoiding a Node process per build saves meaningful traversal
|
|
416
424
|
# time while preserving the same ownership invariants.
|
|
417
425
|
apple_native_cached_output_is_current() {
|
|
418
426
|
local outDir="$1"
|
|
@@ -526,12 +534,10 @@ process.stdout.write(hash.digest('hex'))
|
|
|
526
534
|
NODE
|
|
527
535
|
}
|
|
528
536
|
|
|
529
|
-
# Run the JSX → C++ pipeline for
|
|
530
|
-
# symbol prefix (resident-app build).
|
|
537
|
+
# Run the JSX → C++ pipeline for the app.
|
|
531
538
|
generate_app() {
|
|
532
539
|
local id="$1"
|
|
533
540
|
local outDir="$2"
|
|
534
|
-
local prefix="$3" # empty = no prefix (single-app mode, top-level)
|
|
535
541
|
local appMeta appRoot _appName
|
|
536
542
|
local appDir=""
|
|
537
543
|
local entry="index.tsx"
|
|
@@ -547,14 +553,6 @@ generate_app() {
|
|
|
547
553
|
return 1
|
|
548
554
|
fi
|
|
549
555
|
local extraArgs=()
|
|
550
|
-
if [[ -n "$prefix" ]]; then
|
|
551
|
-
extraArgs=(
|
|
552
|
-
--entry-symbol "${prefix}_top_level"
|
|
553
|
-
--cpp-prelude-symbol "${prefix}_register_styles"
|
|
554
|
-
--font-symbol-prefix "$prefix"
|
|
555
|
-
--isolate-symbols
|
|
556
|
-
)
|
|
557
|
-
fi
|
|
558
556
|
local buildConfig="$outDir/gea-build-config.json"
|
|
559
557
|
mkdir -p "$outDir"
|
|
560
558
|
local debugConfigArgs=()
|
|
@@ -764,45 +762,12 @@ refresh_geatsc_runtime_assets() {
|
|
|
764
762
|
done
|
|
765
763
|
}
|
|
766
764
|
|
|
767
|
-
#
|
|
768
|
-
#
|
|
769
|
-
#
|
|
770
|
-
RESIDENT_IDS=()
|
|
771
|
-
if [[ "$APP_ID" == "app-launcher" ]]; then
|
|
772
|
-
# Apps explicitly disabled for the macOS resident bundle. Currently
|
|
773
|
-
# `dialer` uses WebRTC integration patterns (heavy template SFINAE) that
|
|
774
|
-
# ESP-IDF's GCC accepts but Apple clang rejects — until the codegen is
|
|
775
|
-
# adjusted, the dialer tile builds standalone (build-macos.sh dialer)
|
|
776
|
-
# but is not embedded into app-launcher.app.
|
|
777
|
-
MACOS_EXCLUDE_REGEX='^(dialer)$'
|
|
778
|
-
RESIDENT_IDS=( $(node "$GEA_CLI" apps list --target geaos) )
|
|
779
|
-
ORDERED_RESIDENT_IDS=(app-launcher)
|
|
780
|
-
for id in "${RESIDENT_IDS[@]}"; do
|
|
781
|
-
[[ "$id" == "app-launcher" ]] && continue
|
|
782
|
-
ORDERED_RESIDENT_IDS+=("$id")
|
|
783
|
-
done
|
|
784
|
-
RESIDENT_IDS=("${ORDERED_RESIDENT_IDS[@]}")
|
|
785
|
-
FILTERED=()
|
|
786
|
-
for id in "${RESIDENT_IDS[@]}"; do
|
|
787
|
-
if [[ "$id" =~ $MACOS_EXCLUDE_REGEX ]]; then
|
|
788
|
-
echo "Excluding '$id' from app-launcher resident bundle (macOS toolchain quirks)" >&2
|
|
789
|
-
continue
|
|
790
|
-
fi
|
|
791
|
-
FILTERED+=("$id")
|
|
792
|
-
done
|
|
793
|
-
RESIDENT_IDS=("${FILTERED[@]}")
|
|
794
|
-
fi
|
|
795
|
-
|
|
796
|
-
# Generate per-app C++ (single-app mode → directly to GENERATED_DIR;
|
|
797
|
-
# multi-app mode → each app under GENERATED_DIR/residents/<id>/).
|
|
765
|
+
# Generate the app's C++ directly into GENERATED_DIR. One build is one app:
|
|
766
|
+
# GeaOS is a separate product with its own build, and apps for it are compiled
|
|
767
|
+
# separately, so nothing here bundles other apps into this binary.
|
|
798
768
|
GENERATED_GEATSC_SOURCES=()
|
|
799
769
|
GENERATED_FONT_CPP=""
|
|
800
770
|
GENERATED_ASSETS_CPP=""
|
|
801
|
-
RESIDENT_GEATSC_SOURCES=()
|
|
802
|
-
RESIDENT_FONT_CPPS=()
|
|
803
|
-
RESIDENT_ASSET_CPPS=()
|
|
804
|
-
RESIDENT_ENTRY_CPPS=()
|
|
805
|
-
RESIDENT_REGISTRY_CPP=""
|
|
806
771
|
|
|
807
772
|
read_geatsc_sources() {
|
|
808
773
|
local outDir="$1"
|
|
@@ -813,45 +778,15 @@ read_geatsc_sources() {
|
|
|
813
778
|
done < "$sourceList"
|
|
814
779
|
}
|
|
815
780
|
|
|
816
|
-
if
|
|
817
|
-
if
|
|
818
|
-
|
|
819
|
-
exit 1
|
|
820
|
-
fi
|
|
781
|
+
if ! generate_app "$APP_ID" "$GENERATED_DIR"; then
|
|
782
|
+
if [[ -n "$APP_META" ]]; then
|
|
783
|
+
exit 1
|
|
821
784
|
fi
|
|
822
|
-
refresh_geatsc_runtime_assets "$GENERATED_DIR"
|
|
823
|
-
while IFS= read -r src; do GENERATED_GEATSC_SOURCES+=("$src"); done < <(read_geatsc_sources "$GENERATED_DIR")
|
|
824
|
-
GENERATED_FONT_CPP="$GENERATED_DIR/gea_embedded_font_generated.cpp"
|
|
825
|
-
GENERATED_ASSETS_CPP="$GENERATED_DIR/gea_embedded_assets_generated.cpp"
|
|
826
|
-
else
|
|
827
|
-
# Track which residents successfully generated — apps without an
|
|
828
|
-
# index.tsx (or otherwise skipped) shouldn't show up in the registry,
|
|
829
|
-
# otherwise the launcher would reference symbols that nobody defines.
|
|
830
|
-
ACTUAL_RESIDENTS=()
|
|
831
|
-
for id in "${RESIDENT_IDS[@]}"; do
|
|
832
|
-
safe="${id//[^A-Za-z0-9_]/_}"
|
|
833
|
-
prefix="gea_resident_${safe}"
|
|
834
|
-
rDir="$GENERATED_DIR/residents/$id"
|
|
835
|
-
mkdir -p "$rDir"
|
|
836
|
-
if ! generate_app "$id" "$rDir" "$prefix"; then continue; fi
|
|
837
|
-
refresh_geatsc_runtime_assets "$rDir"
|
|
838
|
-
while IFS= read -r src; do RESIDENT_GEATSC_SOURCES+=("$src"); done < <(read_geatsc_sources "$rDir")
|
|
839
|
-
if [[ -f "$rDir/gea_embedded_font_generated.cpp" ]]; then
|
|
840
|
-
RESIDENT_FONT_CPPS+=("$rDir/gea_embedded_font_generated.cpp")
|
|
841
|
-
fi
|
|
842
|
-
if [[ -f "$rDir/gea_embedded_assets_generated.cpp" ]]; then
|
|
843
|
-
RESIDENT_ASSET_CPPS+=("$rDir/gea_embedded_assets_generated.cpp")
|
|
844
|
-
fi
|
|
845
|
-
entryCpp="$rDir/entry.cpp"
|
|
846
|
-
node "$ROOT_DIR/targets/macos/generate-resident-entry.mjs" "$prefix" "$entryCpp"
|
|
847
|
-
RESIDENT_ENTRY_CPPS+=("$entryCpp")
|
|
848
|
-
ACTUAL_RESIDENTS+=("$id")
|
|
849
|
-
done
|
|
850
|
-
RESIDENT_IDS=("${ACTUAL_RESIDENTS[@]}")
|
|
851
|
-
RESIDENT_REGISTRY_CPP="$GENERATED_DIR/resident_registry.cpp"
|
|
852
|
-
node "$ROOT_DIR/targets/macos/generate-resident-registry.mjs" \
|
|
853
|
-
"$RESIDENT_REGISTRY_CPP" "$APP_ID" "${RESIDENT_IDS[@]}"
|
|
854
785
|
fi
|
|
786
|
+
refresh_geatsc_runtime_assets "$GENERATED_DIR"
|
|
787
|
+
while IFS= read -r src; do GENERATED_GEATSC_SOURCES+=("$src"); done < <(read_geatsc_sources "$GENERATED_DIR")
|
|
788
|
+
GENERATED_FONT_CPP="$GENERATED_DIR/gea_embedded_font_generated.cpp"
|
|
789
|
+
GENERATED_ASSETS_CPP="$GENERATED_DIR/gea_embedded_assets_generated.cpp"
|
|
855
790
|
timing_mark generation
|
|
856
791
|
|
|
857
792
|
# Apple-native detection. geatsc emits gea/apple/*.mm (handle-table bridge +
|
|
@@ -886,12 +821,12 @@ INCLUDES=(
|
|
|
886
821
|
)
|
|
887
822
|
# Framework include roots from the shared manifest (gea_sources.sh).
|
|
888
823
|
while IFS= read -r __inc; do INCLUDES+=("$__inc"); done < <(gea_fw_include_flags)
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
824
|
+
if [[ "$GEAOS_BUILD" == "1" ]]; then
|
|
825
|
+
while IFS= read -r __inc; do INCLUDES+=("$__inc"); done < <(gea_geaos_include_flags)
|
|
826
|
+
fi
|
|
827
|
+
SINGLE_APP_DIR="$(resolve_app_dir "$APP_ID")"
|
|
828
|
+
if [[ -n "$SINGLE_APP_DIR" ]]; then
|
|
829
|
+
INCLUDES+=(-I"$SINGLE_APP_DIR" -I"$SINGLE_APP_DIR/native")
|
|
895
830
|
fi
|
|
896
831
|
|
|
897
832
|
CXX_DEFINES=(
|
|
@@ -1015,12 +950,11 @@ if [[ "$THERMALRIGHT_DISPLAY_TARGET" == "1" ]]; then
|
|
|
1015
950
|
-DGEA_EMBEDDED_DISPLAY_NATIVE_HEIGHT="$THERMALRIGHT_HEIGHT"
|
|
1016
951
|
)
|
|
1017
952
|
fi
|
|
1018
|
-
if [[ "$THERMALRIGHT_DISPLAY_TARGET" == "1" &&
|
|
953
|
+
if [[ "$THERMALRIGHT_DISPLAY_TARGET" == "1" && -f "$GENERATED_FONT_CPP" ]]; then
|
|
1019
954
|
CXX_DEFINES+=(-DGEA_EMBEDDED_HAS_GENERATED_FONTS=1)
|
|
1020
955
|
fi
|
|
1021
956
|
|
|
1022
957
|
C_SOURCES=(
|
|
1023
|
-
"$ROOT_DIR/targets/macos/main/macos_apps.c"
|
|
1024
958
|
)
|
|
1025
959
|
# Framework C sources (AnimatedGIF) from the shared manifest.
|
|
1026
960
|
while IFS= read -r __csrc; do C_SOURCES+=("$__csrc"); done < <(gea_fw_c_sources)
|
|
@@ -1029,76 +963,62 @@ CXX_SOURCES=(
|
|
|
1029
963
|
"$ROOT_DIR/targets/macos/main/macos_memory.cpp"
|
|
1030
964
|
"$ROOT_DIR/targets/macos/main/macos_sensors.cpp"
|
|
1031
965
|
)
|
|
1032
|
-
# Framework C++ sources (engine/host/elements
|
|
966
|
+
# Framework C++ sources (engine/host/elements) from the shared manifest.
|
|
1033
967
|
# Apple (AppKit-native) lacks camera/power, uses its own run loop, and has no
|
|
1034
|
-
#
|
|
968
|
+
# OTA/diagnostics services — exclude those framework sources (their
|
|
1035
969
|
# gea::platform::* / service impls are esp32/web-only) so the curated set links.
|
|
1036
970
|
while IFS= read -r __cxxsrc; do CXX_SOURCES+=("$__cxxsrc"); done < <(gea_fw_cxx_sources | grep -vE "/(host/camera|runtime|services/[a-z_]+)\.cpp$")
|
|
1037
971
|
|
|
972
|
+
if [[ "$GEAOS_BUILD" == "1" ]]; then
|
|
973
|
+
CXX_DEFINES+=(-DGEA_GEAOS=1)
|
|
974
|
+
while IFS= read -r __cxxsrc; do CXX_SOURCES+=("$__cxxsrc"); done < <(gea_geaos_cxx_sources)
|
|
975
|
+
fi
|
|
976
|
+
|
|
1038
977
|
GENERATED_OBJCXX_SOURCES=()
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
GENERATED_OBJCXX_KEYS
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
fi
|
|
1070
|
-
done
|
|
1071
|
-
else
|
|
1072
|
-
CXX_SOURCES+=("$ROOT_DIR/targets/macos/main/macos_smoke_app.cpp")
|
|
1073
|
-
fi
|
|
1074
|
-
# Embedded-asset registry (plain C++) is compiled in regardless of
|
|
1075
|
-
# apple-native mode — generated app modules may be Objective-C++, this never is.
|
|
1076
|
-
if [[ "$THERMALRIGHT_DISPLAY_TARGET" == "1" && -f "$GENERATED_FONT_CPP" ]]; then
|
|
1077
|
-
CXX_SOURCES+=("$GENERATED_FONT_CPP")
|
|
1078
|
-
elif [[ -f "$GENERATED_FONT_CPP" ]]; then
|
|
1079
|
-
# The windowed build skips the font TU, so carry its declared glyph set
|
|
1080
|
-
# (baseline + --gea-font-charset) to the runtime TTF slots on its own.
|
|
1081
|
-
node "$ROOT_DIR/targets/macos/runtime-glyphs.mjs" --out "$GENERATED_DIR/gea_runtime_glyphs_generated.cpp" "$GENERATED_FONT_CPP"
|
|
1082
|
-
CXX_SOURCES+=("$GENERATED_DIR/gea_runtime_glyphs_generated.cpp")
|
|
1083
|
-
fi
|
|
1084
|
-
[[ -f "$GENERATED_ASSETS_CPP" ]] && CXX_SOURCES+=("$GENERATED_ASSETS_CPP")
|
|
978
|
+
# gea_app_entry.cpp provides Application::init/frame,
|
|
979
|
+
# which calls the one __gea_top_level emitted by geatsc. In apple-native mode
|
|
980
|
+
# that __gea_top_level builds the AppKit object graph and calls installRootView.
|
|
981
|
+
CXX_SOURCES+=("$GEA_CORE/gea_app_entry.cpp")
|
|
982
|
+
if [[ ${#GENERATED_GEATSC_SOURCES[@]} -gt 0 ]]; then
|
|
983
|
+
# The vast majority of generated geatsc modules are pure C++: they reference
|
|
984
|
+
# host types (NSView, NSColor, …) as plain C++ handle-wrapper structs, and the
|
|
985
|
+
# ObjC-backed method bodies live in the hand-written gea/apple/*.mm bridges
|
|
986
|
+
# (APPLE_BRIDGE_MMS), resolved at link. Compile those with the plain C++
|
|
987
|
+
# toolchain against the cxx runtime PCH — apple-native included — instead of
|
|
988
|
+
# forcing every module through `-ObjC++ -fobjc-arc`, which made each of the
|
|
989
|
+
# hundreds of TUs re-parse the entire AppKit/Metal/Foundation ObjC surface
|
|
990
|
+
# (native_bridge.h now guards those imports behind `#ifdef __OBJC__`).
|
|
991
|
+
#
|
|
992
|
+
# A small minority emit genuine ObjC syntax inline — the callback-target
|
|
993
|
+
# bridge (`[[GeaAppleObjCTarget alloc] …]`, `(__bridge void *)`) that an
|
|
994
|
+
# AppKit event handler lowers to. Those must stay on the .mm toolchain; detect
|
|
995
|
+
# them by content and route only those to MM_SOURCES below.
|
|
996
|
+
GENERATED_OBJCXX_KEYS=$'\n'
|
|
997
|
+
while IFS= read -r f; do
|
|
998
|
+
[[ -n "$f" ]] && GENERATED_OBJCXX_KEYS+="$f"$'\n'
|
|
999
|
+
done < <(grep -lE '__bridge|GeaAppleObjCTarget|@selector|@autoreleasepool|objc_msgSend' \
|
|
1000
|
+
"${GENERATED_GEATSC_SOURCES[@]}" 2>/dev/null || true)
|
|
1001
|
+
for f in "${GENERATED_GEATSC_SOURCES[@]}"; do
|
|
1002
|
+
if [[ "$GENERATED_OBJCXX_KEYS" == *$'\n'"$f"$'\n'* ]]; then
|
|
1003
|
+
GENERATED_OBJCXX_SOURCES+=("$f")
|
|
1004
|
+
else
|
|
1005
|
+
CXX_SOURCES+=("$f")
|
|
1006
|
+
fi
|
|
1007
|
+
done
|
|
1085
1008
|
else
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
#
|
|
1094
|
-
#
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
CXX_SOURCES+=("$GENERATED_DIR/gea_runtime_glyphs_generated.cpp")
|
|
1098
|
-
fi
|
|
1099
|
-
for f in "${RESIDENT_ASSET_CPPS[@]}"; do CXX_SOURCES+=("$f"); done
|
|
1100
|
-
for f in "${RESIDENT_ENTRY_CPPS[@]}"; do CXX_SOURCES+=("$f"); done
|
|
1009
|
+
CXX_SOURCES+=("$ROOT_DIR/targets/macos/main/macos_smoke_app.cpp")
|
|
1010
|
+
fi
|
|
1011
|
+
# Embedded-asset registry (plain C++) is compiled in regardless of
|
|
1012
|
+
# apple-native mode — generated app modules may be Objective-C++, this never is.
|
|
1013
|
+
if [[ "$THERMALRIGHT_DISPLAY_TARGET" == "1" && -f "$GENERATED_FONT_CPP" ]]; then
|
|
1014
|
+
CXX_SOURCES+=("$GENERATED_FONT_CPP")
|
|
1015
|
+
elif [[ -f "$GENERATED_FONT_CPP" ]]; then
|
|
1016
|
+
# The windowed build skips the font TU, so carry its declared glyph set
|
|
1017
|
+
# (baseline + --gea-font-charset) to the runtime TTF slots on its own.
|
|
1018
|
+
node "$ROOT_DIR/targets/macos/runtime-glyphs.mjs" --out "$GENERATED_DIR/gea_runtime_glyphs_generated.cpp" "$GENERATED_FONT_CPP"
|
|
1019
|
+
CXX_SOURCES+=("$GENERATED_DIR/gea_runtime_glyphs_generated.cpp")
|
|
1101
1020
|
fi
|
|
1021
|
+
[[ -f "$GENERATED_ASSETS_CPP" ]] && CXX_SOURCES+=("$GENERATED_ASSETS_CPP")
|
|
1102
1022
|
|
|
1103
1023
|
MM_SOURCES=(
|
|
1104
1024
|
# gea::platform::audio — the AVAudioEngine backend, shared verbatim with iOS.
|
|
@@ -1115,11 +1035,13 @@ MM_SOURCES=(
|
|
|
1115
1035
|
"$ROOT_DIR/targets/macos/main/image_bridge.mm"
|
|
1116
1036
|
"$ROOT_DIR/targets/macos/main/canvas_view.mm"
|
|
1117
1037
|
"$ROOT_DIR/targets/macos/main/thermalright_hid_display.mm"
|
|
1118
|
-
"$ROOT_DIR/targets/macos/main/macos_app_platform.mm"
|
|
1119
1038
|
"$ROOT_DIR/targets/macos/main/macos_device_control.mm"
|
|
1120
1039
|
"$ROOT_DIR/targets/macos/main/macos_host_device_control.mm"
|
|
1121
1040
|
"$ROOT_DIR/targets/macos/main/macos_network.mm"
|
|
1122
1041
|
)
|
|
1042
|
+
if [[ "$GEAOS_BUILD" == "1" ]]; then
|
|
1043
|
+
MM_SOURCES+=("$ROOT_DIR/targets/macos/main/macos_app_platform.mm")
|
|
1044
|
+
fi
|
|
1123
1045
|
# Fail rather than silently linking weak transport fallbacks from an older core.
|
|
1124
1046
|
FRAMEWORK_OBJCXX_SOURCES="$(gea_fw_objcxx_sources)" || exit 1
|
|
1125
1047
|
[[ -n "$FRAMEWORK_OBJCXX_SOURCES" ]] || { echo "Missing framework Apple transport sources" >&2; exit 1; }
|
|
@@ -1248,11 +1170,10 @@ needs_compile() {
|
|
|
1248
1170
|
}
|
|
1249
1171
|
|
|
1250
1172
|
# macOS ships bash 3.2, where "${arr[@]}" on an EMPTY array is an unbound-
|
|
1251
|
-
# variable error under `set -u
|
|
1252
|
-
#
|
|
1173
|
+
# variable error under `set -u`, so guard with the [@]+ idiom (same as
|
|
1174
|
+
# native-test-common.sh).
|
|
1253
1175
|
GEATSC_GENERATED_SOURCES=()
|
|
1254
1176
|
for f in ${GENERATED_GEATSC_SOURCES[@]+"${GENERATED_GEATSC_SOURCES[@]}"}; do GEATSC_GENERATED_SOURCES+=("$f"); done
|
|
1255
|
-
for f in ${RESIDENT_GEATSC_SOURCES[@]+"${RESIDENT_GEATSC_SOURCES[@]}"}; do GEATSC_GENERATED_SOURCES+=("$f"); done
|
|
1256
1177
|
GEATSC_GENERATED_SOURCE_KEYS=$'\n'
|
|
1257
1178
|
for f in ${GEATSC_GENERATED_SOURCES[@]+"${GEATSC_GENERATED_SOURCES[@]}"}; do
|
|
1258
1179
|
GEATSC_GENERATED_SOURCE_KEYS+="$f"$'\n'
|
|
@@ -1482,7 +1403,7 @@ if [[ "$MACOS_SHARED_RUNTIME_BUILTINS" == "1" ]]; then
|
|
|
1482
1403
|
exit 1
|
|
1483
1404
|
fi
|
|
1484
1405
|
# Every consumer gets the same declaration-mode flag; exactly one owner is
|
|
1485
|
-
# linked for the entire native build
|
|
1406
|
+
# linked for the entire native build.
|
|
1486
1407
|
# Use the real host prelude before the runtime implementation, just as the
|
|
1487
1408
|
# generated units do, so engine/host types retain their existing ABI.
|
|
1488
1409
|
sharedRuntimeOwner="$BUILD_DIR/gea_runtime_builtins_owner.cpp"
|
|
@@ -2103,22 +2024,13 @@ if [[ -n "$APP_META" && "${GEA_MACOS_PRERENDER:-0}" != "1" ]]; then
|
|
|
2103
2024
|
fi
|
|
2104
2025
|
fi
|
|
2105
2026
|
|
|
2106
|
-
# Copy any TTF / OTF referenced by @font-face in
|
|
2107
|
-
# builds we walk every resident's app dir so fonts used by other tiles
|
|
2108
|
-
# are also bundled.
|
|
2027
|
+
# Copy any TTF / OTF referenced by @font-face in the app's CSS.
|
|
2109
2028
|
if [[ "$MACOS_PIPELINE_CACHE" == "0" && "${GEA_MACOS_PRERENDER:-0}" != "1" ]]; then
|
|
2110
2029
|
FONTS_OUT="$RES_DIR/Fonts"
|
|
2111
2030
|
mkdir -p "$FONTS_OUT"
|
|
2112
2031
|
APP_DIRS_FOR_FONTS=()
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
[[ -n "$d" ]] && APP_DIRS_FOR_FONTS+=("$d")
|
|
2116
|
-
else
|
|
2117
|
-
for id in "${RESIDENT_IDS[@]}"; do
|
|
2118
|
-
d="$(resolve_app_dir "$id")"
|
|
2119
|
-
[[ -n "$d" ]] && APP_DIRS_FOR_FONTS+=("$d")
|
|
2120
|
-
done
|
|
2121
|
-
fi
|
|
2032
|
+
d="$(resolve_app_dir "$APP_ID")"
|
|
2033
|
+
[[ -n "$d" ]] && APP_DIRS_FOR_FONTS+=("$d")
|
|
2122
2034
|
for d in "${APP_DIRS_FOR_FONTS[@]}"; do
|
|
2123
2035
|
GEA_FONT_MODULE_GRAPH="$GENERATED_DIR/module-graph/gea-module-graph.json" \
|
|
2124
2036
|
node -e "
|
|
@@ -2191,14 +2103,7 @@ fi
|
|
|
2191
2103
|
else
|
|
2192
2104
|
APP_DIRS_FOR_FONTS=()
|
|
2193
2105
|
APP_DIR_FOR_CONFIG="$(resolve_app_dir "$APP_ID")"
|
|
2194
|
-
|
|
2195
|
-
[[ -n "$SINGLE_APP_DIR" ]] && APP_DIRS_FOR_FONTS+=("$SINGLE_APP_DIR")
|
|
2196
|
-
else
|
|
2197
|
-
for id in "${RESIDENT_IDS[@]}"; do
|
|
2198
|
-
d="$(resolve_app_dir "$id")"
|
|
2199
|
-
[[ -n "$d" ]] && APP_DIRS_FOR_FONTS+=("$d")
|
|
2200
|
-
done
|
|
2201
|
-
fi
|
|
2106
|
+
[[ -n "$SINGLE_APP_DIR" ]] && APP_DIRS_FOR_FONTS+=("$SINGLE_APP_DIR")
|
|
2202
2107
|
RESOURCE_SYNC_ARGS=(
|
|
2203
2108
|
--resources-dir "$RES_DIR"
|
|
2204
2109
|
--manifest "$BUILD_DIR/resources-owned.json"
|
|
@@ -2212,10 +2117,8 @@ else
|
|
|
2212
2117
|
done
|
|
2213
2118
|
# Stylesheets imported from workspace packages sit outside every app dir;
|
|
2214
2119
|
# the module graph lists each one the bundle pulled in.
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
[[ -f "$graph" ]] && RESOURCE_SYNC_ARGS+=(--module-graph "$graph")
|
|
2218
|
-
done
|
|
2120
|
+
graph="$GENERATED_DIR/module-graph/gea-module-graph.json"
|
|
2121
|
+
[[ -f "$graph" ]] && RESOURCE_SYNC_ARGS+=(--module-graph "$graph")
|
|
2219
2122
|
RESOURCE_SYNC_RESULT="$(node "$ROOT_DIR/targets/macos/sync-resources.mjs" "${RESOURCE_SYNC_ARGS[@]}")"
|
|
2220
2123
|
if [[ "$RESOURCE_SYNC_RESULT" == *'changed=1'* ]]; then BUNDLE_CONTENT_CHANGED=1; fi
|
|
2221
2124
|
fi
|
|
@@ -2225,14 +2128,7 @@ fi
|
|
|
2225
2128
|
# them by basename out of the app bundle. Runs in both pipeline-cache modes.
|
|
2226
2129
|
SOUNDS_OUT="$RES_DIR/Sounds"
|
|
2227
2130
|
SOUND_APP_DIRS=()
|
|
2228
|
-
|
|
2229
|
-
[[ -n "$SINGLE_APP_DIR" ]] && SOUND_APP_DIRS+=("$SINGLE_APP_DIR")
|
|
2230
|
-
else
|
|
2231
|
-
for id in "${RESIDENT_IDS[@]}"; do
|
|
2232
|
-
d="$(resolve_app_dir "$id")"
|
|
2233
|
-
[[ -n "$d" ]] && SOUND_APP_DIRS+=("$d")
|
|
2234
|
-
done
|
|
2235
|
-
fi
|
|
2131
|
+
[[ -n "$SINGLE_APP_DIR" ]] && SOUND_APP_DIRS+=("$SINGLE_APP_DIR")
|
|
2236
2132
|
for d in ${SOUND_APP_DIRS[@]+"${SOUND_APP_DIRS[@]}"}; do
|
|
2237
2133
|
srcSounds="$d/src/sounds"
|
|
2238
2134
|
[[ -d "$srcSounds" ]] || continue
|
|
@@ -2342,7 +2238,4 @@ fi
|
|
|
2342
2238
|
timing_mark hard-mute-preflight
|
|
2343
2239
|
|
|
2344
2240
|
echo "Built $APP_BUNDLE"
|
|
2345
|
-
if [[ ${#RESIDENT_IDS[@]} -gt 0 ]]; then
|
|
2346
|
-
echo " residents bundled: ${RESIDENT_IDS[*]}"
|
|
2347
|
-
fi
|
|
2348
2241
|
echo "Run: open '$APP_BUNDLE'"
|
|
@@ -400,7 +400,7 @@ static bool measureNativeText(const char *text,
|
|
|
400
400
|
|
|
401
401
|
// Memoize by (text, maxWidth, fontId, fontSize): the layout engine re-measures
|
|
402
402
|
// EVERY text node on EVERY layout pass, and a pass now runs on every
|
|
403
|
-
// interaction.
|
|
403
|
+
// interaction. NSAttributedString boundingRectWithSize:/sizeWithAttributes:
|
|
404
404
|
// dominated the interaction profile; the inputs fully determine the result,
|
|
405
405
|
// so a cache turns repeat measurements (the stable note list) into O(1).
|
|
406
406
|
static std::mutex measureLock;
|
|
@@ -439,21 +439,16 @@ static bool measureNativeText(const char *text,
|
|
|
439
439
|
NSParagraphStyleAttributeName: paragraph,
|
|
440
440
|
};
|
|
441
441
|
NSAttributedString *attributed = [[NSAttributedString alloc] initWithString:str attributes:attrs];
|
|
442
|
-
//
|
|
443
|
-
//
|
|
444
|
-
//
|
|
445
|
-
//
|
|
446
|
-
//
|
|
447
|
-
//
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
cell.wraps = YES;
|
|
453
|
-
cell.attributedStringValue = attributed;
|
|
454
|
-
const NSSize cellSize = [cell cellSizeForBounds:NSMakeRect(0, 0, boundedMax, CGFLOAT_MAX)];
|
|
455
|
-
*outWidth = static_cast<int>(std::ceil(cellSize.width));
|
|
456
|
-
*outHeight = static_cast<int>(std::ceil(cellSize.height));
|
|
442
|
+
// Measure with the exact call the renderer draws with: GeaTextCell's
|
|
443
|
+
// drawInteriorWithFrame: draws the attributed string with
|
|
444
|
+
// drawWithRect:options: (line-fragment origin, font leading) and no cell
|
|
445
|
+
// padding. NSTextFieldCell's cellSizeForBounds: adds its own inset (4px
|
|
446
|
+
// wide, 1px tall at 11px) that the drawing never uses, so centered text
|
|
447
|
+
// landed 2px left of its box's center.
|
|
448
|
+
const NSRect used = [attributed boundingRectWithSize:NSMakeSize(boundedMax, CGFLOAT_MAX)
|
|
449
|
+
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading];
|
|
450
|
+
*outWidth = static_cast<int>(std::ceil(used.size.width));
|
|
451
|
+
*outHeight = static_cast<int>(std::ceil(used.size.height));
|
|
457
452
|
{
|
|
458
453
|
std::scoped_lock guard(measureLock);
|
|
459
454
|
if (measureCache.size() > 8192) measureCache.clear(); // bound unbounded growth
|