forked from cory/tildefriends
Compile for android. Probably needs a bunch of work to run, but it's a step in a direction.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4087 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
94d7d2e3e0
commit
d9aee6d05f
31
Makefile
31
Makefile
@ -5,7 +5,7 @@ MAKEFLAGS += --no-builtin-rules
|
|||||||
|
|
||||||
PROJECT = tildefriends
|
PROJECT = tildefriends
|
||||||
BUILD_DIR ?= out
|
BUILD_DIR ?= out
|
||||||
BUILD_TYPES := debug release windebug winrelease
|
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease
|
||||||
UNAME_M := $(shell uname -m)
|
UNAME_M := $(shell uname -m)
|
||||||
|
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
@ -20,13 +20,27 @@ CFLAGS += \
|
|||||||
-g
|
-g
|
||||||
LDFLAGS += -Wl,-gc-sections
|
LDFLAGS += -Wl,-gc-sections
|
||||||
|
|
||||||
debug windebug: CFLAGS += -Og
|
NDK_PATH := /usr/lib/android-sdk/ndk-bundle
|
||||||
debug release: LDFLAGS += -rdynamic
|
NDK_SSL_PATH := deps/openssl_android
|
||||||
|
NDK_API_VERSION := 30
|
||||||
|
NDK_TARGET_TRIPLE := aarch64-linux-android
|
||||||
|
|
||||||
|
debug windebug androiddebug: CFLAGS += -Og
|
||||||
|
debug release androidrelease: LDFLAGS += -rdynamic
|
||||||
release winrelease: CFLAGS += -DNDEBUG -O3
|
release winrelease: CFLAGS += -DNDEBUG -O3
|
||||||
windebug winrelease: CC = i686-w64-mingw32-gcc-win32
|
windebug winrelease: CC = i686-w64-mingw32-gcc-win32
|
||||||
windebug winrelease: AS = $(CC)
|
windebug winrelease: AS = $(CC)
|
||||||
windebug winrelease: CFLAGS += -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNTDDI_VERSION=NTDDI_WIN10
|
windebug winrelease: CFLAGS += -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNTDDI_VERSION=NTDDI_WIN10
|
||||||
windebug winrelease: LDFLAGS += -static
|
windebug winrelease: LDFLAGS += -static
|
||||||
|
androiddebug androidrelease: CC = $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
|
||||||
|
androiddebug androidrelease: AS = $(CC)
|
||||||
|
androiddebug androidrelease: CFLAGS += \
|
||||||
|
-target $(NDK_TARGET_TRIPLE)$(NDK_API_VERSION) \
|
||||||
|
-I$(NDK_SSL_PATH)/arm64-v8a/usr/local/include \
|
||||||
|
-Wno-unknown-warning-option
|
||||||
|
androiddebug androidrelease: LDFLAGS += \
|
||||||
|
-target $(NDK_TARGET_TRIPLE)$(NDK_API_VERSION) \
|
||||||
|
-L$(NDK_SSL_PATH)/arm64-v8a/usr/local/lib
|
||||||
|
|
||||||
ifeq ($(UNAME_M),x86_64)
|
ifeq ($(UNAME_M),x86_64)
|
||||||
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
|
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
|
||||||
@ -36,7 +50,9 @@ endif
|
|||||||
get_objs = \
|
get_objs = \
|
||||||
$(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
|
$(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
|
||||||
$(foreach build_type,debug release,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix))))) \
|
$(foreach build_type,debug release,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix))))) \
|
||||||
$(foreach build_type,windebug winrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_win)))))
|
$(foreach build_type,windebug winrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_win))))) \
|
||||||
|
$(foreach build_type,androiddebug androidrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_android))))) \
|
||||||
|
$(foreach build_type,androiddebug androidrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix)))))
|
||||||
|
|
||||||
APP_SOURCES := $(wildcard src/*.c)
|
APP_SOURCES := $(wildcard src/*.c)
|
||||||
APP_OBJS := $(call get_objs,APP_SOURCES)
|
APP_OBJS := $(call get_objs,APP_SOURCES)
|
||||||
@ -105,6 +121,9 @@ UV_SOURCES_unix := \
|
|||||||
deps/libuv/src/unix/thread.c \
|
deps/libuv/src/unix/thread.c \
|
||||||
deps/libuv/src/unix/tty.c \
|
deps/libuv/src/unix/tty.c \
|
||||||
deps/libuv/src/unix/udp.c
|
deps/libuv/src/unix/udp.c
|
||||||
|
UV_SOURCES_android := \
|
||||||
|
deps/libuv/src/unix/pthread-fixes.c \
|
||||||
|
deps/libuv/src/unix/random-getentropy.c
|
||||||
UV_SOURCES_win := \
|
UV_SOURCES_win := \
|
||||||
deps/libuv/src/win/async.c \
|
deps/libuv/src/win/async.c \
|
||||||
deps/libuv/src/win/core.c \
|
deps/libuv/src/win/core.c \
|
||||||
@ -282,6 +301,10 @@ windebug winrelease: LDFLAGS += \
|
|||||||
-lkernel32 \
|
-lkernel32 \
|
||||||
-liphlpapi \
|
-liphlpapi \
|
||||||
-luserenv
|
-luserenv
|
||||||
|
androiddebug androidrelease: LDFLAGS += \
|
||||||
|
-ldl \
|
||||||
|
-lssl \
|
||||||
|
-lcrypto
|
||||||
|
|
||||||
unix: debug release
|
unix: debug release
|
||||||
win: windebug winrelease
|
win: windebug winrelease
|
||||||
|
@ -29,7 +29,9 @@
|
|||||||
#include <backtrace.h>
|
#include <backtrace.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
#ifndef __ANDROID__
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1147,7 +1149,7 @@ JSValue tf_task_allocate_promise(tf_task_t* task, promiseid_t* out_promise)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
count = CaptureStackBackTrace(0, sizeof(buffer) / sizeof(*buffer), buffer, NULL);
|
count = CaptureStackBackTrace(0, sizeof(buffer) / sizeof(*buffer), buffer, NULL);
|
||||||
stack_hash = fnv32a((const void*)buffer, sizeof(void*) * count, stack_hash);
|
stack_hash = fnv32a((const void*)buffer, sizeof(void*) * count, stack_hash);
|
||||||
#else
|
#elif !defined(__ANDROID__)
|
||||||
count = backtrace(buffer, sizeof(buffer) / sizeof(*buffer));
|
count = backtrace(buffer, sizeof(buffer) / sizeof(*buffer));
|
||||||
stack_hash = fnv32a((const void*)buffer, sizeof(void*) * count, stack_hash);
|
stack_hash = fnv32a((const void*)buffer, sizeof(void*) * count, stack_hash);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user