diff --git a/meson.build b/meson.build index 5c43a988813f62bfb06785e790873be62e8f87e6..ddd2aefc199c69fd7243e69441d001bc52d76af7 100644 --- a/meson.build +++ b/meson.build @@ -3,15 +3,37 @@ project('usadelndsoc', ['cpp', 'fortran'], meson_version: '>= 0.55.0', default_options : ['cpp_std=c++17', 'build.cpp_std=c++17']) +cpp = meson.get_compiler('cpp') + cppad_dep = dependency('cppad') eigen3_dep = dependency('eigen3') +if not cppad_dep.found() + cppad_dep = cpp.find_library('libcppad_lib', + dirs : [get_option('cppad_lib')], + has_headers : ['cppad/cppad.h'], + header_include_directories : [get_option('cppad_inc')]) + if not cppad_dep.found() + cppad_dep = cpp.find_library('cppad_lib', + dirs : [get_option('cppad_lib')], + has_headers : ['cppad/cppad.h'], + header_include_directories : [get_option('cppad_inc')], + required : true) + endif +endif + +if not eigen3_dep.found() + if cpp.has_header('Eigen/Core', include_directories : [get_option('eigen_lib')]) + eigen3_dep = declare_dependency(include_directories : [get_option('eigen_lib')]) + else + error('Eigen/Core header not found') + endif +endif + py_mod = import('python') py3 = py_mod.find_installation('python3') py3_dep = py3.dependency() -cpp = meson.get_compiler('cpp') - incdir_numpy = run_command(py3, [ '-c', diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000000000000000000000000000000000..735211202513d7d1b6835895322cabfb98412481 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,6 @@ +option('cppad_inc', + type: 'string') +option('cppad_lib', + type: 'string') +option('eigen_inc', + type: 'string')