Fix things building on linux again.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4486 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-10-04 23:38:42 +00:00
parent 31af27529e
commit ec83f9c747
2 changed files with 26 additions and 12 deletions

View File

@ -9,8 +9,13 @@ VERSION_NAME := Be nothing, and you will have everything to give to others.
PROJECT = tildefriends
BUILD_DIR ?= out
BUILD_TYPES := debug release windebug winrelease macosdebug macosrelease androiddebug androidrelease androiddebug-x86 androidrelease-x86 androiddebug-x86_64 androidrelease-x86_64 androiddebug-armv7a androidrelease-armv7a
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),Darwin)
BUILD_TYPES := macosdebug macosrelease
else
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86 androidrelease-x86 androiddebug-x86_64 androidrelease-x86_64 androiddebug-armv7a androidrelease-armv7a
endif
CFLAGS += \
-Wall \
@ -45,14 +50,19 @@ ANDROID_TARGETS := \
$(ANDROID_X86_64_TARGETS) \
$(ANDROID_ARMV7A_TARGETS) \
$(ANDROID_ARM64_TARGETS)
LINUX_TARGETS := \
out/debug/tildefriends \
out/release/tildefriends
WINDOWS_TARGETS := \
out/windebug/tildefriends.exe \
out/winrelease/tildefriends.exe
MACOS_TARGETS := \
out/macosdebug/tildefriends \
out/macosrelease/tildefriends
NONMACOS_TARGETS := $(filter-out $(MACOS_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS))
DEBUG_TARGETS := \
out/debug/tildefriends \
out/windebug/tildefriends \
out/windebug/tildefriends.exe \
out/macosdebug/tildefriends \
out/androiddebug/tildefriends \
out/androiddebug-armv7a/tildefriends \
@ -60,7 +70,7 @@ DEBUG_TARGETS := \
out/androiddebug-x86/tildefriends
RELEASE_TARGETS := \
out/release/tildefriends \
out/winrelease/tildefriends \
out/winrelease/tildefriends.exe \
out/macosrelease/tildefriends \
out/androidrelease/tildefriends \
out/androidrelease-armv7a/tildefriends \
@ -69,9 +79,10 @@ RELEASE_TARGETS := \
ANDROID_RELEASE_TARGETS := $(filter-out $(DEBUG_TARGETS),$(ANDROID_TARGETS))
NONANDROID_RELEASE_TARGETS := $(filter-out $(ANDROID_ARM64_TARGETS),$(RELEASE_TARGETS))
NONANDROID_TARGETS := $(filter-out $(ANDROID_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS))
NONMACOS_TARGETS := $(filter-out $(MACOS_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS))
$(NONANDROID_TARGETS): CFLAGS += -fno-omit-frame-pointer
$(NONANDROID_TARGETS): LDFLAGS += -rdynamic
$(filter-out $(ANDROID_TARGETS) $(WINDOWS_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS)): LDFLAGS += -rdynamic
$(ANDROID_TARGETS): CFLAGS += \
--sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot \
-fPIC \
@ -84,20 +95,18 @@ $(DEBUG_TARGETS): CFLAGS += -DDEBUG -Og
$(RELEASE_TARGETS): CFLAGS += -DNDEBUG
$(NONANDROID_RELEASE_TARGETS): CFLAGS += -O3
$(ANDROID_RELEASE_TARGETS): CFLAGS += -Os
windebug winrelease: CC = x86_64-w64-mingw32-gcc-win32
windebug winrelease: AS = $(CC)
windebug winrelease: CFLAGS += \
$(WINDOWS_TARGETS): CC = x86_64-w64-mingw32-gcc-win32
$(WINDOWS_TARGETS): AS = $(CC)
$(WINDOWS_TARGETS): CFLAGS += \
-D_WIN32_WINNT=0x0A00 \
-DWINVER=0x0A00 \
-DNTDDI_VERSION=NTDDI_WIN10 \
-Ideps/openssl/mingw64/include
windebug winrelease: LDFLAGS += \
$(WINDOWS_TARGETS): LDFLAGS += \
-static \
-lm \
-Ldeps/openssl/mingw64/lib
$(MACOS_TARGETS): CC = xcrun clang
$(NONMACOS_TARGETS): CFLAGS += -Wno-cast-function-type
$(NONMACOS_TARGETS): LDFLAGS += -Wl,--gc-sections
$(ANDROID_X86_64_TARGETS): ANDROID_NDK_TARGET_TRIPLE := x86_64-linux-android
$(ANDROID_X86_TARGETS): ANDROID_NDK_TARGET_TRIPLE := i686-linux-android
$(ANDROID_ARMV7A_TARGETS): ANDROID_NDK_TARGET_TRIPLE := armv7a-linux-androideabi
@ -116,6 +125,8 @@ $(ANDROID_X86_TARGETS): CFLAGS += -Wno-atomic-alignment
$(ANDROID_X86_TARGETS): LDFLAGS += -Ldeps/openssl/android/x86/usr/local/lib
$(ANDROID_X86_64_TARGETS): CFLAGS += -Ideps/openssl/android/x86_64/usr/local/include
$(ANDROID_X86_64_TARGETS): LDFLAGS += -Ldeps/openssl/android/x86_64/usr/local/lib
$(NONMACOS_TARGETS): CFLAGS += -Wno-cast-function-type
$(NONMACOS_TARGETS): LDFLAGS += -Wl,--gc-sections
ifeq ($(UNAME_M),x86_64)
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common

View File

@ -202,7 +202,10 @@ tf_mem_allocation_t* tf_mem_summarize_allocations(int* out_count)
qsort(summary.allocations, summary.count, sizeof(tf_mem_allocation_t), _tf_mem_size_compare);
*out_count = summary.count;
tf_mem_allocation_t* result = tf_malloc(sizeof(tf_mem_allocation_t) * summary.count);
memcpy(result, summary.allocations, sizeof(tf_mem_allocation_t) * summary.count);
if (result)
{
memcpy(result, summary.allocations, sizeof(tf_mem_allocation_t) * summary.count);
}
free(summary.allocations);
return result;
}