Files
sizzletracker-android/ios/Makefile
T
ReactorcoremeltdownandClaude Opus 5.5 29650b88d7 iOS milestone 3 groundwork: SizzleSession bridge, app shell with tabs, slot-backed editors, screen snapshots
SizzleSession owns the song, engine (192-frame chunks, try-lock on the audio
thread), samples and audio output; AppModel/RootView give the four tabs;
DeviceModel now works on toolbox slots too; make screen-snapshots renders the
app's tabs on the Mac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:15:28 +01:00

185 lines
10 KiB
Makefile

# Sizzle for iOS/iPadOS — build entrypoint (separate from the Android Makefile).
#
# app/ the Sizzle app (cc.tiredsysadmin.ios.sizzle): Sizzle's devices as AUv3
# plugins for hosts like AUM, installed with TrollStore. iOS/iPadOS 15+.
# core/ the C++ DSP core those plugins run: a port of the Android app's Kotlin
# DSP, checked sample by sample against audio the Kotlin code renders.
# spike/ the TrollStore AUv3 feasibility spike (kept for reference).
#
# make help what each target does
# make golden export DeviceSpecs.gen.hpp + Kotlin reference audio (needs the
# Android toolchain; runs IosGoldenExport in ../app)
# make core-test build the C++ core and compare it with the reference audio
# (TYPES="FILTER EQ10" limits it to some devices)
# make au-test macOS check of the AUv3 wrapper: every effect through AVAudioEngine
# must match the core, plus parameters, presets and saved state
# make project generate app/Sizzle.xcodeproj (components + XcodeGen)
# make ipa unsigned device build, ad-hoc signed with entitlements, packed as
# dist/cc.tiredsysadmin.ios.sizzle_<versionCode>.ipa for TrollStore
# make bump-minor new feature -> x.(y+1).0, versionCode +1 (also bump-patch/-major)
# make spike-ipa the spike's .ipa (dist/cc.tiredsysadmin.ios.sizzlespike_<build>.ipa)
# make clean remove build/ and dist/
#
# Needs Xcode and XcodeGen (brew install xcodegen). Builds stay local (CLAUDE.md).
SHELL := /bin/sh
VERSIONS := ../versions.properties
VERSION := $(shell sed -n 's/^ios.versionName[[:space:]]*=[[:space:]]*//p' $(VERSIONS) | tr -d ' ')
BUILD_NO := $(shell sed -n 's/^ios.versionCode[[:space:]]*=[[:space:]]*//p' $(VERSIONS) | tr -d ' ')
APP_ID := cc.tiredsysadmin.ios.sizzle
PROJECT := app/Sizzle.xcodeproj
APP_SRC := $(shell find app core/src core/include -type f -not -path '*.xcodeproj/*')
DEV_APP := build/dev/Build/Products/Release-iphoneos/Sizzle.app
IPA := dist/$(APP_ID)_$(BUILD_NO).ipa
# C++ DSP core: reference audio lives in core/golden/ (regenerated, not committed).
CORE_SRC := $(wildcard core/src/*.cpp core/src/*/*.cpp)
CORE_HDR := $(wildcard core/include/sizzle/*.hpp core/src/*/*.hpp)
CXX ?= c++
CXXFLAGS := -std=c++17 -O2 -Wall -Wextra -Icore/include -Icore/src -Icore/src/fx
GOLDEN := core/golden
SPECS_GEN := core/include/sizzle/DeviceSpecs.gen.hpp
# Gradle needs the Android SDK; same default location as the Android Makefile.
ANDROID_SDK ?= $(or $(ANDROID_HOME),$(HOME)/Library/Android/sdk)
SPIKE_PROJ := spike/SizzleSpike.xcodeproj
SPIKE_SRC := $(shell find spike -type f -not -path '*.xcodeproj/*')
SPIKE_NO := $(shell sed -n 's/^ *CURRENT_PROJECT_VERSION: *"\(.*\)"/\1/p' spike/project.yml)
SPIKE_IPA := dist/cc.tiredsysadmin.ios.sizzlespike_$(SPIKE_NO).ipa
.DEFAULT_GOAL := help
help:
@sed -n 's/^# //p' Makefile
@echo ""
@echo "current: $(APP_ID) $(VERSION) (build $(BUILD_NO))"
# ------------------------------------------------------------------ core
golden:
cd .. && ANDROID_HOME=$(ANDROID_SDK) SIZZLE_GOLDEN_DIR=$(CURDIR)/$(GOLDEN) \
SIZZLE_SPECS_OUT=$(CURDIR)/$(SPECS_GEN) SIZZLE_LAYOUTS_OUT=$(CURDIR)/app/FX/DeviceLayouts.json \
./gradlew -q :app:testDebugUnitTest --tests '*IosGolden*' --rerun
@ls $(GOLDEN)/*.scn | wc -l | xargs echo "reference scenarios:"
build/core/golden_test: $(CORE_SRC) $(CORE_HDR) core/tests/golden_test.cpp
mkdir -p build/core
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) core/tests/golden_test.cpp
build/core/sampler_test: $(CORE_SRC) $(CORE_HDR) core/tests/sampler_test.cpp
mkdir -p build/core
$(CXX) $(CXXFLAGS) -Icore/src/sampler -o $@ $(CORE_SRC) core/tests/sampler_test.cpp
build/core/engine_test: $(CORE_SRC) $(CORE_HDR) core/tests/engine_test.cpp
mkdir -p build/core
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) core/tests/engine_test.cpp
build/core/io_test: $(CORE_SRC) $(CORE_HDR) core/tests/io_test.cpp
mkdir -p build/core
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) core/tests/io_test.cpp
core-test: build/core/golden_test build/core/sampler_test build/core/engine_test build/core/io_test
@test -f $(GOLDEN)/input.f32 || $(MAKE) --no-print-directory golden
build/core/golden_test $(GOLDEN) $(TYPES)
build/core/sampler_test
build/core/engine_test $(GOLDEN)/songs
build/core/io_test $(GOLDEN)/songs ../app/src/test/resources/mikroseq
# ------------------------------------------------------------------ app
AU_SRC := app/FX/SizzleDeviceAU.mm app/FX/SizzleEffectAU.mm app/FX/SizzleInstrumentAU.mm
build/core/au_test: $(AU_SRC) $(wildcard app/FX/*.h app/FX/*.hpp) app/tests/au_test.mm $(CORE_SRC) $(CORE_HDR)
mkdir -p build/core
$(CXX) $(CXXFLAGS) -Wno-deprecated-declarations -fobjc-arc -Iapp/FX -o $@ $(AU_SRC) app/tests/au_test.mm $(CORE_SRC) \
-framework AVFoundation -framework AudioToolbox -framework Foundation
au-test: build/core/au_test
@test -f $(GOLDEN)/input.f32 || $(MAKE) --no-print-directory golden
build/core/au_test $(GOLDEN)/input.f32
# Mac snapshots of the SwiftUI device editors (AUAudioUnit and SwiftUI exist on
# macOS too): the AU classes + core as a dylib, the editor Swift on top.
EDITOR_SWIFT := $(wildcard app/FX/Editor/*.swift)
build/snapshots/libsizzlesnap.dylib: $(AU_SRC) app/tests/SnapshotComponents.mm $(CORE_SRC) $(CORE_HDR)
mkdir -p build/snapshots
$(CXX) $(CXXFLAGS) -Wno-deprecated-declarations -fobjc-arc -Iapp/FX -dynamiclib -install_name @rpath/libsizzlesnap.dylib \
-o $@ $(AU_SRC) app/tests/SnapshotComponents.mm $(CORE_SRC) -framework AVFoundation -framework AudioToolbox -framework Foundation
build/snapshots/editor_snapshots: build/snapshots/libsizzlesnap.dylib $(EDITOR_SWIFT) app/tests/editor_snapshots.swift
swiftc -O -parse-as-library -import-objc-header app/tests/SnapshotBridging.h -Iapp/FX -Iapp/tests \
-o $@ $(EDITOR_SWIFT) app/tests/editor_snapshots.swift -Lbuild/snapshots -lsizzlesnap -Xlinker -rpath -Xlinker @executable_path
cp app/FX/DeviceLayouts.json build/snapshots/
editor-snapshots: build/snapshots/editor_snapshots
cd build/snapshots && ./editor_snapshots png
SNAPDIR ?= build/screens
# Mac snapshots of the app's tabs with the demo song (SizzleSession runs on macOS
# too, without audio). Screens must stay SwiftUI-only (no UIKit) to render here.
SCREEN_SWIFT := $(EDITOR_SWIFT) app/Host/AppModel.swift app/Host/RootView.swift app/Host/SlotDeviceModel.swift \
app/Host/KeyboardView.swift $(shell find app/Host/Screens -name '*.swift')
$(SNAPDIR)/libsizzlescreens.dylib: $(AU_SRC) $(wildcard app/Host/SizzleSession*.mm app/Host/SizzleSession*.h) app/tests/SnapshotComponents.mm $(CORE_SRC) $(CORE_HDR)
mkdir -p $(SNAPDIR)
$(CXX) $(CXXFLAGS) -Wno-deprecated-declarations -fobjc-arc -Iapp/FX -Iapp/Host -dynamiclib -install_name @rpath/libsizzlescreens.dylib \
-o $@ $(AU_SRC) $(wildcard app/Host/SizzleSession*.mm) app/tests/SnapshotComponents.mm $(CORE_SRC) \
-framework AVFoundation -framework AudioToolbox -framework Foundation
$(SNAPDIR)/screen_snapshots: $(SNAPDIR)/libsizzlescreens.dylib $(SCREEN_SWIFT) app/tests/screen_snapshots.swift
swiftc -O -parse-as-library -import-objc-header app/tests/ScreenBridging.h -Iapp/FX -Iapp/Host -Iapp/tests \
-o $@ $(SCREEN_SWIFT) app/tests/screen_snapshots.swift -L$(SNAPDIR) -lsizzlescreens -Xlinker -rpath -Xlinker @executable_path
cp app/FX/DeviceLayouts.json $(SNAPDIR)/
screen-snapshots: $(SNAPDIR)/screen_snapshots
cd $(SNAPDIR) && ./screen_snapshots png $(CURDIR)/../samples/demo.sng
app/FX/Info.plist app/FX/Components.gen.h: app/components.txt tools/gen_components.py
python3 tools/gen_components.py app/components.txt app/FX/Info.plist app/FX/Components.gen.h
project: $(PROJECT)/project.pbxproj
$(PROJECT)/project.pbxproj: app/project.yml app/FX/Info.plist
cd app && xcodegen generate --spec project.yml --quiet
# Device: build without signing, then ad-hoc sign inside-out (extension first) with
# each target's entitlements. TrollStore re-signs at install and keeps them.
ipa: $(IPA)
$(IPA): $(PROJECT)/project.pbxproj $(APP_SRC) $(VERSIONS)
xcodebuild -quiet -project $(PROJECT) -scheme Sizzle -configuration Release \
-sdk iphoneos -derivedDataPath build/dev CODE_SIGNING_ALLOWED=NO \
MARKETING_VERSION=$(VERSION) CURRENT_PROJECT_VERSION=$(BUILD_NO) build
rm -rf build/Payload && mkdir -p build/Payload dist
cp -R $(DEV_APP) build/Payload/
codesign -f -s - --entitlements app/FX/FX.entitlements build/Payload/Sizzle.app/PlugIns/SizzleFX.appex
codesign -f -s - --entitlements app/Host/Host.entitlements build/Payload/Sizzle.app
rm -f $@ && cd build && zip -qr ../$@ Payload
@echo "wrote $@"
# ------------------------------------------------------------------ versions
bump-major: ; @$(MAKE) --no-print-directory bump FIELD=1
bump-minor: ; @$(MAKE) --no-print-directory bump FIELD=2
bump-patch: ; @$(MAKE) --no-print-directory bump FIELD=3
bump:
@new=$$(echo $(VERSION) | awk -F. -v f=$(FIELD) '{ if (f==1) {$$1++; $$2=0; $$3=0} else if (f==2) {$$2++; $$3=0} else {$$3++} print $$1"."$$2"."$$3 }'); \
code=$$(( $(BUILD_NO) + 1 )); \
sed -i '' -e "s/^ios.versionName .*/ios.versionName = $$new/" -e "s/^ios.versionCode .*/ios.versionCode = $$code/" $(VERSIONS); \
echo "ios $$new (build $$code)"
# ------------------------------------------------------------------ spike
$(SPIKE_PROJ)/project.pbxproj: spike/project.yml
cd spike && xcodegen generate --spec project.yml --quiet
spike-ipa: $(SPIKE_IPA)
$(SPIKE_IPA): $(SPIKE_PROJ)/project.pbxproj $(SPIKE_SRC)
xcodebuild -quiet -project $(SPIKE_PROJ) -scheme SizzleSpike -configuration Release \
-sdk iphoneos -derivedDataPath build/spike CODE_SIGNING_ALLOWED=NO build
rm -rf build/SpikePayload && mkdir -p build/SpikePayload/Payload dist
cp -R build/spike/Build/Products/Release-iphoneos/SizzleSpike.app build/SpikePayload/Payload/
codesign -f -s - --entitlements spike/AU/AU.entitlements \
build/SpikePayload/Payload/SizzleSpike.app/PlugIns/SizzleSpikeAU.appex
codesign -f -s - --entitlements spike/App/App.entitlements build/SpikePayload/Payload/SizzleSpike.app
rm -f $@ && cd build/SpikePayload && zip -qr ../../$@ Payload
@echo "wrote $@"
clean:
rm -rf build dist
.PHONY: help golden core-test au-test project ipa bump-major bump-minor bump-patch bump spike-ipa clean