port: allow theoretical ARM builds

this requires your device to support desktop GL3+ and might require manual setting of the TOOLCHAIN variable
This commit is contained in:
fgsfds committed 2023-08-20 21:41:04 +02:00
1 parent 2b6b205a78
commit b4207b3fd9
2 files changed
+26 -10

No files matched your search

+8 -2
View File
@@ -132,10 +132,16 @@ ifneq (,$(findstring windows,$(TARGET_PLATFORM)))
TARGET_CFLAGS := $(shell pkg-config sdl2 --cflags-only-I)
TARGET_LDFLAGS := $(shell pkg-config sdl2 --libs) -lz -lopengl32 -static-libstdc++
# on windows/mingw we need this to be built with a 32-bit compiler so it finds the correct libs
TOOLCHAIN := i686-w64-mingw32-
else # TODO
TOOLCHAIN ?= i686-w64-mingw32-
else # assume *nix
TARGET_CFLAGS := $(shell pkg-config sdl2 --cflags-only-I)
TARGET_LDFLAGS := $(shell pkg-config sdl2 --libs) -lGL -lz
ifneq (,$(findstring arm,$(TARGET_PLATFORM))$(findstring aarch,$(TARGET_PLATFORM)))
# linux on arm or aarch64
# TODO: detect soft/hardfloat abi
TARGET_LDFLAGS += -ldl
TOOLCHAIN ?= arm-linux-gnueabihf-
endif
endif
# On x86_64 gcc add -m32 to CFLAGS if building a 32-bit executable.
+18 -8
View File
@@ -4,14 +4,13 @@
// detect OS
#if defined(_WIN32)
#define PLATFORM_WIN32 1
#else
// assume POSIX compatible
#elif defined(__linux__)
#define PLATFORM_POSIX 1
#if defined(__linux__)
#define PLATFORM_LINUX 1
#else // TODO
#error "Unknown platform."
#endif
#define PLATFORM_LINUX 1
#else
// assume POSIX-compatible
#define PLATFORM_POSIX 1
#warning "Unknown OS. Please add it to platform.h."
#endif
// detect arch
@@ -20,10 +19,21 @@
#define PLATFORM_64BIT 1
#elif defined(__i386__) || defined(_X86_) || defined(_M_IX86)
#define PLATFORM_X86 1
#else // TODO
#elif defined(__aarch64__) || defined(_M_ARM64)
#define PLATFORM_ARM 8
#define PLATFORM_64BIT 1
#elif defined(__arm__) || defined(_M_ARM)
// assume armv7
#define PLATFORM_ARM 7
#else
#error "Unknown CPU arch."
#endif
// TODO: remove this after 64-bit support is in place
#ifdef PLATFORM_64BIT
#error "64-bit platforms are currently not supported."
#endif
// detect endianness
#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__