mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-03 00:38:58 +00:00
Enable C++20 and re-enable MSVC build
Also switched to standard-conforming __VA_OPT__ for logging.
This commit is contained in:
+12
-4
@@ -1,5 +1,9 @@
|
|||||||
# CMake 3.8 required for 17 to be a valid value for CXX_STANDARD
|
# CMake 3.12.4 required for 20 to be a valid value for CXX_STANDARD
|
||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
# Add MSVC runtime library selection flags automatically:
|
||||||
|
cmake_policy(SET CMP0091 OLD)
|
||||||
|
# Don't override the warning flags in MSVC:
|
||||||
|
cmake_policy(SET CMP0092 NEW)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
||||||
include(DownloadExternals)
|
include(DownloadExternals)
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
@@ -73,8 +77,12 @@ message(STATUS "Target architecture: ${ARCHITECTURE}")
|
|||||||
|
|
||||||
# Configure C++ standard
|
# Configure C++ standard
|
||||||
# ===========================
|
# ===========================
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
if (MSVC)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
add_compile_options(/std:c++latest)
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# set up output paths for executable binaries
|
# set up output paths for executable binaries
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
+2
-2
@@ -10,7 +10,7 @@ environment:
|
|||||||
CHERE_INVOKING: 1
|
CHERE_INVOKING: 1
|
||||||
matrix:
|
matrix:
|
||||||
- BUILD_TYPE: mingw
|
- BUILD_TYPE: mingw
|
||||||
# - BUILD_TYPE: msvc
|
- BUILD_TYPE: msvc
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- x64
|
- x64
|
||||||
@@ -37,7 +37,7 @@ before_build:
|
|||||||
- ps: |
|
- ps: |
|
||||||
if ($env:BUILD_TYPE -eq 'msvc') {
|
if ($env:BUILD_TYPE -eq 'msvc') {
|
||||||
# redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
|
# redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
|
||||||
cmd /C 'cmake -G "Visual Studio 16 2019" -DUSE_BUNDLED_QT=OFF -DQt5_DIR=C:\Qt\5.14\msvc2017_64\lib\cmake\qt5 -DWARNINGS_AS_ERRORS=OFF - .. 2>&1 && exit 0'
|
cmd /C 'cmake -G "Visual Studio 16 2019" -DUSE_BUNDLED_QT=OFF -DQt5_DIR=C:\Qt\5.14\msvc2017_64\lib\cmake\qt5 -DWARNINGS_AS_ERRORS=OFF .. 2>&1 && exit 0'
|
||||||
} else {
|
} else {
|
||||||
C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release -DMINGW_STATIC_BUILD=ON -DCOMPILE_WITH_DWARF=OFF .. 2>&1"
|
C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release -DMINGW_STATIC_BUILD=ON -DCOMPILE_WITH_DWARF=OFF .. 2>&1"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ if (MSVC)
|
|||||||
# /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates
|
# /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates
|
||||||
# /Zc:inline - Let codegen omit inline functions in object files
|
# /Zc:inline - Let codegen omit inline functions in object files
|
||||||
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
|
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
|
||||||
# /experimental:preprocessor - Work around bugs within MSVC's crappy preprocessor
|
# /Zc:preprocessor - Use std-conforming MSVC preprocessor
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
/W4
|
/W4
|
||||||
/w34263
|
/w34263
|
||||||
@@ -60,7 +60,7 @@ if (MSVC)
|
|||||||
/Zc:externConstexpr
|
/Zc:externConstexpr
|
||||||
/Zc:inline
|
/Zc:inline
|
||||||
/Zc:throwingNew
|
/Zc:throwingNew
|
||||||
/experimental:preprocessor
|
/Zc:preprocessor
|
||||||
)
|
)
|
||||||
|
|
||||||
# /GS- - No stack buffer overflow checks
|
# /GS- - No stack buffer overflow checks
|
||||||
|
|||||||
@@ -15,12 +15,11 @@
|
|||||||
std::uint64_t GetLoggingTime();
|
std::uint64_t GetLoggingTime();
|
||||||
std::string StandardizeLogClass(const std::string& log_class);
|
std::string StandardizeLogClass(const std::string& log_class);
|
||||||
|
|
||||||
// TODO: Use a standard variant of ##__VA_ARGS__?
|
|
||||||
#define LOG_PRINT(log_class, level, text_style, file, line, func, format, ...) \
|
#define LOG_PRINT(log_class, level, text_style, file, line, func, format, ...) \
|
||||||
{ \
|
{ \
|
||||||
fmt::print(stderr, text_style, "[{:12.6f}] {} <{}> {}:{}:{}: " format "\n", \
|
fmt::print(stderr, text_style, "[{:12.6f}] {} <{}> {}:{}:{}: " format "\n", \
|
||||||
GetLoggingTime() / 1000000.0, StandardizeLogClass(log_class), level, file, \
|
GetLoggingTime() / 1000000.0, StandardizeLogClass(log_class), level, file, \
|
||||||
line, func, ##__VA_ARGS__); \
|
line, func __VA_OPT__(, ) __VA_ARGS__); \
|
||||||
fflush(stderr); \
|
fflush(stderr); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ struct ArchiveFormatInfo {
|
|||||||
u32_le number_files; ///< The pre-defined number of files in the archive.
|
u32_le number_files; ///< The pre-defined number of files in the archive.
|
||||||
u8 duplicate_data; ///< Whether the archive should duplicate the data.
|
u8 duplicate_data; ///< Whether the archive should duplicate the data.
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD");
|
static_assert(std::is_standard_layout_v<ArchiveFormatInfo> && std::is_trivial_v<ArchiveFormatInfo>,
|
||||||
|
"ArchiveFormatInfo is not POD");
|
||||||
|
|
||||||
union TableOffset {
|
union TableOffset {
|
||||||
// This has different meanings for different savegame layouts
|
// This has different meanings for different savegame layouts
|
||||||
|
|||||||
Reference in New Issue
Block a user