File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ class Options
33
44 def initialize
55 @configs = { }
6+ @pending_configs = [ ]
7+ @ignored_configs = [ ]
68
79 configure
810 end
@@ -27,6 +29,36 @@ def to_s
2729 . join ( " " )
2830 end
2931
32+ def cmake_options
33+ return @cmake_options if @cmake_options
34+
35+ output = nil
36+ Dir . chdir __dir__ do
37+ output = `cmake -S sources -B build -L`
38+ end
39+ started = false
40+ @cmake_options = output . lines . filter_map { |line |
41+ if line . chomp == "-- Cache values"
42+ started = true
43+ next
44+ end
45+ next unless started
46+ option , value = line . chomp . split ( "=" , 2 )
47+ name , type = option . split ( ":" , 2 )
48+ [ name , type , value ]
49+ }
50+ end
51+
52+ def missing_options
53+ cmake_options . collect { |name , type , value | name } -
54+ @configs . keys - @pending_configs - @ignored_configs
55+ end
56+
57+ def extra_options
58+ @configs . keys + @pending_configs - @ignored_configs -
59+ cmake_options . collect { |name , type , value | name }
60+ end
61+
3062 private
3163
3264 def configure
@@ -179,8 +211,10 @@ def filepath(name)
179211 end
180212
181213 def pending ( name )
214+ @pending_configs << name
182215 end
183216
184217 def ignored ( name )
218+ @ignored_configs << name
185219 end
186220end
You can’t perform that action at this time.
0 commit comments