From 6fe70b3240a590037b3733f1e65121e4f5f5a1dc Mon Sep 17 00:00:00 2001 From: Per Malmberg Date: Thu, 22 Aug 2024 09:11:48 +0200 Subject: [PATCH] Macro fix for newer compiler on Linux (#10) * Macro fix for newer compiler on Linux * clang-tidy warnings on macOS --- CMakePresets.json | 21 ++++++++++++++++++++- src/LoutLogger.cpp | 3 +-- src/LoutLogger.h | 2 +- src/output/IOutput.cpp | 1 + vcpkg_triplets/x64-linux-static.cmake | 5 +++++ vcpkg_triplets/x86-linux-static.cmake | 6 ++++++ 6 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 vcpkg_triplets/x64-linux-static.cmake create mode 100644 vcpkg_triplets/x86-linux-static.cmake diff --git a/CMakePresets.json b/CMakePresets.json index e2636941..dbfa85f1 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -27,8 +27,8 @@ "build-type-release" ], "condition": { - "type": "equals", "lhs": "${hostSystemName}", + "type": "equals", "rhs": "Linux" }, "cacheVariables": { @@ -58,6 +58,25 @@ } } }, + { + "name": "x86-linux-static-dev", + "inherits": [ + "base-default", + "base-linux", + "base-dev", + "build-type-debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x86-linux-static", + "CMAKE_CXX_FLAGS": "-m32", + "CMAKE_C_FLAGS": "-m32" + } + }, { "name": "osx-static", "inherits": [ diff --git a/src/LoutLogger.cpp b/src/LoutLogger.cpp index 8df6eaf9..12b4b72d 100644 --- a/src/LoutLogger.cpp +++ b/src/LoutLogger.cpp @@ -8,7 +8,6 @@ #include "Lout.h" #include "item/ILogItem.h" #include "item/StringItem.h" -#include #include #include #include @@ -132,7 +131,7 @@ namespace lout // // ////////////////////////////////////////////////////////////////////////// -#if ULONG_MAX == (0xFFFFFFFFUL) || __APPLE__ +#if !__x86_64__ || __APPLE__ // Don't compile this on 64 bit platforms since it is the same as uint64_t LoutLogger& LoutLogger::operator<<(unsigned long value) { diff --git a/src/LoutLogger.h b/src/LoutLogger.h index a26cbc2b..5d4a06d1 100644 --- a/src/LoutLogger.h +++ b/src/LoutLogger.h @@ -53,7 +53,7 @@ namespace lout LoutLogger& operator<<(uint64_t value); -#if ULONG_MAX == (0xFFFFFFFFUL) || __APPLE__ +#if !__x86_64__ || __APPLE__ // Don't compile this on 64 bit platforms since it is the same as uint64_t LoutLogger& operator<<(unsigned long value); #endif diff --git a/src/output/IOutput.cpp b/src/output/IOutput.cpp index dca139ac..03e62470 100644 --- a/src/output/IOutput.cpp +++ b/src/output/IOutput.cpp @@ -7,6 +7,7 @@ #include "loglevel/ILogLevel.h" #include "output/IOutput.h" #include +#include namespace lout::output { diff --git a/vcpkg_triplets/x64-linux-static.cmake b/vcpkg_triplets/x64-linux-static.cmake new file mode 100644 index 00000000..e17b46a9 --- /dev/null +++ b/vcpkg_triplets/x64-linux-static.cmake @@ -0,0 +1,5 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) diff --git a/vcpkg_triplets/x86-linux-static.cmake b/vcpkg_triplets/x86-linux-static.cmake new file mode 100644 index 00000000..9a1714ae --- /dev/null +++ b/vcpkg_triplets/x86-linux-static.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) +