Skip to content

Commit

Permalink
restore local deps and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Ji committed Nov 17, 2024
1 parent 3284c24 commit 1cd4d1c
Show file tree
Hide file tree
Showing 2,860 changed files with 1,182,657 additions and 38 deletions.
201 changes: 201 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: ci

on:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
cancel-in-progress: true

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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: Install sdl2
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: SDL version
run: sdl2-config --version
- name: Check format
continue-on-error: true
run: zig fmt --check .
- name: Build and run tests
run: zig build test
- name: Build examples
run: zig build examples

build-macos:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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: Install sdl2
run: brew install sdl2
- name: Build and run tests
run: zig build test
- name: Build examples
run: zig build examples

build-windows:
strategy:
fail-fast: false
matrix:
target: [x86_64-windows-gnu, x86_64-windows-msvc]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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: Install VisualStudio (x64)
if: ${{ matrix.target == 'x86_64-windows-msvc' }}
uses: ilammy/msvc-dev-cmd@v1
with:
uwp: false
arch: x64
- name: Download SDL2 (MinGW)
uses: carlosperate/[email protected]
if: ${{ matrix.target == 'x86_64-windows-gnu' }}
with:
file-url: https://www.libsdl.org/release/SDL2-devel-2.0.18-mingw.tar.gz
file-name: SDL2.tar.gz
location: .
- name: Download SDL2 (Visual Studio)
uses: carlosperate/[email protected]
if: ${{ matrix.target == 'x86_64-windows-msvc' }}
with:
file-url: https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip
file-name: SDL2.tar.gz
location: .
- name: Extract SDL2
uses: brunoborges/justextract@v1
with:
file: SDL2.tar.gz
- name: Create SDK file
uses: DamianReeves/[email protected]
with:
path: .build_config/sdl.json
contents: |
{
"x86_64-windows-gnu": {
"include": "SDL2-2.0.18/x86_64-w64-mingw32/include",
"libs": "SDL2-2.0.18/x86_64-w64-mingw32/lib",
"bin": "SDL2-2.0.18/x86_64-w64-mingw32/bin"
},
"x86_64-windows-msvc": {
"include": "SDL2-2.0.18/include",
"libs": "SDL2-2.0.18/lib/x64",
"bin": "SDL2-2.0.18/lib/x64"
}
}
write-mode: overwrite
- name: Build and run tests
run: zig build test
- name: Build examples
run: zig build -Dtarget=${{matrix.target}} examples

