Add swiftc tool
This commit is contained in:
		
							parent
							
								
									c669ad98f1
								
							
						
					
					
						commit
						fd2e6ae699
					
				
					 2 changed files with 34 additions and 1 deletions
				
			
		| 
						 | 
					@ -184,7 +184,7 @@ class Environment(SCons.Environment.Environment):
 | 
				
			||||||
    def _append_custom_tools(self, kwargs):
 | 
					    def _append_custom_tools(self, kwargs):
 | 
				
			||||||
        '''Add custom tools to the `kwargs`.'''
 | 
					        '''Add custom tools to the `kwargs`.'''
 | 
				
			||||||
        tools = kwargs.setdefault('tools', ['default'])
 | 
					        tools = kwargs.setdefault('tools', ['default'])
 | 
				
			||||||
        for tool in ['lib', 'test', 'program', 'sconscript']:
 | 
					        for tool in ['lib', 'test', 'program', 'sconscript', 'swiftc']:
 | 
				
			||||||
            if tool in tools:
 | 
					            if tool in tools:
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
            tools.append(tool)
 | 
					            tools.append(tool)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										33
									
								
								site_scons/site_tools/swiftc.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								site_scons/site_tools/swiftc.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,33 @@
 | 
				
			||||||
 | 
					# swiftc.py
 | 
				
			||||||
 | 
					# vim: set ft=python:
 | 
				
			||||||
 | 
					# Eryn Wells <eryn@erynwells.me>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					'''
 | 
				
			||||||
 | 
					SCons plugin for building Swift files with swiftc.
 | 
				
			||||||
 | 
					'''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import SCons.Action
 | 
				
			||||||
 | 
					import SCons.Tool
 | 
				
			||||||
 | 
					import SCons.Util
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SwiftSuffix = '.swift'
 | 
				
			||||||
 | 
					SwiftAction = SCons.Action.Action("$SWIFTCCOM", "$SWIFTCCOMSTR")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					compilers = ['swiftc']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def generate(env):
 | 
				
			||||||
 | 
					    static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
 | 
				
			||||||
 | 
					    static_obj.add_action(SwiftSuffix, SwiftAction)
 | 
				
			||||||
 | 
					    static_obj.add_emitter(SwiftSuffix, SCons.Defaults.SharedObjectEmitter)
 | 
				
			||||||
 | 
					    shared_obj.add_action(SwiftSuffix, SwiftAction)
 | 
				
			||||||
 | 
					    shared_obj.add_emitter(SwiftSuffix, SCons.Defaults.SharedObjectEmitter)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if 'SWIFTC' not in env:
 | 
				
			||||||
 | 
					        compiler = env.Detect(compilers)
 | 
				
			||||||
 | 
					        env['SWIFTC'] = compiler if compiler else compilers[0]
 | 
				
			||||||
 | 
					    env['SWIFTFLAGS'] = SCons.Util.CLVar('')
 | 
				
			||||||
 | 
					    env['SWIFTCCOM']   = '$SWIFTC -o $TARGET -c $SWIFTFLAGS $SOURCES'
 | 
				
			||||||
 | 
					    env['SWIFTFILESUFFIX'] = SwiftSuffix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def exists(env):
 | 
				
			||||||
 | 
					    return env.Detect(compilers)
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue