Skip to content

Commit

Permalink
Android build fixes, incomplete.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanvb committed Feb 3, 2025
1 parent b0b1e07 commit 461537a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.dir-locals.el
/build/
/obj/
/etc/b2_tests/[Zz]/
/dependencies/ProcessorTests/
*.etl
Expand Down
21 changes: 21 additions & 0 deletions jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
LOCAL_PATH := $(call my-dir)

CORE_DIR := $(LOCAL_PATH)/../src

include $(CORE_DIR)/libretro/Makefile.common

COREFLAGS := -D__LIBRETRO__ -DB2_LIBRETRO_CORE -DHAVE_STRLCPY -DBUILD_TYPE_Final -DBBCMICRO_TRACE $(INCFLAGS)

GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif

include $(CLEAR_VARS)
LOCAL_MODULE := retro
LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_CPP)
LOCAL_CXXFLAGS := $(COREFLAGS) -fexceptions -frtti -std=c++17
LOCAL_CFLAGS := $(COREFLAGS)
LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
2 changes: 2 additions & 0 deletions jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_STL := c++_static
APP_ABI := all
5 changes: 2 additions & 3 deletions src/libretro/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ SOURCES_CPP := \
$(CORE_DIR)/beeb/src/TVOutput.cpp \
$(CORE_DIR)/beeb/src/type.cpp \
$(CORE_DIR)/beeb/src/video.cpp \
$(CORE_DIR)/beeb/src/uef.cpp \
$(CORE_DIR)/beeb/src/VideoULA.cpp \
$(CORE_DIR)/shared/c/log.cpp \
$(CORE_DIR)/shared/c/system.cpp \
Expand All @@ -52,10 +53,8 @@ SOURCES_CPP := \

SOURCES_C := \
$(CORE_DIR)/6502/c/6502.c \
$(CORE_DIR)/shared/c/path.c \


ifneq (,$(filter osx ios-arm64 tvos-arm64,$(platform)))
ifneq (,$(findstring osx,$(platform)))
SOURCES_CPP += \
$(CORE_DIR)/shared/c/system_osx.cpp \

Expand Down
5 changes: 5 additions & 0 deletions src/link.T
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
global: retro_*;
local: *;
};

5 changes: 4 additions & 1 deletion src/shared/c/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void LogStackTrace(Log *log) {
if (!log) {
return;
}

#if !defined(ANDROID)
void *buffer[100];
int n = backtrace(buffer, sizeof buffer / sizeof buffer[0]);

Expand Down Expand Up @@ -699,6 +699,9 @@ void LogStackTrace(Log *log) {

free(symbols);
symbols = NULL;
#else
log->f("Stack trace not supported on Android");
#endif
}

//////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion src/shared/h/shared/system_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ extern "C" {
* system_windows.h, and it's certainly convenient. */
#include <signal.h>
#include <unistd.h>
#if !defined(ANDROID)
#include <execinfo.h>

#endif
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit 461537a

Please sign in to comment.