Skip to content

Commit 951958c

Browse files
committed
Add a section in README on how to use this as a Meson subproject
1 parent 881764a commit 951958c

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ benchmark](https://github.com/google/benchmark) frameworks respectively. You
8181
can configure meson to build them both by using `-Dbuild_tests=true` and
8282
`-Dbuild_benchmarks=true`.
8383

84+
## Using x86-simd-sort as a Meson subproject
85+
86+
If you would like to use this as a Meson subproject, then create `subprojects`
87+
directory and copy `x86-simd-sort` into it. Add these two lines
88+
in your meson.build.
89+
```
90+
xss = subproject('x86-simd-sort')
91+
xss_dep = xss.get_variable('x86simdsortcpp_dep')
92+
```
93+
94+
For more detailed instructions please refer to Meson
95+
[documentation](https://mesonbuild.com/Subprojects.html#using-a-subproject).
96+
8497
## Example usage
8598

8699
#### Sort an array of floats

meson.build

+8-9
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,27 @@ else
6161
)
6262
endif
6363

64-
x86simdsortcpp_dep = declare_dependency(
65-
include_directories: include_directories('lib'),
66-
link_with: libsimdsort,
67-
)
68-
6964
pkg_mod = import('pkgconfig')
7065
pkg_mod.generate(libraries : libsimdsort,
7166
version : '4.0',
7267
name : 'libx86simdsortcpp',
7368
filebase : 'x86simdsortcpp',
7469
description : 'C++ template library for high performance SIMD based sorting routines.')
7570

71+
# Create a new dependency variable making it easy to use this as a subproject:
72+
x86simdsortcpp_dep = declare_dependency(
73+
include_directories: include_directories('lib'),
74+
link_with: libsimdsort,
75+
)
76+
7677
# Build test suite if option build_tests set to true
7778
if get_option('build_tests')
7879
gtest_dep = dependency('gtest_main', required : true, static: false)
7980
subdir('tests')
8081
testexe = executable('testexe',
8182
include_directories : [lib, utils],
82-
dependencies : gtest_dep,
83+
dependencies : [gtest_dep, x86simdsortcpp_dep],
8384
link_whole : [libtests],
84-
link_with : libsimdsort,
8585
)
8686
test('x86 simd sort tests', testexe)
8787
endif
@@ -94,10 +94,9 @@ if get_option('build_benchmarks')
9494
subdir('benchmarks')
9595
benchexe = executable('benchexe',
9696
include_directories : [src, lib, utils, bench],
97-
dependencies : [gbench_dep, thread_dep],
97+
dependencies : [gbench_dep, thread_dep, x86simdsortcpp_dep],
9898
link_args: ['-lbenchmark_main', ipplink],
9999
link_whole : [libbench],
100-
link_with : libsimdsort,
101100
)
102101
endif
103102

0 commit comments

Comments
 (0)