Skip to content

Commit cb61c2c

Browse files
iOS: Makefile can also build for simulator too
1 parent 862da4f commit cb61c2c

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.github/workflows/build_ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
2626
- uses: ./.github/actions/upload_build
2727
with:
28-
SOURCE_FILE: 'ClassiCube.ipa'
28+
SOURCE_FILE: 'ClassiCube-iPhoneOS.ipa'
2929
DEST_NAME: 'cc.ipa'
3030

3131

misc/ios/Makefile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,26 @@ TARGET = ClassiCube
1010
SOURCE_DIRS = src src/ios third_party/bearssl
1111

1212
# CPU architecture names
13-
ARCH_32 ?= armv7
14-
ARCH_64 ?= arm64
13+
ifdef IOS_SIM
14+
ARCH_32 := i386
15+
ARCH_64 := x86_64
16+
SDK_TYPE:= iPhoneSimulator
17+
else
18+
ARCH_32 := armv7
19+
ARCH_64 := arm64
20+
SDK_TYPE:= iPhoneOS
21+
endif
22+
FULL_TARGET := $(TARGET)-$(SDK_TYPE)
1523

1624
# Directory where object files are placed
17-
BUILD_DIR_APP := build/ios/$(TARGET).app
25+
BUILD_DIR_APP := build/ios/$(FULL_TARGET).app
1826
BUILD_DIR_32 := build/ios/$(ARCH_32)
1927
BUILD_DIR_64 := build/ios/$(ARCH_64)
2028

21-
XCODE_ROOT := /Applications/Xcode.app/Contents/Developer
22-
IOS_SDK_PATH ?= $(XCODE_ROOT)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk
29+
IOS_SDK_VERSION ?= 12.1
2330
IOS_MIN_VERSION ?= 6.0
31+
XCODE_ROOT := /Applications/Xcode.app/Contents/Developer
32+
IOS_SDK_PATH := $(XCODE_ROOT)/Platforms/$(SDK_TYPE).platform/Developer/SDKs/$(SDK_TYPE)$(IOS_SDK_VERSION).sdk
2433

2534

2635
#---------------------------------------------------------------------------------
@@ -57,7 +66,7 @@ DEPFILES_64 := $(OBJS_64:%.o=%.d)
5766
#---------------------------------------------------------------------------------
5867
# main targets
5968
#---------------------------------------------------------------------------------
60-
all: $(BUILD_DIR_32) $(BUILD_DIR_64) $(BUILD_DIR_APP) $(TARGET).ipa
69+
all: $(BUILD_DIR_32) $(BUILD_DIR_64) $(BUILD_DIR_APP) $(FULL_TARGET).ipa
6170

6271
$(BUILD_DIR_32):
6372
mkdir -p $(BUILD_DIR_32)
@@ -98,11 +107,12 @@ $(BUILD_DIR_APP)/PkgInfo: misc/ios/PkgInfo
98107
cp $^ $@
99108

100109

101-
$(TARGET).ipa: $(BUILD_DIR_APP)/$(TARGET) $(BUILD_DIR_APP)/Assets.car $(BUILD_DIR_APP)/Info.plist $(BUILD_DIR_APP)/PkgInfo
110+
$(FULL_TARGET).ipa: $(BUILD_DIR_APP)/$(TARGET) $(BUILD_DIR_APP)/Assets.car $(BUILD_DIR_APP)/Info.plist $(BUILD_DIR_APP)/PkgInfo
102111
rm -rf Payload
103112
mkdir -p Payload
104113
cp -R $(BUILD_DIR_APP) Payload
105-
zip -r $(TARGET).ipa Payload
114+
mv Payload/$(FULL_TARGET).app Payload/$(TARGET).app
115+
zip -r $(FULL_TARGET).ipa Payload
106116

107117

108118
#---------------------------------------------------------------------------------

0 commit comments

Comments
 (0)