mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-01 13:52:19 -05:00
d4c1c40c1d
* hacks to align strings for clang... wow just wow
* start work to getting built with clang
* fix issues with struct constructors, all builds, doesn't link still
* fix some narrowing issues that clang complains about
* fix compliation of zapd
* fix null deref in VersionInfo
* builds with clang
* make stringbuilding use StringHelper instead of addition
* fix linking
* add CLANG SHIP overlay on clang built versions
* doesn't need to be volatile
* mark unknown strings as extern
* rename some stuff
* can't align extern
* hopefully fix compilation for everythign
* expandtab
* allow setting LD
* Revert "allow setting LD"
This reverts commit 711aba6db2
.
maybe to use lld it should be a LDFLAG?
* -Wno-deprecated-declarations is required for newer versions of clang
on macOS 13 beta sdk, the version of apple clang requires this
* Add jenkins support for clang
* Forward CXX flags to stormlib compilation
* Move GCC only flags to check
* use exports to set multiarch setup
* Fix Jenkins forever
* use make instead of cmake --build
add some flags to build with clang-11 as well
* address review coments
- rework extraction to allow multi thread
- misc readability cleanup
* update makefile to add WARN on linux+clang
Co-authored-by: David Chavez <david@dcvz.io>
124 lines
2.9 KiB
Makefile
124 lines
2.9 KiB
Makefile
# Only used for standalone compilation, usually inherits these from the main makefile
|
|
|
|
CXX ?= g++
|
|
CC ?= gcc
|
|
AR := ar
|
|
FORMAT := clang-format-11
|
|
UNAME := $(shell uname)
|
|
|
|
ASAN ?= 0
|
|
DEBUG ?= 1
|
|
OPTFLAGS ?= -O0
|
|
LTO ?= 0
|
|
|
|
WARN := -Wall -Wextra -Werror \
|
|
-Wno-unused-variable \
|
|
-Wno-unused-parameter \
|
|
-Wno-unused-function \
|
|
-Wno-parentheses \
|
|
-Wno-narrowing \
|
|
-Wno-missing-field-initializers \
|
|
-Wno-error=multichar \
|
|
-Wno-unused-command-line-argument \
|
|
-Wno-delete-non-abstract-non-virtual-dtor \
|
|
-Wno-unused-private-field \
|
|
-Wno-deprecated-copy-with-user-provided-copy \
|
|
-Wno-deprecated-declarations \
|
|
-Wno-unknown-warning-option
|
|
|
|
CWARN :=
|
|
CXXWARN := -Wno-deprecated-enum-enum-conversion -Wno-deprecated-copy
|
|
|
|
COMPILER_VERSION := $(shell $(CXX) --version)
|
|
ifneq '' '$(findstring g++,$(COMPILER_VERSION))'
|
|
WARN += -Wno-error=stringop-overflow
|
|
CXXWARN += -Wno-error=maybe-uninitialized
|
|
endif
|
|
|
|
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
|
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
|
|
CPPFLAGS := -MMD
|
|
|
|
ifeq ($(UNAME), Darwin) #APPLE
|
|
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL
|
|
endif
|
|
|
|
ifeq ($(UNAME), Linux)
|
|
WARN += -Wno-error=stringop-overflow # This is required with clang on Linux.
|
|
endif
|
|
|
|
ifneq ($(DEBUG),0)
|
|
CXXFLAGS += -g -D_DEBUG
|
|
CFLAGS += -g -D_DEBUG
|
|
endif
|
|
|
|
ifneq ($(ASAN),0)
|
|
CXXFLAGS += -fsanitize=address
|
|
CFLAGS += -fsanitize=address
|
|
endif
|
|
|
|
ifneq ($(LTO),0)
|
|
CXXFLAGS += -flto
|
|
CFLAGS += -flto
|
|
endif
|
|
|
|
SRC_DIRS := $(shell find . -type d -not -path "*build*")
|
|
|
|
CXX_FILES := \
|
|
$(shell find libultraship/Factories -name "*.cpp") \
|
|
$(shell find libultraship/Lib/Fast3D -name "*.cpp") \
|
|
$(shell find libultraship -maxdepth 1 -name "*.cpp") \
|
|
$(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \
|
|
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
|
|
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
|
|
libultraship/Lib/StrHash64.cpp \
|
|
libultraship/Lib/tinyxml2/tinyxml2.cpp
|
|
|
|
C_FILES := \
|
|
libultraship/mixer.c \
|
|
libultraship/Lib/stb/stb_impl.c
|
|
|
|
FMT_FILES := $(shell find libultraship/ -type f \( -name "*.cpp" -o -name "*.h" \) -a -not -path "libultraship/Lib/*")
|
|
|
|
O_FILES := \
|
|
$(CXX_FILES:%.cpp=build/%.o) \
|
|
$(C_FILES:%.c=build/%.o)
|
|
|
|
D_FILES := $(O_FILES:%.o=%.d)
|
|
|
|
LIB := libultraship.a
|
|
|
|
INC_DIRS := $(addprefix -I, \
|
|
../ZAPDTR/ZAPDUtils \
|
|
libultraship/Lib/Fast3D/U64 \
|
|
libultraship/Lib/spdlog \
|
|
libultraship/Lib/spdlog/include \
|
|
libultraship/Lib/ImGui \
|
|
libultraship \
|
|
../StormLib/src \
|
|
)
|
|
|
|
# create build directories
|
|
$(shell mkdir -p $(SRC_DIRS:%=build/%))
|
|
|
|
all: $(LIB)
|
|
|
|
clean:
|
|
rm -rf build $(LIB)
|
|
|
|
format:
|
|
$(FORMAT) -i $(FMT_FILES)
|
|
|
|
.PHONY: all clean format
|
|
|
|
build/%.o: %.cpp
|
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
|
|
|
|
build/%.o: %.c
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
|
|
|
|
$(LIB): $(O_FILES)
|
|
$(AR) rcs $@ $^
|
|
|
|
-include $(D_FILES)
|