|
| 1 | +Clear-Host |
| 2 | + |
| 3 | +$path_root = git rev-parse --show-toplevel |
| 4 | +$path_scripts = Join-Path $path_root 'scripts' |
| 5 | + |
| 6 | +$target_arch = Join-Path $path_scripts 'helpers/target_arch.psm1' |
| 7 | +$devshell = Join-Path $path_scripts 'helpers/devshell.ps1' |
| 8 | +$format_cpp = Join-Path $path_scripts 'helpers/format_cpp.psm1' |
| 9 | +$incremental_checks = Join-Path $path_scripts 'helpers/incremental_checks.ps1' |
| 10 | +$vendor_toolchain = Join-Path $path_scripts 'helpers/vendor_toolchain.ps1' |
| 11 | + |
| 12 | +$path_project = Join-Path $path_root 'project' |
| 13 | +$path_aux = Join-Path $path_project 'auxillary' |
| 14 | +$path_vis_root = Join-Path $path_aux 'vis_ast' |
| 15 | +$path_binaries = Join-Path $path_vis_root 'binaries' |
| 16 | +$path_build = Join-Path $path_vis_root 'build' |
| 17 | +$path_code = Join-Path $path_vis_root 'code' |
| 18 | +$path_win32 = Join-Path $path_code 'win32' |
| 19 | + |
| 20 | +Import-Module $target_arch |
| 21 | +Import-Module $format_cpp |
| 22 | + |
| 23 | +#region Arguments |
| 24 | +$vendor = $null |
| 25 | +$optimize = $null |
| 26 | +$debug = $null |
| 27 | +$analysis = $false |
| 28 | +$dev = $false |
| 29 | +$verbose = $null |
| 30 | +$platform = $null |
| 31 | +$module_specified = $false |
| 32 | + |
| 33 | +[array] $vendors = @( "clang", "msvc" ) |
| 34 | + |
| 35 | +# This is a really lazy way of parsing the args, could use actual params down the line... |
| 36 | + |
| 37 | +if ( $args ) { $args | ForEach-Object { |
| 38 | +switch ($_){ |
| 39 | + { $_ -in $vendors } { $vendor = $_; break } |
| 40 | + "optimize" { $optimize = $true } |
| 41 | + "debug" { $debug = $true } |
| 42 | + "analysis" { $analysis = $true } |
| 43 | + "dev" { $dev = $true } |
| 44 | + "verbose" { $verbose = $true } |
| 45 | + "platform" { $platform = $true; $module_specified = $true } |
| 46 | +} |
| 47 | +}} |
| 48 | +#endregion Argument |
| 49 | + |
| 50 | +if ( -not $module_specified ) |
| 51 | +{ |
| 52 | + $platform = $true |
| 53 | +} |
| 54 | + |
| 55 | +# Load up toolchain configuraion |
| 56 | +. $vendor_toolchain |
| 57 | +. $incremental_checks |
| 58 | + |
| 59 | +write-host "Building Vis AST with $vendor" |
| 60 | + |
| 61 | +if ( (Test-Path $path_build) -eq $false ) { |
| 62 | + New-Item $path_build -ItemType Directory |
| 63 | +} |
| 64 | + |
| 65 | +if ( (Test-Path $path_binaries) -eq $false ) { |
| 66 | + New-Item $path_binaries -ItemType Directory |
| 67 | +} |
| 68 | + |
| 69 | +$includes = @( |
| 70 | + $paht_code |
| 71 | +) |
| 72 | + |
| 73 | +# Microsoft |
| 74 | +$lib_gdi32 = 'Gdi32.lib' |
| 75 | +$lib_xinput = 'Xinput.lib' |
| 76 | +$lib_user32 = 'User32.lib' |
| 77 | +$lib_winmm = 'Winmm.lib' |
| 78 | + |
| 79 | +$stack_size = 1024 * 1024 * 4 |
| 80 | + |
| 81 | +$compiler_args = @( |
| 82 | + ($flag_define + 'UNICODE'), |
| 83 | + ($flag_define + '_UNICODE') |
| 84 | + ( $flag_define + 'INTELLISENSE_DIRECTIVES=0'), |
| 85 | + # ($flag_set_stack_size + $stack_size) |
| 86 | + $flag_wall |
| 87 | + $flag_warnings_as_errors |
| 88 | + $flag_optimize_intrinsics |
| 89 | +) |
| 90 | + |
| 91 | +if ( $dev ) { |
| 92 | + $compiler_args += ( $flag_define + 'Build_Development=1' ) |
| 93 | +} |
| 94 | +else { |
| 95 | + $compiler_args += ( $flag_define + 'Build_Development=0' ) |
| 96 | +} |
| 97 | + |
| 98 | +$linker_args = @( |
| 99 | + $flag_link_win_subsystem_windows, |
| 100 | + $flag_link_optiiize_references |
| 101 | +) |
| 102 | + |
| 103 | +$unit = join-path $path_code 'vis_ast_windows.cpp' |
| 104 | +$executable = join-path $path_binaries 'vis_ast.exe' |
| 105 | + |
| 106 | +$build_result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable |
0 commit comments