Skip to content

Commit

Permalink
Fixed iOS build.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Dec 16, 2024
1 parent 61eb415 commit 7dc7dfc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 39 deletions.
6 changes: 6 additions & 0 deletions scripts/genie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ project "bx.test"
"pthread",
}

configuration { "ios*" }
linkoptions {
"-framework CoreFoundation",
"-framework Foundation",
}

configuration { "osx*" }
links {
"Cocoa.framework",
Expand Down
50 changes: 12 additions & 38 deletions scripts/toolchain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function toolchain(_buildDir, _libDir)
{ "linux-ppc64le-gcc", "Linux (PPC64LE, GCC compiler)" },
{ "linux-ppc64le-clang", "Linux (PPC64LE, Clang compiler)" },
{ "linux-riscv64-gcc", "Linux (RISC-V 64, GCC compiler)" },
{ "ios-arm", "iOS - ARM" },
{ "ios-arm64", "iOS - ARM64" },
{ "ios-simulator", "iOS - Simulator" },
{ "tvos-arm64", "tvOS - ARM64" },
Expand Down Expand Up @@ -257,8 +256,7 @@ function toolchain(_buildDir, _libDir)
premake.gcc.namestyle = "Emscripten"
location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))

elseif "ios-arm" == _OPTIONS["gcc"]
or "ios-arm64" == _OPTIONS["gcc"] then
elseif "ios-arm64" == _OPTIONS["gcc"] then
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
premake.gcc.ar = "ar"
Expand Down Expand Up @@ -458,7 +456,7 @@ function toolchain(_buildDir, _libDir)
location (path.join(_buildDir, "projects", _ACTION .. "-osx"))

elseif "ios" == _OPTIONS["xcode"] then
action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "13.0")
action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "16.0")
premake.xcode.toolset = "iphoneos"
location (path.join(_buildDir, "projects", _ACTION .. "-ios"))

Expand Down Expand Up @@ -963,54 +961,30 @@ function toolchain(_buildDir, _libDir)
}
includedirs { path.join(bxDir, "include/compat/osx") }

configuration { "ios*" }
linkoptions {
"-lc++",
}
buildoptions {
"-Wfatal-errors",
"-Wunused-value",
"-Wundef",
-- "-mios-version-min=16.0",
}
includedirs { path.join(bxDir, "include/compat/ios") }

configuration { "xcode*", "ios*" }
targetdir (path.join(_buildDir, "ios-arm/bin"))
objdir (path.join(_buildDir, "ios-arm/obj"))

configuration { "ios-arm" }
targetdir (path.join(_buildDir, "ios-arm/bin"))
objdir (path.join(_buildDir, "ios-arm/obj"))
libdirs { path.join(_libDir, "lib/ios-arm") }
linkoptions {
"-arch armv7",
}
buildoptions {
"-arch armv7",
}

configuration { "ios-arm64" }
targetdir (path.join(_buildDir, "ios-arm64/bin"))
objdir (path.join(_buildDir, "ios-arm64/obj"))
libdirs { path.join(_libDir, "lib/ios-arm64") }
linkoptions {
"-arch arm64",
}
includedirs { path.join(bxDir, "include/compat/ios") }
buildoptions {
"-arch arm64",
}
"-mios-version-min=16.0",
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",

configuration { "ios-arm*" }
"-fembed-bitcode",
"-Wfatal-errors",
"-Wunused-value",
"-Wundef",
}
linkoptions {
"-arch arm64",
"-mios-version-min=16.0",
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
"-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
"-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
"-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
}
buildoptions {
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
"-fembed-bitcode",
}

configuration { "xros*" }
Expand Down
2 changes: 1 addition & 1 deletion tests/math_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST_CASE("isFinite, isInfinite, isNan", "[math]")
{
union { uint32_t ui; float f; } u = { uint32_t(ii) };

#if BX_PLATFORM_OSX
#if BX_PLATFORM_OSX || BX_PLATFORM_IOS
REQUIRE(::__isnanf(u.f) == bx::isNan(u.f) );
REQUIRE(::__isfinitef(u.f) == bx::isFinite(u.f) );
REQUIRE(::__isinff(u.f) == bx::isInfinite(u.f) );
Expand Down

0 comments on commit 7dc7dfc

Please sign in to comment.