meson.build#
The file meson.build
can be used to build the examples using Meson.
project('HpkExamples', 'cpp',
version: '0.5.1',
meson_version: '>=1.0.0',
default_options: ['cpp_std=c++17',
'b_ndebug=if-release',
'warning_level=3',
'pkg_config_path=/opt/libhpk0/lib/pkgconfig'
+ ':/opt/libhpk0/lib64/pkgconfig'])
# This example project is distributed with Hpk and is given the same version
# as Hpk itself. Below, we set the variable hpkVersion to be our version, and
# we will require an exact match when looking up Hpk dependencies.
hpkVersion = meson.project_version()
hpk_core = dependency('hpk_core',
version: hpkVersion, method: 'pkg-config')
if (host_machine.cpu_family() == 'x86_64')
hpk_fft_fp32 = dependency('hpk_fft_avx2_fp32',
version: hpkVersion, method: 'pkg-config')
hpk_fft_fp64 = dependency('hpk_fft_avx2_fp64',
version: hpkVersion, method: 'pkg-config')
hpk_fft_openmp = dependency('hpk_fft_iomp',
version: hpkVersion, method: 'pkg-config',
required: false, disabler: true)
elif (host_machine.cpu_family() == 'aarch64')
hpk_fft_fp32 = dependency('hpk_fft_sve256_fp32',
version: hpkVersion, method: 'pkg-config')
hpk_fft_fp64 = dependency('hpk_fft_sve256_fp64',
version: hpkVersion, method: 'pkg-config')
hpk_fft_openmp = dependency('hpk_fft_omp',
version: hpkVersion, method: 'pkg-config',
required: false, disabler: true)
else
error('Unsupported host cpu')
endif
# The dynamic link interface (dlopen, dlsym, etc.) is built into libc.so.6 for
# glibc >= 2.34, so the following is needed only on older platforms:
dl = dependency('dl')
# The first example below uses only single precision, so we list only that
# as a dependency. Meson knows that the fft libraries depend on hpk_core
# and will automatically add that dependency as well.
executable('example', 'example.cpp', dependencies: [hpk_fft_fp32, dl])
# The next example uses both single and double precision.
# Note that we can explicitly list hpk_core as a dependency if we choose.
executable('fft_cc', 'fft_cc.cpp',
dependencies: [hpk_fft_fp32, hpk_fft_fp64, hpk_core, dl])
# This 2D example uses single precision and OpenMP parallelism.
# It is disabled (not built) if the Hpk omp library was not found.
executable('fft_cc_2d', 'fft_cc_2d.cpp',
dependencies: [hpk_fft_fp32, hpk_fft_openmp, hpk_core, dl])
# This real time domain example uses only single precision.
executable('fft_rc', 'fft_rc.cpp', dependencies: [hpk_fft_fp32, hpk_core, dl])
# This will build the advanced examples:
subdir('advanced')