// Полный showcase возможностей build-блока. // Показывает: toolchains c платформами / переопределением binary / явным class, // build_defaults как общая основа, три профиля (release/debug/sanitized), // фильтры platforms и compilers, OS-оверрайды, wrapper, sanitize, define, // includes, link, extra, а также build-level `wrapper` для valgrind. toolchains { gcc { platforms = "linux" } clang { platforms = "linux" "windows" binary = "clang-17" // конкретная версия в PATH class = gnu // явный class если имя нестандартное } msvc { platforms = "windows" } nvcc { platforms = "linux" class = gnu // nvcc принимает gnu-like флаги } } build_defaults { language = "c" standard = "c11" sources = "src/*.c" // glob, раскрывается относительно work dir output = "solution" // на Windows автоматически станет solution.exe includes = "include" "vendor/include" link = "m" "pthread" warnings = strict // → -Wall -Wextra / /W4 define("BUILD_ID") = "42" } build "release" { profile = release // → -O2 / /O2 // OS-специфичные правки поверх defaults. Скаляры переопределяются, // списки (extra, sanitize, sources, includes) аккумулируются. linux { extra = "-fPIC" } windows { extra = "/bigobj" } darwin { extra = "-mmacosx-version-min=11" } } build "debug" { profile = debug // → -O0 -g / /Od /Zi warnings = pedantic // → добавляет -Wpedantic / /permissive- define("DEBUG") = "1" } build "sanitized" { profile = sanitized sanitize = "address" "undefined" "leak" platforms = "linux" // UBSan не работает на MSVC compilers = "gcc" "clang" // и только gnu-like extra = "-fno-sanitize-recover=all" } build "debug-valgrind" { profile = debug wrapper = "valgrind --error-exitcode=99 --leak-check=full -q" platforms = "linux" compilers = "gcc" } timeout 10s memory_limit = 256M group("basic") { weight = 1.0 test("smoke") { stdout = "ok\n" } }