summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2024-01-06 11:41:41 -0300
committerFrederico Linhares <fred@linhares.blue>2024-01-06 11:41:41 -0300
commit66afe52032c85763ac3cc0ab03166879a2adb3ea (patch)
tree3da0b511503469e592972b9f220ef04928c02d64 /Rakefile
parentea2237fa3166321f06c4aea2586de315fab62282 (diff)
buil Use NSIS to create Windows installer
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile53
1 files changed, 17 insertions, 36 deletions
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]