@ -1,12 +1,12 @@
project ( 'spdlog' , [ 'cpp' ] ,
project ( 'spdlog' , [ 'cpp' ] ,
license : 'MIT' ,
license : 'MIT' ,
version : run_command ( find_program ( 'scripts/extract_version.py' ) ) . stdout ( ) . strip ( ) ,
version : run_command ( find_program ( 'scripts/extract_version.py' ) ) . stdout ( ) . strip ( ) ,
default_options : [
default_options : [
'warning_level=3' ,
'warning_level=3' ,
'cpp_std=c++11' ,
'cpp_std=c++11' ,
'buildtype=release' ,
'buildtype=release' ,
'b_colorout=always' ,
'b_colorout=always' ,
] ,
] ,
)
)
# ------------------------
# ------------------------
@ -20,17 +20,57 @@ dep_list += dependency('threads')
# Check for FMT
# Check for FMT
if get_option ( 'external_fmt' )
if get_option ( 'external_fmt' )
if not meson . version ( ) . version_compare ( '>=0.49.0' )
if not meson . version ( ) . version_compare ( '>=0.49.0' )
warning ( 'Finding fmt can fail with meson versions before 0.49.0' )
warning ( 'Finding fmt can fail with meson versions before 0.49.0' )
endif
endif
dep_list + = dependency ( 'fmt' )
dep_list + = dependency ( 'fmt' )
compile_args + = '-DSPDLOG_FMT_EXTERNAL'
compile_args + = '-DSPDLOG_FMT_EXTERNAL'
endif
endif
if get_option ( 'no_exceptions' )
if get_option ( 'no_exceptions' )
compile_args + = '-DSPDLOG_NO_EXCEPTIONS'
compile_args + = '-DSPDLOG_NO_EXCEPTIONS'
endif
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_support 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 ---
# --- Compiled library version ---
# ------------------------------------
# ------------------------------------
@ -50,40 +90,40 @@ if not get_option('external_fmt')
endif
endif
if get_option ( 'library_type' ) == 'static'
if get_option ( 'library_type' ) == 'static'
spdlog = static_library (
spdlog = static_library (
'spdlog' ,
'spdlog' ,
spdlog_srcs ,
spdlog_srcs ,
cpp_args : [ compile_args ] + [ '-DSPDLOG_COMPILED_LIB' ] ,
cpp_args : compile_args_compiled ,
include_directories : spdlog_inc ,
include_directories : spdlog_inc ,
dependencies : dep_list ,
dependencies : dep_list ,
install : not meson . is_subproject ( )
install : not meson . is_subproject ( )
)
)
else
else
spdlog = shared_library ( 'spdlog' ,
spdlog = shared_library ( 'spdlog' ,
spdlog_srcs ,
spdlog_srcs ,
cpp_args : [ compile_args ] + [ '-DSPDLOG_COMPILED_LIB' ] ,
cpp_args : compile_args_compiled ,
include_directories : spdlog_inc ,
include_directories : spdlog_inc ,
dependencies : dep_list ,
dependencies : dep_list ,
install : not meson . is_subproject ( ) ,
install : not meson . is_subproject ( ) ,
)
)
endif
endif
spdlog_dep = declare_dependency (
spdlog_dep = declare_dependency (
link_with : spdlog ,
link_with : spdlog ,
include_directories : spdlog_inc ,
include_directories : spdlog_inc ,
compile_args : compile_args + [ '-DSPDLOG_COMPILED_LIB' ] ,
compile_args : compile_args _compiled ,
dependencies : dep_list ,
dependencies : dep_list ,
version : meson . project_version ( ) ,
version : meson . project_version ( ) ,
)
)
# ----------------------------------
# ----------------------------------
# --- Header only dependency ---
# --- Header only dependency ---
# ----------------------------------
# ----------------------------------
spdlog_headeronly_dep = declare_dependency (
spdlog_headeronly_dep = declare_dependency (
include_directories : spdlog_inc ,
include_directories : spdlog_inc ,
compile_args : compile_args ,
compile_args : compile_args _ho ,
dependencies : dep_list ,
dependencies : dep_list ,
version : meson . project_version ( ) ,
version : meson . project_version ( ) ,
)
)
# ------------------------
# ------------------------
@ -92,15 +132,15 @@ spdlog_headeronly_dep = declare_dependency(
# Do not install when spdlog is used as a subproject
# Do not install when spdlog is used as a subproject
if not meson . is_subproject ( )
if not meson . is_subproject ( )
install_subdir ( 'include/spdlog' , install_dir : get_option ( 'includedir' ) )
install_subdir ( 'include/spdlog' , install_dir : get_option ( 'includedir' ) )
pkg = import ( 'pkgconfig' )
pkg = import ( 'pkgconfig' )
pkg . generate ( spdlog ,
pkg . generate ( spdlog ,
name : 'spdlog' ,
name : 'spdlog' ,
description : 'Fast C++ logging library' ,
description : 'Fast C++ logging library' ,
url : 'https://github.com/gabime/spdlog' ,
url : 'https://github.com/gabime/spdlog' ,
extra_cflags : [ '-DSPDLOG_COMPILED_LIB' ]
extra_cflags : compile_args_compiled
)
)
endif
endif
# -------------------------------------
# -------------------------------------
@ -108,15 +148,15 @@ endif
# -------------------------------------
# -------------------------------------
if get_option ( 'enable_tests' )
if get_option ( 'enable_tests' )
subdir ( 'tests' )
subdir ( 'tests' )
endif
endif
if get_option ( 'enable_examples' )
if get_option ( 'enable_examples' )
subdir ( 'example' )
subdir ( 'example' )
endif
endif
if get_option ( 'enable_benchmarks' )
if get_option ( 'enable_benchmarks' )
subdir ( 'bench' )
subdir ( 'bench' )
endif
endif
# -------------------
# -------------------
@ -124,7 +164,6 @@ endif
# -------------------
# -------------------
summary_str = '' ' spdlog build summary :
summary_str = '' ' spdlog build summary :
- using external fmt : @ 0 @
- using external fmt : @ 0 @
- building tests : @ 1 @
- building tests : @ 1 @
- building examples : @ 2 @
- building examples : @ 2 @