From 942a710653f69e6569ad09b5a9962f966b9425ad Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Wed, 5 Oct 2022 11:48:56 -0300 Subject: buil Configure compilatio for MinGW --- Rakefile | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 69bdb84..46d6bfe 100644 --- a/Rakefile +++ b/Rakefile @@ -15,6 +15,12 @@ require 'rake/clean' require 'rake/loaders/makefile' +OS = if RUBY_PLATFORM == "x64-mingw32" + :windows +else + :linux +end + OBJ = 'candy_gear' VERSION = '0.1.0' @@ -48,9 +54,20 @@ LIBRARIES = [ 'SDL2_image', 'SDL2_mixer', 'm', - 'vulkan', 'yaml-cpp' ] +case OS +when :windows + LIBRARIES.concat([ + 'SDL2main', + 'mingw32', + 'vulkan-1.dll' + ]) +when :linux + LIBRARIES.concat([ + 'vulkan' + ]) +end CLEAN.include( FileList[ @@ -72,7 +89,10 @@ end # 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` } + Dir.chdir("mruby-#{MRUBY_VERSION}") do + ENV['MRUBY_CONFIG'] = '../ruby_build_config.rb' + `rake` + end end task :doc do @@ -109,7 +129,14 @@ end task build: CPP_OBJS + SPV_FILES + [MRUBY_STATIC_LIB] do libs = LIBRARIES.inject('') {_1 + "-l#{_2} "} - system("g++ -o #{OBJ} #{CPP_OBJS} #{MRUBY_STATIC_LIB} #{libs}") + flags = '' + case OS + when :windows + flags = '-w -Wl,-subsystem,windows' + when :linux + end + + system("g++ -o #{OBJ} #{CPP_OBJS} #{MRUBY_STATIC_LIB} #{flags} #{libs}") end task install: :build do -- cgit v1.2.3