organize build script
This commit is contained in:
parent
efa98cd686
commit
b84969d109
2 changed files with 35 additions and 18 deletions
35
do.ps1
35
do.ps1
|
|
@ -1,4 +1,22 @@
|
||||||
#!/usr/bin/env pwsh
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
$OUT_DIR = "out";
|
||||||
|
$DEPS_DIR = "thirdparty";
|
||||||
|
$EXE_NAME = "p2601";
|
||||||
|
|
||||||
|
$C_SOURCE = "source/main.c";
|
||||||
|
$C_INCLUDES = "-Isrc -I$DEPS_DIR";
|
||||||
|
$C_FLAGS = "-std=c23 -fblocks -g $C_INCLUDES";
|
||||||
|
$RELEASE_FLAGS = "-Ofast -Wno-everything -ffast-math";
|
||||||
|
|
||||||
|
$WINDOWS_FLAGS = "-ld3d11 -lgdi32";
|
||||||
|
$MACOS_FLAGS = "-x objective-c -lobjc -framework Foundation -framework Cocoa -framework CoreFoundation -framework CoreGraphics -framework QuartzCore -framework Metal -framework MetalKit";
|
||||||
|
$LINUX_FLAGS = "-lgl";
|
||||||
|
$WASM_FLAGS = "-c -fno-sanitize=address -fno-sanitize=undefined";
|
||||||
|
|
||||||
|
|
||||||
|
# ..............
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop";
|
$ErrorActionPreference = "Stop";
|
||||||
|
|
||||||
$HOST_OS = &{
|
$HOST_OS = &{
|
||||||
|
|
@ -21,11 +39,7 @@ $HOST_ARCH = &{
|
||||||
"Arm64" { "aarch64" }
|
"Arm64" { "aarch64" }
|
||||||
default { Write-Error "Unsupported host architecture"; }
|
default { Write-Error "Unsupported host architecture"; }
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$OUT_DIR = "out";
|
|
||||||
$DEPS_DIR = "thirdparty";
|
|
||||||
$EXE_NAME = "p2601";
|
|
||||||
|
|
||||||
function Get-Ext($platform) {
|
function Get-Ext($platform) {
|
||||||
if ($platform -eq "windows") { return ".exe"; }
|
if ($platform -eq "windows") { return ".exe"; }
|
||||||
|
|
@ -46,16 +60,7 @@ $BLOCKS_RT_SOURCE = "$BLOCKS_RT_RUNTIME $BLOCKS_RT_DATA";
|
||||||
|
|
||||||
$EMSDK_REPO = "https://github.com/emscripten-core/emsdk.git";
|
$EMSDK_REPO = "https://github.com/emscripten-core/emsdk.git";
|
||||||
$EMSDK_DIR = Join-Path $DEPS_DIR "emsdk";
|
$EMSDK_DIR = Join-Path $DEPS_DIR "emsdk";
|
||||||
|
$WASM_FLAGS += " -isystem" + (Join-Path $EMSDK_DIR "upstream" "emscripten" "cache" "sysroot" "include");
|
||||||
$C_SOURCE = "source/main.c";
|
|
||||||
$C_INCLUDES = "-Isrc -I$DEPS_DIR";
|
|
||||||
$C_FLAGS = "-std=c23 -fblocks -g $C_INCLUDES";
|
|
||||||
$RELEASE_FLAGS = "-Ofast -Wno-everything -ffast-math";
|
|
||||||
|
|
||||||
$WINDOWS_FLAGS = "-ld3d11 -lgdi32";
|
|
||||||
$MACOS_FLAGS = "-x objective-c -lobjc -framework Foundation -framework Cocoa -framework CoreFoundation -framework CoreGraphics -framework QuartzCore -framework Metal -framework MetalKit";
|
|
||||||
$LINUX_FLAGS = "-lgl";
|
|
||||||
$WASM_FLAGS = "-c -fno-sanitize=address -fno-sanitize=undefined -isystem " + (Join-Path $EMSDK_DIR "upstream" "emscripten" "cache" "sysroot" "include");
|
|
||||||
|
|
||||||
# try vendoring zig
|
# try vendoring zig
|
||||||
if (-not (Test-Path $ZIG)) {
|
if (-not (Test-Path $ZIG)) {
|
||||||
|
|
|
||||||
14
justfile
14
justfile
|
|
@ -1,2 +1,14 @@
|
||||||
default:
|
default:
|
||||||
@pwsh do.ps1 b
|
@pwsh do.ps1 build
|
||||||
|
|
||||||
|
windows:
|
||||||
|
@pwsh do.ps1 build-cross x86_64-windows-gnu
|
||||||
|
|
||||||
|
linux:
|
||||||
|
@pwsh do.ps1 build-cross x86_64-linux-gnu
|
||||||
|
|
||||||
|
wasm:
|
||||||
|
@pwsh do.ps1 build-cross wasm32-emscripten
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@pwsh do.ps1 clean
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue