Updated meson build
This commit is contained in:
		@@ -11,3 +11,5 @@ foreach i : bench_matrix
 | 
				
			|||||||
  bench_exe = executable(i[0], i[0] + '.cpp', dependencies: i[1])
 | 
					  bench_exe = executable(i[0], i[0] + '.cpp', dependencies: i[1])
 | 
				
			||||||
  benchmark('bench_' + i[0], bench_exe, args: i[2])
 | 
					  benchmark('bench_' + i[0], bench_exe, args: i[2])
 | 
				
			||||||
endforeach
 | 
					endforeach
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run_command(find_program('mkdir'), meson.current_build_dir() + '/logs')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,5 @@
 | 
				
			|||||||
example_matrix =  [
 | 
					executable('example', 'example.cpp', dependencies: spdlog_dep)
 | 
				
			||||||
  ['spdlog-example',    spdlog_dep],
 | 
					executable('example_header_only', 'example.cpp', dependencies: spdlog_headeronly_dep)
 | 
				
			||||||
  ['spdlog-example-ho', spdlog_headeronly_dep],
 | 
					run_command(find_program('mkdir'), meson.current_build_dir() + '/logs')
 | 
				
			||||||
]
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
foreach i : example_matrix
 | 
					 | 
				
			||||||
  test_exe = executable(i[0], ['example.cpp'], dependencies: i[1])
 | 
					 | 
				
			||||||
endforeach
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										28
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								meson.build
									
									
									
									
									
								
							@@ -27,21 +27,37 @@ if get_option('external_fmt')
 | 
				
			|||||||
  compile_args += '-DSPDLOG_FMT_EXTERNAL'
 | 
					  compile_args += '-DSPDLOG_FMT_EXTERNAL'
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if get_option('no_exceptions')
 | 
				
			||||||
 | 
					  compile_args += '-DSPDLOG_NO_EXCEPTIONS'
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ------------------------------------
 | 
					# ------------------------------------
 | 
				
			||||||
# ---   Compiled library version   ---
 | 
					# ---   Compiled library version   ---
 | 
				
			||||||
