Skip to content

Commit

Permalink
[Meson] Add an option to compile or not the binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison authored and nimgould committed Jan 3, 2025
1 parent f91baf5 commit 92923d2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 50 deletions.
1 change: 1 addition & 0 deletions README.meson
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Currently supported options with their default value:
* `-Dpythoniface=false`: build the Python interfaces in double precision;
* `-Dexamples=false`: generate the examples;
* `-Dtests=false`: generate the tests;
* `-Dbinaries=false`: generate the binaries;
* `-Dsingle=true`: generate the single precision library, tests and examples;
* `-Ddouble=true`: generate the double precision library, tests and examples;
* `-Dquadruple=false`: generate the quadruple precision library, tests and examples;
Expand Down
103 changes: 53 additions & 50 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ build_double = get_option('double')
build_quadruple = get_option('quadruple')
build_tests = get_option('tests')
build_examples = get_option('examples')
build_binaries = get_option('binaries')
build_ssids = get_option('ssids')

libblas_name = get_option('libblas')
Expand Down Expand Up @@ -648,59 +649,61 @@ if build_pythoniface and build_ciface and build_double and (not int64)
endif

# Binaries
galahad_binaries_single = galahad_binaries
galahad_binaries_double = galahad_binaries
galahad_binaries_quadruple = galahad_binaries
if libcutest_single.found()
galahad_binaries_single += galahad_cutest_binaries
endif
if libcutest_double.found()
galahad_binaries_double += galahad_cutest_binaries
endif
if libcutest_quadruple.found()
galahad_binaries_quadruple += galahad_cutest_binaries
endif
if build_binaries
galahad_binaries_single = galahad_binaries
galahad_binaries_double = galahad_binaries
galahad_binaries_quadruple = galahad_binaries
if libcutest_single.found()
galahad_binaries_single += galahad_cutest_binaries
endif
if libcutest_double.found()
galahad_binaries_double += galahad_cutest_binaries
endif
if libcutest_quadruple.found()
galahad_binaries_quadruple += galahad_cutest_binaries
endif

if build_single
foreach binary: galahad_binaries_single
binname = binary[0]
binfile = binary[1]
executable(binname+'_single', binfile,
dependencies : libgalahad_single_deps,
fortran_args : pp_flag + extra_args_single,
link_with : libgalahad_single,
link_language : 'fortran',
include_directories: libgalahad_include,
install : true)
endforeach
endif
if build_single
foreach binary: galahad_binaries_single
binname = binary[0]
binfile = binary[1]
executable(binname+'_single', binfile,
dependencies : libgalahad_single_deps,
fortran_args : pp_flag + extra_args_single,
link_with : libgalahad_single,
link_language : 'fortran',
include_directories: libgalahad_include,
install : true)
endforeach
endif

if build_double
foreach binary: galahad_binaries_double
binname = binary[0]
binfile = binary[1]
executable(binname+'_double', binfile,
dependencies : libgalahad_double_deps,
fortran_args : pp_flag + extra_args_double,
link_with : libgalahad_double,
link_language : 'fortran',
include_directories: libgalahad_include,
install : true)
endforeach
endif
if build_double
foreach binary: galahad_binaries_double
binname = binary[0]
binfile = binary[1]
executable(binname+'_double', binfile,
dependencies : libgalahad_double_deps,
fortran_args : pp_flag + extra_args_double,
link_with : libgalahad_double,
link_language : 'fortran',
include_directories: libgalahad_include,
install : true)
endforeach
endif

if build_quadruple
foreach binary: galahad_binaries_quadruple
binname = binary[0]
binfile = binary[1]
executable(binname+'_quadruple', binfile,
dependencies : libgalahad_quadruple_deps,
fortran_args : pp_flag + extra_args_quadruple,
link_with : libgalahad_quadruple,
link_language : 'fortran',
include_directories: libgalahad_include,
install : true)
endforeach
if build_quadruple
foreach binary: galahad_binaries_quadruple
binname = binary[0]
binfile = binary[1]
executable(binname+'_quadruple', binfile,
dependencies : libgalahad_quadruple_deps,
fortran_args : pp_flag + extra_args_quadruple,
link_with : libgalahad_quadruple,
link_language : 'fortran',
include_directories: libgalahad_include,
install : true)
endforeach
endif
endif

# Headers
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ option('tests',
value : false,
description : 'whether to generate the tests')

option('binaries',
type : 'boolean',
value : false,
description : 'whether to generate the binaries')

option('single',
type : 'boolean',
value : true,
Expand Down

0 comments on commit 92923d2

Please sign in to comment.