ryb 0.1.3.1 → 0.2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +36 -47
  3. data/NOTES +0 -0
  4. data/README.md +3 -1
  5. data/TODO +4 -0
  6. data/bin/ryb +2 -42
  7. data/lib/ryb.rb +31 -20
  8. data/lib/ryb/cli.rb +103 -0
  9. data/lib/ryb/code.rb +7 -0
  10. data/lib/ryb/configuration.rb +18 -12
  11. data/lib/ryb/configurations.rb +9 -0
  12. data/lib/ryb/dependencies.rb +7 -0
  13. data/lib/ryb/dependency.rb +30 -0
  14. data/lib/ryb/dsl.rb +280 -0
  15. data/lib/ryb/environment.rb +9 -0
  16. data/lib/ryb/flags.rb +17 -0
  17. data/lib/ryb/gem.rb +58 -0
  18. data/lib/ryb/helpers/defaults.rb +26 -0
  19. data/lib/ryb/helpers/pretty_string.rb +47 -0
  20. data/lib/ryb/languages.rb +13 -0
  21. data/lib/ryb/name.rb +3 -5
  22. data/lib/ryb/ninja.rb +257 -200
  23. data/lib/ryb/paths.rb +7 -0
  24. data/lib/ryb/preprocessor.rb +10 -0
  25. data/lib/ryb/product.rb +31 -0
  26. data/lib/ryb/project.rb +6 -29
  27. data/lib/ryb/source_file.rb +62 -0
  28. data/lib/ryb/visual_studio.rb +93 -57
  29. data/lib/rybfile.rb +30 -10
  30. data/lib/rybfile/walker.rb +202 -0
  31. data/lib/yb.rb +4 -0
  32. data/lib/ybfile.rb +3 -0
  33. data/ryb.gemspec +18 -13
  34. data/ryb.sublime-project +18 -17
  35. metadata +45 -31
  36. data/lib/ryb/application.rb +0 -24
  37. data/lib/ryb/architecture.rb +0 -16
  38. data/lib/ryb/architectures/x86.rb +0 -11
  39. data/lib/ryb/architectures/x86_64.rb +0 -11
  40. data/lib/ryb/library.rb +0 -29
  41. data/lib/ryb/properties.rb +0 -10
  42. data/lib/ryb/properties/architectures.rb +0 -32
  43. data/lib/ryb/properties/configurations.rb +0 -29
  44. data/lib/ryb/properties/defines.rb +0 -31
  45. data/lib/ryb/properties/dependencies.rb +0 -23
  46. data/lib/ryb/properties/files.rb +0 -25
  47. data/lib/ryb/properties/flags.rb +0 -33
  48. data/lib/ryb/properties/named.rb +0 -17
  49. data/lib/ryb/properties/paths.rb +0 -37
  50. data/lib/ryb/properties/suffix.rb +0 -17
  51. data/lib/ryb/properties/targets.rb +0 -36
  52. data/lib/ryb/target.rb +0 -16
  53. data/lib/ryb/targets/linux.rb +0 -11
  54. data/lib/ryb/targets/macosx.rb +0 -33
  55. data/lib/ryb/targets/windows.rb +0 -13
  56. data/lib/ryb/version.rb +0 -11
  57. data/lib/ryb/windows.rb +0 -40
  58. data/lib/ryb/xcode.rb +0 -145
