#include "build.h"

Examples

These examples all use the current v2 API and show the key patterns from the files shipped in the repository.

Basic

A minimal executable target with one explicit entry source.

ib_target* target = ib_project_add_target(project, "main", IB_TARGET_EXECUTABLE);
ib_target_set_entry(target, "main.c");
ib_project_build(project, IB_MODE_DEBUG);

View on GitHub

Multi-file

A target with one entry source plus additional shared sources discovered from the current directory.

ib_target* target = ib_project_add_target(project, "app", IB_TARGET_EXECUTABLE);
ib_target_set_entry(target, "main.c");
ib_project_scan_shared_dir(project, ".", false);
ib_project_build(project, IB_MODE_DEBUG);

View on GitHub

Logging

Context-based diagnostics, log levels, and verbose command output.

ib_context_set_verbose(ctx, true);
ib_context_set_log_level(ctx, IB_DIAG_DEBUG);
ib_project_build(project, IB_MODE_DEBUG);

View on GitHub

Custom Limits

V2 does not rely on fixed-size project arrays. The example exists to show that the runtime now grows its internal lists dynamically.

puts("IncludeBuild v2 grows lists dynamically.");
ib_project_build(project, IB_MODE_DEBUG);

View on GitHub

Static Library

A static archive target built with the configured archiver.

ib_target* target = ib_project_add_target(project, "sample", IB_TARGET_STATIC_LIB);
ib_target_add_source(target, "lib.c");
ib_project_build(project, IB_MODE_DEBUG);

View on GitHub

Shared Library

A shared library target built with platform-specific output naming.

ib_target* target = ib_project_add_target(project, "sample", IB_TARGET_SHARED_LIB);
ib_target_add_source(target, "lib.c");
ib_project_build(project, IB_MODE_DEBUG);

View on GitHub

Game

A Raylib-based example with platform-specific link flags and support for either vendored or system Raylib libraries. The shipped tree includes vendored headers and a Windows-compatible vendored library; macOS and Linux use platform-specific vendored library directories when present, then pkg-config, then platform fallback flags.

ib_target_add_include_dir(target, "vendor/raylib/include");
if (vendored_raylib_found) {
    ib_target_add_link_flags(target, "-Lvendor/raylib/lib/... -lraylib ...");
} else if (pkg_config_raylib_found) {
    ib_target_add_link_flags(target, pkg_config_flags);
} else {
    ib_target_add_link_flags(target, platform_fallback_flags);
}

View on GitHub