Skip to content

Commit 10d64cc

Browse files
authored
Merge pull request #383 from jet082/ios
ios support
2 parents c7f2fb3 + 023b205 commit 10d64cc

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to [ChaiLove](https://github.com/RobLoach/ChaiLove) will be
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 1.1.x - xxxx-xx-xx
8+
### Fixes
9+
- iOS compilation
10+
11+
712
## 1.0.0 - 2019-08-23
813
### Chores
914
- Updated dependencies

Makefile.libretro

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,16 @@ else ifneq (,$(findstring ios,$(platform)))
102102
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
103103
endif
104104
ifeq ($(platform),ios-arm64)
105-
CC = cc -arch arm64 -isysroot $(IOSSDK)
105+
CC = cc -arch arm64 -isysroot -DHAVE_POSIX_MEMALIGN $(IOSSDK)
106+
CFLAGS += -DDONT_WANT_ARM_OPTIMIZATIONS
107+
HAVE_NEON = 0
106108
else
107-
CC = cc -arch armv7 -isysroot $(IOSSDK)
109+
CC = cc -arch armv7 -isysroot $(IOSSDK)
108110
endif
109111
CFLAGS += -DIOS
110112
ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
111-
CC += -miphoneos-version-min=8.0
112-
CFLAGS += -miphoneos-version-min=8.0
113+
CC += -miphoneos-version-min=8.0 -DHAVE_POSIX_MEMALIGN
114+
CFLAGS += -miphoneos-version-min=8.0 -DHAVE_POSIX_MEMALIGN
113115
else
114116
CC += -miphoneos-version-min=5.0
115117
CFLAGS += -miphoneos-version-min=5.0
@@ -299,8 +301,8 @@ else ifeq ($(platform), libnx)
299301
# Platform affix = classic_<ISA>_<µARCH>
300302
# Help at https://modmyclassic.com/comp
301303

302-
# (armv7 a7, hard point, neon based) ###
303-
# NESC, SNESC, C64 mini
304+
# (armv7 a7, hard point, neon based) ###
305+
# NESC, SNESC, C64 mini
304306
else ifeq ($(platform), classic_armv7_a7)
305307
TARGET := $(TARGET_NAME)_libretro.so
306308
fpic := -fPIC
@@ -611,6 +613,13 @@ else
611613
endif
612614
endif
613615

616+
ifeq ($(platform), ios-arm64)
617+
LDFLAGS += -framework IOKit -framework Foundation
618+
FLAGS += -D__MACH__ -D__APPLE__ -DPHYSFS_PLATFORM_APPLE
619+
FLAGS += -DCHAILOVE_DISABLE_LOVE_SYSTEM_EXECUTE
620+
SOURCES_M += $(CORE_DIR)/vendor/didstopia-physfs/src/physfs_platform_apple.m
621+
endif
622+
614623
ifeq ($(EXTERNAL_ZLIB), 1)
615624
CFLAGS += -DHAVE_EXTERNAL_ZLIB
616625
endif

src/love/system.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ std::string system::getUsername() {
106106
}
107107

108108
bool system::execute(const std::string& command) {
109+
#ifdef CHAILOVE_DISABLE_LOVE_SYSTEM_EXECUTE
110+
std::cout << "[ChaiLove] [system] love.system.execute() is disabled." << std::endl;
111+
return false;
112+
#else
109113
std::cout << "[ChaiLove] [system] love.system.execute(\"" << command << "\")" << std::endl;
110114
int result = std::system(command.c_str());
111115
if (result != 0) {
@@ -114,6 +118,7 @@ bool system::execute(const std::string& command) {
114118
}
115119
std::cout << "[ChaiLove] [system] Finished " << command << std::endl;
116120
return true;
121+
#endif
117122
}
118123

119124
std::string system::getClipboardText() {

test/unittests/system.chai

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assert_equal(version[1], '.', "love.system.getVersionString()")
88

99
// getVersion()
1010
var versionNumber = love.system.getVersion()
11-
assert_equal(versionNumber[0], 0, "love.system.getVersion()")
11+
assert_equal(versionNumber[0], 1, "love.system.getVersion()")
1212

1313
// getUsername()
1414
var username = love.system.getUsername()

0 commit comments

Comments
 (0)