From f88712a929ee3543f8e1d45c6071f676df339cdb Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Tue, 2 Aug 2022 16:52:33 -0300 Subject: refa Use Vulkan for graphics This is a partial refactory. Some functionalities implemented in SDL were removed and need reimplementation. --- Rakefile | 51 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index ef51ee2..6e6388e 100644 --- a/Rakefile +++ b/Rakefile @@ -21,45 +21,45 @@ VERSION = '0.1.0' DATA_DIR = '/usr/local/share/candy_gear' -C_FILES = FileList[ - 'src/*.c' +CPP_H_FILES = FileList[ + 'src/**/*.hpp' ] -C_H_FILES = FileList[ - 'src/*.h' -] -C_OBJS = C_FILES.ext('.o') - CPP_FILES = FileList[ - 'src/*.cpp' + 'src/**/*.cpp' ] CPP_OBJS = CPP_FILES.ext('.o') -OBJ_FILES = C_OBJS + CPP_OBJS - RB_LIBS = FileList[ 'lib/*.rb' ] +SPV_FILES = [ + 'glsl/vert.spv', + 'glsl/frag.spv' +] + LIBRARIES = [ 'SDL2', 'SDL2_image', 'SDL2_mixer', - 'SDL2_ttf', 'm', 'mruby', + 'vulkan', 'yaml-cpp' ] +CLEAN.include( + FileList[ + 'src/**/*.o' + ] +) + task :doc do `doxygen Doxyfile` end -rule '.o' => ['.c'] do |t| - `gcc -c -std=c99 #{t.source} -o #{t.name}` -end - rule '.o' => ['.cpp'] do |t| - `g++ -c -std=c++17 #{t.source} -o #{t.name}` + `g++ -D DEBUG=1 -c -std=c++17 #{t.source} -o #{t.name}` end task :pkg do @@ -72,8 +72,7 @@ task :pkg do 'Rakefile', 'README.markdown' ] + - C_FILES + - C_H_FILES + + CPP_H_FILES + CPP_FILES + RB_LIBS @@ -81,17 +80,29 @@ task :pkg do `tar -czvf pkg/#{name}.tar.gz --transform 's,^,#{name}/,' #{files}` end -task build: OBJ_FILES do +task :shaders do + system('glslangValidator -V glsl/shader.vert -o glsl/vert.spv') and + system('glslangValidator -V glsl/shader.frag -o glsl/frag.spv') +end + +task build: CPP_OBJS do libs = LIBRARIES.inject('') {_1 + "-l#{_2} "} - `g++ -o #{OBJ} #{OBJ_FILES} #{libs}` + `g++ -o #{OBJ} #{CPP_OBJS} #{libs}` end task :install do destdir = ENV['DESTDIR'] || '' + # Install engine `install -d #{destdir}/usr/local/bin` `install #{OBJ} #{destdir}/usr/local/bin` + + # Install shaders + `install -d #{destdir}#{DATA_DIR}/glsl` + SPV_FILES.each {`install #{_1} #{destdir}#{DATA_DIR}/glsl`} + + # Install libs `install -d #{destdir}#{DATA_DIR}/lib` RB_LIBS.each {`install #{_1} #{destdir}#{DATA_DIR}/lib`} end -- cgit v1.2.3