mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	build: use wlroots dependency variables
Instead of manually parsing header files and having two different code-paths depending on whether a subproject is used, use dependency variables which can come from either the subproject or pkg-config. References: https://github.com/swaywm/wlroots/pull/2734
This commit is contained in:
		
							parent
							
								
									4e02a598a3
								
							
						
					
					
						commit
						b4950e2a6d
					
				
					 1 changed files with 11 additions and 14 deletions
				
			
		
							
								
								
									
										21
									
								
								meson.build
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								meson.build
									
										
									
									
									
								
							| 
						 | 
					@ -65,26 +65,23 @@ wlroots_proj = subproject(
 | 
				
			||||||
	required: false,
 | 
						required: false,
 | 
				
			||||||
	version: wlroots_version,
 | 
						version: wlroots_version,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					if wlroots_proj.found()
 | 
				
			||||||
 | 
						wlroots = wlroots_proj.get_variable('wlroots')
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						wlroots = dependency('wlroots', version: wlroots_version)
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wlroots_features = {
 | 
					wlroots_features = {
 | 
				
			||||||
	'xwayland': false,
 | 
						'xwayland': false,
 | 
				
			||||||
	'systemd': false,
 | 
						'systemd': false,
 | 
				
			||||||
	'elogind': false,
 | 
						'elogind': false,
 | 
				
			||||||
	'libseat': false,
 | 
						'libseat': false,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if wlroots_proj.found()
 | 
					 | 
				
			||||||
	wlroots = wlroots_proj.get_variable('wlroots')
 | 
					 | 
				
			||||||
	wlroots_conf = wlroots_proj.get_variable('conf_data')
 | 
					 | 
				
			||||||
foreach name, _ : wlroots_features
 | 
					foreach name, _ : wlroots_features
 | 
				
			||||||
		has = wlroots_conf.get('WLR_HAS_' + name.to_upper()) == 1
 | 
						var_name = 'have_' + name.underscorify()
 | 
				
			||||||
		wlroots_features += { name: has }
 | 
						have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true'
 | 
				
			||||||
 | 
						wlroots_features += { name: have }
 | 
				
			||||||
endforeach
 | 
					endforeach
 | 
				
			||||||
else
 | 
					 | 
				
			||||||
	wlroots = dependency('wlroots', version: wlroots_version)
 | 
					 | 
				
			||||||
	foreach name, _ : wlroots_features
 | 
					 | 
				
			||||||
		has = cc.get_define('WLR_HAS_' + name.to_upper(), prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
 | 
					 | 
				
			||||||
		wlroots_features += { name: has }
 | 
					 | 
				
			||||||
	endforeach
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
 | 
					if get_option('xwayland').enabled() and not wlroots_features['xwayland']
 | 
				
			||||||
	error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
 | 
						error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue