Skip to content

Commit

Permalink
meson: allow to disable build of benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinas committed Jul 12, 2023
1 parent d65aabe commit 98ddc5c
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 125 deletions.
20 changes: 11 additions & 9 deletions faest_128f/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_128f_bench_c2', bench_sources,
dependencies: [libfaest_128f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_128f_bench_c2', bench_sources,
dependencies: [libfaest_128f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_128s/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_128s_bench_c2', bench_sources,
dependencies: [libfaest_128s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_128s_bench_c2', bench_sources,
dependencies: [libfaest_128s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_192f/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_192f_bench_c2', bench_sources,
dependencies: [libfaest_192f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_192f_bench_c2', bench_sources,
dependencies: [libfaest_192f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_192s/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_192s_bench_c2', bench_sources,
dependencies: [libfaest_192s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_192s_bench_c2', bench_sources,
dependencies: [libfaest_192s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_256f/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_256f_bench_c2', bench_sources,
dependencies: [libfaest_256f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_256f_bench_c2', bench_sources,
dependencies: [libfaest_256f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_256s/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_256s_bench_c2', bench_sources,
dependencies: [libfaest_256s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_256s_bench_c2', bench_sources,
dependencies: [libfaest_256s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_em_128f/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_128f_bench_c2', bench_sources,
dependencies: [libfaest_em_128f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_128f_bench_c2', bench_sources,
dependencies: [libfaest_em_128f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_em_128s/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_128s_bench_c2', bench_sources,
dependencies: [libfaest_em_128s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_128s_bench_c2', bench_sources,
dependencies: [libfaest_em_128s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_em_192f/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_192f_bench_c2', bench_sources,
dependencies: [libfaest_em_192f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_192f_bench_c2', bench_sources,
dependencies: [libfaest_em_192f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_em_192s/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_192s_bench_c2', bench_sources,
dependencies: [libfaest_em_192s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_192s_bench_c2', bench_sources,
dependencies: [libfaest_em_192s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_em_256f/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_256f_bench_c2', bench_sources,
dependencies: [libfaest_em_256f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_256f_bench_c2', bench_sources,
dependencies: [libfaest_em_256f_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
20 changes: 11 additions & 9 deletions faest_em_256s/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ if valgrind_exec.found()
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_256s_bench_c2', bench_sources,
dependencies: [libfaest_em_256s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_em_256s_bench_c2', bench_sources,
dependencies: [libfaest_em_256s_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
18 changes: 10 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ endforeach

# dependencies
openssl = dependency('openssl', required: get_option('openssl'))
boost_program_options = dependency('boost', required: false, modules: ['program_options'])
boost_program_options = dependency('boost', required: get_option('benchmarks'), modules: ['program_options'])
valgrind = dependency('valgrind', required: get_option('valgrind'))
if valgrind.found()
valgrind_exec = find_program('valgrind', required: true)
Expand Down Expand Up @@ -403,13 +403,15 @@ if host_machine.system() == 'windows'
endif

# catch2 for benchmarks
libcatch2 = static_library('catch2',
files(join_paths(meson.project_source_root(), 'catch2', 'extras', 'catch_amalgamated.cpp')),
)
catch2 = declare_dependency(
link_with: libcatch2,
include_directories: include_directories(join_paths('catch2', 'extras'))
)
if get_option('benchmarks').enabled()
libcatch2 = static_library('catch2',
files(join_paths(meson.project_source_root(), 'catch2', 'extras', 'catch_amalgamated.cpp')),
)
catch2 = declare_dependency(
link_with: libcatch2,
include_directories: include_directories(join_paths('catch2', 'extras'))
)
endif

# generate config.h
config_header = configure_file(
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ option('valgrind',
type: 'feature',
value: 'disabled',
description: 'Use valgrind for timing checks'
)
option('benchmarks',
type: 'feature',
value: 'auto',
description: 'Build benchmark executables'
)
20 changes: 11 additions & 9 deletions tools/crypto_sign_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,17 @@ def generate(param_name):
build_by_default: false,
)
endif
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_{param_name}_bench_c2', bench_sources,
dependencies: [libfaest_{param_name}_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
if get_option('benchmarks').enabled()
bench_sources = files(
join_paths(meson.project_source_root(), 'tools', 'bench_c2.cpp'),
)
bench_catch = executable('faest_{param_name}_bench_c2', bench_sources,
dependencies: [libfaest_{param_name}_dependency, boost_program_options, catch2],
include_directories: include_directories,
c_args: defines + c_flags,
cpp_args: defines + cpp_flags
)
endif
"""
)

Expand Down

0 comments on commit 98ddc5c

Please sign in to comment.