-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5312dc5
Showing
16 changed files
with
533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
set -e | ||
|
||
git -C externals/cetech1/ submodule update --init | ||
|
||
zig build init | ||
zig build -Dexternals_optimize=Debug -Dwith_shaderc=false | ||
|
||
ls -Rhan zig-out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: Test | ||
|
||
permissions: | ||
checks: write | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
validation: | ||
name: Validation | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 1 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read .zig-version | ||
id: zigversion | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ./.zigversion | ||
- name: Install Zig | ||
uses: mlugg/setup-zig@v1 | ||
with: | ||
version: ${{ steps.zigversion.outputs.content }} | ||
|
||
- name: Lint | ||
run: zig fmt --check . --exclude externals/ | ||
|
||
# TODO: Fix me | ||
x86-64-linux: | ||
needs: ["validation"] | ||
name: x86-64 Linux | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Prepare | ||
uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: libdbus-1-dev | ||
version: 1.0 | ||
|
||
- name: Read .zig-version | ||
id: zigversion | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ./.zigversion | ||
- name: Install Zig | ||
uses: mlugg/setup-zig@v1 | ||
with: | ||
version: ${{ steps.zigversion.outputs.content }} | ||
|
||
- name: Build | ||
run: .ci/build.sh | ||
|
||
# FIXME: this works on cetech1 CI but not in this repo. | ||
# x86-64-macos: | ||
# needs: ["validation"] | ||
# name: x86-64 Macos | ||
# runs-on: macos-latest | ||
# timeout-minutes: 20 | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# submodules: true | ||
|
||
# - name: Read .zig-version | ||
# id: zigversion | ||
# uses: juliangruber/read-file-action@v1 | ||
# with: | ||
# path: ./.zigversion | ||
# - name: Install Zig | ||
# uses: mlugg/setup-zig@v1 | ||
# with: | ||
# version: ${{ steps.zigversion.outputs.content }} | ||
|
||
# - name: Build | ||
# run: .ci/build.sh | ||
|
||
# FIXME: this works on cetech1 CI but not in this repo. | ||
# x86-64-windows: | ||
# needs: ["validation"] | ||
# name: x86-64 Windows | ||
# runs-on: windows-latest | ||
# timeout-minutes: 20 | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# submodules: true | ||
|
||
# - name: Read .zig-version | ||
# id: zigversion | ||
# uses: juliangruber/read-file-action@v1 | ||
# with: | ||
# path: ./.zigversion | ||
# - name: Install Zig | ||
# uses: mlugg/setup-zig@v1 | ||
# with: | ||
# version: ${{ steps.zigversion.outputs.content }} | ||
|
||
# - name: Build | ||
# shell: bash | ||
# run: .ci/build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Build | ||
/build | ||
|
||
# ZIG | ||
*zig-cache | ||
*zig-out | ||
|
||
# VSCode | ||
|
||
# MacOS | ||
*.DS_Store | ||
.DS_Store | ||
*.dylib | ||
|
||
# Xcode | ||
*.pbxuser | ||
*.mode1v3 | ||
*.mode2v3 | ||
*.perspectivev3 | ||
*.xcuserstate | ||
project.xcworkspace/ | ||
xcuserdata/ | ||
|
||
kcov-output/ | ||
|
||
imgui.ini | ||
|
||
_static.zig | ||
|
||
# VSCode | ||
.vscode/launch.json | ||
.vscode/settings.json | ||
|
||
# Fleet | ||
.fleet/settings.json | ||
.fleet/run.json | ||
|
||
# temp folder for tests | ||
/fixtures/tmp | ||
|
||
# folder for generated tmp data, cache and debug purpose files | ||
.ct_temp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "externals/cetech1"] | ||
path = externals/cetech1 | ||
url = https://github.com/cyberegoorg/cetech1.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0-a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"recommendations": [ | ||
"ziglang.vscode-zig", // ZIG support | ||
"vadimcn.vscode-lldb", // Debugging support | ||
"Gruntfuggly.todo-tree", // Todo viewer | ||
"kdheepak.d2-markdown-preview", // D2 preview | ||
"oderwat.indent-rainbow", // Bring colors to life | ||
"MalcolmMielle.semantic-highlighting" // More colors to life | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2024.11.0-mach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# [CETech1](https://github.com/cyberegoorg/cetech1) minimal project | ||
|
||
> [!IMPORTANT] | ||
> Work in progressssssssssssss | ||
## Getting started | ||
|
||
1. Create repository from this template. | ||
|
||
2. [Get ZIG](https://cyberegoorg.github.io/cetech1/getting-started.html#get-zig) | ||
|
||
3. [Get ZLS](https://cyberegoorg.github.io/cetech1/getting-started.html#zls) | ||
|
||
4. Init | ||
|
||
```sh | ||
git -C externals/cetech1/ submodule update --init | ||
zig build init | ||
``` | ||
|
||
5. Build | ||
|
||
```sh | ||
zig build | ||
``` | ||
|
||
6. Create CETech1 project in `content` dir | ||
|
||
```sh | ||
zig-out/bin/cetech1 --asset-root content/ | ||
``` | ||
|
||
7. Add `content` dir with project to git | ||
|
||
```sh | ||
git add content/ | ||
``` | ||
|
||
8. Replace README.md with your own. | ||
|
||
9. Have fun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
const std = @import("std"); | ||
const builtin = @import("builtin"); | ||
|
||
const min_zig_version = std.SemanticVersion.parse("0.14.0-dev.1911") catch @panic("Where is .zigversion?"); | ||
const version = std.SemanticVersion.parse(@embedFile(".version")) catch @panic("Where is .version?"); | ||
|
||
const cetech1_build = @import("cetech1"); | ||
|
||
const enabled_cetech_modules = cetech1_build.core_modules ++ cetech1_build.editor_modules; | ||
|
||
pub const modules = [_][]const u8{ | ||
// Minimal | ||
"minimal", | ||
}; | ||
|
||
pub fn build(b: *std.Build) !void { | ||
try ensureZigVersion(); | ||
|
||
const target = b.standardTargetOptions(.{}); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
|
||
// | ||
// OPTIONS | ||
// | ||
|
||
const options = .{ | ||
.externals_optimize = b.option(std.builtin.OptimizeMode, "externals_optimize", "Optimize for externals libs") orelse .ReleaseFast, | ||
.dynamic_modules = b.option(bool, "dynamic_modules", "build all modules in dynamic mode.") orelse true, | ||
//.static_modules = b.option(bool, "static_modules", "build all modules in static mode.") orelse false, | ||
|
||
// Tracy options | ||
.enable_tracy = b.option(bool, "with_tracy", "build with tracy.") orelse true, | ||
.tracy_on_demand = b.option(bool, "tracy_on_demand", "build tracy with TRACY_ON_DEMAND") orelse true, | ||
|
||
.enable_shaderc = b.option(bool, "with_shaderc", "build with shaderc support") orelse true, | ||
}; | ||
|
||
const options_step = b.addOptions(); | ||
options_step.addOption(std.SemanticVersion, "version", version); | ||
|
||
// add build args | ||
inline for (std.meta.fields(@TypeOf(options))) |field| { | ||
options_step.addOption(field.type, field.name, @field(options, field.name)); | ||
} | ||
const options_module = options_step.createModule(); | ||
_ = options_module; // autofix | ||
|
||
// | ||
// Extrnals | ||
// | ||
|
||
// Cetech1 | ||
const cetech1 = b.dependency( | ||
"cetech1", | ||
.{ | ||
.target = target, | ||
.optimize = optimize, | ||
.externals_optimize = options.externals_optimize, | ||
|
||
.with_tracy = options.enable_tracy, | ||
.tracy_on_demand = options.tracy_on_demand, | ||
|
||
.with_shaderc = options.enable_shaderc, | ||
|
||
//.static_modules = options.static_modules, | ||
.dynamic_modules = options.dynamic_modules, | ||
}, | ||
); | ||
|
||
// | ||
// TOOLS | ||
// | ||
|
||
const generate_vscode_tool = b.addExecutable(.{ | ||
.name = "generate_vscode", | ||
.root_source_file = b.path("tools/generate_vscode.zig"), | ||
.target = target, | ||
}); | ||
generate_vscode_tool.root_module.addAnonymousImport("generate_vscode", .{ | ||
.root_source_file = b.path("externals/cetech1/src/tools/generate_vscode.zig"), | ||
}); | ||
|
||
// | ||
// Init repository step | ||
// | ||
const init_step = b.step("init", "init repository"); | ||
cetech1_build.initStep(b, init_step, "externals/cetech1/"); | ||
|
||
// | ||
// Gen vscode | ||
// | ||
const vscode_step = b.step("vscode", "init/update vscode configs"); | ||
const gen_vscode = b.addRunArtifact(generate_vscode_tool); | ||
gen_vscode.addDirectoryArg(b.path(".vscode/")); | ||
vscode_step.dependOn(&gen_vscode.step); | ||
|
||
if (options.enable_shaderc) { | ||
b.installArtifact(cetech1.artifact("shaderc")); | ||
} | ||
|
||
if (options.dynamic_modules) { | ||
b.installArtifact(cetech1.artifact("cetech1")); | ||
|
||
var buff: [256:0]u8 = undefined; | ||
|
||
// CETech modules | ||
for (enabled_cetech_modules) |m| { | ||
const artifact_name = try std.fmt.bufPrintZ(&buff, "ct_{s}", .{m}); | ||
const art = cetech1.artifact(artifact_name); | ||
const step = b.addInstallArtifact(art, .{}); | ||
b.default_step.dependOn(&step.step); | ||
} | ||
|
||
// Project modules | ||
for (modules) |m| { | ||
const artifact_name = try std.fmt.bufPrintZ(&buff, "ct_{s}", .{m}); | ||
const art = b.dependency(m, .{ | ||
.target = target, | ||
.optimize = optimize, | ||
}).artifact(artifact_name); | ||
|
||
const step = b.addInstallArtifact(art, .{}); | ||
b.default_step.dependOn(&step.step); | ||
} | ||
} | ||
} | ||
|
||
fn ensureZigVersion() !void { | ||
var installed_ver = builtin.zig_version; | ||
installed_ver.build = null; | ||
|
||
if (installed_ver.order(min_zig_version) == .lt) { | ||
std.log.err("\n" ++ | ||
\\--------------------------------------------------------------------------- | ||
\\ | ||
\\Installed Zig compiler version is too old. | ||
\\ | ||
\\Min. required version: {any} | ||
\\Installed version: {any} | ||
\\ | ||
\\Please install newer version and try again. | ||
\\zig/get_zig.sh <ARCH> | ||
\\ | ||
\\--------------------------------------------------------------------------- | ||
\\ | ||
, .{ min_zig_version, installed_ver }); | ||
return error.ZigIsTooOld; | ||
} | ||
} |
Oops, something went wrong.