Skip to content

Commit

Permalink
[Meson] Update the main meson.build
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Dec 22, 2024
1 parent 9a10204 commit b2db864
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 90 deletions.
4 changes: 3 additions & 1 deletion .github/julia/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ meson setup builddir --cross-file=${MESON_TARGET_TOOLCHAIN%.*}_gcc.meson \
-Dlibhwloc=$HWLOC \
-Dlibblas=openblas \
-Dliblapack=openblas \
-Dquadruple=true \
-Dlibhsl_modules=$prefix/modules
meson compile -C builddir
Expand All @@ -61,7 +62,8 @@ platforms = expand_gfortran_versions(platforms)
# The products that we will ensure are always built
products = [
LibraryProduct("libgalahad_single", :libgalahad_single),
LibraryProduct("libgalahad_double", :libgalahad_double)
LibraryProduct("libgalahad_double", :libgalahad_double),
LibraryProduct("libgalahad_quadruple", :libgalahad_quadruple)
]

# Dependencies that must be installed before this package can be built
Expand Down
8 changes: 2 additions & 6 deletions .github/meson/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,8 @@ runs:
-Dlibcutest_single=${CUTEST_SINGLE} \
-Dlibcutest_double=${CUTEST_DOUBLE} \
-Dlibcutest_quadruple=${CUTEST_QUADRUPLE} \
-Dlibcutest_single_path=$CUTEST/${LIBDIR} \
-Dlibcutest_double_path=$CUTEST/${LIBDIR} \
-Dlibcutest_quadruple_path=$CUTEST/${LIBDIR} \
-Dlibcutest_single_modules=../CUTEst/modules \
-Dlibcutest_double_modules=../CUTEst/modules \
-Dlibcutest_quadruple_modules=../CUTEst/modules \
-Dlibcutest_path=$CUTEST/${LIBDIR} \
-Dlibcutest_modules=../CUTEst/modules \
-Dlibhsl=${HSL} \
-Dlibhsl_path=${HSL_PATH} \
-Dlibhsl_modules=../deps/modules
Expand Down
16 changes: 9 additions & 7 deletions README.meson
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ meson setup builddir/pc64.lnx.gfo -Dint64=false (default)
meson setup builddir/pc64.lnx.gfo -Dint64=true
```

Note that all dependencies (BLAS, LAPACK, METIS, etc...) must also be compiled with 64-bit integers.
Note that all dependencies (BLAS, LAPACK, etc...) must also be compiled with 64-bit integers.
To force Meson to not use a dependency compiled with 32-bit integers, you can use the option `-Dlibdep=`
where `libdep` is an option described below to provide the name of the library.
GALAHAD will not link with the dependency or compile its own 64-bit version, except for BLAS, LAPACK and METIS.
GALAHAD will not link with the dependency or compile its own 64-bit version, except for BLAS and LAPACK.

```shell
meson setup builddir/pc64.lnx.gfo -Dint64=true -Dlibblas= -Dliblapack= -Dlibmetis=
Expand Down Expand Up @@ -74,14 +74,15 @@ Currently supported options with their default value:
* `-Dtests=false`: generate the tests;
* `-Dsingle=true`: generate the single precision library, tests and examples;
* `-Ddouble=true`: generate the double precision library, tests and examples;
* `-Dquadruple=true`: generate the quadruple precision library, tests and examples;
* `-Dquadruple=false`: generate the quadruple precision library, tests and examples;
* `-Dssids=true`: build ssids;
* `-Dlibblas=openblas`: BLAS library against which to link;
* `-Dliblapack=openblas`: LAPACK library against which to link;
* `-Dlibhsl=hsl`: HSL library against which to link;
* `-Dlibcutest=cutest`: CUTEst library against which to link;
* `-Dlibhsl=hsl_subset`: HSL library against which to link;
* `-Dlibcutest_single=cutest_single`: CUTEst library in single precision against which to link;
* `-Dlibcutest_double=cutest_double`: CUTEst library in double precision against which to link;
* `-Dlibcutest_quadruple=cutest_quadruple`: CUTEst library in quadruple precision against which to link;
* `-Dlibwsmp=wsmp`: WSMP library against which to link;
* `-Dlibumfpack=umfpack`: UMFPACK library against which to link;
* `-Dlibpardiso=pardiso`: PARDISO library against which to link;
* `-Dlibspmf=spmf`: SPMF library against which to link;
* `-Dlibpastix=pastix`: PASTIX library against which to link;
Expand All @@ -92,7 +93,7 @@ Currently supported options with their default value:
* `-Dlibblas_path=[]`: additional directories to search for the BLAS library;
* `-Dliblapack_path=[]`: additional directories to search for the LAPACK library;
* `-Dlibhsl_path=[]`: additional directories to search for the HSL library;
* `-Dlibcutest_path=[]`: additional directories to search for the CUTEST library;
* `-Dlibcutest_path=[]`: additional directories to search for the CUTEST libraries;
* `-Dlibwsmp_path=[]`: additional directories to search for the WSMP library;
* `-Dlibpardiso_path=[]`: additional directories to search for the PARDISO library;
* `-Dlibspmf_path=[]`: additional directories to search for the SPMF library;
Expand All @@ -102,6 +103,7 @@ Currently supported options with their default value:
* `-Dlibhwloc_path=[]`: additional directories to search for the HWLOC library;
* `-Dlibhwloc_include=[]`: additional directories to search for the HWLOC header files;
* `-Dlibhsl_modules[]`: additional directories to search for the HSL modules;
* `-Dlibcutest_modules[]`: additional directories to search for the CUTEst modules;
* `-Dint64=false`: compile GALAHAD with 64-bit integer.

