mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-11-03 15:26:12 -08:00 
			
		
		
		
	More refactoring, getting rid of meson in favor of just powershell scripts
This commit is contained in:
		
							
								
								
									
										25
									
								
								scripts/helpers/target_arch.psm1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								scripts/helpers/target_arch.psm1
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
# target_arch.psm1
 | 
			
		||||
 | 
			
		||||
function Get-TargetArchClang {
 | 
			
		||||
    # Get the target architecture by querying clang itself
 | 
			
		||||
    $output = & clang -v 2>&1
 | 
			
		||||
    foreach ($line in $output) {
 | 
			
		||||
        if ($line -like "*Target:*") {
 | 
			
		||||
            $clangTarget = ($line -split ':')[1].Trim()
 | 
			
		||||
            return $clangTarget
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    throw "Clang target architecture could not be determined."
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function Get-TargetArchMSVC {
 | 
			
		||||
    # Assuming you've set the Visual Studio environment variables using `vcvarsall.bat`
 | 
			
		||||
    # This looks for the `VSCMD_ARG_TGT_ARCH` environment variable which Visual Studio sets to indicate the target architecture.
 | 
			
		||||
    $arch = $env:VSCMD_ARG_TGT_ARCH
 | 
			
		||||
    if (-not $arch) {
 | 
			
		||||
        throw "MSVC target architecture could not be determined. Ensure you've initialized the Visual Studio environment."
 | 
			
		||||
    }
 | 
			
		||||
    return $arch
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Export-ModuleMember -Function Get-TargetArchClang, Get-TargetArchMSVC
 | 
			
		||||
		Reference in New Issue
	
	Block a user