mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-11-03 23:36:12 -08:00 
			
		
		
		
	Updated build scripts to latest setup used with HandmadeHero repo
This commit is contained in:
		
							
								
								
									
										26
									
								
								scripts/helpers/format_cpp.psm1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								scripts/helpers/format_cpp.psm1
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
# format_cpp.psm1
 | 
			
		||||
 | 
			
		||||
function format-cpp
 | 
			
		||||
{
 | 
			
		||||
	param( $path, $include, $exclude )
 | 
			
		||||
 | 
			
		||||
	# Format generated gencpp
 | 
			
		||||
	Write-Host "Beginning format"
 | 
			
		||||
	$formatParams = @(
 | 
			
		||||
		'-i'          # In-place
 | 
			
		||||
		'-style=file:.clang-format'
 | 
			
		||||
		'-verbose'
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	$targetFiles = @(
 | 
			
		||||
		Get-ChildItem -Recurse -Path $path -Include $include -Exclude $exclude
 | 
			
		||||
			| Select-Object -ExpandProperty FullName
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	$time_taken = Measure-Command {
 | 
			
		||||
		clang-format $formatParams $targetFiles
 | 
			
		||||
	}
 | 
			
		||||
	Write-Host "Formatting complete in $($time_taken.TotalMilliseconds) ms`n"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Export-ModuleMember -Function format-cpp
 | 
			
		||||
		Reference in New Issue
	
	Block a user