diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-22 10:58:47 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-22 10:58:47 +0900 |
| commit | 384865997de9a994199da665f352eb83f66b8506 (patch) | |
| tree | 42839ce78cec9148c5b555a3a4bf3ab93fe0b9b7 /lib | |
| parent | fbc629c56f2aa24bbf477255976f1f64d8566cb1 (diff) | |
| download | mruby-384865997de9a994199da665f352eb83f66b8506.tar.gz mruby-384865997de9a994199da665f352eb83f66b8506.zip | |
build: provide global defines by `build.defines`.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mruby/build.rb | 3 | ||||
| -rw-r--r-- | lib/mruby/build/command.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index a99c0f507..f82eb9401 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -71,7 +71,7 @@ module MRuby include Rake::DSL include LoadGems - attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir + attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir, :defines attr_reader :products, :libmruby_core_objs, :libmruby_objs, :gems, :toolchains, :presym, :mrbc_build, :gem_dir_to_repo_url alias libmruby libmruby_objs @@ -97,6 +97,7 @@ module MRuby @file_separator = '/' @build_dir = "#{build_dir}/#{@name}" @gem_clone_dir = "#{build_dir}/repos/#{@name}" + @defines = [] @cc = Command::Compiler.new(self, %w(.c), label: "CC") @cxx = Command::Compiler.new(self, %w(.cc .cxx .cpp), label: "CXX") @objc = Command::Compiler.new(self, %w(.m), label: "OBJC") diff --git a/lib/mruby/build/command.rb b/lib/mruby/build/command.rb index 23a118465..c93d08ea7 100644 --- a/lib/mruby/build/command.rb +++ b/lib/mruby/build/command.rb @@ -77,7 +77,7 @@ module MRuby end def all_flags(_defines=[], _include_paths=[], _flags=[]) - define_flags = [defines, _defines].flatten.map{ |d| option_define % d } + define_flags = [defines, _defines, build.defines].flatten.map{ |d| option_define % d } include_path_flags = [include_paths, _include_paths].flatten.map do |f| option_include_path % filename(f) end |
