From 66afe52032c85763ac3cc0ab03166879a2adb3ea Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Sat, 6 Jan 2024 11:41:41 -0300 Subject: buil Use NSIS to create Windows installer --- Rakefile | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 377a77b..eeab51a 100644 --- a/Rakefile +++ b/Rakefile @@ -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] -- cgit v1.2.3