Actions workflow + slang, glsl compilation + asset copy
All checks were successful
Build / Build (push) Successful in 3m20s
All checks were successful
Build / Build (push) Successful in 3m20s
This commit is contained in:
73
.gitea/workflows/build.yml
Normal file
73
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
on: [push, pull_request]
|
||||
|
||||
name: Build
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: true
|
||||
|
||||
- name: Checkout lfs
|
||||
run: |
|
||||
git lfs install --local
|
||||
AUTH=$(git config --local http.${{ github.server_url }}/.extraheader)
|
||||
git config --local --unset http.${{ github.server_url }}/.extraheader
|
||||
git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
|
||||
git lfs pull
|
||||
|
||||
- name: Apt update
|
||||
run: sudo apt update
|
||||
|
||||
- name: Installing build chain
|
||||
run: sudo apt-get install pigz libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev libxkbcommon-dev ninja-build g++ clang pkg-config cmake vulkan-tools vulkan-validationlayers glslc libglfw3 libglfw3-dev libtbb-dev -y;
|
||||
|
||||
- name: Cache CPM
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: "~/.cache/CPM/"
|
||||
key: ${{ runner.os }}-CPM
|
||||
|
||||
- name: Install Vulkan SDK
|
||||
uses: jakoch/install-vulkan-sdk-action@v1
|
||||
|
||||
- name: Configure debug
|
||||
run: cd scripts; CPM_SOURCE_CACHE="~/.cache/CPM/" ./configure-debug.sh
|
||||
|
||||
- name: Configure release
|
||||
run: cd scripts; CPM_SOURCE_CACHE="~/.cache/CPM/" ./configure-release.sh
|
||||
|
||||
- name: Configure RelWithDeb
|
||||
run: cd scripts; CPM_SOURCE_CACHE="~/.cache/CPM/" ./configure-relwithdeb.sh
|
||||
|
||||
- name: Build debug
|
||||
run: cd scripts; ./build-debug.sh
|
||||
|
||||
- name: Build release
|
||||
run: cd scripts; ./build-release.sh
|
||||
|
||||
- name: Build Release with debug info
|
||||
run: cd scripts; ./build-relwithdeb.sh
|
||||
|
||||
- name: Copy assets
|
||||
run: |-
|
||||
cp -r build/debug/assets bin/Debug;
|
||||
cp -r build/release/assets bin/Release;
|
||||
cp -r build/relwithdeb/assets bin/RelWithDeb;
|
||||
|
||||
- name: Packaging
|
||||
run: |-
|
||||
tar -I 'pigz -9' -cf oatmeal-debug-amd64.tar.gz bin/Debug;
|
||||
tar -I 'pigz -9' -cf oatmeal-rel-amd64.tar.gz bin/Release;
|
||||
tar -I 'pigz -9' -cf oatmeal-relwithdeb-amd64.tar.gz bin/Relwithdeb;
|
||||
|
||||
- uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
files: |-
|
||||
oatmeal-debug-amd64.tar.gz
|
||||
oatmeal-rel-amd64.tar.gz
|
||||
oatmeal-relwithdeb-amd64.tar.gz
|
||||
@@ -10,6 +10,22 @@ foreach(cmake_file ${CMAKE_FILES})
|
||||
include(${cmake_file})
|
||||
endforeach()
|
||||
|
||||
# TODO: Add a check to disable compiling the examples
|
||||
|
||||
set(ASSET_DIR "assets/")
|
||||
set(SHADERS_DIR "assets/shaders")
|
||||
|
||||
create_copy_folder_target(copy_assets ${CMAKE_CURRENT_SOURCE_DIR}/assets ${CMAKE_CURRENT_BINARY_DIR}/assets)
|
||||
create_slang_shader_target(slang_shaders
|
||||
"${SHADERS_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}"
|
||||
)
|
||||
create_glslc_shader_target(glsl_shaders
|
||||
"${SHADERS_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}"
|
||||
)
|
||||
|
||||
|
||||
add_subdirectory(examples/shared)
|
||||
|
||||
add_subdirectory(examples/basicGLFWWindow)
|
||||
|
||||
34
assets/shaders/shader.slang
Normal file
34
assets/shaders/shader.slang
Normal file
@@ -0,0 +1,34 @@
|
||||
struct VSInput {
|
||||
float3 inPosition;
|
||||
float3 inColor;
|
||||
float2 inTexCoord;
|
||||
};
|
||||
|
||||
struct UniformBuffer {
|
||||
float4x4 model;
|
||||
float4x4 view;
|
||||
float4x4 proj;
|
||||
};
|
||||
ConstantBuffer<UniformBuffer> ubo;
|
||||
|
||||
struct VSOutput {
|
||||
float4 pos : SV_Position;
|
||||
float3 color;
|
||||
float2 fragTexCoord;
|
||||
};
|
||||
|
||||
[shader("vertex")]
|
||||
VSOutput vertMain(VSInput input) {
|
||||
VSOutput output;
|
||||
output.pos = mul(ubo.proj, mul(ubo.view, mul(ubo.model, float4(input.inPosition, 1.0))));
|
||||
output.color = input.inColor;
|
||||
output.fragTexCoord = input.inTexCoord;
|
||||
return output;
|
||||
}
|
||||
|
||||
Sampler2D texture;
|
||||
|
||||
[shader("fragment")]
|
||||
float4 fragMain(VSOutput vertIn) : SV_Target {
|
||||
return float4(texture.Sample(vertIn.fragTexCoord).rgb, 1.0);
|
||||
}
|
||||
11
cmake/copy_files.cmake
Normal file
11
cmake/copy_files.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
function(create_copy_folder_target target_name src dst)
|
||||
add_custom_target(${target_name}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-E copy_directory
|
||||
${src}
|
||||
${dst}
|
||||
COMMENT "Copying ${src} to ${dst}"
|
||||
)
|
||||
endfunction()
|
||||
@@ -31,7 +31,4 @@ function(create_glslc_shader_target TARGET SOURCE_DIR OUTPUT_DIR)
|
||||
add_custom_target(${TARGET} ALL DEPENDS ${OUTPUT_FILES})
|
||||
endfunction()
|
||||
|
||||
create_glslc_shader_target(glsl_shaders
|
||||
"${SHADERS_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}"
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,4 @@ function(create_slang_shader_target TARGET SOURCE_DIR OUTPUT_DIR)
|
||||
add_custom_target(${TARGET} ALL DEPENDS ${OUTPUT_FILES})
|
||||
endfunction()
|
||||
|
||||
create_slang_shader_target(slang_shaders
|
||||
"${SHADERS_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${SHADERS_DIR}"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user