summaryrefslogtreecommitdiffhomepage
path: root/core/mruby_build_host.rb
blob: 7e0b77ceb211aa0aebbd64ba0643bbfa404cd84c (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
configure_project_root = File.expand_path('../..')
configure_mrbgem_dir = File.expand_path("#{configure_project_root}/mrbgems")


MRuby::Build.new do |conf|
  # load specific toolchain settings
  conf.toolchain :clang
  #conf.toolchain

  disable_lock # disables being stuck on a single commit

  # -- CORE GEMS --
  conf.gembox "stdlib"
  conf.gembox "stdlib-ext"
  conf.gembox "math"
  conf.gembox "metaprog"
  #conf.gembox "stdlib-io"

  # Use standard IO/File class
  conf.gem :core => "mruby-io"

  # TODO: this gem doesnt current work
  # with windows export
  #conf.gem :core => "mruby-socket"

  # Use standard print/puts/p
  conf.gem :core => "mruby-print"

  # Generate mrbc command
  conf.gem :core => "mruby-bin-mrbc"

  # Generate mirb command
  conf.gem :core => "mruby-bin-mirb"

  # Generate mruby command
  conf.gem :core => "mruby-bin-mruby"

  # Generate mruby-strip command
  conf.gem :core => "mruby-bin-strip"

  # Generate mruby-config command
  conf.gem :core => "mruby-bin-config"

  # -- POTENTIAL GEMS --
  # gems that we may want incorperated

  # Simple Http
  #conf.gem :git => 'https://github.com/matsumotory/mruby-simplehttp'

  # Memory Profiler
  #conf.gem :git => 'https://github.com/iij/mruby-memprof'

  # Testing Framework
  #conf.gem :git => 'https://github.com/iij/mruby-mtest'

  # Regex
  #conf.gem :git => 'https://github.com/iij/mruby-regexp-pcre'

  # JSON
  #conf.gem :git => 'https://github.com/iij/mruby-iijson'

  # Dir
  #conf.gem :git => 'https://github.com/iij/mruby-dir'

  # -- YOUR GEMS --
  # gems added into the mrbgems directory

  Dir.each_child(configure_mrbgem_dir) do |mrb_gem|
    conf.gem "#{configure_mrbgem_dir}/#{mrb_gem}"
  end

  # ---

  # C compiler settings
  conf.cc do |cc|
    cc.command = 'zig cc -target native -O2'
    cc.include_paths << ["#{configure_project_root}/vendor/tux/include"]
  end

  # Linker settings
  conf.linker do |linker|
    #linker.command = ENV['LD'] || 'gcc'
    linker.command = 'zig c++ -target native -O2'
    linker.flags << ['-lraylib -lGL -lm -lpthread -ldl -lrt -lX11']
    linker.library_paths << ["#{configure_project_root}/vendor/tux/lib"]
  end

  conf.cxx.command = 'zig c++ -target native -O2'

  # Turn on `enable_debug` for better debugging
  # conf.enable_debug
  conf.enable_bintest
  conf.enable_test
end