Files
ptprnt/meson.build
Moritz Martinius 6f9bb54611
Some checks failed
Build ptprnt / build (push) Failing after 2m28s
Use statically linked spdlog over system spdlog/libfmt
2025-10-19 11:51:11 +02:00

75 lines
1.8 KiB
Meson

project(
'ptprnt',
'cpp',
version: 'v0.2.0-'
+ run_command(
'git',
'rev-parse',
'--short', 'HEAD',
check: true,
).stdout().strip(),
license: 'GPLv3',
default_options: [
'c_std=c11',
'cpp_std=c++20',
'b_sanitize=none',
'b_lto=true',
'b_lto_mode=thin',
'b_thinlto_cache=true',
],
)
usb_dep = dependency('libusb-1.0')
pangocairo_dep = dependency('pangocairo')
# spdlog with std::format (C++20) - static library
spdlog_proj = subproject('spdlog', default_options: ['std_format=enabled', 'default_library=static', 'compile_library=true'])
log_dep = spdlog_proj.get_variable('spdlog_dep')
if not log_dep.found()
error('spdlog not found, can not proceed')
endif
# CLI11
cli11_proj = subproject('cli11')
cli11_dep = cli11_proj.get_variable('CLI11_dep')
if not cli11_dep.found()
error('CLI11 not found, can not proceed')
endif
incdir = include_directories('src')
subdir('src')
# Build arguments
cpp_args = ['-DPROJ_VERSION="' + meson.project_version() + '"']
# USB trace mode option (for debugging without sending to hardware)
if get_option('usb_trace_only')
cpp_args += ['-DUSB_TRACE_ONLY']
message(
'USB_TRACE_ONLY enabled: USB data will be logged but not sent to device',
)
endif
ptprnt_exe = executable(
'ptprnt',
'src/main.cpp',
install: true,
dependencies: [usb_dep, log_dep, pangocairo_dep, cli11_dep],
include_directories: incdir,
sources: [ptprnt_srcs],
cpp_args: cpp_args,
)
### Unit tests
# GTest and GMock
gtest_proj = subproject('gtest')
gtest_dep = gtest_proj.get_variable('gtest_main_dep')
gmock_dep = gtest_proj.get_variable('gmock_main_dep')
if not gtest_dep.found()
error('MESON_SKIP_TEST: gtest not installed.')
endif
subdir('tests')