Skip to content

Commit 745324c

Browse files
author
Raghuveer Devulapalli
authored
Merge pull request #199 from blazingpretzel/add-meson-dependency-object
Add Meson dependency declaration for use as a subproject
2 parents eafc913 + 951958c commit 745324c

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

README.md

Lines changed: 13 additions & 0 deletions
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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,20 @@ pkg_mod.generate(libraries : libsimdsort,
6868
filebase : 'x86simdsortcpp',
6969
description : 'C++ template library for high performance SIMD based sorting routines.')
7070

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+
7177
# Build test suite if option build_tests set to true
7278
if get_option('build_tests')
7379
gtest_dep = dependency('gtest_main', required : true, static: false)
7480
subdir('tests')
7581
testexe = executable('testexe',
7682
include_directories : [lib, utils],
77-
dependencies : gtest_dep,
83+
dependencies : [gtest_dep, x86simdsortcpp_dep],
7884
link_whole : [libtests],
79-
link_with : libsimdsort,
8085
)
8186
test('x86 simd sort tests', testexe)
8287
endif
@@ -89,10 +94,9 @@ if get_option('build_benchmarks')
8994
subdir('benchmarks')
9095
benchexe = executable('benchexe',
9196
include_directories : [src, lib, utils, bench],
92-
dependencies : [gbench_dep, thread_dep],
97+
dependencies : [gbench_dep, thread_dep, x86simdsortcpp_dep],
9398
link_args: ['-lbenchmark_main', ipplink],
9499
link_whole : [libbench],
95-
link_with : libsimdsort,
96100
)
97101
endif
98102

0 commit comments

Comments
 (0)