Skip to content

Commit

Permalink
fix: new build for apple ios
Browse files Browse the repository at this point in the history
remove armv7

lua build LUA_USE_IOS

fix double inclusion of static libs

use system malloc

build two separate libraries (avoid lipo)

fix release process and apply ccache where possible

enable ccache on builds
  • Loading branch information
jaromil committed Sep 24, 2024
1 parent 4197ee2 commit cd294c3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 8 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,33 +133,40 @@ jobs:
# make -f build/meson.mk CLANG=1 RELEASE=1

windows-build:
name: 🪟 Windows build
name: 🪟 Windows build test
needs: [reuse, c-lint, lua-lint]
if: "github.event_name == 'pull_request'"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hendrikmuhs/[email protected]
- name: install dependencies
run : |
sudo apt install -y zsh jq gcc-mingw-w64 g++-mingw-w64 ccache
sudo apt install -y zsh jq gcc-mingw-w64 g++-mingw-w64
- name: Build x86_64 windows .exe
run: |
make -f build/win-exe.mk CCACHE=1
make clean -C src
make -f build/win-dll.mk CCACHE=1
macosx-build:
name: 🍎 Macosx build
apple-ios-build:
name: 🍎 Apple iOS build test
needs: [reuse, c-lint, lua-lint]
if: "github.event_name == 'pull_request'"
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: make osx
- run: |
make -f build/apple-ios.mk ios-arm64
# make clean
# make -f build/apple-ios.mk ios-sim
# make -f build/apple-ios.mk ios-fat
# make -f build/apple-ios.mk ios-armv7
# make clean
go-build-check:
name: 🐹 go build & checks
Expand Down Expand Up @@ -478,15 +485,27 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hendrikmuhs/[email protected]
- run: |
make osx
- name: Upload artifact win x86_64
make clean
make -f build/apple-ios.mk ios-arm64 CCACHE=1
make clean
make -f build/apple-ios.mk ios-sim CCACHE=1
- name: Upload artifacts for Apple OSX
uses: actions/upload-artifact@v4
with:
name: release-bin-osx
name: release-apple-osx
path: |
src/zenroom.command
src/zencode-exec.command
- name: Upload artifacts for Apple iOS
uses: actions/upload-artifact@v4
with:
name: release-apple-ios
path: |
zenroom-ios-arm64.a
zenroom-ios-x86_64.a
npm-release:
name: 📦 npm release
Expand Down
52 changes: 52 additions & 0 deletions build/apple-ios.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Initialize build defaults
include build/init.mk

ifdef CCACHE
milagro_cmake_flags += -DCMAKE_C_COMPILER_LAUNCHER=ccache
pfxcc += ccache
endif

OS := iphoneos
cc := $(shell xcrun --sdk iphoneos -f gcc 2>/dev/null)
ar := $(shell xcrun --sdk iphoneos -f ar 2>/dev/null)
ld := $(shell xcrun --sdk iphoneos -f ld 2>/dev/null)
ranlib := $(shell xcrun --sdk iphoneos -f ranlib 2>/dev/null)
cflags += -O2 -fPIC ${cflags_protection}
cflags += -D'ARCH="OSX"' -DNO_SYSTEM -DARCH_OSX
cflags += -DLIBCMALLOC
lua_cflags += -DLUA_USE_IOS
ldflags := -lm
platform := ios
quantum_proof_cc := ${pfxcc} ${cc}
ed25519_cc := ${pfxcc} ${cc}
libcc_cc := ${pfxcc} ${cc}

ios-armv7: cflags += -arch armv7 -isysroot $(shell xcrun --sdk iphoneos --show-sdk-path 2>/dev/null)
ios-armv7: ${BUILD_DEPS} ${ZEN_SOURCES}
TARGET=armv7 libtool -static -o zenroom-ios-armv7.a \
${ZEN_SOURCES} ${ldadd}

ios-arm64: cflags += -arch arm64 -isysroot $(shell xcrun --sdk iphoneos --show-sdk-path 2>/dev/null)
ios-arm64: ${BUILD_DEPS} ${ZEN_SOURCES}
TARGET=arm64 libtool -static -o zenroom-ios-arm64.a \
${ZEN_SOURCES} ${ldadd}

ios-sim: cc := ${pfxcc} $(shell xcrun --sdk iphonesimulator -f gcc 2>/dev/null)
ios-sim: ar := $(shell xcrun --sdk iphonesimulator -f ar 2>/dev/null)
ios-sim: ld := $(shell xcrun --sdk iphonesimulator -f ld 2>/dev/null)
ios-sim: ranlib := $(shell xcrun --sdk iphonesimulator -f ranlib 2>/dev/null)
ios-sim: cflags += -arch x86_64 -isysroot $(shell xcrun --sdk iphonesimulator --show-sdk-path 2>/dev/null)
ios-sim: quantum_proof_cc := ${cc}
ios-sim: ed25519_cc := ${cc}
ios-sim: libcc_cc := ${cc}
ios-sim: ${BUILD_DEPS} ${ZEN_SOURCES}
TARGET=x86_64 libtool -static -o zenroom-ios-x86_64.a \
${ZEN_SOURCES} ${ldadd}

# ios-fat:
# lipo -create \
# zenroom-ios-x86_64.a \
# zenroom-ios-arm64.a \
# -output zenroom-ios.a

include build/deps.mk
2 changes: 1 addition & 1 deletion build/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ platform := posix
# ------------
# lua settings
lua_cc ?= ${cc}
lua_cflags = -DLUA_COMPAT_5_3 -DLUA_COMPAT_MODULE -DLUA_COMPAT_BITLIB -I${pwd}/lib/milagro-crypto-c/build/include -I${pwd}/src -I${pwd}/lib/milagro-crypto-c/build/include -I ${pwd}/lib/mimalloc/include
lua_cflags := -DLUA_COMPAT_5_3 -DLUA_COMPAT_MODULE -DLUA_COMPAT_BITLIB -I${pwd}/lib/milagro-crypto-c/build/include -I${pwd}/src -I${pwd}/lib/milagro-crypto-c/build/include -I ${pwd}/lib/mimalloc/include

# ----------------
# milagro settings
Expand Down

0 comments on commit cd294c3

Please sign in to comment.