Commit a6f7edf9 authored by gabime's avatar gabime

Updated meson build options

parent 4a4f13be
...@@ -31,6 +31,46 @@ if get_option('no_exceptions') ...@@ -31,6 +31,46 @@ 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 ---
# ------------------------------------ # ------------------------------------
...@@ -53,7 +93,7 @@ if get_option('library_type') == 'static' ...@@ -53,7 +93,7 @@ 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()
...@@ -61,7 +101,7 @@ if get_option('library_type') == 'static' ...@@ -61,7 +101,7 @@ if get_option('library_type') == 'static'
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(),
...@@ -71,7 +111,7 @@ endif ...@@ -71,7 +111,7 @@ 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(),
) )
...@@ -81,7 +121,7 @@ spdlog_dep = declare_dependency( ...@@ -81,7 +121,7 @@ spdlog_dep = declare_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(),
) )
...@@ -99,7 +139,7 @@ if not meson.is_subproject() ...@@ -99,7 +139,7 @@ if not meson.is_subproject()
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
...@@ -124,7 +164,6 @@ 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@
......
...@@ -4,3 +4,11 @@ option('enable_benchmarks', type: 'boolean', value: false, description: 'Build b ...@@ -4,3 +4,11 @@ option('enable_benchmarks', type: 'boolean', value: false, description: 'Build b
option('enable_tests', type: 'boolean', value: true, description: 'Build tests') option('enable_tests', type: 'boolean', value: true, description: 'Build tests')
option('library_type', type: 'combo', choices: ['static', 'shared'], value: 'static', description: 'Library build type') 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('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')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment