summaryrefslogtreecommitdiffhomepage
path: root/Rakefile
blob: 2a23f71da8ee321f17ace604e62bde8ad1d80f35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace :build do
  desc "Build the engine"
  task :mruby do
    Dir.chdir("mruby") do
      system('env MRUBY_CONFIG=build_config/felflame_linux.rb rake')
    end
  end
  desc 'Build the game'
  task :game do
    Dir.chdir("build/temp") do
      system('emcc -s WASM=1 -Os -I ../../mruby/include/ ../template/game.c ../../mruby/build/web/lib/libmruby.a -o game.html --closure 1 ../../raylib_lib_files/web/libraylib.a -I ../../raylib/src/ -s USE_GLFW=3')
    end
  end
end

namespace :clean do
  desc "Clean the mruby build folders"
  task :mruby do
    Dir.chdir("mruby") do
      system('rake deep_clean')
    end
  end
end

desc "Create a server and open your game in your browser"
task :serve do
  link = "http://localhost:8000/game.html"
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
    system "start #{link}"
  elsif RbConfig::CONFIG['host_os'] =~ /darwin/
    system "open #{link}"
  elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
    system "xdg-open #{link}"
  end
  `ruby -run -ehttpd build/temp/ -p8000`
end
task :s => :serve