From a9e7ae113f9245c7455216edb2ca4b031e49a0c7 Mon Sep 17 00:00:00 2001 From: Bruce Merry Date: Mon, 21 Aug 2023 19:55:18 +0200 Subject: [PATCH] Skip building non-Python stuff in Python build --- meson.build | 14 +++--- src/meson.build | 122 ++++++++++++++++++++++++------------------------ 2 files changed, 70 insertions(+), 66 deletions(-) diff --git a/meson.build b/meson.build index 4627ccfe7..57dfadf6f 100644 --- a/meson.build +++ b/meson.build @@ -158,9 +158,11 @@ subdir('include/spead2') # Generates include/spead2/common_features.h and commo include_dir = include_directories('include') subdir('src') # Defines the targets -pkg = import('pkgconfig') -pkg.generate( - st_lib, - description : 'Library for sending and receiving data in the SPEAD protocol', - filebase : 'spead2', -) +if not get_option('python') + pkg = import('pkgconfig') + pkg.generate( + st_lib, + description : 'Library for sending and receiving data in the SPEAD protocol', + filebase : 'spead2', + ) +endif diff --git a/src/meson.build b/src/meson.build index f23fc9078..1977c2202 100644 --- a/src/meson.build +++ b/src/meson.build @@ -87,76 +87,78 @@ ssconfig = ss.apply(conf) # TODO: handle debug_log user option -st_lib = static_library( - 'spead2', - include_directories: include_dir, - sources: ssconfig.sources(), - dependencies: ssconfig.dependencies(), - install : true -) - -st_dep = declare_dependency( - include_directories : include_dir, - sources : gen_headers, - link_with : st_lib -) - -if boost_program_options_dep.found() - executable( - 'spead2_recv', - 'spead2_recv.cpp', 'spead2_cmdline.cpp', - dependencies : [boost_program_options_dep, st_dep], - install : true - ) - executable( - 'spead2_send', - 'spead2_send.cpp', 'spead2_cmdline.cpp', - dependencies : [boost_program_options_dep, st_dep], +if not get_option('python') + st_lib = static_library( + 'spead2', + include_directories: include_dir, + sources: ssconfig.sources(), + dependencies: ssconfig.dependencies(), install : true ) - executable( - 'spead2_bench', - 'spead2_bench.cpp', 'spead2_cmdline.cpp', - dependencies : [boost_program_options_dep, st_dep], - install : true + + st_dep = declare_dependency( + include_directories : include_dir, + sources : gen_headers, + link_with : st_lib ) - if use_ibv + + if boost_program_options_dep.found() + executable( + 'spead2_recv', + 'spead2_recv.cpp', 'spead2_cmdline.cpp', + dependencies : [boost_program_options_dep, st_dep], + install : true + ) + executable( + 'spead2_send', + 'spead2_send.cpp', 'spead2_cmdline.cpp', + dependencies : [boost_program_options_dep, st_dep], + install : true + ) executable( - 'mcdump', - 'mcdump.cpp', - dependencies: [boost_program_options_dep, st_dep], + 'spead2_bench', + 'spead2_bench.cpp', 'spead2_cmdline.cpp', + dependencies : [boost_program_options_dep, st_dep], install : true ) + if use_ibv + executable( + 'mcdump', + 'mcdump.cpp', + dependencies: [boost_program_options_dep, st_dep], + install : true + ) + endif endif -endif -if cap_dep.found() - executable('spead2_net_raw', 'spead2_net_raw.cpp', dependencies : [cap_dep], install : true) -endif + if cap_dep.found() + executable('spead2_net_raw', 'spead2_net_raw.cpp', dependencies : [cap_dep], install : true) + endif -if boost_unit_test_framework_dep.found() - unit_test = executable( - 'spead2_unit_test', - 'unittest_main.cpp', - 'unittest_logging.cpp', - 'unittest_memcpy.cpp', - 'unittest_memory_allocator.cpp', - 'unittest_memory_pool.cpp', - 'unittest_raw_packet.cpp', - 'unittest_recv_live_heap.cpp', - 'unittest_recv_custom_memcpy.cpp', - 'unittest_recv_stream_stats.cpp', - 'unittest_semaphore.cpp', - 'unittest_send_heap.cpp', - 'unittest_send_streambuf.cpp', - 'unittest_send_tcp.cpp', - cpp_args : '-DBOOST_TEST_DYN_LINK', - dependencies : [st_dep, boost_unit_test_framework_dep] - ) - test('unit tests', unit_test) -endif + if boost_unit_test_framework_dep.found() + unit_test = executable( + 'spead2_unit_test', + 'unittest_main.cpp', + 'unittest_logging.cpp', + 'unittest_memcpy.cpp', + 'unittest_memory_allocator.cpp', + 'unittest_memory_pool.cpp', + 'unittest_raw_packet.cpp', + 'unittest_recv_live_heap.cpp', + 'unittest_recv_custom_memcpy.cpp', + 'unittest_recv_stream_stats.cpp', + 'unittest_semaphore.cpp', + 'unittest_send_heap.cpp', + 'unittest_send_streambuf.cpp', + 'unittest_send_tcp.cpp', + cpp_args : '-DBOOST_TEST_DYN_LINK', + dependencies : [st_dep, boost_unit_test_framework_dep] + ) + test('unit tests', unit_test) + endif + +else # python -if get_option('python') py_sources = files( 'py_common.cpp', 'py_recv.cpp',