Skip to content

Commit

Permalink
Update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
parham-k committed May 9, 2023
1 parent 282faf5 commit 3017be7
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,62 +1,72 @@
project(
'nthits',
'cpp',
version: '1.0.1',
version: '1.0.2',
license: 'MIT',
default_options: ['cpp_std=c++17', 'warning_level=3', 'werror=true']
default_options: [
'cpp_std=c++17',
'warning_level=3',
'werror=true',
'optimization=3',
],
)

configure_file(
input : 'include/version.in',
output : 'version.hpp',
configuration : {
'PROJECT_VERSION' : meson.project_version()
}
input: 'include/version.in',
output: 'version.hpp',
configuration: {'PROJECT_VERSION': meson.project_version()},
)

compiler = meson.get_compiler('cpp')

dependencies = [
dependency('openmp'),
compiler.find_library('btllib')
]
dependencies = [dependency('openmp'), compiler.find_library('btllib')]

include_dirs = [
include_directories('include'),
include_directories('vendor/argparse/include'),
]

tests_files = [
'tests/min_thresh.cpp'
]
tests_files = ['tests/min_thresh.cpp']

executable(
'nthits',
['src/main.cpp'],
dependencies: dependencies,
include_directories: include_dirs,
install: true
install: true,
)

executable(
'nthits-bfq',
['src/bf_query.cpp'],
dependencies: dependencies,
include_directories: include_dirs,
install: true
install: true,
)

# TESTS ------------------------------------------------------------------------
catch2 = dependency('Catch2', method : 'cmake', modules : ['Catch2::Catch2WithMain'], required: false)

if not catch2.found()
error('Tests require catch2 to be installed.')
endif

foreach file : tests_files
t = file.split('.cpp')[0].split('/')[-1]
test(t, executable(t + '_test', file,
include_directories : include_dirs,
dependencies : dependencies + [catch2])
if get_option('buildtype') != 'release'
catch2 = dependency(
'Catch2',
method: 'cmake',
modules: ['Catch2::Catch2WithMain'],
)
endforeach

if not catch2.found()
error('Tests require catch2 to be installed.')
endif

foreach file : tests_files
t = file.split('.cpp')[0].split('/')[-1]
test(
t,
executable(
t + '_test',
file,
include_directories: include_dirs,
dependencies: dependencies + [catch2],
),
)
endforeach
endif

0 comments on commit 3017be7

Please sign in to comment.