# ------------------------------------
 | 
					# ------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spdlog_inc = include_directories('./include')
 | 
					spdlog_inc = include_directories('./include')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					spdlog_srcs = files([
 | 
				
			||||||
 | 
					    'src/async.cpp',
 | 
				
			||||||
 | 
					    'src/color_sinks.cpp',
 | 
				
			||||||
 | 
					    'src/file_sinks.cpp',
 | 
				
			||||||
 | 
					    'src/fmt.cpp',
 | 
				
			||||||
 | 
					    'src/spdlog.cpp',
 | 
				
			||||||
 | 
					    'src/stdout_sinks.cpp'
 | 
				
			||||||
 | 
					])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if get_option('library_type') == 'static'
 | 
					if get_option('library_type') == 'static'
 | 
				
			||||||
  spdlog = static_library('spdlog', ['src/spdlog.cpp'],
 | 
					  spdlog = static_library(
 | 
				
			||||||
 | 
					    'spdlog',
 | 
				
			||||||
 | 
					    spdlog_srcs,
 | 
				
			||||||
    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
					    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
				
			||||||
    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', ['src/spdlog.cpp'],
 | 
					  spdlog = shared_library('spdlog',
 | 
				
			||||||
 | 
					    spdlog_srcs,
 | 
				
			||||||
    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
					    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
				
			||||||
    include_directories : spdlog_inc,
 | 
					    include_directories : spdlog_inc,
 | 
				
			||||||
    dependencies        : dep_list,
 | 
					    dependencies        : dep_list,
 | 
				
			||||||
@@ -112,12 +128,14 @@ summary_str = '''spdlog build summary:
 | 
				
			|||||||
  - building examples:   @2@
 | 
					  - building examples:   @2@
 | 
				
			||||||
  - building benchmarks: @3@
 | 
					  - building benchmarks: @3@
 | 
				
			||||||
  - library type:        @4@
 | 
					  - library type:        @4@
 | 
				
			||||||
 | 
					  - no exceptions:       @5@
 | 
				
			||||||
'''.format(
 | 
					'''.format(
 | 
				
			||||||
  get_option('external_fmt'),
 | 
					  get_option('external_fmt'),
 | 
				
			||||||
  get_option('enable_tests'),
 | 
					  get_option('enable_tests'),
 | 
				
			||||||
  get_option('enable_examples'),
 | 
					  get_option('enable_examples'),
 | 
				
			||||||
  get_option('enable_benchmarks'),
 | 
					  get_option('enable_benchmarks'),
 | 
				
			||||||
  get_option('library_type')
 | 
					  get_option('library_type'),
 | 
				
			||||||
 | 
					  get_option('no_exceptions')
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message(summary_str)
 | 
					message(summary_str)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
option('external_fmt',      type: 'boolean', value: false)
 | 
					option('external_fmt',      type: 'boolean', value: false)
 | 
				
			||||||
option('enable_examples',   type: 'boolean', value: false)
 | 
					option('enable_examples',   type: 'boolean', value: true)
 | 
				
			||||||
option('enable_benchmarks', type: 'boolean', value: false)
 | 
					option('enable_benchmarks', type: 'boolean', value: false)
 | 
				
			||||||
option('enable_tests',      type: 'boolean', value: false)
 | 
					option('enable_tests',      type: 'boolean', value: false)
 | 
				
			||||||
option('library_type',      type: 'combo', choices: ['static', 'shared'], value: 'static')
 | 
					option('library_type',      type: 'combo', choices: ['static', 'shared'], value: 'static')
 | 
				
			||||||
 | 
					option('no_exceptions',      type: 'boolean', value: false)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,27 @@
 | 
				
			|||||||
test_sources = files([
 | 
					test_sources = files([
 | 
				
			||||||
  'main.cpp',
 | 
					    'test_file_helper.cpp',
 | 
				
			||||||
  'test_async.cpp',
 | 
					    'test_file_logging.cpp',
 | 
				
			||||||
  'test_dup_filter.cpp',
 | 
					    'test_daily_logger.cpp',
 | 
				
			||||||
  'test_errors.cpp',
 | 
					    'test_misc.cpp',
 | 
				
			||||||
  'test_file_helper.cpp',
 | 
					    'test_pattern_formatter.cpp',
 | 
				
			||||||
  'test_file_logging.cpp',
 | 
					    'test_async.cpp',
 | 
				
			||||||
  'test_fmt_helper.cpp',
 | 
					    'includes.h',
 | 
				
			||||||
  'test_macros.cpp',
 | 
					    'test_registry.cpp',
 | 
				
			||||||
  'test_misc.cpp',
 | 
					    'test_macros.cpp',
 | 
				
			||||||
  'test_mpmc_q.cpp',
 | 
					    'utils.cpp',
 | 
				
			||||||
  'test_pattern_formatter.cpp',
 | 
					    'main.cpp',
 | 
				
			||||||
  'test_registry.cpp',
 | 
					    'test_mpmc_q.cpp',
 | 
				
			||||||
  'test_stdout_api.cpp',
 | 
					    'test_fmt_helper.cpp',
 | 
				
			||||||
  'utils.cpp',
 | 
					    'test_stdout_api.cpp',
 | 
				
			||||||
 | 
					    'test_dup_filter.cpp',
 | 
				
			||||||
 | 
					    'test_backtrace.cpp'
 | 
				
			||||||
])
 | 
					])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if  not get_option('no_exceptions')
 | 
				
			||||||
 | 
					    test_sources += 'test_errors.cpp'
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
global_test_deps = []
 | 
					global_test_deps = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# -----------------------------------------------------
 | 
					# -----------------------------------------------------
 | 
				
			||||||
@@ -24,20 +31,23 @@ global_test_deps = []
 | 
				
			|||||||
systemd_dep = dependency('libsystemd', required: false)
 | 
					systemd_dep = dependency('libsystemd', required: false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if systemd_dep.found()
 | 
					if systemd_dep.found()
 | 
				
			||||||
  test_sources += files(['test_systemd.cpp'])
 | 
					  test_sources += 'test_systemd.cpp'
 | 
				
			||||||
  global_test_deps += systemd_dep
 | 
					  global_test_deps += systemd_dep
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run_command('mkdir', 'logs')
 | 
				
			||||||
# --------------------------------------
 | 
					# --------------------------------------
 | 
				
			||||||
# ---   Build the test executables   ---
 | 
					# ---   Build the test executables   ---
 | 
				
			||||||
# --------------------------------------
 | 
					# --------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_matrix =  [
 | 
					test_matrix =  [
 | 
				
			||||||
  ['spdlog-utest',    spdlog_dep],
 | 
					  ['spdlog-utests',    spdlog_dep],
 | 
				
			||||||
  ['spdlog-utest-ho', spdlog_headeronly_dep],
 | 
					  ['spdlog-utests-ho', spdlog_headeronly_dep],
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
foreach i : test_matrix
 | 
					foreach i : test_matrix
 | 
				
			||||||
  test_exe = executable(i[0], test_sources, dependencies: global_test_deps + [i[1]])
 | 
					  test_exe = executable(i[0], test_sources, dependencies: global_test_deps + [i[1]])
 | 
				
			||||||
  test('test_' + i[0], test_exe)
 | 
					  test('test_' + i[0], test_exe)
 | 
				
			||||||
endforeach
 | 
					endforeach
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					run_command(find_program('mkdir'), meson.current_build_dir() + '/logs')
 | 
				
			||||||
		Reference in New Issue
	
	Block a user