@@ -0,0 +1,7 @@
1
+ module Ryb
2
+ Paths = Struct.new(:includes, :libraries, :binaries) do
3
+ def initialize(includes=[], libraries=[], binaries=[])
4
+ super
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Ryb
2
+ module Preprocessor
3
+ include Pour::Pourable
4
+
5
+ property :defines, Typespec.hash[Typespec.string => Typespec.or[Typespec.nothing,
6
+ Typespec.boolean,
7
+ Typespec.number,
8
+ Typespec.string]]
9
+ end
10
+ end
@@ -0,0 +1,31 @@
1
+ module Ryb
2
+ class Product < Pour::Mould
3
+ property :name, Typespec.t[Ryb::Name]
4
+
5
+ property :author, Typespec.string
6
+ property :description, Typespec.string
7
+ property :license, Typespec.string
8
+ property :version, Typespec.string
9
+
10
+ # TODO(mtwilliams): Code signing.
11
+ # property :certificate, Typespec.struct[:public => Typespec.string,
12
+ # :private => Typespec.string]
13
+
14
+ pour Configurations
15
+ pour Environment
16
+ pour Preprocessor
17
+ pour Flags
18
+
19
+ pour Code
20
+
21
+ pour Dependencies
22
+ end
23
+
24
+ class Application < Product
25
+ end
26
+
27
+ class Library < Product
28
+ # Link at compile-time or load-time.
29
+ property :linkage, Typespec.enum[:static, :dynamic]
30
+ end
31
+ end
@@ -1,34 +1,11 @@
1
- require 'ryb/name'
2
- require 'ryb/properties'
3
-
4
- require 'ryb/architecture'
5
- require 'ryb/configuration'
6
- require 'ryb/library'
7
- require 'ryb/application'
8
-
9
1
  module Ryb
10
- class Project
11
- include Properties::Named
12
- include Properties::Defines
13
- include Properties::Flags
14
- include Properties::Paths
15
- include Properties::Architectures
16
- include Properties::Targets
17
- include Properties::Configurations
18
-
19
- def initialize(name, opts={})
20
- @name = Name.new(name, opts[:pretty])
21
- yield self if block_given?
22
- end
2
+ class Project < Pour::Mould
3
+ property :name, Typespec.t[Ryb::Name]
23
4
 
24
- def libraries; @libraries ||= [] end
25
- def library(*args, &block)
26
- self.libraries << Library.new(*args, &block)
27
- end
5
+ pour Configurations
6
+ pour Environment
7
+ pour Preprocessor
28
8
 
29
- def applications; @applications ||= [] end
30
- def application(*args, &block)
31
- self.applications << Application.new(*args, &block)
32
- end
9
+ property :products, Typespec.array[Typespec.t[Ryb::Product]]
33
10
  end
34
11
  end
@@ -0,0 +1,62 @@
1
+ module Ryb
2
+ class SourceFile
3
+ attr_reader :path
4
+ attr_reader :language
5
+ attr_reader :inconsequential
6
+
7
+ def initialize(path, opts={})
8
+ @path = path
9
+ @language = opts[:language] || SourceFile.language_from_path(path)
10
+ @inconsequential = SourceFile.inconsequential?(@path)
11
+
12
+ # TODO(mtwilliams): Use Ryb::UnsupportedLanguage.
13
+ unless Ryb::Languages.supported?(@language)
14
+ raise "..." unless @inconsequential
15
+ end
16
+ end
17
+
18
+ alias :eql? :==
19
+ def ==(other)
20
+ self.path == other.path
21
+ end
22
+
23
+ def self.c(path)
24
+ SourceFile.new(path, :language => :c)
25
+ end
26
+
27
+ def self.cpp(path)
28
+ SourceFile.new(path, :language => :cpp)
29
+ end
30
+
31
+ def self.csharp(path)
32
+ SourceFile.new(path, :language => :csharp)
33
+ end
34
+
35
+ def self.language_from_path(path)
36
+ if ext = File.extname(path)[1..-1]
37
+ self.language_from_extension(ext)
38
+ end
39
+ end
40
+
41
+ EXTENSIONS_TO_LANGUAGE = {%w{h} => :c,
42
+ %w{c} => :c,
43
+ %w{hh hpp hxx h++} => :cpp,
44
+ %w{cc cpp cxx c++} => :cpp,
45
+ %w{cs} => :csharp}
46
+
47
+ def self.language_from_extension(ext)
48
+ EXTENSIONS_TO_LANGUAGE.each do |extensions, language|
49
+ return language if extensions.include?(ext)
50
+ end
51
+ :unknown
52
+ end
53
+
54
+ INCONSEQUENTIAL = %w{h hpp hxx h++ inl}
55
+
56
+ def self.inconsequential?(path)
57
+ if ext = File.extname(path)[1..-1]
58
+ INCONSEQUENTIAL.include? ext
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,68 +1,104 @@
1
1
  module Ryb
