11project (
22 ' mkl_random' ,
3- [' c' , ' cpp ' , ' cython' ],
3+ [' c' , ' cython' ],
44 version : run_command (
55 find_program (' python3' , ' python' ),
66 [' -c' , ' exec(open("mkl_random/_version.py").read()); print(__version__)' ],
@@ -25,7 +25,6 @@ np_dir = run_command(py,
2525inc_np = include_directories (np_dir, ' mkl_random/src' )
2626
2727# compiler/linker
28- cpp = meson .get_compiler(' cpp' )
2928cpp_args = [
3029 ' -D_FILE_OFFSET_BITS=64' ,
3130 ' -D_LARGEFILE_SOURCE=1' ,
@@ -35,12 +34,6 @@ cpp_args = [
3534]
3635link_args = []
3736
38- if cpp.get_argument_syntax() == ' msvc'
39- link_args += [' Advapi32.lib' ]
40- else
41- cpp_args += [' -Wno-unused-but-set-variable' , ' -Wno-unused-function' ]
42- endif
43-
4437rpath_link_args = []
4538if host_machine .system() != ' windows'
4639 if host_machine .system() == ' darwin'
@@ -63,7 +56,18 @@ mkl_dep = dependency('MKL', method: 'cmake',
6356 required : true
6457)
6558
66- # Cython extension
59+ # cpp must be added after MKL detection:
60+ # MKLConfig.cmake runs check_cxx_compiler_flag when CXX is present
61+ # in the cmake toolchain which fails with non-Intel clang++
62+ add_languages (' cpp' , native : false )
63+ cpp = meson .get_compiler(' cpp' )
64+
65+ if cpp.get_argument_syntax() == ' msvc'
66+ link_args += [' Advapi32.lib' ]
67+ else
68+ cpp_args += [' -Wno-unused-but-set-variable' , ' -Wno-unused-function' ]
69+ endif
70+
6771py.extension_module(
6872 ' mklrand' ,
6973 sources : [
0 commit comments