mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-03-10 11:52:18 -07:00
* Fixed GeoLayout loading and implemented mario loading from otr * Ported bobomb and coins * Ported cannon barrel * Ported blue_coin_switch * Fixed collision loading * Ported checkerboard_platform * Ported most of common0 to otr * Fixed amp on jp * Fixed some wrong yamls * Fixed faulty snow interpolation * Bump LUS * Extracted 99.99999% actors to be loaded from otr * Removed unnessesary print and added o2r mod support * Fixed headers * Added us support into geolayout parser * Fixed conflicts * Removed done indicators * Remove duplicated headers * Added bbh, bitdw, bitfs, bits, bob and lll loaded from otr * Bump torch * Fixed linux compilation * Pushed header generation * Got compiling on Linux working. (#59) * Added more data and hopefully fix more issues * Updated libultraship * bin dls and vtxs (#60) * Fixed master volume * Updated torch * Renamed otr files * Renamed otr en cmakelists * Updated libultraship and torch * Removed actors code * [WIP] The big one that removes almost all hardcoded assets from levels and actors * Updating cmake to match Starship * Updated more references * Updated cmake to add more targets * Updated o2r name * Removed unnecesary dma call * Updated gitmodules * Bump LUS, fixed cmake and fixed audio on windows * Update torch and wdw * Fixed some corrupted ptrs, cleaned up jp support and fixed bully * Added USE_GBI_TRACE * Fixed packaging.cmake and audio fixes * Removed old LUS * Updated torch and readded LUS * More compilation issues * Removed interpolation to use on the future the new system * Bump libs * Reimplemented skybox, and added synthesis overflow fix * Removed prints to use SPDLOG * This should had been on another branch but fuck it * Added more interpolation stuff * Fixed interpolation, fixed some random things and ported from GameInteractor to Lwyx's EventSystem * Removed some FrameInterpolation changes * Fixed gitignore and implemented PortEnhancements * Fixed interpolation crashes, WIP implemented reset among other fixes * Bump torch to fix paintings * Moved log to be a trace * Readded some frame tagging * Fixed rumble * Fixed skybox crashes * Bump LUS * Moved skybox and floats to float for better precision * Moved to health change and created lives change event * Fixed bubbles being broken * Fixed lives event not being registered * Fixed skybox crashes * Initialized mixer variables * Fixed some memory leaks * Fixed trajectory being exported incorrectly * Hopefully fixed us yamls * Fixed remaining us issues * Implemented o2r generation among some other things --------- Co-authored-by: KiritoDv <KiritoDv> Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
215 lines
7.3 KiB
Makefile
215 lines
7.3 KiB
Makefile
# =============================================================================
|
|
# Cool Makefile for CMake Projects
|
|
# =============================================================================
|
|
#
|
|
# A Makefile that makes configuring and building CMake projects really simple.
|
|
|
|
|
|
# =============================================================================
|
|
# Functions
|
|
# =============================================================================
|
|
|
|
define to_lower_case
|
|
$(shell echo $(1) | tr '[:upper:]' '[:lower:]')
|
|
endef
|
|
|
|
define find_in_list
|
|
$(shell resolved_value=$$(for candidate in $(2); do \
|
|
if [ "$(call to_lower_case,$(1))" = "$$(echo $$candidate | tr '[:upper:]' '[:lower:]')" ]; then \
|
|
echo $$candidate; \
|
|
fi; \
|
|
done); \
|
|
echo "$${resolved_value:-$(1)}";)
|
|
endef
|
|
|
|
define exists_in_list
|
|
$(shell resolved_value=$$(for candidate in $(2); do \
|
|
if [ "$(call to_lower_case,$(1))" = "$$(echo $$candidate | tr '[:upper:]' '[:lower:]')" ]; then \
|
|
echo true; \
|
|
fi; \
|
|
done); \
|
|
echo "$${resolved_value:-false}";)
|
|
endef
|
|
|
|
# =============================================================================
|
|
# Variables
|
|
# =============================================================================
|
|
|
|
project_name:=?
|
|
project_lang:=?
|
|
type:=debug
|
|
generator:=$(shell if [ -x "$$(which ninja)" ]; then echo "Ninja"; else echo "Unix Makefiles"; fi)
|
|
build_path:=$(shell if [ "$(call to_lower_case,$(generator))" = "xcode" ]; then echo "xcode-build"; else echo "cmake-build-$(call to_lower_case,$(type))"; fi)
|
|
|
|
# =============================================================================
|
|
# Constants
|
|
# =============================================================================
|
|
|
|
override cores:=$(shell if [ "$$(uname)" = "Darwin" ]; then sysctl -n hw.ncpu; elif [ "$$(uname)" = "Linux" ]; then nproc --all; else echo 1; fi)
|
|
override valid_generators:="Unix Makefiles" "Ninja" "Xcode"
|
|
override valid_types:=Release Debug RelWithDebInfo MinSizeRel
|
|
override debug_types:=Debug RelWithDebInfo
|
|
|
|
override cmake_build_type_arg:=$(call find_in_list,$(type),$(valid_types))
|
|
override cmake_generator_arg:=$(call find_in_list,$(generator),$(valid_generators))
|
|
override is_debug:=$(call exists_in_list,$(type),$(debug_types))
|
|
|
|
# =============================================================================
|
|
# Utility targets
|
|
# =============================================================================
|
|
|
|
# All targets are phony in this Makefile
|
|
.PHONY : $(shell egrep "^[A-Za-z0-9_-]+\:([^\=]|$$)" $(lastword $(MAKEFILE_LIST)) | sed -E 's/(.*):.*/\1/g')
|
|
|
|
# Default target is build
|
|
all: build
|
|
|
|
#: Displays this message
|
|
help:
|
|
@echo "Usage:"
|
|
@echo
|
|
@echo " make type=<build type> generator=<generator> <target>"
|
|
@echo
|
|
@echo "Targets:"
|
|
@egrep -B1 "^[A-Za-z0-9_-]+\:([^\=]|$$)" $(lastword $(MAKEFILE_LIST)) \
|
|
| grep -v -- -- \
|
|
| sed 'N;s/\n/###/' \
|
|
| sed -n 's/^#: \(.*\)###\(.*\):.*/ \2###\1/p' \
|
|
| column -t -s '###'
|
|
|
|
#: List available build types
|
|
list-types:
|
|
@for type in $(valid_types); do echo $$type; done
|
|
|
|
#: List available generators
|
|
list-generators:
|
|
@for generator in $(valid_generators); do echo $$generator; done;
|
|
|
|
validate-type:
|
|
ifneq ($(cmake_build_type_arg),$(filter $(cmake_build_type_arg),$(valid_types)))
|
|
@echo "Invalid build type: $(cmake_build_type_arg). Valid types are:" >&2;
|
|
@for type in $(valid_types); do echo - $$type >&2; done
|
|
@exit 1;
|
|
else ifeq ($(strip $(cmake_build_type_arg)),)
|
|
@echo "Empty build type. Valid types are:" >&2;
|
|
@for type in $(valid_types); do echo - $$type >&2; done
|
|
@exit 1;
|
|
else
|
|
@:
|
|
endif
|
|
|
|
validate-generator:
|
|
ifneq ("$(cmake_generator_arg)",$(filter "$(cmake_generator_arg)",$(valid_generators)))
|
|
@echo "Unsupported generator: $(cmake_generator_arg). Valid generators are:" >&2;
|
|
@for generator in $(valid_generators); do echo - $$generator >&2; done;
|
|
@exit 1;
|
|
else ifeq ($(strip $(cmake_generator_arg)),)
|
|
@echo "Empty CMake generator. Valid generators are:" >&2;
|
|
@for generator in $(valid_generators); do echo - $$generator >&2; done;
|
|
@exit 1;
|
|
else
|
|
@:
|
|
endif
|
|
|
|
# =============================================================================
|
|
# Build targets
|
|
# =============================================================================
|
|
|
|
#: Delete the build path for the currently selected type and generator
|
|
clean: validate-type
|
|
@rm -rf "./$(build_path)";
|
|
|
|
#: Delete all build paths for all types and generators
|
|
clean-all:
|
|
@for generator in $(valid_generators); do \
|
|
for type in $(valid_types); do \
|
|
$(MAKE) generator="$$generator" type=$$type clean; \
|
|
done; \
|
|
done;
|
|
|
|
#: Initialise an empty CMake project
|
|
init:
|
|
@if [ ! -f CMakeLists.txt ]; then \
|
|
project_name=$(project_name); \
|
|
if [ "$$project_name" = "?" ]; then \
|
|
read -p "Enter project name: " project_name; \
|
|
fi; \
|
|
project_lang=$(project_lang); \
|
|
if [ "$$project_lang" = "?" ]; then \
|
|
read -p "Enter project language (c|cpp): " project_lang; \
|
|
fi; \
|
|
project_lang=$$(echo $$project_lang | tr '[:upper:]' '[:lower:]' | sed -E -e 's/^(c\+\+|cxx)$$/cpp/'); \
|
|
if [ "$$project_lang" = "c" ]; then \
|
|
echo "#include \"stdio.h\"\n\nint main() {\n\tprintf(\"%s\", \"hello, world!\");\n\treturn 0;\n}\n" >$$project_name.$$project_lang; \
|
|
elif [ "$$project_lang" = "cpp" ]; then \
|
|
echo "#include <iostream>\n\nint main() {\n\tstd::cout << \"hello, world!\" << std::endl;\n\treturn 0;\n}\n" >$$project_name.$$project_lang; \
|
|
else \
|
|
echo "Unsupported language type" >&2; \
|
|
exit 1; \
|
|
fi; \
|
|
echo "project($$project_name)\n\nadd_executable($$project_name $$project_name.$$project_lang)\n\n" >CMakeLists.txt; \
|
|
fi;
|
|
|
|
#: Configure the project for the selected type and generator
|
|
configure: validate-type validate-generator init
|
|
ifeq ($(cmake_generator_arg), Xcode)
|
|
@cmake -S . -B $(build_path) \
|
|
-G "$(cmake_generator_arg)";
|
|
else
|
|
@cmake -S . -B $(build_path) \
|
|
-DCMAKE_BUILD_TYPE=$(cmake_build_type_arg) \
|
|
-G "$(cmake_generator_arg)";
|
|
endif
|
|
|
|
#: Build the project for the selected type and generator
|
|
build: configure
|
|
ifeq ($(cmake_generator_arg), Xcode)
|
|
@cmake --build $(build_path) --config $(cmake_build_type_arg);
|
|
else
|
|
@cmake --build $(build_path) -- -j$(cores);
|
|
endif
|
|
|
|
#: Install the project for the selected type and generator
|
|
install: build
|
|
ifeq ($(cmake_generator_arg), Xcode)
|
|
@cmake --install $(build_path) --config $(cmake_build_type_arg);
|
|
else
|
|
@cmake --install $(build_path);
|
|
endif
|
|
|
|
#: Run the application
|
|
run: build
|
|
@app_name=$$(cmake -S . -B "$(build_path)" --trace 2>&1 \
|
|
| egrep -i add_executable \
|
|
| sort -r \
|
|
| head -n 1 \
|
|
| sed -E 's/.*add_executable.[[:space:]]*([A-Za-z0-9\\"_\.+-]+)[[:space:]].*/\1/'); \
|
|
if [ "$(call to_lower_case,$(generator))" = "xcode" ]; then \
|
|
cd $(build_path)/$(cmake_build_type_arg) && ./$$app_name; \
|
|
else \
|
|
cd $(build_path) && ./$$app_name; \
|
|
fi
|
|
@echo "\nProcessed finished with exit code $$?"
|
|
|
|
|
|
# =============================================================================
|
|
# Makefile debugging targets
|
|
# =============================================================================
|
|
|
|
list-variables:
|
|
@echo $(foreach \
|
|
v, \
|
|
$(.VARIABLES), \
|
|
$(if \
|
|
$(filter file, $(origin $(v))), \
|
|
\\n$(v)=$($(v)), \
|
|
$(if \
|
|
$(filter command line, $(origin $(v))), \
|
|
\\n$(v)=$($(v)), \
|
|
$(if \
|
|
$(filter override, $(origin $(v))), \
|
|
\\n$(v)=$($(v)))))) | egrep -v '^$$' | egrep -v '=\s*$$' | sort
|
|
|
|
list-targets:
|
|
@egrep "^[A-Za-z0-9_-]+\:([^\=]|$$)" $(lastword $(MAKEFILE_LIST)) | sed -E 's/(.*):.*/\1/g' | sort
|