Skip to content

Commit

Permalink
Merge pull request #164 from WilliamTambellini/fixbenchexelink
Browse files Browse the repository at this point in the history
Add option to choose the lib type (shared or static)
  • Loading branch information
r-devulap authored Sep 4, 2024
2 parents 87486d1 + 15cdb5c commit 169dc6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
17 changes: 15 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ int main() {
cancompilefp16 = cpp.compiles(fp16code, args:'-march=sapphirerapids')

subdir('lib')
libsimdsort = shared_library('x86simdsortcpp',
if get_option('lib_type') == 'shared'
libsimdsort = shared_library('x86simdsortcpp',
'lib/x86simdsort.cpp',
include_directories : [src, utils, lib],
link_args : [openmpflags],
Expand All @@ -43,6 +44,17 @@ libsimdsort = shared_library('x86simdsortcpp',
install : true,
soversion : 1,
)
else
libsimdsort = static_library('x86simdsortcpp',
'lib/x86simdsort.cpp',
include_directories : [src, utils, lib],
link_args : [openmpflags],
link_with : [libtargets],
gnu_symbol_visibility : 'inlineshidden',
install : true,
pic: true,
)
endif

pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : libsimdsort,
Expand All @@ -68,10 +80,11 @@ endif

if get_option('build_benchmarks')
gbench_dep = dependency('benchmark', required : true, static: false)
thread_dep = dependency('threads') # libbenchmark could need pthread_create
subdir('benchmarks')
benchexe = executable('benchexe',
include_directories : [src, lib, utils, bench],
dependencies : [gbench_dep],
dependencies : [gbench_dep, thread_dep],
link_args: ['-lbenchmark_main', ipplink],
link_whole : [libbench],
link_with : libsimdsort,
Expand Down
3 changes: 3 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ option('build_vqsortbench', type : 'boolean', value : true,
description : 'Add google vqsort to benchmarks (default: "true").')
option('use_openmp', type : 'boolean', value : false,
description : 'Use OpenMP to accelerate key-value sort (default: "false").')
option('lib_type', type : 'string', value : 'shared',
description : 'Library type: shared or static (default: "shared").')

0 comments on commit 169dc6e

Please sign in to comment.