diff options
author | Frederico Linhares <fred@linhares.blue> | 2022-08-02 16:52:33 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2022-08-02 16:52:33 -0300 |
commit | f88712a929ee3543f8e1d45c6071f676df339cdb (patch) | |
tree | ad4c9272ead49eb205b1c655bb1d878654863e26 /Rakefile | |
parent | 9c6a166fa2b00a1ab177d9e9216a839b87e36ca7 (diff) |
refa Use Vulkan for graphics
This is a partial refactory. Some functionalities implemented in
SDL were removed and need reimplementation.
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 51 |
1 files changed, 31 insertions, 20 deletions
@@ -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 |