diff --git a/configure.py b/configure.py index 04a50fc2f1e..b52fe708bbf 100755 --- a/configure.py +++ b/configure.py @@ -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 diff --git a/src/examples/amalgamation_header.cpp b/src/examples/amalgamation_header.cpp new file mode 100644 index 00000000000..4c65b6554ba --- /dev/null +++ b/src/examples/amalgamation_header.cpp @@ -0,0 +1,15 @@ +#include +#if __has_include() + #include + +int main() { + std::cout << "Build with amalgamation.\n"; + std::cout << "That's " << Botan::hex_encode(std::vector{0xC0, 0x01}) << "\n"; + return 0; +} +#else +int main() { + std::cout << "Build without amalgamation.\n"; + return 0; +} +#endif diff --git a/src/scripts/ci/setup_gh_actions.sh b/src/scripts/ci/setup_gh_actions.sh index 6c221f529d6..c1f83987009 100755 --- a/src/scripts/ci/setup_gh_actions.sh +++ b/src/scripts/ci/setup_gh_actions.sh @@ -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 @@ -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 diff --git a/src/scripts/ci/setup_gh_actions_after_vcvars.ps1 b/src/scripts/ci/setup_gh_actions_after_vcvars.ps1 index 06dd072ab0d..290db6340ea 100644 --- a/src/scripts/ci/setup_gh_actions_after_vcvars.ps1 +++ b/src/scripts/ci/setup_gh_actions_after_vcvars.ps1 @@ -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" diff --git a/src/scripts/ci_build.py b/src/scripts/ci_build.py index cf4f90406db..abcedc56cf9 100755 --- a/src/scripts/ci_build.py +++ b/src/scripts/ci_build.py @@ -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' @@ -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': @@ -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']: