diff --git a/CMakeLists.txt b/CMakeLists.txt index 50d7fbaf37..7312a63988 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,6 +260,7 @@ target_precompile_headers(openttd_lib src/stdafx.h src/core/format.hpp ) +set_source_files_properties(src/3rdparty/fmt/format.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON) add_subdirectory(${CMAKE_SOURCE_DIR}/bin) add_subdirectory(${CMAKE_SOURCE_DIR}/src) diff --git a/src/3rdparty/fmt/CMakeLists.txt b/src/3rdparty/fmt/CMakeLists.txt index e687b2b3d8..edc97e1fa3 100644 --- a/src/3rdparty/fmt/CMakeLists.txt +++ b/src/3rdparty/fmt/CMakeLists.txt @@ -1,6 +1,7 @@ add_files( chrono.h core.h + format.cc format.h format-inl.h ostream.h diff --git a/src/3rdparty/fmt/format.cc b/src/3rdparty/fmt/format.cc new file mode 100644 index 0000000000..d503fe1133 --- /dev/null +++ b/src/3rdparty/fmt/format.cc @@ -0,0 +1,43 @@ +// Formatting library for C++ +// +// Copyright (c) 2012 - 2016, Victor Zverovich +// All rights reserved. +// +// For the license information refer to format.h. + +#include "format-inl.h" + +FMT_BEGIN_NAMESPACE +namespace detail { + +template FMT_API auto dragonbox::to_decimal(float x) noexcept + -> dragonbox::decimal_fp; +template FMT_API auto dragonbox::to_decimal(double x) noexcept + -> dragonbox::decimal_fp; + +#ifndef FMT_STATIC_THOUSANDS_SEPARATOR +template FMT_API locale_ref::locale_ref(const std::locale& loc); +template FMT_API auto locale_ref::get() const -> std::locale; +#endif + +// Explicit instantiations for char. + +template FMT_API auto thousands_sep_impl(locale_ref) + -> thousands_sep_result; +template FMT_API auto decimal_point_impl(locale_ref) -> char; + +template FMT_API void buffer::append(const char*, const char*); + +template FMT_API void vformat_to(buffer&, string_view, + typename vformat_args<>::type, locale_ref); + +// Explicit instantiations for wchar_t. + +template FMT_API auto thousands_sep_impl(locale_ref) + -> thousands_sep_result; +template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; + +template FMT_API void buffer::append(const wchar_t*, const wchar_t*); + +} // namespace detail +FMT_END_NAMESPACE diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index dfb2bf6aca..1cc833add8 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -21,7 +21,11 @@ #include "table/strings.h" #if defined(WITH_ZLIB) -#include +# include +# if defined(_WIN32) + /* Required for: dup, fileno, close */ +# include +# endif #endif #ifdef __EMSCRIPTEN__ diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 9978497257..de1697107d 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -20,6 +20,7 @@ #include /* SHGetFolderPath */ #include #include +#include #include "win32.h" #include "../../fios.h" #include "../../core/alloc_func.hpp" diff --git a/src/settingsgen/CMakeLists.txt b/src/settingsgen/CMakeLists.txt index 91c8eca7c8..9e71393ed6 100644 --- a/src/settingsgen/CMakeLists.txt +++ b/src/settingsgen/CMakeLists.txt @@ -5,6 +5,7 @@ if (NOT HOST_BINARY_DIR) set(sourcefiles settingsgen.cpp + ../3rdparty/fmt/format.cc ../core/alloc_func.cpp ../misc/getoptdata.cpp ../error.cpp diff --git a/src/stdafx.h b/src/stdafx.h index bdfc049cb6..b689aeeb57 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -298,9 +298,6 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; # define GNU_TARGET(x) #endif /* __GNUC__ || __clang__ */ -/* For the FMT library we only want to use the headers, not link to some library. */ -#define FMT_HEADER_ONLY - [[noreturn]] void NOT_REACHED(const std::source_location location = std::source_location::current()); [[noreturn]] void AssertFailedError(const char *expression, const std::source_location location = std::source_location::current()); diff --git a/src/strgen/CMakeLists.txt b/src/strgen/CMakeLists.txt index 554a9db20a..40aff5556d 100644 --- a/src/strgen/CMakeLists.txt +++ b/src/strgen/CMakeLists.txt @@ -8,6 +8,7 @@ if (NOT HOST_BINARY_DIR) set(sourcefiles strgen.cpp strgen_base.cpp + ../3rdparty/fmt/format.cc ../core/alloc_func.cpp ../misc/getoptdata.cpp ../error.cpp