Non-default compilers can be selected by setting the `CC`, `CXX` and
Expand Down
75 changes: 23 additions & 52 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,20 @@ libpardiso_path = get_option('libpardiso_path')
libspmf_path = get_option('libspmf_path')
libpastixf_path = get_option('libpastixf_path')
libampl_path = get_option('libampl_path')
libcutest_single_path = get_option('libcutest_single_path')
libcutest_double_path = get_option('libcutest_double_path')
libcutest_quadruple_path = get_option('libcutest_quadruple_path')
libcutest_path = get_option('libcutest_path')
libhwloc_path = get_option('libhwloc_path')

libhwloc_include = include_directories(get_option('libhwloc_include'))
libcutest_single_modules = include_directories(get_option('libcutest_single_modules'))
libcutest_double_modules = include_directories(get_option('libcutest_double_modules'))
libcutest_quadruple_modules = include_directories(get_option('libcutest_quadruple_modules'))
libhsl_modules = include_directories(get_option('libhsl_modules'))
libcutest_modules = include_directories(get_option('libcutest_modules'))

# Dependencies
libblas = fc.find_library(libblas_name, dirs : libblas_path, required : false)
liblapack = fc.find_library(liblapack_name, dirs : liblapack_path, required : false)
libhsl = fc.find_library(libhsl_name, dirs : libhsl_path, required : false)
libcutest_single = fc.find_library(libcutest_single_name, dirs : libcutest_single_path, required : false)
libcutest_double = fc.find_library(libcutest_double_name, dirs : libcutest_double_path, required : false)
libcutest_quadruple = fc.find_library(libcutest_quadruple_name, dirs : libcutest_quadruple_path, required : false)
libcutest_single = fc.find_library(libcutest_single_name, dirs : libcutest_path, required : false)
libcutest_double = fc.find_library(libcutest_double_name, dirs : libcutest_path, required : false)
libcutest_quadruple = fc.find_library(libcutest_quadruple_name, dirs : libcutest_path, required : false)
libwsmp = fc.find_library(libwsmp_name, dirs : libwsmp_path, required : false)
libpardiso = fc.find_library(libpardiso_name, dirs : libpardiso_path, required : false)
libspmf = fc.find_library(libspmf_name, dirs : libspmf_path, required : false)
Expand Down Expand Up @@ -251,11 +247,7 @@ galahad_python_tests = []
libgalahad_include = [include_directories('include'),
include_directories('src/dum/include'),
include_directories('src/metis/include'),
include_directories('src/ampl')] + libhsl_modules + libhwloc_include

libgalahad_single_include = libgalahad_include + libcutest_single_modules
libgalahad_double_include = libgalahad_include + libcutest_double_modules
libgalahad_quadruple_include = libgalahad_include + libcutest_quadruple_modules
include_directories('src/ampl')] + libhsl_modules + libcutest_modules + libhwloc_include

if host_machine.system() == 'linux'
add_global_arguments('-DSPRAL_HAVE_SCHED_GETCPU', language : 'cpp')
Expand Down Expand Up @@ -521,7 +513,7 @@ if build_single
cpp_args : extra_args_single,
link_language : 'fortran',
link_args : lstdcpp,
include_directories: libgalahad_single_include,
include_directories: libgalahad_include,
install : true)
endif

Expand Down Expand Up @@ -574,7 +566,7 @@ if build_double
cpp_args : extra_args_double,
link_language : 'fortran',
link_args : lstdcpp,
include_directories: libgalahad_double_include,
include_directories: libgalahad_include,
install : true)
endif

Expand Down Expand Up @@ -627,7 +619,7 @@ if build_quadruple
cpp_args : extra_args_quadruple,
link_language : 'fortran',
link_args : lstdcpp,
include_directories: libgalahad_quadruple_include,
include_directories: libgalahad_include,
install : true)
endif

