diff options
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -19,6 +19,10 @@ OBJ = 'candy_gear' VERSION = '0.1.0' +MRUBY_VERSION = '3.1.0' +MRUBY_ZIP_FILE = "mruby-#{MRUBY_VERSION}.zip" +MRUBY_STATIC_LIB = "mruby-#{MRUBY_VERSION}/build/host/lib/libmruby.a" + DATA_DIR = '/usr/local/share/candy_gear' CPP_H_FILES = FileList[ @@ -44,7 +48,6 @@ LIBRARIES = [ 'SDL2_image', 'SDL2_mixer', 'm', - 'mruby', 'vulkan', 'yaml-cpp' ] @@ -55,12 +58,30 @@ CLEAN.include( ] ) +file MRUBY_ZIP_FILE do + system("wget https://github.com/mruby/mruby/archive/#{MRUBY_VERSION}.zip "\ + "-O #{MRUBY_ZIP_FILE}") +end + +directory "mruby-#{MRUBY_VERSION}" +file "mruby-#{MRUBY_VERSION}" => MRUBY_ZIP_FILE do + `unzip #{MRUBY_ZIP_FILE}` +end + +# Candy Gear aims to be portable to several platforms. The language is embedded +# inside the engine to ensure all versions of the engine have precisely the +# same features. +file MRUBY_STATIC_LIB => ["mruby-#{MRUBY_VERSION}"] do + Dir.chdir("mruby-#{MRUBY_VERSION}") { `rake` } +end + task :doc do `doxygen Doxyfile` end -rule '.o' => ['.cpp'] do |t| - `g++ -D DEBUG=1 -c -std=c++17 #{t.source} -o #{t.name}` +rule '.o' => ['.cpp', "mruby-#{MRUBY_VERSION}"] do |t| + system("g++ -D DEBUG=1 -c -std=c++17 -Imruby-#{MRUBY_VERSION}/include/ "\ + "#{t.source} -o #{t.name}") end task :pkg do @@ -85,10 +106,10 @@ rule '.spv' => ['.glsl'] do |t| system("glslangValidator -V #{t.source} -o #{t.name}") end -task build: CPP_OBJS + SPV_FILES do +task build: CPP_OBJS + SPV_FILES + [MRUBY_STATIC_LIB] do libs = LIBRARIES.inject('') {_1 + "-l#{_2} "} - `g++ -o #{OBJ} #{CPP_OBJS} #{libs}` + system("g++ -o #{OBJ} #{CPP_OBJS} #{MRUBY_STATIC_LIB} #{libs}") end task install: :build do |