summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMichael Anghelone <[email protected]>2023-07-16 07:08:55 -0400
committerGitHub <[email protected]>2023-07-16 13:08:55 +0200
commit70286c7cdc6d972c63704ad957c18065f6a44cfe (patch)
treedc93ae1dc84c4d56cd4ed3c035f91a752645eae7 /src
parentb980268ba7fd1fb5083546ca3f0b20f3390fe128 (diff)
downloadraylib-70286c7cdc6d972c63704ad957c18065f6a44cfe.tar.gz
raylib-70286c7cdc6d972c63704ad957c18065f6a44cfe.zip
Makefile change for cross compiling. (#3176)
Working from wsl and compiling for windows this change makes it much easier to compile a static library for windows on arm. To compile a static library for windows on arm: ``` make PLATFORM=PLATFORM_DESKTOP TARGET_OS=WINDOWS CROSS_CC=/llvm/bin/aarch64-w64-mingw32-gcc CROSS_AR=/llvm/bin/aarch64-w64-mingw32-ar ``` This does not work to compile a shared library yet, only static.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index fc4c5b0c..30ac232f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -308,6 +308,17 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
AR = $(ANDROID_TOOLCHAIN)/bin/llvm-ar
endif
+# This section is here to help handle cross compilation. eg build on Linux for Windows. If you are doing this, you better know what you are doing!
+ifdef TARGET_OS
+ ifdef CROSS_CC
+ CC = ${CROSS_CC}
+ endif
+ ifdef CROSS_AR
+ AR = ${CROSS_AR}
+ endif
+ PLATFORM_OS = ${TARGET_OS}
+endif
+
# Define compiler flags: CFLAGS
#------------------------------------------------------------------------------------------------
# -O1 defines optimization level