Archived
1
0
Fork 0

Add support for building for MacOS dev machines

This commit is contained in:
Sebastian Benjamin 2025-03-17 11:29:27 -07:00
parent a0f27fe378
commit c41604e35b

View file

@ -1,13 +1,27 @@
.PHONY: all build_ffi build_godot run_server run_server_build test clean
# Configuration
ifeq ($(OS),Windows_NT)
DETECTED_OS = Windows
TARGET = x86_64-unknown-linux-musl
FFI_LIB = ffi-wrapper\target\$(TARGET)\release\libffi_wrapper.a
FFI_HEADER = ffi-wrapper\target\ffi-wrapper.h
GODOT_LIB = godot-extension\target\release\godot_extension.dll
SERVER_LIB_DIR = server\lib
PATH_SEP = \\
COPY = copy
MKDIR = if not exist "$(SERVER_LIB_DIR)" mkdir "$(SERVER_LIB_DIR)"
RMDIR = if exist "$(SERVER_LIB_DIR)" rmdir /s /q "$(SERVER_LIB_DIR)"
else
DETECTED_OS = POSIX
TARGET = aarch64-unknown-linux-musl
PATH_SEP = /
COPY = cp
MKDIR = mkdir -p "$(SERVER_LIB_DIR)"
RMDIR = rm -rf "$(SERVER_LIB_DIR)"
endif
# Default: Build everything and deploy with build
SERVER_LIB_DIR = server$(PATH_SEP)lib
FFI_LIB = ffi-wrapper$(PATH_SEP)target$(PATH_SEP)$(TARGET)$(PATH_SEP)release$(PATH_SEP)libffi_wrapper.a
FFI_HEADER = ffi-wrapper$(PATH_SEP)target$(PATH_SEP)ffi-wrapper.h
GODOT_LIB = godot-extension$(PATH_SEP)target$(PATH_SEP)release$(PATH_SEP)godot_extension.dll
# Default: Build everything and deploy server
all: build_ffi build_godot run_server_build
## Build Targets ##
@ -26,9 +40,9 @@ run_server:
cd server && docker compose up
run_server_build:
if not exist $(SERVER_LIB_DIR) mkdir $(SERVER_LIB_DIR)
copy $(FFI_LIB) $(SERVER_LIB_DIR)
copy $(FFI_HEADER) $(SERVER_LIB_DIR)
$(MKDIR)
$(COPY) $(FFI_LIB) $(SERVER_LIB_DIR)
$(COPY) $(FFI_HEADER) $(SERVER_LIB_DIR)
cd server && docker compose up --build
## Test Target ##
@ -44,4 +58,4 @@ clean:
cd shared && cargo clean
cd ffi-wrapper && cargo clean
cd godot-extension && cargo clean
if exist $(SERVER_LIB_DIR) rmdir /s /q $(SERVER_LIB_DIR)
$(RMDIR)