2
2
  module VisualStudio
3
- POSSIBLE_INSTALL_DIRECTORY_REGISTRY_KEYS =
4
- ["SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\14.0\\Setup\\VC",
5
- "SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VC",
6
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\12.0\\Setup\\VC",
7
- "SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC",
8
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\12.0\\Setup\\VC",
9
- "SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC",
10
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC",
11
- "SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC",
12
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\11.0\\Setup\\VC",
13
- "SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC",
14
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\10.0\\Setup\\VC",
15
- "SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC",
16
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\10.0\\Setup\\VC",
17
- "SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC",
18
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\9.0\\Setup\\VC",
19
- "SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC",
20
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\9.0\\Setup\\VC",
21
- "SOFTWARE\\Microsoft\\VCExpress\\9.0\\Setup\\VC",
22
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\Setup\\VC",
23
- "SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC",
24
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\8.0\\Setup\\VC",
25
- "SOFTWARE\\Microsoft\\VCExpress\\8.0\\Setup\\VC",
26
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC",
27
- "SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC",
28
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\7.1\\Setup\\VC",
29
- "SOFTWARE\\Microsoft\\VCExpress\\7.1\\Setup\\VC",
30
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\7.0\\Setup\\VC",
31
- "SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VC",
32
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\7.0\\Setup\\VC",
33
- "SOFTWARE\\Microsoft\\VCExpress\\7.0\\Setup\\VC",
34
- "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\6.0\\Setup\\VC",
35
- "SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\VC",
36
- "SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\6.0\\Setup\\VC",
37
- "SOFTWARE\\Microsoft\\VCExpress\\6.0\\Setup\\VC"]
3
+ module Compiler
4
+ STANDARD_FLAGS = [
5
+ # Suppress the annoying startup banner.
6
+ "/nologo",
7
+ # Don't link after compilation.
8
+ "/c",
9
+ # Be vocal about shit code.
10
+ "/W4",
11
+ # Fuck off, RTTI.
12
+ "/GR-",
13
+ # Don't optimize for one architecture at the loss of another.
14
+ "/favor:blend"
15
+ ]
38
16
 
39
- def self.install
40
- if Ryb.platform == :windows
41
- if ENV.key?('VCInstallDir')
42
- ENV['VCInstallDir']
43
- else
44
- # TODO(mtwilliams): Escape, i.e. .gsub(/\\/,'/').gsub(/\ /,'\\ ')?
45
- self.installs.first
46
- end
17
+ def self.include_paths_to_flags(paths)
18
+ [*paths].map{|path| "/I\"#{path}\""}
19
+ end
20
+
21
+ def self.defines_to_flags(defines)
22
+ return [] unless defines
23
+ (defines.map do |name, value|
24
+ case value
25
+ when TrueClass
26
+ "/D#{name}=1"
27
+ when FalseClass
28
+ "/D#{name}=0"
29
+ when Integer
30
+ "/D#{name}=#{value}"
31
+ when String
32
+ "/D#{name}=#{value.to_s}"
33
+ else
34
+ nil
35
+ end
36
+ end).compact
37
+ end
38
+
39
+ def self.treat_warnings_as_errors_to_flag(enabled)
40
+ enabled ? %w{/WX} : []
41
+ end
42
+
43
+ def self.generate_debug_symbols_to_flag(enabled)
44
+ # HACK(mtwilliams): Force writes to PDBs to be serialized.
45
+ # Refer to https://msdn.microsoft.com/en-us/library/dn502518.aspx.
46
+ enabled ? %w{/MDd /Zi /FS} : %w{/MD}
47
+ end
48
+
49
+ def self.link_time_code_generation_to_flag(enabled)
50
+ enabled ? %w{/WX} : []
47
51
  end
48
- end
49
52
 
