summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2022-10-05 11:48:56 -0300
committerFrederico Linhares <fred@linhares.blue>2022-10-05 11:48:56 -0300
commit942a710653f69e6569ad09b5a9962f966b9425ad (patch)
tree5288b9247d25a558e45333c413ee6ce70ba498e1 /Rakefile
parent2032daa62db8c2c70ab36ee14f0f4e87c2a68278 (diff)
buil Configure compilatio for MinGW
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile33
1 files changed, 30 insertions, 3 deletions
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