diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Makefile | 275 | ||||
-rw-r--r-- | cfg/Makefile | 21 | ||||
-rw-r--r-- | configure.lua | 388 | ||||
-rw-r--r-- | qstd/Makefile | 31 | ||||
-rw-r--r-- | sc/Makefile | 51 | ||||
-rw-r--r-- | video.cpp | 2 |
7 files changed, 523 insertions, 251 deletions
@@ -9,9 +9,9 @@ tags /msbuild/obj /msbuild/bin /data/ -/cfg/libcfg.a -/qstd/libqstd.a -/sc/sc +/libcfg.a +/libqstd.a +/shadercompiler /c2 /pack /packer @@ -1,149 +1,136 @@ -.POSIX: - -target = c2 -data_dir = data -shaders = \ - $(data_dir)/triangle.csh \ - $(data_dir)/ui.csh \ - $(data_dir)/surface.csh \ - $(data_dir)/surface_depthonly.csh \ - $(data_dir)/sky.csh \ - $(data_dir)/mip_spec.csh -textures = \ - $(data_dir)/22.tex \ - $(data_dir)/kita.tex \ - $(data_dir)/brick_albedo.tex \ - $(data_dir)/brick_ao.tex \ - $(data_dir)/brick_normal.tex \ - $(data_dir)/sky.tex -models = $(data_dir)/monkey.mdl -materials = $(data_dir)/bricks.mat $(data_dir)/plastic.mat -packed_files = $(shaders) $(textures) $(models) $(materials) -tools = qstd cfg sc -objects = app.o c2.o video.o pipeline.o asset.o ui.o maths.o model.o -includes = -Iqstd -defines = -Dplat_x86 -Dplat_posix -Dplat_x11 -Dallocation_default_alignment=8 -cflags = -MMD -MF $(basename $@).d $(includes) $(defines) $(DEBUG_COMPILE_FLAG) -libs = -lX11 -lm -lflags = $(libs) $(DEBUG_LINK_FLAG) - -.PHONY: all clean $(tools) -all: $(target) $(shaders) $(tools) $(objects) pack - -qstd: - $(MAKE) -C qstd - -cfg: qstd - $(MAKE) -C cfg - -sc: qstd cfg - $(MAKE) -C sc - -packer: packer.c | qstd - $(CC) $(cflags) packer.c $(lflags) -Lqstd -lqstd -o packer - -convtexture: convtexture.c | qstd - $(CC) $(cflags) convtexture.c $(lflags) -Lqstd -lqstd -o convtexture - -convmodel: convmodel.c | qstd - $(CC) $(cflags) convmodel.c $(lflags) -Lqstd -lqstd -o convmodel - -convmaterial: convmaterial.c | qstd cfg - $(CC) $(cflags) convmaterial.c $(lflags) -Lqstd -lqstd -Lcfg -lcfg -o convmaterial - -pack: $(packed_files) packer - ./packer pack $(data_dir) $(notdir $(packed_files)) - -data/triangle.csh: intermediate/triangle.glsl | $(data_dir) sc - ./sc/sc intermediate/triangle.glsl $(data_dir)/triangle.csh - -data/ui.csh: intermediate/ui.glsl | $(data_dir) sc - ./sc/sc intermediate/ui.glsl $(data_dir)/ui.csh - -data/surface.csh: intermediate/surface.glsl | $(data_dir) sc - ./sc/sc intermediate/surface.glsl $(data_dir)/surface.csh - -data/surface_depthonly.csh: intermediate/surface_depthonly.glsl | $(data_dir) sc - ./sc/sc intermediate/surface_depthonly.glsl $(data_dir)/surface_depthonly.csh - -data/sky.csh: intermediate/sky.glsl | $(data_dir) sc - ./sc/sc intermediate/sky.glsl $(data_dir)/sky.csh - -data/mip_spec.csh: intermediate/mip_spec.glsl | $(data_dir) sc - ./sc/sc intermediate/mip_spec.glsl $(data_dir)/mip_spec.csh - -data/22.tex: intermediate/22.bmp | $(data_dir) convtexture - ./convtexture intermediate/22.bmp $(data_dir)/22.tex bc1 - -data/kita.tex: intermediate/kita.bmp | $(data_dir) convtexture - ./convtexture intermediate/kita.bmp $(data_dir)/kita.tex bc1 - -data/brick_albedo.tex: intermediate/brick_albedo.bmp | $(data_dir) convtexture - ./convtexture intermediate/brick_albedo.bmp $(data_dir)/brick_albedo.tex bc1 - -data/brick_ao.tex: intermediate/brick_ao.bmp | $(data_dir) convtexture - ./convtexture intermediate/brick_ao.bmp $(data_dir)/brick_ao.tex bc4 - -data/brick_normal.tex: intermediate/brick_normal.bmp | $(data_dir) convtexture - ./convtexture intermediate/brick_normal.bmp $(data_dir)/brick_normal.tex bc5 - -data/sky.tex: intermediate/sky.hdr | $(data_dir) convtexture - ./convtexture intermediate/sky.hdr $(data_dir)/sky.tex rgba16f - -data/monkey.mdl: intermediate/monkey.glb $(shaders) | $(data_dir) convmodel - ./convmodel $(data_dir) intermediate/monkey.glb $(data_dir)/monkey.mdl - -data/bricks.mat: intermediate/bricks.mat | $(data_dir) convmaterial - ./convmaterial intermediate/bricks.mat $(data_dir)/bricks.mat - -data/plastic.mat: intermediate/plastic.mat | $(data_dir) convmaterial - ./convmaterial intermediate/plastic.mat $(data_dir)/plastic.mat - -app.o: - $(CXX) -c $(cflags) app.cpp -o app.o - -video.o: - $(CXX) -c $(cflags) video.cpp -o video.o - -pipeline.o: - $(CXX) -c $(cflags) pipeline.cpp -o pipeline.o - -asset.o: - $(CXX) -c $(cflags) asset.cpp -o asset.o - -ui.o: - $(CXX) -c $(cflags) ui.cpp -o ui.o - -maths.o: - $(CXX) -c $(cflags) maths.cpp -o maths.o - -model.o: - $(CXX) -c $(cflags) model.cpp -o model.o - -c2.o: - $(CXX) -c $(cflags) c2.cpp -o c2.o - -$(target): $(objects) qstd/libqstd.a - $(CXX) $(objects) $(lflags) -o $(target) -Lqstd -lqstd - -qstd/libqstd.a: - $(MAKE) -C qstd - -$(data_dir): - mkdir -p $(data_dir) +# generated by configure.lua + +cflags = -pedantic -Wall -Wextra -Dplat_x11 -Dplat_x86 -Dplat_posix -Dallocation_default_alignment=8 -Icfg -Iqstd -Isc/glslang -MMD -MF $(basename $@).d + +.PHONY: all clean +all: c2 + +ifndef config + config=debug +endif +ifeq ($(config),debug) + opt_com = -DDEBUG -g -O0 + opt_lnk = +endif +ifeq ($(config),release) + opt_com = -DNDEBUG -O3 + opt_lnk = -s +endif + +qstd/memory.o: qstd/memory.c + gcc -std=gnu99 $(opt_com) $(cflags) -c qstd/memory.c -o qstd/memory.o +qstd/plat.o: qstd/plat.c + gcc -std=gnu99 $(opt_com) $(cflags) -c qstd/plat.c -o qstd/plat.o +qstd/str.o: qstd/str.c + gcc -std=gnu99 $(opt_com) $(cflags) -c qstd/str.c -o qstd/str.o +qstd/pack.o: qstd/pack.c + gcc -std=gnu99 $(opt_com) $(cflags) -c qstd/pack.c -o qstd/pack.o +libqstd.a: qstd/memory.o qstd/plat.o qstd/str.o qstd/pack.o + ar -rcs libqstd.a qstd/memory.o qstd/plat.o qstd/str.o qstd/pack.o + +cfg/cfgparse.o: cfg/cfgparse.c + gcc -std=gnu99 $(opt_com) $(cflags) -c cfg/cfgparse.c -o cfg/cfgparse.o +libcfg.a: cfg/cfgparse.o + ar -rcs libcfg.a cfg/cfgparse.o + +sc/sc.o: sc/sc.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c sc/sc.cpp -o sc/sc.o +sc/includer.o: sc/includer.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c sc/includer.cpp -o sc/includer.o +shadercompiler: sc/sc.o sc/includer.o libqstd.a libcfg.a + g++ $(opt_lnk) $(lflags) -o shadercompiler sc/sc.o sc/includer.o libqstd.a libcfg.a -Lsc/glslang/build/glslang -Lsc/glslang/build/SPIRV -Lsc/glslang/build/glslang/OSDependent/Unix -Lsc/glslang/build/External/spirv-tools/source -Lsc/glslang/build/External/spirv-tools/source/link -Lsc/glslang/build/External/spirv-tools/source/opt -lglslang -lglslang-default-resource-limits -lSPIRV -lMachineIndependent -lSPVRemapper -lOSDependent -lGenericCodeGen -lSPIRV-Tools-link -lSPIRV-Tools-opt -lSPIRV-Tools + +app.o: app.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c app.cpp -o app.o +c2.o: c2.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c c2.cpp -o c2.o +video.o: video.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c video.cpp -o video.o +pipeline.o: pipeline.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c pipeline.cpp -o pipeline.o +asset.o: asset.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c asset.cpp -o asset.o +ui.o: ui.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c ui.cpp -o ui.o +maths.o: maths.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c maths.cpp -o maths.o +model.o: model.cpp + g++ -std=c++20 $(opt_com) $(cflags) -c model.cpp -o model.o +c2: app.o c2.o video.o pipeline.o asset.o ui.o maths.o model.o libqstd.a + g++ $(opt_lnk) $(lflags) -o c2 app.o c2.o video.o pipeline.o asset.o ui.o maths.o model.o libqstd.a -lX11 -lm + +c2: pack + +convtexture.o: convtexture.c + gcc -std=gnu99 $(opt_com) $(cflags) -c convtexture.c -o convtexture.o +convtexture: convtexture.o libqstd.a + gcc $(opt_lnk) $(lflags) -o convtexture convtexture.o libqstd.a + +convmodel.o: convmodel.c + gcc -std=gnu99 $(opt_com) $(cflags) -c convmodel.c -o convmodel.o +convmodel: convmodel.o libqstd.a + gcc $(opt_lnk) $(lflags) -o convmodel convmodel.o libqstd.a + +convmaterial.o: convmaterial.c + gcc -std=gnu99 $(opt_com) $(cflags) -c convmaterial.c -o convmaterial.o +convmaterial: convmaterial.o libqstd.a libcfg.a + gcc $(opt_lnk) $(lflags) -o convmaterial convmaterial.o libqstd.a libcfg.a + +packer.o: packer.c + gcc -std=gnu99 $(opt_com) $(cflags) -c packer.c -o packer.o +packer: packer.o libqstd.a + gcc $(opt_lnk) $(lflags) -o packer packer.o libqstd.a + +data/triangle.csh: intermediate/triangle.glsl shadercompiler | data + ./shadercompiler intermediate/triangle.glsl data/triangle.csh +data/ui.csh: intermediate/ui.glsl shadercompiler | data + ./shadercompiler intermediate/ui.glsl data/ui.csh +data/surface.csh: intermediate/surface.glsl shadercompiler | data + ./shadercompiler intermediate/surface.glsl data/surface.csh +data/surface_depthonly.csh: intermediate/surface_depthonly.glsl shadercompiler | data + ./shadercompiler intermediate/surface_depthonly.glsl data/surface_depthonly.csh +data/sky.csh: intermediate/sky.glsl shadercompiler | data + ./shadercompiler intermediate/sky.glsl data/sky.csh +data/mip_spec.csh: intermediate/mip_spec.glsl shadercompiler | data + ./shadercompiler intermediate/mip_spec.glsl data/mip_spec.csh + +data/monkey.mdl: convmodel intermediate/monkey.glb data/triangle.csh data/ui.csh data/surface.csh data/surface_depthonly.csh data/sky.csh data/mip_spec.csh | data + ./convmodel data intermediate/monkey.glb data/monkey.mdl + +data/22.tex: convtexture intermediate/22.bmp | data + ./convtexture intermediate/22.bmp data/22.tex bc1 +data/kita.tex: convtexture intermediate/kita.bmp | data + ./convtexture intermediate/kita.bmp data/kita.tex bc1 +data/brick_albedo.tex: convtexture intermediate/brick_albedo.bmp | data + ./convtexture intermediate/brick_albedo.bmp data/brick_albedo.tex bc1 +data/brick_ao.tex: convtexture intermediate/brick_ao.bmp | data + ./convtexture intermediate/brick_ao.bmp data/brick_ao.tex bc4 +data/brick_normal.tex: convtexture intermediate/brick_normal.bmp | data + ./convtexture intermediate/brick_normal.bmp data/brick_normal.tex bc5 +data/sky.tex: convtexture intermediate/sky.hdr | data + ./convtexture intermediate/sky.hdr data/sky.tex rgba16f + +data/bricks.mat: convmaterial intermediate/bricks.mat | data + ./convmaterial intermediate/bricks.mat data/bricks.mat +data/plastic.mat: convmaterial intermediate/plastic.mat | data + ./convmaterial intermediate/plastic.mat data/plastic.mat + +pack: packer data/triangle.csh data/ui.csh data/surface.csh data/surface_depthonly.csh data/sky.csh data/mip_spec.csh data/monkey.mdl data/22.tex data/kita.tex data/brick_albedo.tex data/brick_ao.tex data/brick_normal.tex data/sky.tex data/bricks.mat data/plastic.mat + ./packer pack data triangle.csh ui.csh surface.csh surface_depthonly.csh sky.csh mip_spec.csh monkey.mdl 22.tex kita.tex brick_albedo.tex brick_ao.tex brick_normal.tex sky.tex bricks.mat plastic.mat + +data: + mkdir -p data + +-include qstd/memory.d qstd/plat.d qstd/str.d qstd/pack.d cfg/cfgparse.d sc/sc.d sc/includer.d app.d c2.d video.d pipeline.d asset.d ui.d maths.d model.d convtexture.d convmodel.d convmaterial.d packer.d clean: - rm -rf $(data_dir) - rm -f $(objects) - rm -f $(objects:%.o=%.d) - rm packer.d - rm -f $(targets) + rm -f qstd/memory.o qstd/plat.o qstd/str.o qstd/pack.o cfg/cfgparse.o sc/sc.o sc/includer.o app.o c2.o video.o pipeline.o asset.o ui.o maths.o model.o convtexture.o convmodel.o convmaterial.o packer.o qstd/memory.d qstd/plat.d qstd/str.d qstd/pack.d cfg/cfgparse.d sc/sc.d sc/includer.d app.d c2.d video.d pipeline.d asset.d ui.d maths.d model.d convtexture.d convmodel.d convmaterial.d packer.d data/triangle.csh data/ui.csh data/surface.csh data/surface_depthonly.csh data/sky.csh data/mip_spec.csh data/monkey.mdl data/22.tex data/kita.tex data/brick_albedo.tex data/brick_ao.tex data/brick_normal.tex data/sky.tex data/bricks.mat data/plastic.mat + rm -f shadercompiler + rmdir data + rm -f c2 rm -f convtexture rm -f convmodel - rm -f packer - make -C qstd clean - make -C cfg clean - make -C sc clean + rm -f convmaterial + rm -f libqstd.a + rm -f libcfg.a --include $(objects:%.o=%.d) --include packer.d diff --git a/cfg/Makefile b/cfg/Makefile deleted file mode 100644 index e10e70f..0000000 --- a/cfg/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -.POSIX: -target = libcfg.a -includes = -I../qstd -cflags = -std=c90 -pedantic -Wall -Wextra $(DEBUG_COMPILE_FLAG) $(includes) -lflags = $(DEBUG_LINK_FLAG) - -objects = cfgparse.o - -.PHONY: all clean - -all: $(target) - -cfgparse.o: cfgparse.c cfgparse.h - $(CC) -c $(cflags) cfgparse.c -o cfgparse.o - -$(target): $(objects) - $(AR) -rcs $(target) $(objects) - -clean: - rm -f $(target) - rm -f $(objects) diff --git a/configure.lua b/configure.lua new file mode 100644 index 0000000..0509346 --- /dev/null +++ b/configure.lua @@ -0,0 +1,388 @@ +config = { + c2 = { + "app", + "c2", + "video", + "pipeline", + "asset", + "ui", + "maths", + "model" + }, + qstd = { + "memory", + "plat", + "str", + "pack" + }, + cfg = { + "cfgparse" + }, + sc = { + "sc", + "includer" + }, + packer = { + "packer" + }, + convtexture = { + "convtexture" + }, + convmodel = { + "convmodel" + }, + convmaterial = { + "convmaterial" + }, + shaders = { + "triangle", + "ui", + "surface", + "surface_depthonly", + "sky", + "mip_spec" + }, + materials = { + "bricks", + "plastic", + }, + models = { + "monkey", + }, + textures = { + { "22", "bmp", "bc1" }, + { "kita", "bmp", "bc1" }, + { "brick_albedo", "bmp", "bc1" }, + { "brick_ao", "bmp", "bc4" }, + { "brick_normal", "bmp", "bc5" }, + { "sky", "hdr", "rgba16f" } + } +} + +local system = arg[1] +if system ~= "windows" and system ~= "unix" then + print("Invalid system, needs to be 'windows' or 'unix'.") + os.exit(1) +end + +function build_unix() + local compiler_c = nil + local compiler_cpp = nil + local ar = nil + if os.execute("gcc --version") then + compiler_c = "gcc" + compiler_cpp = "g++" + elseif os.execute("clang --version") then + compiler_c = "clang" + compiler_cpp = "clang++" + end + if os.execute("ar --version") then + ar = "ar" + end + if not compiler_c or not compiler_cpp then + print("didn't find a valid compiler :(") + os.exit(2) + end + print("c compiler: " .. compiler_c) + print("c++ compiler: " .. compiler_cpp) + print("ar: " .. ar) + + local outfile = io.open("Makefile", "w") + if not outfile then + print("Failed to open Makefile.") + exit(3) + end + local std_flag = { + c = "-std=gnu99", + cpp = "-std=c++20" + } + outfile:write("# generated by configure.lua\n\n") + outfile:write( + "cflags = -pedantic -Wall -Wextra " .. + "-Dplat_x11 -Dplat_x86 -Dplat_posix -Dallocation_default_alignment=8 " .. + "-Icfg -Iqstd -Isc/glslang " .. + "-MMD -MF $(basename $@).d " .. + "\n\n" + ) + + outfile:write(".PHONY: all clean\n") + outfile:write("all: c2\n\n") + + outfile:write("ifndef config\n") + outfile:write(" config=debug\n") + outfile:write("endif\n") + outfile:write("ifeq ($(config),debug)\n") + outfile:write(" opt_com = -DDEBUG -g -O0\n") + outfile:write(" opt_lnk =\n") + outfile:write("endif\n") + outfile:write("ifeq ($(config),release)\n") + outfile:write(" opt_com = -DNDEBUG -O3\n") + outfile:write(" opt_lnk = -s\n") + outfile:write("endif\n\n") + + local all_objs = {} + local all_deps = {} + local all_assets = {} + local all_shaders = {} + local function objs(com, ext, tab, dir) + local std = std_flag[ext] + for _, fname in ipairs(tab) do + outfile:write(string.format( + "%s%s.o: %s%s.%s\n\t%s %s $(opt_com) $(cflags) -c %s%s.%s -o %s%s.o\n", + dir, + fname, + dir, + fname, + ext, + com, + std, + dir, + fname, + ext, + dir, + fname + )) + all_objs[#all_objs + 1] = dir .. fname .. '.o' + all_deps[#all_deps + 1] = dir .. fname .. '.d' + end + end + + local function lib(com, tab, name, dir) + objs(com, 'c', tab, dir) + outfile:write(name .. ": ") + for _, fname in ipairs(tab) do + outfile:write(dir .. fname .. ".o ") + end + outfile:write("\n\t") + outfile:write(ar .. " -rcs " .. name .. " ") + for _, fname in ipairs(tab) do + outfile:write(dir .. fname .. ".o ") + end + outfile:write("\n\n") + end + + local function prog(type, com, tab, name, dir, dep, lib) + objs(com, type, tab, dir) + outfile:write(name .. ": ") + for _, fname in ipairs(tab) do + outfile:write(dir .. fname .. ".o ") + end + for _, fname in ipairs(dep) do + outfile:write(fname .. " ") + end + outfile:write("\n\t") + outfile:write(com .. " $(opt_lnk) $(lflags) -o " .. name .. " ") + for _, fname in ipairs(tab) do + outfile:write(dir .. fname .. ".o ") + end + for _, fname in ipairs(dep) do + outfile:write(fname .. " ") + end + for _, fname in ipairs(lib) do + outfile:write(fname .. " ") + end + outfile:write("\n\n") + end + + local function shaders(stype, dtype, tool, tab) + for _, fname in ipairs(tab) do + outfile:write(string.format( + "data/%s.%s: intermediate/%s.%s %s | data\n\t./%s intermediate/%s.%s data/%s.%s\n", + fname, + dtype, + fname, + stype, + tool, + tool, + fname, + stype, + fname, + dtype + )) + all_shaders[#all_shaders + 1] = "data/" .. fname .. "." .. dtype + all_assets[#all_assets + 1] = fname .. "." .. dtype + end + outfile:write("\n") + end + + local function models(tab) + for _, fname in ipairs(tab) do + outfile:write(string.format( + "data/%s.mdl: convmodel intermediate/%s.glb ", + fname, fname + )) + for _, fname in ipairs(all_shaders) do + outfile:write(fname .. " ") + end + outfile:write("| data\n\t") + outfile:write(string.format( + "./convmodel data intermediate/%s.glb data/%s.mdl\n", + fname, fname + )) + all_assets[#all_assets + 1] = fname .. ".mdl" + end + outfile:write("\n") + end + + local function textures(tab) + for _, c in ipairs(tab) do + local fname = c[1] + local ext = c[2] + local fmt = c[3] + outfile:write(string.format( + "data/%s.tex: convtexture intermediate/%s.%s ", + fname, fname, ext + )) + outfile:write("| data\n\t") + outfile:write(string.format( + "./convtexture intermediate/%s.%s data/%s.tex %s\n", + fname, ext, fname, fmt + )) + all_assets[#all_assets + 1] = fname .. ".tex" + end + outfile:write("\n") + end + + local function materials(tab) + for _, fname in ipairs(tab) do + outfile:write(string.format( + "data/%s.mat: convmaterial intermediate/%s.mat ", + fname, fname + )) + outfile:write("| data\n\t") + outfile:write(string.format( + "./convmaterial intermediate/%s.mat data/%s.mat\n", + fname, fname + )) + all_assets[#all_assets + 1] = fname .. ".mat" + end + outfile:write("\n") + end + + local function pack() + outfile:write("pack: packer ") + for _, fname in ipairs(all_assets) do + outfile:write("data/" .. fname .. " ") + end + outfile:write("\n\t./packer pack data ") + for _, fname in ipairs(all_assets) do + outfile:write(fname .. " ") + end + outfile:write("\n\n") + end + + lib(compiler_c, config.qstd, "libqstd.a", "qstd/") + lib(compiler_c, config.cfg, "libcfg.a", "cfg/") + prog( + "cpp", + compiler_cpp, + config.sc, + "shadercompiler", + "sc/", + { "libqstd.a", "libcfg.a" }, + { + "-Lsc/glslang/build/glslang", + "-Lsc/glslang/build/SPIRV", + "-Lsc/glslang/build/glslang/OSDependent/Unix", + "-Lsc/glslang/build/External/spirv-tools/source", + "-Lsc/glslang/build/External/spirv-tools/source/link", + "-Lsc/glslang/build/External/spirv-tools/source/opt", + "-lglslang", + "-lglslang-default-resource-limits", + "-lSPIRV", + "-lMachineIndependent", + "-lSPVRemapper", + "-lOSDependent", + "-lGenericCodeGen", + "-lSPIRV-Tools-link", + "-lSPIRV-Tools-opt", + "-lSPIRV-Tools" + } + ) + prog( + "cpp", + compiler_cpp, + config.c2, + "c2", + "", + { "libqstd.a" }, + { "-lX11", "-lm" } + ) + outfile:write("c2: pack\n\n") + prog( + "c", + compiler_c, + config.convtexture, + "convtexture", + "", + { "libqstd.a" }, + {} + ) + prog( + "c", + compiler_c, + config.convmodel, + "convmodel", + "", + { "libqstd.a" }, + {} + ) + prog( + "c", + compiler_c, + config.convmaterial, + "convmaterial", + "", + { "libqstd.a", "libcfg.a" }, + {} + ) + prog( + "c", + compiler_c, + config.packer, + "packer", + "", + { "libqstd.a" }, + {} + ) + shaders("glsl", "csh", "shadercompiler", config.shaders) + models(config.models) + textures(config.textures) + materials(config.materials) + pack() + outfile:write("data:\n\tmkdir -p data\n\n") + outfile:write("-include ") + for _, fname in ipairs(all_deps) do + outfile:write(fname .. " ") + end + outfile:write("\n\n") + outfile:write("clean:\n\trm -f ") + for _, fname in ipairs(all_objs) do + outfile:write(fname .. " ") + end + for _, fname in ipairs(all_deps) do + outfile:write(fname .. " ") + end + for _, fname in ipairs(all_assets) do + outfile:write("data/" .. fname .. " ") + end + outfile:write("\n\trm -f shadercompiler\n") + outfile:write("\trmdir data\n") + outfile:write("\trm -f c2\n") + outfile:write("\trm -f convtexture\n") + outfile:write("\trm -f convmodel\n") + outfile:write("\trm -f convmaterial\n") + outfile:write("\trm -f libqstd.a\n") + outfile:write("\trm -f libcfg.a\n") + outfile:write("\n") + print("done.") +end + +if system == "unix" then + build_unix() +end + +if system == "windows" then + print("windows isn't done yet.") +end + diff --git a/qstd/Makefile b/qstd/Makefile deleted file mode 100644 index 7e3f0f1..0000000 --- a/qstd/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -.POSIX: -target = libqstd.a -includes = -I../qstd -defines = -Dplat_x86 -Dplat_posix -Dallocation_default_alignment=8 -cflags = -std=gnu90 -pedantic -Wall -Wextra $(DEBUG_COMPILE_FLAG) $(includes) $(defines) -lflags = $(DEBUG_LINK_FLAG) - -objects = plat.o memory.o str.o pack.o - -.PHONY: all clean - -all: $(target) - -memory.o: memory.c memory.h plat.h - $(CC) -c $(cflags) memory.c -o memory.o - -plat.o: plat.c plat.h - $(CC) -c $(cflags) plat.c -o plat.o - -str.o: str.c str.h memory.h - $(CC) -c $(cflags) str.c -o str.o - -pack.o: pack.c pack.h str.h plat.h memory.h - $(CC) -c $(cflags) pack.c -o pack.o - -$(target): $(objects) - $(AR) -rcs $(target) $(objects) - -clean: - rm -f $(target) - rm -f $(objects) diff --git a/sc/Makefile b/sc/Makefile deleted file mode 100644 index 6ec1cc3..0000000 --- a/sc/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -.POSIX: -target = sc -includes = -I../cfg -I../qstd -Iglslang -cflags = $(includes) -Wall -Wextra -pedantic -std=c++20 $(DEBUG_COMPILE_FLAG) -lflags = \ - $(DEBUG_LINK_FLAG) \ - -Lglslang/build/glslang \ - -Lglslang/build/SPIRV \ - -Lglslang/build/glslang/OSDependent/Unix \ - -Lglslang/build/External/spirv-tools/source \ - -Lglslang/build/External/spirv-tools/source/link \ - -Lglslang/build/External/spirv-tools/source/opt \ - -L../qstd \ - -L../cfg \ - -lcfg \ - -lqstd \ - -lglslang \ - -lglslang-default-resource-limits \ - -lSPIRV \ - -lMachineIndependent \ - -lSPVRemapper \ - -lOSDependent \ - -lGenericCodeGen \ - -lSPIRV-Tools-link \ - -lSPIRV-Tools-opt \ - -lSPIRV-Tools - -objects = sc.o includer.o - -.PHONY: all clean - -all: $(target) - -sc.o: sc.cpp includer.hpp sh_enums.h - $(CXX) -c $(cflags) sc.cpp -o sc.o - -includer.o: includer.cpp includer.hpp - $(CXX) -c $(cflags) includer.cpp -o includer.o - -$(target): $(objects) ../qstd/libqstd.a ../cfg/libcfg.a - $(CXX) $(objects) $(lflags) -o $(target) - -../qstd/libqstd.a: - $(MAKE) -C ../qstd - -../cfg/libcfg.a: - $(MAKE) -C ../cfg - -clean: - rm -f $(target) - rm -f $(objects) @@ -6,7 +6,7 @@ #define max_buffers 1024 #define max_vertex_formats 64 #define max_rpos 64 -#define max_fbos 1024 +#define max_fbos 128 #define max_pipelines 64 #define max_descriptor_sets 1024 #define max_shaders 32 |