Some reviews for Android compilation
This commit is contained in:
parent
231a69417a
commit
d90a33b850
3 changed files with 16 additions and 24 deletions
14
src/Makefile
14
src/Makefile
|
@ -262,15 +262,20 @@ endif
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
|
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
|
||||||
# -Werror=implicit-function-declaration catch function calls without prior declaration
|
CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith
|
||||||
CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith -Werror=implicit-function-declaration
|
|
||||||
|
|
||||||
ifeq ($(RAYLIB_BUILD_MODE), DEBUG)
|
ifeq ($(RAYLIB_BUILD_MODE), DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
# -Wextra enables some extra warning flags that are not enabled by -Wall
|
||||||
|
# -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration
|
||||||
|
# -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types
|
||||||
|
# -Werror=implicit-function-declaration catch function calls without prior declaration
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
CFLAGS += -Werror=implicit-function-declaration
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# -O2 # if used, also set --memory-init-file 0
|
# -O2 # if used, also set --memory-init-file 0
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
|
@ -285,7 +290,8 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||||
# Compilation functions attributes options
|
# Compilation functions attributes options
|
||||||
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
|
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
|
||||||
# Compiler options for the linker
|
# Compiler options for the linker
|
||||||
CFLAGS += -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes
|
# -Werror=format-security
|
||||||
|
CFLAGS += -Wa,--noexecstack -Wformat -no-canonical-prefixes
|
||||||
# Preprocessor macro definitions
|
# Preprocessor macro definitions
|
||||||
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16
|
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -294,11 +294,11 @@ static int renderOffsetX = 0; // Offset X from render area (must b
|
||||||
static int renderOffsetY = 0; // Offset Y from render area (must be divided by 2)
|
static int renderOffsetY = 0; // Offset Y from render area (must be divided by 2)
|
||||||
static bool fullscreen = false; // Fullscreen mode (useful only for PLATFORM_DESKTOP)
|
static bool fullscreen = false; // Fullscreen mode (useful only for PLATFORM_DESKTOP)
|
||||||
static Matrix downscaleView; // Matrix to downscale view (in case screen size bigger than display size)
|
static Matrix downscaleView; // Matrix to downscale view (in case screen size bigger than display size)
|
||||||
|
static bool cursorHidden = false; // Track if cursor is hidden
|
||||||
|
static bool cursorOnScreen = false; // Tracks if cursor is inside client area
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB) || defined(PLATFORM_UWP)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB) || defined(PLATFORM_UWP)
|
||||||
static const char *windowTitle = NULL; // Window text title...
|
static const char *windowTitle = NULL; // Window text title...
|
||||||
static bool cursorHidden = false; // Track if cursor is hidden
|
|
||||||
static bool cursorOnScreen = false; // Tracks if cursor is inside client area
|
|
||||||
static int screenshotCounter = 0; // Screenshots counter
|
static int screenshotCounter = 0; // Screenshots counter
|
||||||
|
|
||||||
// Register mouse states
|
// Register mouse states
|
||||||
|
|
|
@ -53,26 +53,21 @@ APP_COMPANY_NAME ?= raylib
|
||||||
APP_PRODUCT_NAME ?= rgame
|
APP_PRODUCT_NAME ?= rgame
|
||||||
APP_VERSION_CODE ?= 1
|
APP_VERSION_CODE ?= 1
|
||||||
APP_VERSION_NAME ?= 1.0
|
APP_VERSION_NAME ?= 1.0
|
||||||
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\logo36x36.png
|
APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png
|
||||||
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\logo48x48.png
|
APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png
|
||||||
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\logo72x72.png
|
APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png
|
||||||
APP_SCREEN_ORIENTATION ?= landscape
|
APP_SCREEN_ORIENTATION ?= landscape
|
||||||
APP_KEYSTORE_PASS ?= raylib
|
APP_KEYSTORE_PASS ?= raylib
|
||||||
|
|
||||||
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll)
|
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
||||||
RAYLIB_LIBTYPE ?= STATIC
|
RAYLIB_LIBTYPE ?= STATIC
|
||||||
OPENAL_LIBTYPE ?= STATIC
|
|
||||||
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
|
RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
|
||||||
OPENAL_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\armeabi-v7a
|
|
||||||
|
|
||||||
# Shared libs must be added to APK if required
|
# Shared libs must be added to APK if required
|
||||||
# NOTE: Generated NativeLoader.java automatically load those libraries
|
# NOTE: Generated NativeLoader.java automatically load those libraries
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
|
PROJECT_SHARED_LIBS = lib/armeabi-v7a/libraylib.so
|
||||||
endif
|
endif
|
||||||
ifeq ($(OPENAL_LIBTYPE),SHARED)
|
|
||||||
PROJECT_SHARED_LIBS += lib/armeabi-v7a/libopenal.so
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Compiler and archiver
|
# Compiler and archiver
|
||||||
# NOTE: GCC is being deprectated in Android NDK r16
|
# NOTE: GCC is being deprectated in Android NDK r16
|
||||||
|
@ -154,15 +149,9 @@ copy_project_required_libs:
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
|
copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.so
|
||||||
endif
|
endif
|
||||||
ifeq ($(OPENAL_LIBTYPE),SHARED)
|
|
||||||
copy /Y $(OPENAL_LIB_PATH)\libopenal.so $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.so
|
|
||||||
endif
|
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
|
copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libraylib.a
|
||||||
endif
|
endif
|
||||||
ifeq ($(OPENAL_LIBTYPE),STATIC)
|
|
||||||
copy /Y $(OPENAL_LIB_PATH)\libopenal.a $(PROJECT_BUILD_PATH)\lib\armeabi-v7a\libopenal.a
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Copy project required resources: strings.xml, icon.png, assets
|
# Copy project required resources: strings.xml, icon.png, assets
|
||||||
# NOTE: Required strings.xml is generated and game resources are copied to assets folder
|
# NOTE: Required strings.xml is generated and game resources are copied to assets folder
|
||||||
|
@ -182,9 +171,6 @@ generate_loader_script:
|
||||||
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
@echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||||
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
@echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||||
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
@echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||||
ifeq ($(OPENAL_LIBTYPE),SHARED)
|
|
||||||
@echo System.loadLibrary("openal"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
|
||||||
endif
|
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
@echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue