mirror of
https://github.com/fmtlib/fmt.git
synced 2024-09-02 13:09:38 +00:00
Move source files to the src directory
This commit is contained in:
parent
7971ed3db3
commit
3da71d51e0
@ -95,12 +95,12 @@ function(add_headers VAR)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Define the fmt library, its includes and the needed defines.
|
# Define the fmt library, its includes and the needed defines.
|
||||||
# format.cc is added to FMT_HEADERS for the header-only configuration.
|
add_headers(FMT_HEADERS core.h format.h format-inl.h locale.h ostream.h printf.h
|
||||||
add_headers(FMT_HEADERS core.h format.h format.cc locale.h ostream.h printf.h
|
|
||||||
time.h)
|
time.h)
|
||||||
|
set(FMT_SOURCES src/format.cc)
|
||||||
if (HAVE_OPEN)
|
if (HAVE_OPEN)
|
||||||
add_headers(FMT_HEADERS posix.h)
|
add_headers(FMT_HEADERS posix.h)
|
||||||
add_headers(FMT_SOURCES posix.cc)
|
set(FMT_SOURCES ${FMT_SOURCES} src/posix.cc)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst)
|
add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst)
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
//
|
//
|
||||||
// For the license information refer to format.h.
|
// For the license information refer to format.h.
|
||||||
|
|
||||||
|
#ifndef FMT_FORMAT_INL_H_
|
||||||
|
#define FMT_FORMAT_INL_H_
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "locale.h"
|
#include "locale.h"
|
||||||
|
|
||||||
@ -69,7 +72,7 @@ inline fmt::internal::null<> strerror_s(char *, std::size_t, ...) {
|
|||||||
namespace fmt {
|
namespace fmt {
|
||||||
|
|
||||||
FMT_FUNC format_error::~format_error() throw() {}
|
FMT_FUNC format_error::~format_error() throw() {}
|
||||||
FMT_FUNC system_error::~system_error() throw() {}
|
FMT_FUNC system_error::~system_error() FMT_DTOR_NOEXCEPT {}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -438,47 +441,10 @@ FMT_FUNC void vprint_colored(color c, string_view format, format_args args) {
|
|||||||
|
|
||||||
FMT_FUNC locale locale_provider::locale() { return fmt::locale(); }
|
FMT_FUNC locale locale_provider::locale() { return fmt::locale(); }
|
||||||
|
|
||||||
#ifndef FMT_HEADER_ONLY
|
|
||||||
|
|
||||||
template struct internal::basic_data<void>;
|
|
||||||
|
|
||||||
// Explicit instantiations for char.
|
|
||||||
|
|
||||||
template char internal::thousands_sep(locale_provider *lp);
|
|
||||||
|
|
||||||
template void basic_fixed_buffer<char>::grow(std::size_t);
|
|
||||||
|
|
||||||
template void internal::arg_map<context>::init(
|
|
||||||
const basic_format_args<context> &args);
|
|
||||||
|
|
||||||
template FMT_API int internal::char_traits<char>::format_float(
|
|
||||||
char *buffer, std::size_t size, const char *format,
|
|
||||||
unsigned width, int precision, double value);
|
|
||||||
|
|
||||||
template FMT_API int internal::char_traits<char>::format_float(
|
|
||||||
char *buffer, std::size_t size, const char *format,
|
|
||||||
unsigned width, int precision, long double value);
|
|
||||||
|
|
||||||
// Explicit instantiations for wchar_t.
|
|
||||||
|
|
||||||
template wchar_t internal::thousands_sep(locale_provider *lp);
|
|
||||||
|
|
||||||
template void basic_fixed_buffer<wchar_t>::grow(std::size_t);
|
|
||||||
|
|
||||||
template void internal::arg_map<wcontext>::init(const wformat_args &args);
|
|
||||||
|
|
||||||
template FMT_API int internal::char_traits<wchar_t>::format_float(
|
|
||||||
wchar_t *buffer, std::size_t size, const wchar_t *format,
|
|
||||||
unsigned width, int precision, double value);
|
|
||||||
|
|
||||||
template FMT_API int internal::char_traits<wchar_t>::format_float(
|
|
||||||
wchar_t *buffer, std::size_t size, const wchar_t *format,
|
|
||||||
unsigned width, int precision, long double value);
|
|
||||||
|
|
||||||
#endif // FMT_HEADER_ONLY
|
|
||||||
|
|
||||||
} // namespace fmt
|
} // namespace fmt
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // FMT_FORMAT_INL_H_
|
@ -3546,7 +3546,7 @@ operator"" _a(const wchar_t *s, std::size_t) { return {s}; }
|
|||||||
|
|
||||||
#ifdef FMT_HEADER_ONLY
|
#ifdef FMT_HEADER_ONLY
|
||||||
# define FMT_FUNC inline
|
# define FMT_FUNC inline
|
||||||
# include "format.cc"
|
# include "format-inl.h"
|
||||||
#else
|
#else
|
||||||
# define FMT_FUNC
|
# define FMT_FUNC
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# define _CRT_SECURE_NO_WARNINGS
|
# define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "posix.h"
|
#include "fmt/posix.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
@ -73,7 +73,7 @@ function(add_fmt_test name)
|
|||||||
add_fmt_executable(${name} ${name}.cc ${ARGN})
|
add_fmt_executable(${name} ${name}.cc ${ARGN})
|
||||||
target_link_libraries(${name} test-main)
|
target_link_libraries(${name} test-main)
|
||||||
|
|
||||||
# define if certain c++ features can be used
|
# Define if certain C++ features can be used.
|
||||||
target_compile_definitions(${name} PRIVATE
|
target_compile_definitions(${name} PRIVATE
|
||||||
FMT_USE_TYPE_TRAITS=$<BOOL:${SUPPORTS_TYPE_TRAITS}>
|
FMT_USE_TYPE_TRAITS=$<BOOL:${SUPPORTS_TYPE_TRAITS}>
|
||||||
FMT_USE_ENUM_BASE=$<BOOL:${SUPPORTS_ENUM_BASE}>)
|
FMT_USE_ENUM_BASE=$<BOOL:${SUPPORTS_ENUM_BASE}>)
|
||||||
@ -101,7 +101,7 @@ endif ()
|
|||||||
|
|
||||||
if (HAVE_OPEN)
|
if (HAVE_OPEN)
|
||||||
add_fmt_executable(posix-mock-test
|
add_fmt_executable(posix-mock-test
|
||||||
posix-mock-test.cc ../include/fmt/format.cc ${TEST_MAIN_SRC})
|
posix-mock-test.cc ../src/format.cc ${TEST_MAIN_SRC})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
||||||
target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1)
|
target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1)
|
||||||
@ -124,7 +124,7 @@ endif ()
|
|||||||
# Test that the library can be compiled with exceptions disabled.
|
# Test that the library can be compiled with exceptions disabled.
|
||||||
check_cxx_compiler_flag(-fno-exceptions HAVE_FNO_EXCEPTIONS_FLAG)
|
check_cxx_compiler_flag(-fno-exceptions HAVE_FNO_EXCEPTIONS_FLAG)
|
||||||
if (HAVE_FNO_EXCEPTIONS_FLAG)
|
if (HAVE_FNO_EXCEPTIONS_FLAG)
|
||||||
add_library(noexception-test ../include/fmt/format.cc)
|
add_library(noexception-test ../src/format.cc)
|
||||||
target_compile_options(noexception-test PUBLIC ${CPP14_FLAG})
|
target_compile_options(noexception-test PUBLIC ${CPP14_FLAG})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
noexception-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
noexception-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
||||||
@ -134,7 +134,7 @@ endif ()
|
|||||||
if (FMT_PEDANTIC)
|
if (FMT_PEDANTIC)
|
||||||
# Test that the library compiles without windows.h.
|
# Test that the library compiles without windows.h.
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
add_library(no-windows-h-test ../include/fmt/format.cc)
|
add_library(no-windows-h-test ../src/format.cc)
|
||||||
target_compile_options(no-windows-h-test PUBLIC ${CPP14_FLAG})
|
target_compile_options(no-windows-h-test PUBLIC ${CPP14_FLAG})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
no-windows-h-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
no-windows-h-test PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "test-assert.h"
|
#include "test-assert.h"
|
||||||
|
|
||||||
// Include format.cc instead of format.h to test implementation.
|
// Include format.cc instead of format.h to test implementation.
|
||||||
#include "fmt/format.cc"
|
#include "../src/format.cc"
|
||||||
#include "fmt/printf.h"
|
#include "fmt/printf.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -1637,7 +1637,7 @@ TEST(FormatTest, OutputIterators) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FormatTest, OutputSize) {
|
TEST(FormatTest, OutputSize) {
|
||||||
EXPECT_EQ(2, fmt::count("{}", 42));
|
EXPECT_EQ(2u, fmt::count("{}", 42));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_USE_CONSTEXPR
|
#if FMT_USE_CONSTEXPR
|
||||||
@ -1974,3 +1974,4 @@ TEST(FormatTest, FormatStringErrors) {
|
|||||||
int, int);
|
int, int);
|
||||||
}
|
}
|
||||||
#endif // FMT_USE_CONSTEXPR
|
#endif // FMT_USE_CONSTEXPR
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
#include "posix-mock.h"
|
#include "posix-mock.h"
|
||||||
#include "fmt/posix.cc"
|
#include "../src/posix.cc"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user