Skip to content

Commit e0c9f9b

Browse files
committed
Compile boost_graph with c++11 for older boosts
1 parent 2e32a7a commit e0c9f9b

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ build-requires = [
128128
host-requires = [
129129
"virtual:interface/blas",
130130
"virtual:compiler/fortran",
131-
"pkg:generic/boost",
132131
"pkg:generic/brial",
133132
"pkg:generic/cddlib",
134133
"pkg:generic/cliquer",
@@ -182,6 +181,7 @@ dependencies = [
182181

183182
[external.optional-host-requires]
184183
extra = [
184+
"pkg:generic/boost",
185185
"pkg:generic/bliss",
186186
"pkg:generic/coxeter3",
187187
"pkg:generic/mcqd",

src/sage/graphs/base/meson.build

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
boost_cpp17_compatible = false
2+
boost = dependency(
3+
'boost',
4+
version: '>=1.83.0',
5+
required: false,
6+
modules: ['graph', 'tuple'],
7+
)
8+
if boost.found()
9+
# Need at least v1.83.0 (https://github.com/boostorg/functional/commit/6a573e4b8333ee63ee62ce95558c3667348db233)
10+
# for C++17 compatibility.
11+
boost_cpp17_compatible = true
12+
else
13+
boost = dependency(
14+
'boost',
15+
version: '>=1.66.0',
16+
required: false,
17+
modules: ['graph', 'tuple'],
18+
)
19+
endif
20+
121
py.install_sources(
222
'__init__.py',
323
'all.py',
@@ -39,14 +59,23 @@ extension_data_cpp = {
3959
}
4060

4161
foreach name, pyx : extension_data_cpp
62+
deps = [py_dep, cysignals, gmp]
63+
override_options = ['cython_language=cpp']
64+
if name == 'boost_graph'
65+
deps += [boost]
66+
if not boost_cpp17_compatible
67+
override_options += ['cpp_std=c++11']
68+
endif
69+
endif
70+
4271
py.extension_module(
4372
name,
4473
sources: pyx,
4574
subdir: 'sage/graphs/base',
4675
install: true,
47-
override_options: ['cython_language=cpp'],
76+
override_options: override_options,
4877
include_directories: [inc_cpython, inc_data_structures, inc_rings],
49-
dependencies: [py_dep, cysignals, gmp],
78+
dependencies: deps,
5079
)
5180
endforeach
5281

0 commit comments

Comments
 (0)