@@ -34,7 +34,8 @@ int main() {
3434cancompilefp16 = cpp.compiles(fp16code, args :' -march=sapphirerapids' )
3535
3636subdir (' lib' )
37- libsimdsort = shared_library (' x86simdsortcpp' ,
37+ if get_option (' lib_type' ) == ' shared'
38+ libsimdsort = shared_library (' x86simdsortcpp' ,
3839 ' lib/x86simdsort.cpp' ,
3940 include_directories : [src, utils, lib],
4041 link_args : [openmpflags],
@@ -43,6 +44,17 @@ libsimdsort = shared_library('x86simdsortcpp',
4344 install : true ,
4445 soversion : 1 ,
4546 )
47+ else
48+ libsimdsort = static_library (' x86simdsortcpp' ,
49+ ' lib/x86simdsort.cpp' ,
50+ include_directories : [src, utils, lib],
51+ link_args : [openmpflags],
52+ link_with : [libtargets],
53+ gnu_symbol_visibility : ' inlineshidden' ,
54+ install : true ,
55+ pic : true ,
56+ )
57+ endif
4658
4759pkg_mod = import (' pkgconfig' )
4860pkg_mod.generate(libraries : libsimdsort,
@@ -68,10 +80,11 @@ endif
6880
6981if get_option (' build_benchmarks' )
7082 gbench_dep = dependency (' benchmark' , required : true , static : false )
83+ thread_dep = dependency (' threads' ) # libbenchmark could need pthread_create
7184 subdir (' benchmarks' )
7285 benchexe = executable (' benchexe' ,
7386 include_directories : [src, lib, utils, bench],
74- dependencies : [gbench_dep],
87+ dependencies : [gbench_dep, thread_dep ],
7588 link_args : [' -lbenchmark_main' , ipplink],
7689 link_whole : [libbench],
7790 link_with : libsimdsort,
0 commit comments