build-cross-windows:
strategy:
fail-fast: false
matrix:
host: [ubuntu-latest, macos-latest]
target: [x86-windows-gnu, x86_64-windows-gnu]
runs-on: ${{matrix.host}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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: Download SDL2 (MinGW)
uses: carlosperate/[email protected]
with:
file-url: https://www.libsdl.org/release/SDL2-devel-2.0.18-mingw.tar.gz
file-name: SDL2.tar.gz
location: .
- name: Extract SDL2
uses: brunoborges/justextract@v1
with:
file: SDL2.tar.gz
- name: Create SDK file
uses: DamianReeves/[email protected]
with:
path: .build_config/sdl.json
contents: |
{
"x86-windows-gnu": {
"include": "SDL2-2.0.18/i686-w64-mingw32/include",
"libs": "SDL2-2.0.18/i686-w64-mingw32/lib",
"bin": "SDL2-2.0.18/i686-w64-mingw32/bin"
},
"x86_64-windows-gnu": {
"include": "SDL2-2.0.18/x86_64-w64-mingw32/include",
"libs": "SDL2-2.0.18/x86_64-w64-mingw32/lib",
"bin": "SDL2-2.0.18/x86_64-w64-mingw32/bin"
}
}
write-mode: overwrite
- name: Build examples
run: zig build -Dtarget=${{matrix.target}} examples

build-cross-linux:
strategy:
fail-fast: false
matrix:
host: [macos-latest, windows-latest]
target: [x86_64-linux-gnu, aarch64-linux-gnu]
runs-on: ${{matrix.host}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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 examples
run: zig build -Dtarget=${{matrix.target}} examples
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dkms.conf
*.swp

# ziglang temp files
zig-cache
.zig-cache
zig-out

Expand Down
38 changes: 9 additions & 29 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,42 +1,22 @@
.{
.name = "jok",
.version = "0.20.1",
.version = "0.22.0",
.paths = .{
"README.md",
"build.zig",
"build.zig.zon",
"src",
"deps",
"stubs",
"examples",
},
.dependencies = .{
.system_sdk = .{
.url = "git+https://github.com/zig-gamedev/system_sdk.git#bf49d627a191e339f70e72668c8333717fb969b0",
.hash = "122047a9298c4c9dd43389d418d6826d469b192246ba0944102964cdc57f94c562df",
},
.zaudio = .{
.url = "git+https://github.com/zig-gamedev/zaudio.git#7c8a86c1b7a44b906e5de5f3ee18cdd0b8de018b",
.hash = "1220423c756c4d6f58d9465a597c2b9f982d929a56fa5ceab4b7626d0ea2685bcd6c",
},
.zgui = .{
.url = "git+https://github.com/zig-gamedev/zgui.git#4f8ee943b81da3e344244818e397993a8be0a74c",
.hash = "1220d390fd5d5cb51fd9c894e970c9d7d65e6124e0cebb83f8f1b86fe3f4f976c070",
},
.zmath = .{
.url = "git+https://github.com/zig-gamedev/zmath.git#c6aa077003b53aaa3929541201b83bc394ed7ddb",
.hash = "1220081d55b58b968d953db1afc2fb01b2f5733929144e69522461ce25fa6450d84e",
},
.zmesh = .{
.url = "git+https://github.com/zig-gamedev/zmesh.git#696f568f16ffd31eef477db4ac755acb31e7de80",
.hash = "1220f914e117966d9d2fc5aca141859a3ebf94b4f1c36b881f201958699568a75f70",
},
.znoise = .{
.url = "git+https://github.com/zig-gamedev/znoise.git#a52da9babfe6d14a0b3e3bfcaabb2907cc2c4e3b",
.hash = "12208e16c80366e2a2f8bd3f1c676b09bf47c157f4d0f0d6440555f9b74d8a9d79f7",
},
.ztracy = .{
.url = "git+https://github.com/zig-gamedev/ztracy.git#9d3f75cb2c2e44f1d99eda0cbd5142205e4c4e1d",
.hash = "122058b9caf1299bcb723b8567999154b18d82e0e896471e10ef56b0e60c6dda59c2",
},
.system_sdk = .{ .path = "deps/system_sdk" },
.zaudio = .{ .path = "deps/zaudio" },
.zgui = .{ .path = "deps/zgui" },
.zmath = .{ .path = "deps/zmath" },
.zmesh = .{ .path = "deps/zmesh" },
.znoise = .{ .path = "deps/znoise" },
.ztracy = .{ .path = "deps/ztracy" },
},
}
22 changes: 22 additions & 0 deletions deps/system_sdk/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2021 Michal Ziulek
Copyright (c) 2024 zig-gamedev contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions deps/system_sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# [zig-gamedev system_sdk](https://github.com/zig-gamedev/system_sdk)

System libraries and headers for cross-compiling [zig-gamedev](https://github.com/zig-gamedev) libs and sample applications.

## Usage
build.zig
```zig
switch (target.os.tag) {
.windows => {
if (target.cpu.arch.isX86()) {
if (target.abi.isGnu() or target.abi.isMusl()) {
if (b.lazyDependency("system_sdk", .{})) |system_sdk| {
compile_step.addLibraryPath(system_sdk.path("windows/lib/x86_64-windows-gnu"));
}
}
}
},
.macos => {
if (b.lazyDependency("system_sdk", .{})) |system_sdk| {
compile_step.addLibraryPath(system_sdk.path("macos12/usr/lib"));
compile_step.addFrameworkPath(system_sdk.path("macos12/System/Library/Frameworks"));
}
},
.linux => {
if (target.cpu.arch.isX86()) {
if (b.lazyDependency("system_sdk", .{})) |system_sdk| {
compile_step.addLibraryPath(system_sdk.path("linux/lib/x86_64-linux-gnu"));
}
} else if (target.cpu.arch == .aarch64) {
if (b.lazyDependency("system_sdk", .{})) |system_sdk| {
compile_step.addLibraryPath(system_sdk.path("linux/lib/aarch64-linux-gnu"));
}
}
},
else => {},
}
```
3 changes: 3 additions & 0 deletions deps/system_sdk/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const std = @import("std");

pub fn build(_: *std.Build) void {}
13 changes: 13 additions & 0 deletions deps/system_sdk/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.{
.name = "system_sdk",
.version = "0.3.0-dev",
.paths = .{
"build.zig",
"build.zig.zon",
"LICENSE",
"README.md",
"linux",
"macos12",
"windows",
},
}
Loading

0 comments on commit 1cd4d1c

Please sign in to comment.