Skip to content

Commit

Permalink
CI: examples in amalgamation build
Browse files Browse the repository at this point in the history
  • Loading branch information
FAlbertDev committed Oct 14, 2024
1 parent e2f7a58 commit 120398b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3440,6 +3440,8 @@ def link_headers(headers, visibility, directory):
build_paths.lib_sources = amalg_cpp_files
template_vars['generated_files'] = ' '.join(amalg_cpp_files + amalg_headers)

link_headers(amalg_headers, 'public', build_paths.public_include_dir)

# Inserting an amalgamation generated using DLL visibility flags into a
# binary project will either cause errors (on Windows) or unnecessary overhead.
# Provide a hint
Expand Down
13 changes: 13 additions & 0 deletions src/examples/amalgamation_header.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
#if __has_include(<botan/botan_all.h>)
#include <botan/botan_all.h>
#else
// if the amalgamation header isn't available, you have to IWYU.
#include <botan/hex.h>
#endif

int main() {
std::cout << "With an amalgamation build you can include everything using the botan_all header.\n";
std::cout << "That's " << Botan::hex_encode(std::vector<uint8_t>{0xC0, 0x01}) << "\n";
return 0;
}
4 changes: 2 additions & 2 deletions src/scripts/ci/setup_gh_actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if type -p "apt-get"; then
sudo apt-get -qq install libboost-dev "${tpm2_specific_packages[@]}"
echo "BOTAN_TPM2_ENABLED=${ci_support_of_tpm2}" >> "$GITHUB_ENV"

elif [ "$TARGET" = "examples" ] || [ "$TARGET" = "tlsanvil" ] || [ "$TARGET" = "clang-tidy" ] ; then
elif [ "$TARGET" = "examples" ] || [ "$TARGET" = "amalgamation" ] || [ "$TARGET" = "tlsanvil" ] || [ "$TARGET" = "clang-tidy" ] ; then
sudo apt-get -qq install libboost-dev libtss2-dev
build_and_install_jitterentropy

Expand Down Expand Up @@ -186,7 +186,7 @@ else
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew install ccache

if [ "$TARGET" = "shared" ]; then
if [ "$TARGET" = "shared" ] || [ "$TARGET" = "amalgamation" ] ; then
brew install boost

# On Apple Silicon we need to specify the include directory
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/ci/setup_gh_actions_after_vcvars.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#
# Botan is released under the Simplified BSD License (see license.txt)

if ($args[0] -in @('shared')) {
$targets_with_boost = @("shared", "amalgamation")

if ($targets_with_boost -contains $args[0]) {
nuget install -NonInteractive -OutputDirectory $env:DEPENDENCIES_LOCATION -Version 1.79.0 boost

$boostincdir = Join-Path -Path $env:DEPENDENCIES_LOCATION -ChildPath "boost.1.79.0/lib/native/include"
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/ci_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def build_targets(target, target_os):
yield 'bogo_shim'
if target in ['sanitizer'] and target_os not in ['windows']:
yield 'bogo_shim'
if target in ['examples']:
if target in ['examples', 'amalgamation']:
yield 'examples'
if target in ['valgrind', 'valgrind-full']:
yield 'ct_selftest'
Expand Down Expand Up @@ -425,7 +425,7 @@ def sanitize_kv(some_string):
flags += ['--with-commoncrypto']

def add_boost_support(target, target_os):
if target in ['coverage', 'shared']:
if target in ['coverage', 'shared', 'amalgamation']:
return True

if target == 'sanitizer' and target_os == 'linux':
Expand Down Expand Up @@ -803,7 +803,7 @@ def main(args=None):
if target in ['coverage', 'fuzzers']:
make_targets += ['fuzzer_corpus_zip', 'fuzzers']

if target in ['examples']:
if target in ['examples', 'amalgamation']:
make_targets += ['examples']

if target in ['valgrind', 'valgrind-full']:
Expand Down

0 comments on commit 120398b

Please sign in to comment.