Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/HarbourMasters/Shipwright
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
Kenix3 committed Jul 14, 2022
1 parent 35528c8 commit 7011802
Show file tree
Hide file tree
Showing 45 changed files with 24,283 additions and 954 deletions.
50 changes: 45 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CXX ?= g++
CC ?= gcc
AR := ar
AR := ar
FORMAT := clang-format-11
UNAME := $(shell uname)

Expand All @@ -11,25 +11,53 @@ DEBUG ?= 1
OPTFLAGS ?= -O0
LTO ?= 0

# flag to save whether the compiler being used is clang or gcc by checking CXX --version
CXX_IS_CLANG ?= $(shell $(CXX) --version | grep -c clang)
ifeq ($(CXX_IS_CLANG),1)
MXX := $(CXX)
else
MXX ?= clang++
endif


WARN := -Wall -Wextra -Werror \
-Wno-unused-variable \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-parentheses \
-Wno-narrowing \
-Wno-error=stringop-overflow \
-Wno-missing-field-initializers \
-Wno-error=multichar
-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-error=maybe-uninitialized
CXXWARN := -Wno-deprecated-enum-enum-conversion -Wno-deprecated-copy

ifneq ($(CXX_IS_CLANG),1)
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

MMFLAGS := -Wno-deprecated-declarations -ObjC++ -fobjc-weak -fobjc-arc

# if not using clang, ask clang to use gcc standard library
ifneq ($(CXX_IS_CLANG),1)
STD_ISYSTEM=$(shell ${CXX} -xc++ -E -v - < /dev/null 2>&1 | grep "> search starts here" -A2 | tail -n 2 | head -n 1)
CXX_ISYSTEM=$(shell ${CXX} -xc++ -E -v - < /dev/null 2>&1 | grep "> search starts here" -A2 | tail -n 2 | tail -n 1)
MMFLAGS += -stdlib++-isystem ${STD_ISYSTEM} -cxx-isystem ${CXX_ISYSTEM}
endif

ifeq ($(UNAME), Darwin) #APPLE
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL -framework Foundation
endif

ifneq ($(DEBUG),0)
Expand All @@ -54,6 +82,7 @@ CXX_FILES := \
$(shell find libultraship/Lib/Fast3D -name "*.cpp") \
$(shell find libultraship -maxdepth 1 -name "*.cpp") \
$(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \
$(shell find libultraship/Lib/Mercury -maxdepth 1 -name "*.cpp") \
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
libultraship/Lib/StrHash64.cpp \
Expand All @@ -63,12 +92,19 @@ C_FILES := \
libultraship/mixer.c \
libultraship/Lib/stb/stb_impl.c

MM_FILES := \
libultraship/OSXFolderManager.mm

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)

ifeq ($(UNAME), Darwin) #APPLE
O_FILES += $(MM_FILES:%.mm=build/%.o)
endif

D_FILES := $(O_FILES:%.o=%.d)

LIB := libultraship.a
Expand All @@ -79,6 +115,7 @@ INC_DIRS := $(addprefix -I, \
libultraship/Lib/spdlog \
libultraship/Lib/spdlog/include \
libultraship/Lib/ImGui \
libultraship/Lib/Mercury \
libultraship \
../StormLib/src \
)
Expand All @@ -102,6 +139,9 @@ build/%.o: %.cpp
build/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@

build/%.o: %.mm
$(MXX) $(MMFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@

$(LIB): $(O_FILES)
$(AR) rcs $@ $^

Expand Down
164 changes: 0 additions & 164 deletions libultraship/ConfigFile.cpp

This file was deleted.

42 changes: 0 additions & 42 deletions libultraship/ConfigFile.h

This file was deleted.

6 changes: 3 additions & 3 deletions libultraship/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static bool ClearCommand(const std::vector<std::string>&) {

std::string toLowerCase(std::string in) {
std::string cpy(in);
std::ranges::transform(cpy, cpy.begin(), [](unsigned char c) { return std::tolower(c); });
std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower);
return cpy;
}

Expand Down Expand Up @@ -204,11 +204,11 @@ void Console::Draw() {
for (int i = 0; i < static_cast<int>(channel.size()); i++) {
ConsoleLine line = channel[i];
if(!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue;
if(this->level_filter != NULLSTR && line.priority != (std::ranges::find(priority_filters, this->level_filter) - priority_filters.begin()) - 1) continue;
if(this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue;
std::string id = line.text + "##" + std::to_string(i);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
const bool is_selected = (this->selectedId == i) || std::ranges::find(this->selectedEntries, i) != this->selectedEntries.end();
const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end();
ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]);
if (ImGui::Selectable(id.c_str(), is_selected)) {
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected)
Expand Down
Loading

0 comments on commit 7011802

Please sign in to comment.