50
- def self.installed?
51
- !self.install.nil?
53
+ def self.optimization_to_flags(optimization)
54
+ case
55
+ when :nothing
56
+ %w{/Od /RTCsu /fp:precise /fp:except}
57
+ when :size
58
+ %w{/Os /fp:fast /fp:except-}
59
+ when :speed
60
+ %w{/Ox /fp:fast /fp:except-}
61
+ end
62
+ end
63
+
64
+ def self.architecture_to_flags(architecture)
65
+ case architecture
66
+ when :x86
67
+ %w{/arch:IA32}
68
+ when :x86_64
69
+ # TODO(mtwilliams): Determine if we can specify a minimum of SSE2?
70
+ []
71
+ else
72
+ []
73
+ end
74
+ end
52
75
  end
53
76
 
54
- def self.installs
55
- if Ryb.platform == :windows
56
- require 'win32/registry'
57
- @installs ||= begin
58
- (POSSIBLE_INSTALL_DIRECTORY_REGISTRY_KEYS.map do |key|
59
- begin
60
- ::Win32::Registry::HKEY_LOCAL_MACHINE.open(key, ::Win32::Registry::KEY_READ)['ProductDir']
61
- rescue
62
- end
63
- end).compact
64
- end
77
+ module Linker
78
+ STANDARD_FLAGS = [
79
+ # Suppress the annoying startup banner.
80
+ "/nologo",
81
+ # Don't create or embed a manifest file.
82
+ "/manifest:no"
83
+ ]
84
+
85
+ def self.library_paths_to_flags(paths)
86
+ [*paths].map{|path| "/LIBPATH:\"#{path}\""}
87
+ end
88
+
89
+ def self.generate_debug_symbols_to_flag(enabled)
90
+ enabled ? %w{/DEBUG} : %w{}
91
+ end
92
+
93
+ def self.architecture_to_flags(architecture)
94
+ case architecture
95
+ when :x86
96
+ %w{/machine:X86}
97
+ when :x86_64
98
+ %w{/machine:X64}
99
+ end
65
100
  end
66
101
  end
67
102
  end
68
103
  end
104
+
@@ -1,15 +1,35 @@
1
1
  require 'ryb'
2
- require 'ostruct'
3
2
 
4
- # TODO(mtwilliams): Improve the handling of Rybfiles.
5
- module Rybfile
6
- def self.load(path)
7
- begin
8
- return OpenStruct.new(:project => eval(File.read(path), binding(), path)).freeze
9
- rescue SignalException, SystemExit
10
- raise
11
- rescue SyntaxError, Exception => e
12
- raise "Invalid Rybfile!\n #{path}\n #{e}"
3
+ class Rybfile < Pour::Mould
4
+ property :project, Typespec.t[Ryb::Project]
5
+
6
+ class DomainSpecificLanguage
7
+ def initialize(rybfile)
8
+ @rybfile = rybfile
9
+ end
10
+
11
+ def project(name, opts={}, &block)
12
+ # TODO(mtwilliams): Allow multiple projects?
13
+ # TODO(mtwilliams): Allow other Rybfiles to be 'included'.
14
+ @rybfile.project = Ryb::Project.new
15
+ @rybfile.project.name = Ryb::Name.new(name, :pretty => opts[:pretty])
16
+
17
+ Ryb::DomainSpecificLanguage.for(@rybfile.project).instance_eval(&block)
18
+ end
19
+
20
+ def self.for(rybfile)
21
+ # Hide behind a SimpleDelegator so users don't play with our internals.
22
+ SimpleDelegator.new(self.new(rybfile))
13
23
  end
14
24
  end
25
+
26
+ def self.load(path)
27
+ rybfile = Rybfile.new
28
+
29
+ # TODO(mtwilliams): Rewrite exceptions from Typespec/Pour into Ryb and attach
30
+ # source information (the file and line number from the responsible Rybfile.)
31
+ DomainSpecificLanguage.for(rybfile).instance_eval(File.read(path), path)
32
+
33
+ rybfile
34
+ end
15
35
  end
