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 Aug 15, 2024
1 parent 6aabd85 commit b123eaf
Show file tree
Hide file tree
Showing 5 changed files with 25 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
15 changes: 15 additions & 0 deletions src/examples/amalgamation_header.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream>
#if __has_include(<botan/botan_all.h>)
#include <botan/botan_all.h>

int main() {
std::cout << "Build with amalgamation.\n";
std::cout << "That's " << Botan::hex_encode(std::vector<uint8_t>{0xC0, 0x01}) << "\n";
return 0;
}
#else
int main() {
std::cout << "Build without amalgamation.\n";
return 0;
}
#endif
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 @@ -33,7 +33,7 @@ if type -p "apt-get"; then
# (l)ist mode (avoiding https://github.com/actions/runner-images/issues/9996)
sudo NEEDRESTART_MODE=l apt-get -qq install valgrind

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

elif [ "$TARGET" = "clang" ]; then
Expand Down Expand Up @@ -138,7 +138,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 @@ -781,7 +781,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 b123eaf

Please sign in to comment.