mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Keep working on Android custom building...
...almost there! raylib already works, issues with OpenAL Soft linkage...
This commit is contained in:
@ -44,27 +44,38 @@ ANDROID_BUILD_TOOLS = C:/android-sdk/build-tools/26.0.1
|
||||
JAVA_HOME = C:/PROGRA~1/Java/jdk1.8.0_144
|
||||
|
||||
# Compilers
|
||||
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang
|
||||
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc
|
||||
AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar
|
||||
|
||||
# Define compiler flags
|
||||
CFLAGS = -Wall -std=c99 -DPLATFORM_ANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
|
||||
# Compiler flags for arquitecture
|
||||
CFLAGS = -std=c99 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
|
||||
# Compilation functions attributes options
|
||||
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
|
||||
# Compiler options for the linker
|
||||
CFLAGS += -Wall -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes
|
||||
# Preprocessor macro definitions
|
||||
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16
|
||||
|
||||
# Define any directories containing required header files
|
||||
INCLUDES = -I. -Ijni/include -I$(ANDROID_NDK)/sources/android/native_app_glue
|
||||
# Paths containing required header files
|
||||
INCLUDES = -I. -Isrc/include -I$(ANDROID_NDK)/sources/android/native_app_glue
|
||||
|
||||
# Define library paths containing required libs
|
||||
LFLAGS = -L. -Ljni -Llib -Ljni/libs
|
||||
# Linker options
|
||||
LFLAGS = -Wl,-soname,lib$(LIBRARY_NAME).so -Wl,--exclude-libs,libatomic.a
|
||||
LFLAGS = -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
|
||||
# Force linking of library module to define symbol
|
||||
LFLAGS = -u ANativeActivity_onCreate
|
||||
# Library paths containing required libs
|
||||
LFLAGS += -L. -Lsrc -Llib -Lsrc/libs
|
||||
|
||||
# Define any libraries to link into executable
|
||||
# if you want to link libraries (libname.so or libname.a), use the -lname
|
||||
LIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES
|
||||
LIBS = -lnative_app_glue -lraylib -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm
|
||||
|
||||
# Building APK
|
||||
# NOTE: typing 'make' will invoke the default target entry called 'all',
|
||||
all: project_dirs \
|
||||
native_app_glue \
|
||||
project_code \
|
||||
project_code_ok \
|
||||
gen_keystore \
|
||||
project_package \
|
||||
project_class \
|
||||
@ -90,13 +101,17 @@ native_app_glue:
|
||||
|
||||
# Compile project code as shared libraries
|
||||
# OUTPUT: $(PROJECT_DIR)/lib/lib$(LIBRARY_NAME).so
|
||||
project_code:
|
||||
$(CC) -c src/core.c -o temp/obj/core.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot -fPIC
|
||||
$(CC) -c src/rlgl.c -o temp/obj/rlgl.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot -fPIC -DGRAPHICS_API_OPENGL_ES2
|
||||
$(CC) -c src/utils.c -o temp/obj/utils.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot -fPIC
|
||||
$(CC) -c src/game_crash.c -o temp/obj/game_crash.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot -fPIC
|
||||
$(CC) -o lib/armeabi-v7a/lib$(LIBRARY_NAME).so temp/obj/game_crash.o temp/obj/core.o temp/obj/rlgl.o temp/obj/utils.o -shared $(INCLUDES) $(LFLAGS) -lnative_app_glue $(LIBS) -u ANativeActivity_onCreate
|
||||
project_code_ok:
|
||||
$(CC) -c src/game_basic.c -o temp/obj/game_basic.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot
|
||||
$(CC) -o lib/armeabi-v7a/lib$(LIBRARY_NAME).so temp/obj/game_basic.o -shared $(INCLUDES) $(LFLAGS) $(LIBS)
|
||||
|
||||
project_code:
|
||||
$(CC) -c src/core.c -o temp/obj/core.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot
|
||||
$(CC) -c src/rlgl.c -o temp/obj/rlgl.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot -DGRAPHICS_API_OPENGL_ES2
|
||||
$(CC) -c src/utils.c -o temp/obj/utils.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot
|
||||
$(CC) -c src/game_crash.c -o temp/obj/game_crash.o $(INCLUDES) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot
|
||||
$(CC) -o lib/armeabi-v7a/lib$(LIBRARY_NAME).so temp/obj/game_crash.o temp/obj/core.o temp/obj/rlgl.o temp/obj/utils.o -shared $(INCLUDES) $(LFLAGS) $(LIBS)
|
||||
|
||||
# Generate key for APK signing
|
||||
# OUTPUT: $(PROJECT_DIR)/temp/$(PROJECT_NAME).keystore
|
||||
gen_keystore:
|
||||
@ -125,7 +140,7 @@ project_class_dex:
|
||||
# NOTE: Use -A resources to define additional directory in which to find raw asset files
|
||||
project_apk:
|
||||
$(ANDROID_BUILD_TOOLS)/aapt package -v -f -M AndroidManifest.xml -S res -A assets -I $(ANDROID_HOME)/platforms/android-16/android.jar -F temp/bin/$(PROJECT_NAME).unsigned.apk temp/bin
|
||||
$(ANDROID_BUILD_TOOLS)/aapt add -v $(PROJECT_DIR)/temp/bin/$(PROJECT_NAME).unsigned.apk lib/armeabi-v7a/lib$(LIBRARY_NAME).so
|
||||
$(ANDROID_BUILD_TOOLS)/aapt add -v $(PROJECT_DIR)/temp/bin/$(PROJECT_NAME).unsigned.apk lib/armeabi-v7a/lib$(LIBRARY_NAME).so lib/armeabi-v7a/libopenal.so
|
||||
|
||||
# Create temp/bin/$(PROJECT_NAME).signed.apk
|
||||
apk_signing:
|
||||
@ -139,7 +154,7 @@ apk_zip_align:
|
||||
deploy:
|
||||
$(ANDROID_HOME)/platform-tools/adb install -r $(PROJECT_NAME).apk
|
||||
$(ANDROID_HOME)/platform-tools/adb logcat -c
|
||||
$(ANDROID_HOME)/platform-tools/adb logcat *:W
|
||||
$(ANDROID_HOME)/platform-tools/adb -d logcat raylib:V *:S
|
||||
|
||||
#$(ANDROID_HOME)/platform-tools/adb logcat *:W
|
||||
#$(ANDROID_HOME)/platform-tools/adb -d logcat raylib:V *:S
|
||||
|
||||
Reference in New Issue
Block a user