From 7b972d9baa3799d5a622ff5446b60e63d4dfb0da Mon Sep 17 00:00:00 2001 From: Matthew Date: Sat, 16 Aug 2025 12:06:24 +1000 Subject: [PATCH] project now compiles --- .gitignore | 1 + .ignore | 3 +++ build.sh | 31 +++++++++++++++++++++++++++++++ dub.json | 22 ++++++++++++++++++++++ src/DLibs | 2 +- src/editor/main.d | 6 ++++++ 6 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .ignore mode change 100644 => 100755 build.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..6bfd821 --- /dev/null +++ b/.ignore @@ -0,0 +1,3 @@ +.git +src/VulkanRenderer/vma +src/DLibs/external diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index e69de29..6bde3b5 --- a/build.sh +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -eu + +# SHADERS + +shader_compiler="glslc" +shader_flags="--target-spv=spv1.5 -std=460 --target-env=vulkan1.2" +shader_out="-oassets/" + +mkdir -p build +mkdir -p assets + +for shader in src/shaders/*.glsl; do + base_name=$(basename -- "$shader" .glsl) + + case "$base_name" in + *.vert) shader_stage="-fshader-stage=vert" ;; + *.frag) shader_stage="-fshader-stage=frag" ;; + *.tesc) shader_stage="-fshader-stage=tesc" ;; + *.tese) shader_stage="-fshader-stage=tese" ;; + *.geom) shader_stage="-fshader-stage=geom" ;; + *.comp) shader_stage="-fshader-stage=comp" ;; + *) continue ;; + esac + + $shader_compiler $shader_flags $shader_stage $shader "${shader_out}${base_name}.spv" +done + +/bin/bash src/VulkanRenderer/build.sh build + +/bin/bash src/DLibs/build.sh build diff --git a/dub.json b/dub.json index e69de29..27269ab 100644 --- a/dub.json +++ b/dub.json @@ -0,0 +1,22 @@ +{ + "name": "main", + "targetType": "none", + "subPackages": [ + { + "name": "editor", + "targetType": "executable", + "targetName": "Editor", + "targetPath": "build", + "sourceFiles-linux": ["build/libvma.a", "build/libstb.a", "build/libm3d.a", "build/libcglm.a"], + "sourceFiles-windows": [], + "importPaths": ["src/editor", "src/DLibs", "src/DLibs/external/xxhash", "src/VulkanRenderer"], + "sourcePaths": ["src/editor", "src/DLibs", "src/DLibs/external/xxhash", "src/VulkanRenderer"], + "libs-linux": ["xcb", "X11", "X11-xcb", "vulkan", "stdc++", "xcb-xfixes", "freetype"], + "libs-windows": [], + "preGenerateCommands-linux": ["./build.sh"], + "preGenerateCommands-windows": [], + "dflags": ["-Xcc=-mno-sse", "-P-I/usr/include/freetype2", "-vgc"], + "dflags-dmd": ["-P=-DSTBI_NO_SIMD"] + }, + ] +} diff --git a/src/DLibs b/src/DLibs index a91b50c..3c6d214 160000 --- a/src/DLibs +++ b/src/DLibs @@ -1 +1 @@ -Subproject commit a91b50cb90397e4455bd505017541c72d1a959e0 +Subproject commit 3c6d214aa7e3058f8de1a4ff380fd1bb8ce56036 diff --git a/src/editor/main.d b/src/editor/main.d index e69de29..55436b0 100644 --- a/src/editor/main.d +++ b/src/editor/main.d @@ -0,0 +1,6 @@ +import std.stdio; + +void main(string[] argv) +{ + writeln("Hello, World!"); +}