@@ -0,0 +1,202 @@
1
+ require 'ryb'
2
+ require 'rybfile'
3
+
4
+ class Rybfile
5
+ class Walker
6
+ def initialize(vistor, rybfile, opts)
7
+ @vistor = vistor
8
+ @rybfile = rybfile
9
+ @root = opts.fetch(:root, '.')
10
+ @build = opts.fetch(:build, '_build')
11
+ # HACK(mtwilliams): Assume debug, development, and release builds are standard.
12
+ @configurations = opts.fetch(:configurations, %w{debug development release})
13
+ @platforms = opts.fetch(:platforms, Ryb::Helpers::Defaults.targets)
14
+ # HACK(mtwilliams): Assume x86 and x86_64 architectures are standard.
15
+ @architectures = opts.fetch(:architectures, %w{x86 x86_64})
16
+ end
17
+
18
+ def walk
19
+ # TODO(mtwilliams): Walk in two steps. The first builds an internal hash
20
+ # of projects and their products that is a deferred copy of this code and
21
+ # caches the results. Then iterate over this tree, passing the the lazy
22
+ # evaluation Proc and let users evalute them. This will cascade when
23
+ # doing dependency resolution (hitting cached versions along the way),
24
+ # thus allowing generators for build systems like Visual Studio, that
25
+ # don't allow us to defer dependency resolution inside, them to be written
26
+ # without much fuss (i.e. write linearly but execute depth-first.)
27
+
28
+ on_project(@rybfile.project)
29
+ end
30
+
31
+ def on_project(project)
32
+ @vistor.on_project(project)
33
+
34
+ project.products.each {|product| on_product(project, product)}
35
+
36
+ builds = to_applicable_build_matrix(
37
+ to_canonical_names(project.configurations),
38
+ to_canonical_names(project.platforms),
39
+ to_canonical_names(project.architectures))
40
+
41
+ builds.each do |config, platform, arch|
42
+ on_project_triplet(project, [config, platform, arch])
43
+ end
44
+ end
45
+
46
+ def on_product(project, product)
47
+ @vistor.on_product(project, product)
48
+
49
+ builds = to_applicable_build_matrix(
50
+ to_canonical_names(project.configurations) | to_canonical_names(product.configurations),
51
+ to_canonical_names(project.platforms) | to_canonical_names(product.platforms),
52
+ to_canonical_names(project.architectures) | to_canonical_names(product.architectures))
53
+
54
+ builds.each do |config, platform, arch|
55
+ on_product_triplet(project, product, [config, platform, arch])
56
+ end
57
+ end
58
+
59
+ def on_project_triplet(project, triplet)
60
+ # TODO(mtwilliams): Extract into a helper function.
61
+ config, platform, arch = *triplet
62
+ config = find_by_canonical_name(project.configurations, config)
63
+ platform = find_by_canonical_name(project.platforms, platform)
64
+ arch = find_by_canonical_name(project.architectures, arch)
65
+
66
+ tripletised = lambda {
67
+ Hashie::Mash.new({
68
+ :configuration => config,
69
+ :platform => platform,
70
+ :architecture => arch,
71
+ :triplet => triplet
72
+ })
73
+ }
74
+
75
+ @vistor.on_project_triplet(project, tripletised)
76
+ end
77
+
78
+ def on_product_triplet(project, product, triplet)
79
+ # TODO(mtwilliams): Extract into a helper function.
80
+ config, platform, arch = *triplet
81
+ project_config = find_by_canonical_name(project.configurations, config)
82
+ project_platform = find_by_canonical_name(project.platforms, platform)
83
+ project_arch = find_by_canonical_name(project.architectures, arch)
84
+ product_config = find_by_canonical_name(product.configurations, config)
85
+ product_platform = find_by_canonical_name(product.platforms, platform)
86
+ product_arch = find_by_canonical_name(product.architectures, arch)
87
+
88
+ # TODO(mtwilliams): Refactor into #merge and #merge!
89
+ config = merge_configuration_settings(project_config, product_config)
90
+ platform = merge_platform_settings(project_platform, product_platform)
91
+ arch = merge_architecture_settings(project_arch, product_arch)
92
+
93
+ # TODO(mtwilliams): Build a completly flattened description of the product
94
+ # for this |triplet|.
95
+
96
+ tripletised = lambda {
97
+ Hashie::Mash.new({
98
+ :configuration => config,
99
+ :platform => platform,
100
+ :architecture => arch,
101
+ :triplet => triplet
102
+ })
103
+ }
104
+
105
+ @vistor.on_product_triplet(project, product, tripletised)
106
+ end
107
+
108
+ private
109
+ def to_canonical_names(collection)
110
+ [*collection].map(&:name).map(&:canonicalize)
111
+ end
112
+
113
+ def match_on_canonical_name(name)
114
+ proc {|obj| obj.name.canonicalize == name.to_s}
115
+ end
116
+
117
+ def filter_by_canonical_name(collection, name)
118
+ matcher = match_on_canonical_name(name)
119
+ [*collection].select(&matcher).compact
120
+ end
121
+
122
+ def find_by_canonical_name(collection, name)
123
+ filter_by_canonical_name(collection, name).first
124
+ end
125
+
126
+ private
127
+ def to_applicable_build_matrix(configurations, platforms, architectures)
128
+ applicable_configurations = configurations & @configurations
129
+ applicable_platforms = platforms & @platforms
130
+ applicable_architectures = architectures & @architectures
131
+ to_build_matrix(applicable_configurations, applicable_platforms, applicable_architectures)
132
+ end
133
+
134
+ def to_build_matrix(configurations, platforms, architectures)
135
+ configurations.product(platforms.product(architectures)).map(&:flatten)
136
+ end
137
+
138
+ private
139
+ def merge_configuration_settings(base, overlay)
140
+ merged = Ryb::Configuration.new
141
+
142
+ merged.name = base.name
143
+ merged.prefix = base.prefix if (base and base.prefix)
144
+ merged.prefix = overlay.prefix if (overlay and overlay.prefix)
145
+ merged.suffix = base.suffix if (base and base.suffix)
146
+ merged.suffix = overlay.suffix if (overlay and overlay.suffix)
147
+
148
+ merged.paths = Ryb::Paths.new
149
+ merged.defines = Hash.new
150
+
151
+ if base and base.paths
152
+ merged.paths.includes += base.paths.includes
153
+ merged.paths.libraries += base.paths.libraries
154
+ merged.paths.binaries += base.paths.binaries
155
+ end
156
+
157
+ if overlay and overlay.paths
158
+ merged.paths.includes += overlay.paths.includes
159
+ merged.paths.libraries += overlay.paths.libraries
160
+ merged.paths.binaries += overlay.paths.binaries
161
+ end
162
+
163
+ merged.defines.merge!(base.defines) if base and base.defines
164
+ merged.defines.merge!(overlay.defines) if overlay and overlay.defines
165
+
166
+ merged.treat_warnings_as_errors = false
167
+ merged.generate_debug_symbols = false
168
+ merged.link_time_code_generation = false
169
+ merged.optimize = :nothing
170
+
171
+ if base
172
+ merged.treat_warnings_as_errors = base.treat_warnings_as_errors unless base.treat_warnings_as_errors().nil?
173
+ merged.generate_debug_symbols = base.generate_debug_symbols unless base.generate_debug_symbols().nil?
174
+ merged.link_time_code_generation = base.link_time_code_generation unless base.link_time_code_generation().nil?
175
+ merged.optimize = base.optimize unless base.optimize().nil?
176
+ end
177
+
178
+ if overlay
179
+ merged.treat_warnings_as_errors = overlay.treat_warnings_as_errors unless overlay.treat_warnings_as_errors().nil?
180
+ merged.generate_debug_symbols = overlay.generate_debug_symbols unless overlay.generate_debug_symbols().nil?
181
+ merged.link_time_code_generation = overlay.link_time_code_generation unless overlay.link_time_code_generation().nil?
182
+ merged.optimize = overlay.optimize unless overlay.optimize().nil?
183
+ end
184
+
185
+ base_dependencies = base ? (base.dependencies || []) : []
186
+ overlay_dependencies = overlay ? (overlay.dependencies || []) : []
187
+ dependencies = base_dependencies | overlay_dependencies
188
+
189
+ merged.dependencies = dependencies
190
+
191
+ merged
192
+ end
193
+
194
+ def merge_platform_settings(base, overlay)
195
+ merge_configuration_settings(base, overlay)
196
+ end
197
+
198
+ def merge_architecture_settings(base, overlay)
199
+ merge_configuration_settings(base, overlay)
200
+ end
201
+ end
202
+ end