VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m26s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m38s
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Successful in 1m26s
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Successful in 1m18s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Successful in 1m15s
VoidBuildSystem CI / 4A2 · VBS installers (self-hosted) (push) Failing after 31s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 2s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m31s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m13s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m24s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m43s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 20s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 26s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m42s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 22s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 37s
- vbs install accepts --target-os/--target-arch like vbs build, so the Windows installers can be produced from the Linux host. - Only targets carrying an install rule (plus their dependencies) are built, so install no longer links test executables. - Failed install actions print their captured stderr. - The VBS description compares the target OS case-insensitively. - The installer job uses a per-run build directory: concurrent runs on the same runner share the repository workspace.
193 lines
8.9 KiB
C++
193 lines
8.9 KiB
C++
#include "build-support/Defaults.hpp"
|
|
|
|
#include <algorithm>
|
|
#include <cctype>
|
|
#include <string>
|
|
|
|
namespace {
|
|
|
|
// The profile context carries the target OS as written on the command line
|
|
// ("windows") or as the host name ("Windows"): compare case-insensitively.
|
|
bool targets_windows(const Void::Build::ProfileContext &ctx) {
|
|
std::string os = ctx.os;
|
|
std::ranges::transform(os, os.begin(),
|
|
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
|
return os == "windows";
|
|
}
|
|
|
|
} // namespace
|
|
|
|
void build(Void::Build::Project &project) {
|
|
const auto &ctx = project.context();
|
|
|
|
auto library = project.dependency("VoidLibrary");
|
|
library
|
|
.git("https://git.faumaray.com/Void/VoidLibrary.git",
|
|
Void::Build::Commit{"de1fdcda72ddd6ac069fba433b13f643327efa3f"})
|
|
.native_builder({{"VOID_ENABLED_MODULES",
|
|
"Configuration;Text;Unicode;Async;Algorithms;Crypto;Archive;Testing;Log"},
|
|
// Only the Testing library is needed, not VoidLibrary's own test
|
|
// executables (the CMake path sets VOID_ENABLE_TESTING=OFF too).
|
|
{"VOID_ENABLE_TESTING", "0"},
|
|
{"BUILD_SHARED_LIBS", false}});
|
|
|
|
// Source membership comes from conventions and globs, not explicit file lists:
|
|
// sdk/ is the declaration SDK, src/ + recipes/ are the native engine, registry/service/
|
|
// is the registry library.
|
|
auto sdk = project.static_library("VoidBuildSdk");
|
|
sdk.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources(project.glob("sdk/*.cpp"))
|
|
.include_directory("include", Void::Build::Visibility::Public);
|
|
BuildSupport::compiler_warnings(sdk, ctx);
|
|
if (ctx.compiler == Void::Build::CompilerFamily::Gcc) {
|
|
sdk.compile_option("-freflection", Void::Build::Visibility::Public);
|
|
}
|
|
|
|
auto core = project.static_library("VoidBuildCore");
|
|
// The entry points (src/Main.cpp, src/Describe.cpp) are not part of the core
|
|
// library: they define main() and Describe.cpp references the example
|
|
// description's build()/profiles(). Glob only the subdirectories.
|
|
core.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources(project.glob("src/*/*.cpp"))
|
|
.sources(project.glob("src/*/*/*.cpp"))
|
|
.sources(project.glob("recipes/**/*.cpp"))
|
|
.include_directory("include", Void::Build::Visibility::Public)
|
|
.include_directory("recipes", Void::Build::Visibility::Public)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.define("VBS_HAS_VOID_CRYPTO=1", Void::Build::Visibility::Public)
|
|
.define("VBS_HAS_VOID_ARCHIVE=1", Void::Build::Visibility::Public)
|
|
.link(sdk, Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Configuration"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Text"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Unicode"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Async"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Algorithms"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Crypto"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Archive"), Void::Build::Visibility::Public)
|
|
.link(library.target("Void::Log"), Void::Build::Visibility::Public);
|
|
if (targets_windows(ctx)) {
|
|
// Winsock for the registry client and the native Windows HTTP fallbacks.
|
|
core.link_option("-lws2_32");
|
|
}
|
|
BuildSupport::compiler_warnings(core, ctx);
|
|
|
|
// Generate profile-isolated BootstrapConfig.hpp inside $GEN/include/Void/Build/.
|
|
const std::string gen_script =
|
|
"mkdir -p \"$GEN/include/Void/Build\" && cat > "
|
|
"\"$GEN/include/Void/Build/BootstrapConfig.hpp\" "
|
|
"<<'EOF'\n"
|
|
"#pragma once\n"
|
|
"#include <string_view>\n"
|
|
"namespace Void::Build::Bootstrap {\n"
|
|
"inline constexpr std::string_view version = \"1.0.0\";\n"
|
|
"inline constexpr std::string_view os = \"" +
|
|
ctx.os +
|
|
"\";\n"
|
|
"inline constexpr std::string_view architecture = \"" +
|
|
ctx.architecture +
|
|
"\";\n"
|
|
"inline constexpr std::string_view source_dir = \"$PROJECT_ROOT\";\n"
|
|
"inline constexpr std::string_view binary_dir = \"\";\n"
|
|
"inline constexpr std::string_view sdk_include_dir = \"$PROJECT_ROOT/include\";\n"
|
|
"inline constexpr std::string_view sdk_source_dir = \"$PROJECT_ROOT/sdk\";\n"
|
|
"}\n"
|
|
"EOF\n";
|
|
|
|
auto bootstrap_cfg = project.custom_action("GenerateBootstrapConfig");
|
|
bootstrap_cfg.command({"/bin/sh", "-c", gen_script})
|
|
.outputs({"include/Void/Build/BootstrapConfig.hpp"});
|
|
// The generated header is a compile input of the core library.
|
|
core.depends_on(bootstrap_cfg);
|
|
|
|
auto cli = project.executable("vbs");
|
|
cli.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"src/Main.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(core)
|
|
.install("bin");
|
|
BuildSupport::compiler_warnings(cli, ctx);
|
|
|
|
// The registry service is POSIX-only until its Track C3 Windows port lands.
|
|
if (!targets_windows(ctx)) {
|
|
auto registry_lib = project.static_library("VoidBuildRegistry");
|
|
registry_lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources(project.glob("registry/service/*.cpp"))
|
|
.include_directory("registry/include", Void::Build::Visibility::Public)
|
|
.link(core, Void::Build::Visibility::Public);
|
|
BuildSupport::compiler_warnings(registry_lib, ctx);
|
|
|
|
auto registry_cli = project.executable("vbs-registry");
|
|
registry_cli.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"registry/cli/Main.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(registry_lib)
|
|
.install("bin");
|
|
BuildSupport::compiler_warnings(registry_cli, ctx);
|
|
|
|
auto reg_tests = project.test("vbs_registry_tests");
|
|
reg_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"tests/RegistryTests.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.depends_on(cli)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(registry_lib)
|
|
.link(library.target("Void::Testing"));
|
|
BuildSupport::compiler_warnings(reg_tests, ctx);
|
|
}
|
|
|
|
auto smoke_test = project.test("vbs_self_smoke");
|
|
smoke_test.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"tests/SelfBuildSmoke.cpp"})
|
|
.link(core);
|
|
BuildSupport::compiler_warnings(smoke_test, ctx);
|
|
|
|
auto benchmarks = project.executable("vbs_benchmarks");
|
|
benchmarks.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"benchmarks/EngineBenchmarks.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(core);
|
|
BuildSupport::compiler_warnings(benchmarks, ctx);
|
|
|
|
auto sdk_tests = project.test("vbs_sdk_tests");
|
|
sdk_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"tests/SdkDeclarations.cpp", "tests/ExampleContexts.cpp", "build.cpp",
|
|
"build.profiles.cpp", "build-support/Defaults.cpp"})
|
|
.link(sdk)
|
|
.link(library.target("Void::Testing"))
|
|
.link(library.target("Void::Configuration"));
|
|
BuildSupport::compiler_warnings(sdk_tests, ctx);
|
|
|
|
auto core_tests = project.test("vbs_core_tests");
|
|
core_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"tests/CoreEngineTests.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(core)
|
|
.link(library.target("Void::Testing"));
|
|
BuildSupport::compiler_warnings(core_tests, ctx);
|
|
|
|
auto v1_tests = project.test("vbs_v1_tests");
|
|
v1_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"tests/FullV1Tests.cpp", "tests/DaemonTests.cpp", "tests/SigningTests.cpp",
|
|
"tests/SignatureEnforcementTests.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.depends_on(cli)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(core)
|
|
.link(library.target("Void::Testing"));
|
|
BuildSupport::compiler_warnings(v1_tests, ctx);
|
|
|
|
auto selfhost_tests = project.test("vbs_selfhost_tests");
|
|
selfhost_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
|
.sources({"tests/SelfHostTests.cpp"})
|
|
.depends_on(bootstrap_cfg)
|
|
.depends_on(cli)
|
|
.include_directory("$GEN/include", Void::Build::Visibility::Private)
|
|
.link(core)
|
|
.link(library.target("Void::Testing"));
|
|
BuildSupport::compiler_warnings(selfhost_tests, ctx);
|
|
}
|