diff options
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 53 |
1 files changed, 17 insertions, 36 deletions
@@ -15,10 +15,12 @@ require 'rake/clean' require 'rake/loaders/makefile' -OS = if RUBY_PLATFORM == "x64-mingw32" - :windows +if RUBY_PLATFORM.include? 'cygwin' then + load './rake/windows.rake' + OS = :windows else - :linux + load './rake/linux.rake' + OS = :linux end OBJ = 'candy_gear' @@ -54,19 +56,7 @@ LIBRARIES = [ 'SDL2_mixer', 'freetype', 'm' -] -case OS -when :windows - LIBRARIES.concat([ - 'SDL2main', - 'mingw32', - 'vulkan-1.dll' - ]) -when :linux - LIBRARIES.concat([ - 'vulkan' - ]) -end +] + OS_LIBRARIES PKG_CONFIG = [ 'freetype2' @@ -133,6 +123,17 @@ rule '.spv' => ['.glsl'] do |t| system("glslangValidator -V #{t.source} -o #{t.name}") end +task :lib do + destdir = ENV['DESTDIR'] || '' + + `install -d #{destdir}#{DATA_DIR}/lib` + RB_LIBS.each do |path| + subdir = /(\/[[:alnum:]]+)\//.match(path)&.captures&.at(0) + `install -d #{destdir}#{DATA_DIR}/lib#{subdir}` unless subdir.nil? + `install #{path} #{destdir}#{DATA_DIR}/lib#{subdir}` + end +end + task build: CPP_OBJS + SPV_FILES + [MRUBY_STATIC_LIB] do libs = LIBRARIES.inject('') {_1 + "-l#{_2} "} @@ -146,24 +147,4 @@ task build: CPP_OBJS + SPV_FILES + [MRUBY_STATIC_LIB] do system("g++ -o #{OBJ} #{CPP_OBJS} #{MRUBY_STATIC_LIB} #{flags} #{libs}") end -task install: :build 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 do |path| - subdir = /(\/[[:alnum:]]+)\//.match(path)&.captures&.at(0) - `install -d #{destdir}#{DATA_DIR}/lib#{subdir}` unless subdir.nil? - `install #{path} #{destdir}#{DATA_DIR}/lib#{subdir}` - end -end - task default: %[build] |