Skip to content

Commit

Permalink
Per preceding TODO -- parameterizing Conan profile to optionally fore…
Browse files Browse the repository at this point in the history
…go LTO. This may not be the most elegant way in terms of Python, but the essence is fine.
  • Loading branch information
ygoldfeld committed Dec 15, 2023
1 parent d4093ca commit eb4e910
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Create Conan profile
run: |
cat <<EOF > conan_profile
cat <<'EOF' > conan_profile
[settings]
compiler = ${{ matrix.compiler.name }}
compiler.version = ${{ matrix.compiler.version }}
Expand All @@ -69,8 +69,8 @@ jobs:
CXX = ${{ matrix.compiler.cpp-path }}
[options]
ipc:build = False
ipc:doc = True
ipc:build = False
EOF
- name: Install Flow-IPC dependencies (like Doxygen) with Conan using the profile
Expand Down Expand Up @@ -178,8 +178,7 @@ jobs:
data['compiler']['gcc']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined']
data['compiler']['clang']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined']
option-env-name: ASAN
cmake-flags: | # At least ASAN with clang + LTO => cryptic link error. No need for LTO when *SAN.
-DCFG_NO_LTO=ON
no-lto: true # At least ASAN with clang + LTO => cryptic link error. No need for LTO when *SAN.
- id: relwithdebinfo-ubsan
conan-profile-build-type: RelWithDebInfo
conan-profile-jemalloc-build-type: Release
Expand All @@ -198,8 +197,7 @@ jobs:
data['compiler']['gcc']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined']
data['compiler']['clang']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined']
option-env-name: UBSAN
cmake-flags: | # While UBSAN might work with LTO, I do not want the aggravation/entropy. Turn it off.
-DCFG_NO_LTO=ON
no-lto: true # While UBSAN might work with LTO, I do not want the aggravation/entropy. Turn it off.
- id: relwithdebinfo-tsan
conan-profile-build-type: RelWithDebInfo
conan-profile-jemalloc-build-type: Release
Expand Down Expand Up @@ -235,7 +233,7 @@ jobs:
Shm_session_data_test.Multithread_object_database
skip-transport-tests: true # TODO: Explain why briefly (even though there's prob a ticket).
option-env-name: TSAN
cmake-flags: # See the other *SAN; but for now I heed jkontrik's words to keep consistent with non-*SAN.
no-lto: false # See the other *SAN; but for now I heed jkontrik's words to keep consistent with non-*SAN.
- id: relwithdebinfo-msan
conan-profile-build-type: RelWithDebInfo
conan-profile-jemalloc-build-type: Release
Expand All @@ -253,8 +251,7 @@ jobs:
conan-custom-settings-defs: |
data['compiler']['gcc']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined']
data['compiler']['clang']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined']
cmake-flags: | # While MSAN might work with LTO, I do not want the aggravation/entropy. Turn it off.
-DCFG_NO_LTO=ON
no-lto: true # While MSAN might work with LTO, I do not want the aggravation/entropy. Turn it off.

# We concentrate on clang sanitizers; they are newer/nicer; also MSAN is clang-only. So gcc ones excluded.
# Attention! Excluding some sanitizer job(s) (with these reasons):
Expand Down Expand Up @@ -412,7 +409,7 @@ jobs:
- name: Create Conan profile
run: |
cat <<EOF > conan_profile
cat <<'EOF' > conan_profile
[settings]
compiler = ${{ matrix.compiler.name }}
compiler.version = ${{ matrix.compiler.version }}
Expand All @@ -435,11 +432,14 @@ jobs:
${{ matrix.build-test-cfg.conan-profile-custom-buildenv }}
[options]
ipc:build = True
ipc:doc = False
flow:build = True
flow:doc = False
flow:build = True
ipc:doc = False
ipc:build = True
EOF
if [ "${{ matrix.build-test-cfg.no-lto }}" != '' ]; then
echo 'ipc:build_no_lto = True'
fi
# We need to prepare a sanitizer ignore-list in MSAN mode. Background for this is subtle and annoying:
# As it stands, whatever matrix compiler/build-type is chosen applies not just to our code (correct)
Expand Down
26 changes: 16 additions & 10 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,39 @@ class IpcRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"

options = {
"build": [True, False],
"build": [True, False],
"build_no_lto": [True, False],
"doc": [True, False],
}

default_options = {
"build": True,
"build": True,
"build_no_lto": False,
"doc": False,
}

def configure(self):
if self.options.build:
self.options["jemalloc"].enable_cxx = False
self.options["jemalloc"].enable_cxx = False
self.options["jemalloc"].prefix = "je_"

def generate(self):
deps = CMakeDeps(self)
if self.options.doc:
deps.build_context_activated = ["doxygen/1.9.4"]
deps.generate()

toolchain = CMakeToolchain(self)
if self.options.build:
toolchain.variables["CFG_ENABLE_TEST_SUITE"] = "ON"
toolchain.variables["JEMALLOC_PREFIX"] = self.options["jemalloc"].prefix
if self.options.build_no_lto:
toolchain.variables["CFG_NO_LTO"] = "ON"
if self.options.doc:
toolchain.variables["CFG_ENABLE_DOC_GEN"] = "ON"
toolchain.variables["CFG_SKIP_CODE_GEN"] = "ON"
toolchain.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
Expand All @@ -44,15 +48,17 @@ def build(self):
if self.options.build:
self.run("cmake --build . -- --keep-going VERBOSE=1")
if self.options.doc:
# Note: `flow_doc_public flow_doc_full` could also be added here and work; however
# we leave that to `flow` and its own Conan setup.
self.run("cmake --build . -- ipc_doc_public ipc_doc_full --keep-going VERBOSE=1")

def requirements(self):
if self.options.build:
self.requires("capnproto/1.0.1")
self.requires("flow/1.0")
self.requires("gtest/1.14.0")
self.requires("jemalloc/5.2.1")

def build_requirements(self):
self.tool_requires("cmake/3.26.3")
if self.options.doc:
Expand All @@ -61,6 +67,6 @@ def build_requirements(self):
def package(self):
cmake = CMake(self)
cmake.install()

def layout(self):
cmake_layout(self)

0 comments on commit eb4e910

Please sign in to comment.