mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-16 01:37:58 +00:00
Compare commits
8 Commits
98388d18de
...
6b4355b76f
Author | SHA1 | Date | |
---|---|---|---|
|
6b4355b76f | ||
|
90bd9692f5 | ||
|
8878185628 | ||
|
15066d1d37 | ||
|
abaae6e28b | ||
|
2170de8819 | ||
|
300ec667f6 | ||
|
348c4380d6 |
71
appveyor.yml
71
appveyor.yml
@ -2,37 +2,50 @@ version: 1.0.{build}
|
||||
image: Visual Studio 2017
|
||||
environment:
|
||||
matrix:
|
||||
- GENERATOR: '"Visual Studio 14 2015"'
|
||||
BUILD_TYPE: Debug
|
||||
WCHAR: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 14 2015"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'ON'
|
||||
- GENERATOR: '"Visual Studio 14 2015 Win64"'
|
||||
BUILD_TYPE: Debug
|
||||
WCHAR: 'ON'
|
||||
- GENERATOR: '"Visual Studio 14 2015 Win64"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'ON'
|
||||
- GENERATOR: '"Visual Studio 15 2017 Win64"'
|
||||
BUILD_TYPE: Debug
|
||||
WCHAR: 'ON'
|
||||
- GENERATOR: '"Visual Studio 15 2017 Win64"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'OFf'
|
||||
- GENERATOR: '"Visual Studio 14 2015"'
|
||||
BUILD_TYPE: Debug
|
||||
WCHAR: 'OFF'
|
||||
BUILD_SHARED: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 14 2015"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'ON'
|
||||
BUILD_SHARED: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 14 2015 Win64"'
|
||||
BUILD_TYPE: Debug
|
||||
WCHAR: 'ON'
|
||||
BUILD_SHARED: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 14 2015 Win64"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'ON'
|
||||
BUILD_SHARED: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 15 2017 Win64"'
|
||||
BUILD_TYPE: Debug
|
||||
WCHAR: 'ON'
|
||||
BUILD_SHARED: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 15 2017 Win64"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'OFF'
|
||||
BUILD_SHARED: 'OFF'
|
||||
- GENERATOR: '"Visual Studio 15 2017 Win64"'
|
||||
BUILD_TYPE: Release
|
||||
WCHAR: 'OFF'
|
||||
BUILD_SHARED: 'ON'
|
||||
build_script:
|
||||
- cmd: >-
|
||||
set
|
||||
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
- cmd: >-
|
||||
set
|
||||
|
||||
set PATH=%PATH%:C:\Program Files\Git\usr\bin
|
||||
|
||||
cmake .. -G %GENERATOR% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DSPDLOG_WCHAR_SUPPORT=%WCHAR% -DSPDLOG_BUILD_EXAMPLE=ON -DSPDLOG_BUILD_EXAMPLE_HO=ON -DSPDLOG_BUILD_TESTS=ON -DSPDLOG_BUILD_TESTS_HO=OFF -DSPDLOG_ENABLE_WARNINGS=ON
|
||||
mkdir build
|
||||
|
||||
cmake --build . --config %BUILD_TYPE%
|
||||
cd build
|
||||
|
||||
set PATH=%PATH%:C:\Program Files\Git\usr\bin
|
||||
|
||||
cmake .. -G %GENERATOR% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DSPDLOG_WCHAR_SUPPORT=%WCHAR% -DSPDLOG_BUILD_SHARED=%BUILD_SHARED% -DSPDLOG_BUILD_EXAMPLE=ON -DSPDLOG_BUILD_EXAMPLE_HO=ON -DSPDLOG_BUILD_TESTS=ON -DSPDLOG_BUILD_TESTS_HO=OFF -DSPDLOG_ENABLE_WARNINGS=ON
|
||||
|
||||
cmake --build . --config %BUILD_TYPE%
|
||||
|
||||
before_test:
|
||||
- set PATH=%PATH%:.\%BUILD_TYPE%
|
||||
|
||||
test_script:
|
||||
- ctest -VV -C "%BUILD_TYPE%"
|
||||
- ctest -VV -C "%BUILD_TYPE%"
|
||||
|
@ -23,15 +23,15 @@
|
||||
#else
|
||||
#define SPDLOG_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#else // !defined(_WIN32) || !defined(SPDLOG_SHARED_LIB)
|
||||
#define SPDLOG_API
|
||||
#endif
|
||||
#define SPDLOG_INLINE
|
||||
#else
|
||||
#else // !defined(SPDLOG_COMPILED_LIB)
|
||||
#define SPDLOG_API
|
||||
#define SPDLOG_HEADER_ONLY
|
||||
#define SPDLOG_INLINE inline
|
||||
#endif
|
||||
#endif // #ifdef SPDLOG_COMPILED_LIB
|
||||
|
||||
#include <spdlog/fmt/fmt.h>
|
||||
|
||||
@ -204,8 +204,8 @@ private:
|
||||
std::string msg_;
|
||||
};
|
||||
|
||||
void throw_spdlog_ex(const std::string &msg, int last_errno);
|
||||
void throw_spdlog_ex(std::string msg);
|
||||
SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno);
|
||||
SPDLOG_API void throw_spdlog_ex(std::string msg);
|
||||
|
||||
struct source_loc
|
||||
{
|
||||
|
184
meson.build
184
meson.build
@ -1,184 +0,0 @@
|
||||
project('spdlog', ['cpp'],
|
||||
license : 'MIT',
|
||||
version : run_command(find_program('scripts/extract_version.py')).stdout().strip(),
|
||||
default_options : [
|
||||
'warning_level=3',
|
||||
'cpp_std=c++11',
|
||||
'buildtype=release',
|
||||
'b_colorout=always',
|
||||
],
|
||||
)
|
||||
|
||||
# ------------------------
|
||||
# --- Dependencies ---
|
||||
# ------------------------
|
||||
dep_list = []
|
||||
compile_args = []
|
||||
|
||||
# Threads
|
||||
dep_list += dependency('threads')
|
||||
|
||||
# Check for FMT
|
||||
if get_option('external_fmt')
|
||||
if not meson.version().version_compare('>=0.49.0')
|
||||
warning('Finding fmt can fail with meson versions before 0.49.0')
|
||||
endif
|
||||
dep_list += dependency('fmt', fallback : ['fmt', 'fmt_dep'])
|
||||
compile_args += '-DSPDLOG_FMT_EXTERNAL'
|
||||
endif
|
||||
|
||||
if get_option('no_exceptions')
|
||||
compile_args += '-DSPDLOG_NO_EXCEPTIONS'
|
||||
endif
|
||||
|
||||
if get_option('wchar_support')
|
||||
if build_machine.system() != 'windows'
|
||||
error('wchar_support only supported under windows')
|
||||
endif
|
||||
compile_args += '-DSPDLOG_WCHAR_TO_UTF8_SUPPORT'
|
||||
endif
|
||||
|
||||
if get_option('wchar_filenames')
|
||||
if build_machine.system() != 'windows'
|
||||
error('wchar_filenames only supported under windows')
|
||||
endif
|
||||
compile_args += '-DSPDLOG_WCHAR_FILENAMES'
|
||||
endif
|
||||
|
||||
if get_option('clock_coarse')
|
||||
if build_machine.system() != 'linux'
|
||||
error('clock_coarse only supported under linux')
|
||||
endif
|
||||
compile_args += '-DSPDLOG_CLOCK_COARSE'
|
||||
endif
|
||||
|
||||
if get_option('prevent_child_fd')
|
||||
compile_args += '-DSPDLOG_PREVENT_CHILD_FD'
|
||||
endif
|
||||
|
||||
if get_option('no_thread_id')
|
||||
compile_args += '-DSPDLOG_NO_THREAD_ID'
|
||||
endif
|
||||
|
||||
if get_option('no_tls')
|
||||
compile_args += '-DSPDLOG_NO_TLS'
|
||||
endif
|
||||
|
||||
if get_option('no_atomic_levels')
|
||||
compile_args += '-DSPDLOG_NO_ATOMIC_LEVELS'
|
||||
endif
|
||||
|
||||
compile_args_compiled = compile_args + ['-DSPDLOG_COMPILED_LIB']
|
||||
compile_args_ho = compile_args
|
||||
|
||||
# ------------------------------------
|
||||
# --- Compiled library version ---
|
||||
# ------------------------------------
|
||||
|
||||
spdlog_inc = include_directories('./include')
|
||||
|
||||
spdlog_srcs = files([
|
||||
'src/async.cpp',
|
||||
'src/color_sinks.cpp',
|
||||
'src/file_sinks.cpp',
|
||||
'src/spdlog.cpp',
|
||||
'src/stdout_sinks.cpp',
|
||||
'src/cfg.cpp'
|
||||
])
|
||||
|
||||
if not get_option('external_fmt')
|
||||
spdlog_srcs+= 'src/fmt.cpp'
|
||||
endif
|
||||
|
||||
if get_option('library_type') == 'static'
|
||||
spdlog = static_library(
|
||||
'spdlog',
|
||||
spdlog_srcs,
|
||||
cpp_args : compile_args_compiled,
|
||||
include_directories : spdlog_inc,
|
||||
dependencies : dep_list,
|
||||
install : not meson.is_subproject()
|
||||
)
|
||||
else
|
||||
spdlog = shared_library('spdlog',
|
||||
spdlog_srcs,
|
||||
cpp_args : compile_args_compiled,
|
||||
include_directories : spdlog_inc,
|
||||
dependencies : dep_list,
|
||||
install : not meson.is_subproject(),
|
||||
version : meson.project_version(),
|
||||
)
|
||||
endif
|
||||
|
||||
spdlog_dep = declare_dependency(
|
||||
link_with : spdlog,
|
||||
include_directories : spdlog_inc,
|
||||
compile_args : compile_args_compiled,
|
||||
dependencies : dep_list,
|
||||
version : meson.project_version(),
|
||||
)
|
||||
|
||||
# ----------------------------------
|
||||
# --- Header only dependency ---
|
||||
# ----------------------------------
|
||||
spdlog_headeronly_dep = declare_dependency(
|
||||
include_directories : spdlog_inc,
|
||||
compile_args : compile_args_ho,
|
||||
dependencies : dep_list,
|
||||
version : meson.project_version(),
|
||||
)
|
||||
|
||||
# ------------------------
|
||||
# --- Installation ---
|
||||
# ------------------------
|
||||
|
||||
# Do not install when spdlog is used as a subproject
|
||||
if not meson.is_subproject()
|
||||
install_subdir('include/spdlog', install_dir: get_option('includedir'))
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
pkg.generate(spdlog,
|
||||
name : 'spdlog',
|
||||
description : 'Fast C++ logging library',
|
||||
url : 'https://github.com/gabime/spdlog',
|
||||
extra_cflags : compile_args_compiled
|
||||
)
|
||||
endif
|
||||
|
||||
# -------------------------------------
|
||||
# --- Conditionally add subdirs ---
|
||||
# -------------------------------------
|
||||
|
||||
if get_option('enable_tests') or get_option('enable_tests_ho')
|
||||
subdir('tests')
|
||||
endif
|
||||
|
||||
if get_option('enable_examples')
|
||||
subdir('example')
|
||||
endif
|
||||
|
||||
if get_option('enable_benchmarks')
|
||||
subdir('bench')
|
||||
endif
|
||||
|
||||
# -------------------
|
||||
# --- Summary ---
|
||||
# -------------------
|
||||
|
||||
summary_str = '''spdlog build summary:
|
||||
- using external fmt: @0@
|
||||
- building tests: @1@
|
||||
- building examples: @2@
|
||||
- building benchmarks: @3@
|
||||
- library type: @4@
|
||||
- no exceptions: @5@
|
||||
'''.format(
|
||||
get_option('external_fmt'),
|
||||
get_option('enable_tests'),
|
||||
get_option('enable_examples'),
|
||||
get_option('enable_benchmarks'),
|
||||
get_option('library_type'),
|
||||
get_option('no_exceptions')
|
||||
)
|
||||
|
||||
message(summary_str)
|
@ -1,15 +0,0 @@
|
||||
option('external_fmt', type: 'boolean', value: false, description: 'Use external fmt package instead of the bundled')
|
||||
option('enable_examples', type: 'boolean', value: true, description: 'Build examples')
|
||||
option('enable_benchmarks', type: 'boolean', value: false, description: 'Build benchmarks')
|
||||
option('enable_tests', type: 'boolean', value: true, description: 'Build tests')
|
||||
option('enable_tests_ho', type: 'boolean', value: false, description: 'Build header-only tests')
|
||||
option('library_type', type: 'combo', choices: ['static', 'shared'], value: 'static', description: 'Library build type')
|
||||
option('no_exceptions', type: 'boolean', value: false, description: 'Disabled exceptions - abort() instead any error')
|
||||
|
||||
option('wchar_support', type: 'boolean', value: false, description:'(Windows only) Support wchar api')
|
||||
option('wchar_filenames', type: 'boolean', value: false, description: '(Windows only) Support wchar filenames')
|
||||
option('clock_coarse', type: 'boolean', value: false, description: '(Linux only) Use the much faster (but much less accurate) CLOCK_REALTIME_COARSE instead of the regular clock')
|
||||
option('prevent_child_fd', type: 'boolean', value: false, description: 'Prevent from child processes to inherit log file descriptors')
|
||||
option('no_thread_id', type: 'boolean', value: false, description: 'prevent spdlog from querying the thread id on each log call if thread id is not needed')
|
||||
option('no_tls', type: 'boolean', value: false, description: 'prevent spdlog from using thread local storage')
|
||||
option('no_atomic_levels', type: 'boolean', value: false, description: 'prevent spdlog from using of std::atomic log levels (use only if your code never modifies log levels concurrently')
|
Loading…
Reference in New Issue
Block a user