Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
CXX: g++-9
run: |
make clean
meson setup --warnlevel 2 --werror --buildtype release builddir
meson setup -Dbuild_tests=true --warnlevel 2 --werror --buildtype release builddir
cd builddir
ninja

Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
CXX: g++-10
run: |
make clean
meson setup --warnlevel 2 --werror --buildtype release builddir
meson setup -Dbuild_tests=true --warnlevel 2 --werror --buildtype release builddir
cd builddir
ninja

Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
CXX: g++-11
run: |
make clean
meson setup --warnlevel 2 --werror --buildtype release builddir
meson setup -Dbuild_tests=true --warnlevel 2 --werror --buildtype release builddir
cd builddir
ninja
- name: Run test suite on TGL
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
CXX: g++-13
run: |
make clean
meson setup --warnlevel 2 --werror --buildtype release builddir
meson setup -Dbuild_tests=true --warnlevel 2 --werror --buildtype release builddir
cd builddir
ninja

Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
CXXFLAGS: -DXSS_MINIMAL_NETWORK_SORT
run: |
make clean
meson setup --warnlevel 2 --werror --buildtype release builddir
meson setup -Dbuild_tests=true --warnlevel 2 --werror --buildtype release builddir
cd builddir
ninja

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
meson:
meson setup --warnlevel 2 --werror --buildtype release builddir
meson setup -Dbuild_tests=true -Dbuild_benchmarks=true --warnlevel 2 --werror --buildtype release builddir
cd builddir && ninja

mesondebug:
meson setup --warnlevel 2 --werror --buildtype debug debug
meson setup -Dbuild_tests=true -Dbuild_benchmarks=true --warnlevel 2 --werror --buildtype debug debug
cd debug && ninja

clean:
$(RM) -rf $(TESTOBJS) $(BENCHOBJS) $(UTILOBJS) testexe benchexe builddir
$(RM) -rf $(TESTOBJS) $(BENCHOBJS) $(UTILOBJS) testexe benchexe builddir debug
2 changes: 2 additions & 0 deletions lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ if cancompilefp16
cpp_args : ['-march=sapphirerapids', flags_hide_symbols],
)
endif

install_headers('x86simdsort.h')
25 changes: 18 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('x86-simd-sort', 'cpp',
version : '2.0.0',
version : '4.0.0',
license : 'BSD 3-clause',
default_options : ['cpp_std=c++17'])
cpp = meson.get_compiler('cpp')
Expand All @@ -8,8 +8,6 @@ lib = include_directories('lib')
bench = include_directories('benchmarks')
utils = include_directories('utils')
tests = include_directories('tests')
gtest_dep = dependency('gtest_main', required : false, static: false)
gbench_dep = dependency('benchmark', required : false, static: false)

fp16code = '''#include<immintrin.h>
int main() {
Expand All @@ -27,19 +25,32 @@ libsimdsort = shared_library('x86simdsort',
include_directories : [utils, lib],
link_with : [libtargets],
cpp_args : [flags_hide_symbols],
install : true,
)

if gtest_dep.found()
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : libsimdsort,
version : '4.0',
name : 'libx86simdsort',
filebase : 'x86simdsort',
description : 'High performance SIMD based sorting routines.')

# Build test suite if option build_tests set to true
if get_option('build_tests')
gtest_dep = dependency('gtest_main', required : true, static: false)
subdir('tests')
testexe = executable('testexe',
include_directories : [lib, utils],
dependencies : gtest_dep,
link_whole : [libtests],
link_with : libsimdsort,
)
test('x86 simd sort tests', testexe)
endif

if gbench_dep.found()
# Build benchmarking suite if option build_benchmarks is set to true
if get_option('build_benchmarks')
gbench_dep = dependency('benchmark', required : true, static: false)
subdir('benchmarks')
benchexe = executable('benchexe',
include_directories : [src, lib, utils, bench],
Expand All @@ -52,8 +63,8 @@ endif

summary({
'Can compile AVX-512 FP16 ISA': cancompilefp16,
'Built test content': gtest_dep.found(),
'Built benchmarks': gbench_dep.found(),
'Build test content': get_option('build_tests'),
'Build benchmarks': get_option('build_benchmarks'),
},
section: 'Configuration',
bool_yn: true
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option('build_tests', type : 'boolean', value : false,
description : 'Build test suite (default: "false").')
option('build_benchmarks', type : 'boolean', value : false,
description : 'Build benchmarking suite (default: "false").')