Expand All @@ -650,7 +642,7 @@ if build_pythoniface and build_ciface and build_double
sources : file,
link_with : libgalahad_double,
link_language : 'c',
include_directories : libgalahad_double_include + incdir_numpy,
include_directories : libgalahad_include + incdir_numpy,
subdir : 'galahad',
install : true)
endforeach
Expand Down Expand Up @@ -679,7 +671,7 @@ if build_single
fortran_args : pp_flag + extra_args_single,
link_with : libgalahad_single,
link_language : 'fortran',
include_directories: libgalahad_single_include,
include_directories: libgalahad_include,
install : true)
endforeach
endif
Expand All @@ -693,7 +685,7 @@ if build_double
fortran_args : pp_flag + extra_args_double,
link_with : libgalahad_double,
link_language : 'fortran',
include_directories: libgalahad_double_include,
include_directories: libgalahad_include,
install : true)
endforeach
endif
Expand All @@ -707,7 +699,7 @@ if build_quadruple
fortran_args : pp_flag + extra_args_quadruple,
link_with : libgalahad_quadruple,
link_language : 'fortran',
include_directories: libgalahad_quadruple_include,
include_directories: libgalahad_include,
install : true)
endforeach
endif
Expand Down Expand Up @@ -748,15 +740,12 @@ if build_tests

if precision == 'single'
deps_tests = libgalahad_single_deps
include_tests = libgalahad_single_include
endif
if precision == 'double'
deps_tests = libgalahad_double_deps
include_tests = libgalahad_double_include
endif
if precision == 'quadruple'
deps_tests = libgalahad_quadruple_deps
include_tests = libgalahad_quadruple_include
endif

if not (name == 'croti_single' or name == 'croti_quadruple')
Expand All @@ -766,7 +755,7 @@ if build_tests
link_with : libgalahad_precision,
dependencies : deps_tests,
link_language : 'fortran',
include_directories: include_tests,
include_directories: libgalahad_include,
install : true,
install_dir : fortran_tests_folder),
suite : [package, precision, 'fortran'],
Expand All @@ -789,22 +778,11 @@ if build_tests and build_ciface
package = test[0]
name = test[1] + '_' + precision
file = test[2]

if precision == 'single'
include_tests = libgalahad_single_include
endif
if precision == 'double'
include_tests = libgalahad_double_include
endif
if precision == 'quadruple'
include_tests = libgalahad_quadruple_include
endif

test(name,
executable(name, file,
c_args : args_precision, link_with : libgalahad_precision,
dependencies : [lm, libquadmath], link_language : 'c',
include_directories : include_tests, install : true,
include_directories : libgalahad_include, install : true,
install_dir : c_tests_folder),
suite : [package, precision, 'C'],
is_parallel : false)
Expand Down Expand Up @@ -836,8 +814,10 @@ if build_examples and build_double and (not int64)
foreach example: galahad_examples
name = example[0]
file = example[1]
executable(name, file, link_with : libgalahad_double, dependencies : libgalahad_double_deps, link_language : 'fortran',
include_directories : libgalahad_double_include, install : true, install_dir : fortran_examples_folder)
executable(name, file, link_with : libgalahad_double,
dependencies : libgalahad_double_deps, link_language : 'fortran',
include_directories : libgalahad_include,
install : true, install_dir : fortran_examples_folder)
endforeach
endif

Expand All @@ -853,19 +833,10 @@ if build_examples and build_ciface
libgalahad_precision = val[2]
name = example[0] + '_' + precision
file = example[1]

if precision == 'single'
include_examples = libgalahad_single_include
endif
if precision == 'double'
include_examples = libgalahad_double_include
endif
if precision == 'quadruple'
include_examples = libgalahad_quadruple_include
endif

executable(name, file, c_args : args_precision, link_with : libgalahad_precision, dependencies : [lm, libquadmath], link_language : 'c',
include_directories : include_examples, install : true, install_dir : c_examples_folder)
executable(name, file, c_args : args_precision, link_with : libgalahad_precision,
dependencies : [lm, libquadmath], link_language : 'c',
include_directories : libgalahad_include,
install : true, install_dir : c_examples_folder)
endforeach
endforeach
endif
28 changes: 4 additions & 24 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,10 @@ option('libhsl_path',
value : [],
description : 'Additional directories to search for the HSL library')

option('libcutest_single_path',
option('libcutest_path',
type : 'array',
value : [],
description : 'Additional directories to search for the CUTEST library in single precision')

option('libcutest_double_path',
type : 'array',
value : [],
description : 'Additional directories to search for the CUTEST library in double precision')

option('libcutest_quadruple_path',
type : 'array',
value : [],
description : 'Additional directories to search for the CUTEST library in quadruple precision')
description : 'Additional directories to search for the CUTEST libraries')

option('libwsmp_path',
type : 'array',
Expand Down Expand Up @@ -188,20 +178,10 @@ option('libhsl_modules',
value : [],
description : 'Additional directories to search for the HSL modules')

option('libcutest_single_modules',
type : 'array',
value : [],
description : 'Additional directories to search for the CUTEST modules in single precision')

option('libcutest_double_modules',
type : 'array',
value : [],
description : 'Additional directories to search for the CUTEST modules in double precision')

option('libcutest_quadruple_modules',
option('libcutest_modules',
type : 'array',
value : [],
description : 'Additional directories to search for the CUTEST modules in quadruple precision')
description : 'Additional directories to search for the CUTEST modules')

option('int64',
type : 'boolean',
Expand Down

0 comments on commit b2db864

Please sign in to comment.