From 1fd6ce88685eae824f60bf2eaa73de408bd13448 Mon Sep 17 00:00:00 2001 From: Antony Chan Date: Wed, 13 Nov 2024 07:53:40 -0800 Subject: [PATCH] Resolve build system warnings Ensure meson version >=1.1 . Link with native liblapack on Ubuntu 20.04 because of stack overflow issue of `_zgel` with libopenblas64 and liblapack64 , as well as write beyond scope issue of SVD decomposition. Don't call BLAS for matrix-matrix multiplications. --- .../packagefiles/armadillo-code/meson.build | 25 ++++++++++++++----- .../packagefiles/armadillo-code/meson.options | 11 ++++++++ examples/meson.build | 2 +- meson.build | 1 + 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 3rdparty/packagefiles/armadillo-code/meson.options diff --git a/3rdparty/packagefiles/armadillo-code/meson.build b/3rdparty/packagefiles/armadillo-code/meson.build index 8800da3..46c8b42 100644 --- a/3rdparty/packagefiles/armadillo-code/meson.build +++ b/3rdparty/packagefiles/armadillo-code/meson.build @@ -1,15 +1,28 @@ project('armadillo', 'cpp', - version: '14.1.x', + version: '14.0.x', ) # Header-only library armadillo_inc = include_directories('include') +if get_option('lapack') == 'openblas64' + lapack_dep = dependency('openblas64') +elif get_option('lapack') == 'openblas' + lapack_dep = dependency('openblas') +elif get_option('lapack') == 'lapack64' + lapack_dep = dependency('lapack64') +else # lapack or altas + lapack_dep = dependency('lapack') +endif + + armadillo_dep = declare_dependency( include_directories: armadillo_inc, + compile_args: [ + '-DARMA_DONT_USE_BLAS', + '-DARMA_DONT_USE_ARPACK', + ], dependencies: [ - dependency('openblas', required: false), - dependency('lapack', required: false), - dependency('arpack2', required: false), - ] -) \ No newline at end of file + lapack_dep, + ], +) diff --git a/3rdparty/packagefiles/armadillo-code/meson.options b/3rdparty/packagefiles/armadillo-code/meson.options new file mode 100644 index 0000000..017520c --- /dev/null +++ b/3rdparty/packagefiles/armadillo-code/meson.options @@ -0,0 +1,11 @@ +option('lapack', + description: 'Choose an implementation of the LAPACK solver', + type: 'combo', + choices: [ + 'openblas64', + 'openblas', + 'lapack64', + 'lapack', + ], + value: 'openblas', +) diff --git a/examples/meson.build b/examples/meson.build index e5c8e41..bb39fe2 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,4 +1,4 @@ -add_languages('c') +add_languages('c', native: false) hdf5_dep = dependency('hdf5', language: 'c', required: false) diff --git a/meson.build b/meson.build index 132c243..ac1ed88 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,5 @@ project('MicroscPSF', 'cpp', + meson_version: '>=1.1', license: 'MIT', license_files: [ 'LICENSE.txt',