Files
factorio-ios/tools/build_save_layout.py
T
SashaGoncharov19 51d085e865 Native iPhone port of Factorio 2.0.77
Run the original macOS ARM64 game code on iOS:
- tools/retarget.py: header-only Mach-O retargeting to an iOS dylib
- platform/native: UIKit host and macOS API shims (AppKit for SDL's
  Cocoa backend, CoreGraphics displays, CoreAudio device, Metal device
  properties, Wuffs PNG decoding, Steam and peripheral stubs)
- touch, overlay, iOS keyboard and hardware keyboard input
- tools/build_native.py: build, sign, install, data copy, launch
- docs: build guide, controls, architecture

Also includes the earlier static-translation research (ARM64 -> WASM ->
native) under docs/research, runtime/, tests/ and tools/.

No game files are included; the build reads them from a local install.
2026-10-23 15:27:58 +04:00

26 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Build the bounded 2.0.77 envelope adapter and real map-header probe."""
import subprocess
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
OUT=ROOT/'build/save-layout'
OUT.mkdir(parents=True,exist_ok=True)
RUNTIME=ROOT/'third_party/wabt/wasm2c'
includes=['-I'+str(p) for p in (ROOT/'runtime',ROOT/'build/version',ROOT/'build/map-header',RUNTIME)]
flags=['-O2','-DWASM_RT_USE_MMAP=0','-DWASM_RT_MEMCHECK_BOUNDS_CHECK=1']
sources=[ROOT/'runtime/save_layout.c',ROOT/'runtime/save_header.c',ROOT/'runtime/version_bridge.c',
ROOT/'runtime/map_header_bridge.c',ROOT/'build/version/factorio_version.c',
ROOT/'build/map-header/factorio_map_header.c',RUNTIME/'wasm-rt-impl.c',RUNTIME/'wasm-rt-mem-impl.c',
ROOT/'tests/save_layout_probe.c']
subprocess.run(['xcrun','clang',*flags,*includes,*map(str,sources),'-lz','-o',str(OUT/'probe')],cwd=ROOT,check=True)
subprocess.run(['xcrun','clang',*flags,*includes,*map(str,sources[:-1]),
str(ROOT/'tests/save_layout_native.c'),str(ROOT/'build/map-header/oracle.S'),
'-lz','-o',str(OUT/'verify_native')],cwd=ROOT,check=True)
sdk=subprocess.check_output(['xcrun','--sdk','iphoneos','--show-sdk-path'],text=True).strip()
obj=OUT/'save_layout.ios.o'
subprocess.run(['xcrun','--sdk','iphoneos','clang','-target','arm64-apple-ios15.0','-isysroot',sdk,
*flags,*includes,'-c',str(ROOT/'runtime/save_layout.c'),'-o',str(obj)],check=True)
subprocess.run(['xcrun','libtool','-static','-o',str(OUT/'libfactorio_save_layout_ios.a'),str(obj)],check=True)
print('Built bounded scenario-envelope adapter and linked AOT constructor probe')