Externals: compile fmtlib as a library instead of using it with FMT_HEADER_ONLY

This commit is contained in:
Aras Pranckevicius 2023-05-30 11:17:23 +03:00
parent 122c48aed0
commit 0d38fa2422
10 changed files with 73 additions and 5 deletions

View File

@ -3,6 +3,7 @@
# Libs that adhere to strict flags
add_subdirectory(curve_fit_nd)
add_subdirectory(fmtlib)
# Otherwise we get warnings here that we cant fix in external projects
remove_strict_flags()

20
extern/fmtlib/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,20 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(INC
include
)
set(INC_SYS
)
set(SRC
include/fmt/core.h
include/fmt/format-inl.h
include/fmt/format.h
src/format.cc
)
set(LIB
)
blender_add_lib(extern_fmtlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@ -4,5 +4,9 @@ License: MIT
Upstream version: 10.0.0 (a0b8a92, 2023 May 10)
Local modifications:
- Took only files needed for Blender: LICENSE, README and include/fmt
folder's core.h, format-inl.h, format.h
- Took only files needed for Blender:
- LICENSE, README
- include/fmt: core.h, format-inl.h, format.h
- src/format.cc
- CMakeLists.txt is not from fmtlib, but
made for Blender codebase

43
extern/fmtlib/src/format.cc vendored Normal file
View File

@ -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 "fmt/format-inl.h"
FMT_BEGIN_NAMESPACE
namespace detail {
template FMT_API auto dragonbox::to_decimal(float x) noexcept
-> dragonbox::decimal_fp<float>;
template FMT_API auto dragonbox::to_decimal(double x) noexcept
-> dragonbox::decimal_fp<double>;
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
template FMT_API locale_ref::locale_ref(const std::locale& loc);
template FMT_API auto locale_ref::get<std::locale>() const -> std::locale;
#endif
// Explicit instantiations for char.
template FMT_API auto thousands_sep_impl(locale_ref)
-> thousands_sep_result<char>;
template FMT_API auto decimal_point_impl(locale_ref) -> char;
template FMT_API void buffer<char>::append(const char*, const char*);
template FMT_API void vformat_to(buffer<char>&, 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<wchar_t>;
template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t;
template FMT_API void buffer<wchar_t>::append(const wchar_t*, const wchar_t*);
} // namespace detail
FMT_END_NAMESPACE

View File

@ -49,6 +49,7 @@ set(SRC
set(LIB
bf_blenkernel
extern_fmtlib
)
if(WIN32)

View File

@ -34,7 +34,6 @@
#include "file_intern.h"
#include "filelist.h"
#define FMT_HEADER_ONLY
#include <fmt/format.h>
using namespace blender;

View File

@ -55,6 +55,7 @@ set(SRC
set(LIB
bf_blenkernel
bf_io_common
extern_fmtlib
)
blender_add_lib(bf_ply "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@ -16,7 +16,6 @@
/* SEP macro from BLI path utils clashes with SEP symbol in fmt headers. */
#undef SEP
#define FMT_HEADER_ONLY
#include <fmt/format.h>
namespace blender::io::ply {

View File

@ -58,6 +58,7 @@ set(SRC
set(LIB
bf_blenkernel
bf_io_common
extern_fmtlib
)
if(WITH_TBB)

View File

@ -17,7 +17,6 @@
/* SEP macro from BLI path utils clashes with SEP symbol in fmt headers. */
#undef SEP
#define FMT_HEADER_ONLY
#include <fmt/format.h>
namespace blender::io::obj {