Skip to content

Commit

Permalink
Makefile change for cross compiling. (#3176)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
superxkooda committed Jul 16, 2023
1 parent b980268 commit 70286c7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 70286c7

Please sign in to comment.