includebuild/www/examples.html

316 lines
No EOL
14 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Examples | IncludeBuild</title>
<link rel="stylesheet" href="css/styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="icon" type="image/svg+xml" href="images/favicon.svg">
<script src="js/nav.js"></script>
</head>
<body>
<header>
<nav>
<!-- Navigation will be loaded here by JavaScript -->
</nav>
</header>
<section class="examples-hero">
<div class="container">
<h1>Example Projects</h1>
<p class="tagline">See IncludeBuild in action with these practical examples</p>
</div>
</section>
<section id="examples-showcase">
<div class="container">
<div class="examples-grid large-grid">
<!-- Basic Example -->
<div class="example-card" id="basic">
<h3>Basic</h3>
<p>A minimal example that demonstrates the simplest use of IncludeBuild. Just include build.h, call ib_init() and ib_build() - that's it!</p>
<div class="example-details">
<div class="example-tag">Beginner</div>
<div class="example-tag">Single File</div>
</div>
<div class="code-snippet">
<pre><code><span class="comment">/**
* IncludeBuild Basic Example
*/</span>
<span class="keyword">#include</span> <span class="string">"../../build.h"</span>
<span class="keyword">#include</span> <span class="string">&lt;stdio.h&gt;</span>
<span class="type">int</span> <span class="function">main</span>() {
<span class="comment">// Initialize IncludeBuild</span>
ib_init();
<span class="comment">// Enable verbose output</span>
ib_set_verbose(true);
<span class="comment">// Build the project</span>
ib_build();
printf(<span class="string">"\nBuild complete!\n"</span>);
return 0;
}</code></pre>
</div>
<a href="https://github.com/korzewarrior/includebuild/tree/master/examples/basic" class="example-link">View Example</a>
</div>
<!-- Multi-File Example -->
<div class="example-card" id="multi-file">
<h3>Multi-file</h3>
<p>Demonstrates how IncludeBuild automatically handles a project with multiple source files and resolves dependencies between them.</p>
<div class="example-details">
<div class="example-tag">Intermediate</div>
<div class="example-tag">Multiple Files</div>
</div>
<div class="code-snippet">
<pre><code><span class="comment">/**
* IncludeBuild Multi-File Example
*/</span>
<span class="keyword">#include</span> <span class="string">"../../build.h"</span>
<span class="keyword">#include</span> <span class="string">&lt;stdio.h&gt;</span>
<span class="type">int</span> <span class="function">main</span>() {
<span class="comment">// Initialize IncludeBuild</span>
ib_init();
<span class="comment">// Enable verbose output</span>
ib_set_verbose(true);
<span class="comment">// Build the project - build.h finds all source files automatically</span>
ib_build();
printf(<span class="string">"\nBuild complete!\n"</span>);
return 0;
}</code></pre>
</div>
<a href="https://github.com/korzewarrior/includebuild/tree/master/examples/multi_file" class="example-link">View Example</a>
</div>
<!-- Library Example -->
<div class="example-card" id="library">
<h3>Library</h3>
<p>Shows how to create a complete library with static and dynamic versions plus tests with just TWO LINES of code.</p>
<div class="example-details">
<div class="example-tag">Advanced</div>
<div class="example-tag">Libraries</div>
</div>
<div class="code-snippet">
<pre><code><span class="comment">/**
* IncludeBuild Library Example - The Magic Solution
*/</span>
<span class="keyword">#include</span> <span class="string">"../../build.h"</span>
<span class="type">int</span> <span class="function">main</span>(int argc, char** argv) {
<span class="comment">// Initialize IncludeBuild</span>
ib_init();
<span class="comment">// Enable verbose output</span>
ib_set_verbose(true);
<span class="comment">// Build the library - this handles everything: static, dynamic, tests</span>
return ib_build_library(<span class="string">"logger"</span>, argc, argv) ? 0 : 1;
}</code></pre>
</div>
<a href="https://github.com/korzewarrior/includebuild/tree/master/examples/library" class="example-link">View Example</a>
</div>
<!-- Game Example -->
<div class="example-card" id="game">
<h3>Game</h3>
<p>A complete Pong game using the Raylib external library, demonstrating IncludeBuild's ability to handle dependencies and cross-platform builds.</p>
<div class="example-details">
<div class="example-tag">Game</div>
<div class="example-tag">External Libraries</div>
</div>
<div class="code-snippet">
<pre><code><span class="comment">/**
* IncludeBuild Game Example
*/</span>
<span class="keyword">#include</span> <span class="string">"../../build.h"</span>
<span class="keyword">#include</span> <span class="string">&lt;stdio.h&gt;</span>
<span class="type">int</span> <span class="function">main</span>() {
<span class="comment">// Initialize IncludeBuild</span>
ib_init();
<span class="comment">// Enable verbose output</span>
ib_set_verbose(true);
<span class="comment">// Add Raylib and its dependencies</span>
ib_add_libraries(<span class="string">"raylib"</span>, <span class="string">"GL"</span>, <span class="string">"m"</span>, <span class="string">"pthread"</span>, <span class="string">"dl"</span>, <span class="string">"rt"</span>, <span class="string">"X11"</span>, NULL);
<span class="comment">// Build the project</span>
ib_build();
printf(<span class="string">"\nBuild complete!\n"</span>);
return 0;
}</code></pre>
</div>
<a href="https://github.com/korzewarrior/includebuild/tree/master/examples/game" class="example-link">View Example</a>
</div>
<!-- Logging Example -->
<div class="example-card" id="logging">
<h3>Logging</h3>
<p>Demonstrates IncludeBuild's logging features with different verbosity levels, allowing for detailed build information and debugging.</p>
<div class="example-details">
<div class="example-tag">Utility</div>
<div class="example-tag">Debug</div>
</div>
<div class="code-snippet">
<pre><code><span class="comment">/**
* IncludeBuild Logging Example
*/</span>
<span class="keyword">#include</span> <span class="string">"../../build.h"</span>
<span class="keyword">#include</span> <span class="string">&lt;stdio.h&gt;</span>
<span class="keyword">#include</span> <span class="string">&lt;string.h&gt;</span>
<span class="type">int</span> <span class="function">main</span>(int argc, char** argv) {
<span class="comment">// Initialize IncludeBuild</span>
ib_init();
<span class="comment">// Enable verbose output</span>
ib_set_verbose(true);
<span class="comment">// Set a different log level if specified</span>
if (argc > 1) {
if (strcmp(argv[1], <span class="string">"debug"</span>) == 0)
ib_set_log_level(IB_LOG_DEBUG); <span class="comment">// Most verbose</span>
else if (strcmp(argv[1], <span class="string">"warn"</span>) == 0)
ib_set_log_level(IB_LOG_WARN); <span class="comment">// Warnings and errors</span>
else if (strcmp(argv[1], <span class="string">"error"</span>) == 0)
ib_set_log_level(IB_LOG_ERROR); <span class="comment">// Errors only</span>
}
<span class="comment">// Build the project</span>
ib_build();
return 0;
}</code></pre>
</div>
<a href="https://github.com/korzewarrior/includebuild/tree/master/examples/logging" class="example-link">View Example</a>
</div>
<!-- Custom Limits Example -->
<div class="example-card" id="custom-limits">
<h3>Custom Limits</h3>
<p>Demonstrates how to customize IncludeBuild's internal limits for larger projects by defining constants before including build.h.</p>
<div class="example-details">
<div class="example-tag">Advanced</div>
<div class="example-tag">Customization</div>
</div>
<div class="code-snippet">
<pre><code><span class="comment">/**
* IncludeBuild Custom Limits Example
*/</span>
<span class="comment">// Define custom limits before including build</span>
<span class="keyword">#define</span> IB_MAX_FILES 2000 <span class="comment">// Default is 1000</span>
<span class="keyword">#define</span> IB_MAX_DEPS 200 <span class="comment">// Default is 100</span>
<span class="keyword">#define</span> IB_MAX_INCLUDE_DIRS 100 <span class="comment">// Default is 50</span>
<span class="keyword">#include</span> <span class="string">"../../build.h"</span>
<span class="keyword">#include</span> <span class="string">&lt;stdio.h&gt;</span>
<span class="type">int</span> <span class="function">main</span>() {
<span class="comment">// Initialize IncludeBuild</span>
ib_init();
ib_set_verbose(true);
<span class="comment">// Print custom limits</span>
printf(<span class="string">"\nCustom limits in effect:\n"</span>);
printf(<span class="string">" IB_MAX_FILES: %d\n"</span>, IB_MAX_FILES);
printf(<span class="string">" IB_MAX_DEPS: %d\n"</span>, IB_MAX_DEPS);
<span class="comment">// Build the project</span>
ib_build();
return 0;
}</code></pre>
</div>
<a href="https://github.com/korzewarrior/includebuild/tree/master/examples/custom_limits" class="example-link">View Example</a>
</div>
</div>
</div>
</section>
<section id="modify-examples">
<div class="container">
<h2>Create Your Own Examples</h2>
<p>These examples are just the beginning. IncludeBuild is flexible enough to handle many different use cases. We encourage you to experiment with these examples and create your own!</p>
<p>If you develop an interesting example, consider contributing it back to the project.</p>
<div style="text-align: center; margin-top: 2rem;">
<a href="https://github.com/korzewarrior/includebuild/blob/master/CONTRIBUTING.md" class="github-cta" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
</svg>
Contribute to IncludeBuild
</a>
</div>
</div>
</section>
<section class="cta-section">
<!-- CTA will be loaded here by JavaScript -->
</section>
<footer>
<div class="container">
<div class="footer-logo">
<a href="index.html">
<span class="include">#include</span><span class="build">"build.h"</span>
</a>
<p class="footer-tagline">The only build system that feels like part of the language</p>
</div>
<div class="footer-links">
<div class="footer-column">
<h4>Product</h4>
<ul>
<li><a href="index.html#features">Features</a></li>
<li><a href="index.html#comparison">Comparison</a></li>
</ul>
</div>
<div class="footer-column">
<h4>Resources</h4>
<ul>
<li><a href="index.html#get-started">Quick Start</a></li>
<li><a href="index.html#docs">Documentation</a></li>
<li><a href="docs/guide.html">User Guide</a></li>
</ul>
</div>
<div class="footer-column">
<h4>Community</h4>
<ul>
<li><a href="https://github.com/korzewarrior/includebuild/blob/master/CONTRIBUTING.md">Contributing</a></li>
<li><a href="mailto:build@includebuild.com">build@includebuild.com</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>&copy; 2025 IncludeBuild. All rights reserved.</p>
</div>
</div>
</footer>
<script src="js/main.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const ctaSection = document.querySelector('.cta-section');
fetch('includes/cta.html')
.then(response => response.text())
.then(html => {
ctaSection.innerHTML = html;
})
.catch(error => {
console.error('Error loading CTA section:', error);
});
});
</script>
</body>
</html>