From 0aeac841b8354806f1c455402edb0815dfe9729e Mon Sep 17 00:00:00 2001 From: Margen67 Date: Sat, 5 Jul 2025 01:34:05 -0700 Subject: [PATCH] Fix building with Clang 20 date: 3.0.4 tomlplusplus: Latest master as of writing since there's no stable release with the build fixes. --- premake5.lua | 16 ++++++++++++++++ src/xenia/base/console_app_main_posix.cc | 2 +- src/xenia/ui/windowed_app_main_posix.cc | 2 +- third_party/date | 2 +- third_party/tomlplusplus | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/premake5.lua b/premake5.lua index 623dbacd0..309f64e36 100644 --- a/premake5.lua +++ b/premake5.lua @@ -159,12 +159,28 @@ filter({"platforms:Linux", "language:C++", "toolset:clang"}) "deprecated-enum-enum-conversion", "attributes", }) +if os.istarget("linux") and string.contains(_OPTIONS["cc"], "clang") then + CLANG_BIN = os.getenv("CC") or _OPTIONS["cc"] + if tonumber(string.match(os.outputof(CLANG_BIN.." --version"), "version (%d%d)")) >= 20 then + filter({"platforms:Linux", "language:C++", "toolset:clang"}) + disablewarnings({ + "deprecated-literal-operator", -- Needed only for tabulate + "nontrivial-memcall", + }) + end +end + filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"}) buildoptions({ "-stdlib=libstdc++", "-std=c++20", -- clang doesn't respect cppdialect(?) }) +filter("files:third_party/tabulate/**") + defines({ + "USE_CPP17", + }) + filter("platforms:Android-*") system("android") systemversion("24") diff --git a/src/xenia/base/console_app_main_posix.cc b/src/xenia/base/console_app_main_posix.cc index f7eac087f..564b406d9 100644 --- a/src/xenia/base/console_app_main_posix.cc +++ b/src/xenia/base/console_app_main_posix.cc @@ -14,7 +14,7 @@ #include "xenia/base/cvar.h" #include "xenia/base/logging.h" -extern "C" int main(int argc, char** argv) { +int main(int argc, char** argv) { xe::ConsoleAppEntryInfo entry_info = xe::GetConsoleAppEntryInfo(); if (!entry_info.transparent_options) { diff --git a/src/xenia/ui/windowed_app_main_posix.cc b/src/xenia/ui/windowed_app_main_posix.cc index dc99e243d..3fdae15c9 100644 --- a/src/xenia/ui/windowed_app_main_posix.cc +++ b/src/xenia/ui/windowed_app_main_posix.cc @@ -17,7 +17,7 @@ #include "xenia/ui/windowed_app.h" #include "xenia/ui/windowed_app_context_gtk.h" -extern "C" int main(int argc_pre_gtk, char** argv_pre_gtk) { +int main(int argc_pre_gtk, char** argv_pre_gtk) { // Before touching anything GTK+, make sure that when running on Wayland, // we'll still get an X11 (Xwayland) window setenv("GDK_BACKEND", "x11", 1); diff --git a/third_party/date b/third_party/date index 5bdb7e6f3..f94b8f36c 160000 --- a/third_party/date +++ b/third_party/date @@ -1 +1 @@ -Subproject commit 5bdb7e6f31fac909c090a46dbd9fea27b6e609a4 +Subproject commit f94b8f36c6180be0021876c4a397a054fe50c6f2 diff --git a/third_party/tomlplusplus b/third_party/tomlplusplus index 30172438c..708fff700 160000 --- a/third_party/tomlplusplus +++ b/third_party/tomlplusplus @@ -1 +1 @@ -Subproject commit 30172438cee64926dc41fdd9c11fb3ba5b2ba9de +Subproject commit 708fff700f36ab3c2ab107b984ec9f3b8be5f055