Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Add wrap files for xtensor-0.21.5 #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions LICENSE.build

This file was deleted.

55 changes: 55 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
project('xtensor', 'cpp',
version:'0.21.5',
license:'BSD-3-Clause',
default_options : ['warning_level=3', 'cpp_std=c++14'])

xtl_dep = dependency('xtl',
version:['>=0.6.12', '<1.0.0'],
fallback : ['xtl', 'xtl_dep'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here, if mesonbuild/quantstack-xtl#1 includes a provide section, you should not need an explicit fallback.

required: false)

json_dep = dependency('nlohmann_json',
version:'>=3.1.1',
fallback : ['nlohmann_json', 'nlohmann_json_dep'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required: false)

required_deps_found = xtl_dep.found()

if get_option('XTENSOR_USE_XSIMD')
xsimd_dep = dependency('xsimd',
version: ['>=7.4.6', '<8.0.0'],
fallback : ['xsimd', 'xsimd_dep'],
required: false)
xtensor_cpp_arg = ['-DXTENSOR_USE_XSIMD']
required_deps_found = required_deps_found and xsimd_dep.found()
else
xsimd_dep = dependency('', required: false) # aka "not found"
xtensor_cpp_arg = []
endif

if required_deps_found
xtensor_dep = declare_dependency(
include_directories:include_directories('include', is_system: true),
dependencies: [xtl_dep, json_dep, xsimd_dep],
compile_args: xtensor_cpp_arg)
else
xtensor_dep = dependency('', required: false) # aka "not found"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I comprehend what's going on here. Shouldn't you just make every single required dependency be, well, required, and have the subproject fail if it cannot, in fact, be successfully configured to produce the subproject's entire reason for existing?

Am I missing something?

endif

extra_cflags = []

# Workaround from mesonbuild/meson github issue 2550
if meson.is_subproject()
install_dir = get_option('subproj_includedir')
extra_cflags += '-I' + get_option('prefix') / install_dir
else
install_dir = get_option('includedir')
endif

install_subdir('include/xtensor', install_dir: install_dir)

pkgconfig = import('pkgconfig')
pkgconfig.generate(name: meson.project_name(),
version: meson.project_version(),
description: 'xtensor is a C++ library meant for numerical analysis with multi-dimensional array expressions.',
extra_cflags: extra_cflags)
6 changes: 6 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
option('XTENSOR_USE_XSIMD', type: 'boolean', value: false, description: 'simd acceleration for xtensor')
option('subproj_includedir',
type: 'string',
value: 'include',
description: 'Header file directory when built as subproject',
yield: true)
6 changes: 6 additions & 0 deletions upstream.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[wrap-file]
directory=xtensor-0.21.5

source_url=https://github.com/xtensor-stack/xtensor/archive/0.21.5.zip
source_filename=xtensor-0.21.5.zip
source_hash=f08aca41dc89128524dec04c82b590d9e0f1e923311e82bab9f024c99e7bb73a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to add https://mesonbuild.com/Wrap-dependency-system-manual.html#provide-section

Upstream provides https://github.com/xtensor-stack/xtensor/blob/master/xtensor.pc.in so users should be able to dependency('xtensor') and the [provide] section tells meson how to find that dependency without using fallbacks.