Skip to content

Commit f253701

Browse files
authored
Merge pull request #125 from Flow-IPC/tkt-118_cxx20-support
2 parents 5a2b4e7 + 9bb4a5c commit f253701

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

.github/workflows/main.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,14 @@ jobs:
215215
216216
strategy:
217217
fail-fast: false
218+
219+
# Please read notes in similar place in Flow's main.yml regarding the matrix's setup, especially
220+
# the bulk of it that discusses how the C++ standard setting (17, 20, etc.) is handled.
221+
# We omit that large comment here and related comments inline inside the `matrix`. Same deal as for Flow.
218222
matrix:
223+
cxx-std:
224+
- id: cxx17
225+
- id: cxx20
219226
compiler:
220227
- id: gcc-9
221228
name: gcc
@@ -451,11 +458,38 @@ jobs:
451458
build-test-cfg: { id: relwithdebinfo-tsan }
452459
- compiler: { id: clang-13 }
453460
build-test-cfg: { id: relwithdebinfo-tsan }
461+
# The rest of these deal with C++20; again please see Flow's main.yml commentary.
462+
# TODO: I am sure there's an overarching TODO somewhere around here to the same effect but... to
463+
# reiterate... it's unpleasant so much is copy-pasted from one .yml to the other, and even accepting
464+
# that it is odd that for some items the real comment is in A, while B says see A; while for others
465+
# it is the opposite. The info is there, and it's not redundant (only the code is), but still.
466+
- cxx-std: { id: cxx20 }
467+
compiler: { id: gcc-9 }
468+
- cxx-std: { id: cxx20 }
469+
compiler: { id: gcc-10 }
470+
- cxx-std: { id: cxx20 }
471+
compiler: { id: gcc-11 }
472+
- cxx-std: { id: cxx20 }
473+
compiler: { id: clang-13 }
474+
- cxx-std: { id: cxx20 }
475+
compiler: { id: clang-15 }
476+
- cxx-std: { id: cxx20 }
477+
compiler: { id: clang-16 }
478+
- cxx-std: { id: cxx20 }
479+
build-test-cfg: { id: release }
480+
- cxx-std: { id: cxx20 }
481+
build-test-cfg: { id: minsizerel }
482+
- cxx-std: { id: cxx20 }
483+
build-test-cfg: { id: relwithdebinfo-asan }
484+
- cxx-std: { id: cxx20 }
485+
build-test-cfg: { id: relwithdebinfo-ubsan }
486+
- cxx-std: { id: cxx20 }
487+
build-test-cfg: { id: relwithdebinfo-tsan }
454488

455489
# Not using ubuntu-latest, so as to avoid surprises with OS upgrades and such.
456490
runs-on: ubuntu-22.04
457491

458-
name: ${{ matrix.compiler.id }}-${{ matrix.build-test-cfg.id }}
492+
name: ${{ matrix.compiler.id }}-${{ matrix.build-test-cfg.id }}-${{ matrix.cxx-std.id }}
459493

460494
env:
461495
build-dir: ${{ github.workspace }}/build/${{ matrix.build-test-cfg.conan-profile-build-type }}
@@ -652,7 +686,7 @@ jobs:
652686
[settings]
653687
compiler = ${{ matrix.compiler.name }}
654688
compiler.version = ${{ matrix.compiler.version }}
655-
compiler.cppstd = 17
689+
compiler.cppstd = ${{ ((matrix.cxx-std.id == 'cxx20') && '20') || '17' }}
656690
# TODO: Consider testing with LLVM-libc++ also (with clang anyway).
657691
compiler.libcxx = libstdc++11
658692
arch = x86_64
@@ -672,10 +706,16 @@ jobs:
672706
${{ matrix.build-test-cfg.conan-profile-custom-buildenv }}
673707
674708
[options]
709+
# TODO: Are the next 2 lines needed, since we are building via `ipc` conanfile.py?
710+
# I (ygoldfel) am admittedly Conan-ignorant.
675711
flow:doc = False
676712
flow:build = True
677713
ipc:doc = False
678714
ipc:build = True
715+
# `0` here as of this writing would effectively mean `17` too. Specifying `17` explicitly has the same
716+
# effect in the end but goes down a slightly different code-path in FlowLikeCodeGenerate.cmake. It's not
717+
# a huge deal... but it's a little nice to cover more paths, so let's do the `0` path when applicable.
718+
ipc:build_cxx_std = ${{ ((matrix.cxx-std.id == 'cxx20') && '20') || '0' }}
679719
EOF
680720
# (Oddly enough `no-lto: True` and `...: False` do still evaluate as `true` and `false` respectively.
681721
# Hence why this compares against `false` and not `False`....)
@@ -1244,7 +1284,7 @@ jobs:
12441284
always()
12451285
uses: actions/upload-artifact@v4
12461286
with:
1247-
name: ipc-test-logs-${{ matrix.compiler.id }}-${{ matrix.build-test-cfg.id }}
1287+
name: ipc-test-logs-${{ matrix.compiler.id }}-${{ matrix.build-test-cfg.id }}-${{ matrix.cxx-std.id }}
12481288
path: ${{ env.install-dir }}/bin/logs.tgz
12491289

12501290
# TODO: Look into the topic of debuggability in case of a crash. Is a core generated? Is it saved?

conanfile.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class IpcRecipe(ConanFile):
3434
options = {
3535
"build": [True, False],
3636
"build_no_lto": [True, False],
37+
3738
# Replaces the core C/C++ compiler flags (not linker flags) for the chosen settings.build_type.
3839
# Note that these appear *after* any C[XX]FLAGS and tools.build.c[xx]flags
3940
# on the compiler command line, so it would not be
@@ -46,13 +47,18 @@ class IpcRecipe(ConanFile):
4647
# This affects `ipc` CMake only; meaning flow, ipc_*, ipc objects will have this overridden; while
4748
# Boost libs, jemalloc lib, capnp/kj, gtest libs will build how they would've built anyway.
4849
"build_type_cflags_override": "ANY",
50+
51+
# 0 => default (let build script decide, as of this writing 17 meaning C++17) or a #, probably `20` as of
52+
# this writing.
53+
"build_cxx_std": ["ANY"],
4954
"doc": [True, False],
5055
}
5156

5257
default_options = {
5358
"build": True,
5459
"build_no_lto": False,
5560
"build_type_cflags_override": "",
61+
"build_cxx_std": 0,
5662
"doc": False,
5763
}
5864

@@ -93,6 +99,8 @@ def generate(self):
9399
suffix = str(self.settings.build_type).upper()
94100
toolchain.variables["CMAKE_CXX_FLAGS_" + suffix] = self.options.build_type_cflags_override
95101
toolchain.variables["CMAKE_C_FLAGS_" + suffix] = self.options.build_type_cflags_override
102+
if self.options.build_cxx_std != 0:
103+
toolchain.variables["CMAKE_CXX_STANDARD"] = self.options.build_cxx_std
96104
else:
97105
toolchain.variables["CFG_SKIP_CODE_GEN"] = "ON"
98106
if self.options.doc:

0 commit comments

Comments
 (0)