Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/demo-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,20 @@ jobs:
repository: vlang/v
ref: 1f128c94619fb6e4863c5f81883e1b860405c8fa
path: toolchain/v
- uses: actions/checkout@v7
with:
repository: vlang/vc
ref: 4a1ba4d772f19c2752c9850d3b5421c71f54a4d6
path: toolchain/v/vc
- uses: actions/checkout@v7
with:
repository: vlang/tccbin
ref: d6e7ac1b1bcc98aed734a6ecbfa8509f24606c74
path: toolchain/v/thirdparty/tcc
- name: Build official V compiler
working-directory: toolchain/v
run: |
make
make local=1
echo "$GITHUB_WORKSPACE/toolchain/v" >> "$GITHUB_PATH"
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential cmake libglfw3-dev libvulkan-dev libvulkan-volk-dev patchelf pkg-config xvfb zip
Expand Down Expand Up @@ -141,6 +151,11 @@ jobs:
repository: vlang/v
ref: 1f128c94619fb6e4863c5f81883e1b860405c8fa
path: toolchain/v
- uses: actions/checkout@v7
with:
repository: vlang/vc
ref: 4a1ba4d772f19c2752c9850d3b5421c71f54a4d6
path: toolchain/v/vc
- uses: actions/checkout@v7
with:
repository: zeux/volk
Expand All @@ -149,7 +164,7 @@ jobs:
- name: Build official V compiler
shell: cmd
working-directory: toolchain/v
run: makev.bat
run: makev.bat -msvc --local
- name: Add V compiler to PATH
shell: pwsh
run: |
Expand Down
37 changes: 29 additions & 8 deletions scripts/run_demo_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ param(
)

$ErrorActionPreference = "Stop"
$UseExistingDemo = $PSBoundParameters.ContainsKey("DemoDirectory")
$RepositoryDirectory = Split-Path -Parent (Split-Path -Parent $PSCommandPath)
$RepositoryParent = Split-Path -Parent $RepositoryDirectory
if (-not $DemoDirectory) {
Expand All @@ -16,12 +17,23 @@ $RuntimeDirectory = Join-Path $RepositoryDirectory "build\windows-demo"

& (Join-Path $RepositoryDirectory "scripts\check_windows.ps1") -BundledGlfw

# A Visual Studio developer shell can put V's .bin\v.bat wrapper ahead of the
# compiler. Batch files reinterpret the pipe separators in V's -path argument,
# so call the compiler executable behind that wrapper when it is available.
$VCommand = (Get-Command v -CommandType Application -ErrorAction Stop).Source
if ([IO.Path]::GetExtension($VCommand) -in @(".bat", ".cmd")) {
$CompilerCandidate = Join-Path (Split-Path -Parent (Split-Path -Parent $VCommand)) "v.exe"
if (Test-Path -LiteralPath $CompilerCandidate) {
$VCommand = $CompilerCandidate
}
}

if (Test-Path (Join-Path $RepositoryDirectory ".git")) {
& git -C $RepositoryDirectory submodule update --init --recursive
if ($LASTEXITCODE -ne 0) { throw "Could not initialise ImGui submodules." }
}

& v run (Join-Path $RepositoryDirectory "build_vimgui.vsh") --linkage shared --glfw bundled --glfw-version 3.4
& $VCommand run (Join-Path $RepositoryDirectory "build_vimgui.vsh") --linkage shared --glfw bundled --glfw-version 3.4
if ($LASTEXITCODE -ne 0) { throw "Could not build the native ImGui library." }

if ($NativeOnly) {
Expand All @@ -34,7 +46,7 @@ foreach ($Module in @("vulkan", "glfw")) {
if (Test-Path (Join-Path $LocalModule "v.mod")) {
Write-Host "Using checked-out antono2.$Module module."
} else {
& v install "antono2.$Module"
& $VCommand install "antono2.$Module"
if ($LASTEXITCODE -ne 0) { throw "Could not install the $Module V module." }
}
}
Expand All @@ -43,10 +55,12 @@ if (-not (Test-Path (Join-Path $DemoDirectory ".git"))) {
& git clone https://github.com/antono2/v_imgui_examples.git $DemoDirectory
if ($LASTEXITCODE -ne 0) { throw "Could not clone v_imgui_examples." }
}
& git -C $DemoDirectory fetch --quiet origin $DemoRevision
if ($LASTEXITCODE -ne 0) { throw "Could not fetch the tested demo revision." }
& git -C $DemoDirectory checkout --quiet --detach $DemoRevision
if ($LASTEXITCODE -ne 0) { throw "Could not check out the tested demo revision." }
if (-not $UseExistingDemo) {
& git -C $DemoDirectory fetch --quiet origin $DemoRevision
if ($LASTEXITCODE -ne 0) { throw "Could not fetch the tested demo revision." }
& git -C $DemoDirectory checkout --quiet --detach $DemoRevision
if ($LASTEXITCODE -ne 0) { throw "Could not check out the tested demo revision." }
}

$GlfwHeader = Get-ChildItem $NativeBuildDirectory -Recurse -Filter "glfw3.h" |
Where-Object { $_.FullName -match "glfw-src.*include.GLFW" } | Select-Object -First 1
Expand Down Expand Up @@ -75,8 +89,15 @@ $env:GLFW_INCLUDE = Split-Path -Parent (Split-Path -Parent $GlfwHeader.FullName)
$env:GLFW_LIB = $LinkDirectory

$Executable = Join-Path $RuntimeDirectory "v_imgui_demo.exe"
$ModulePath = "$RepositoryParent|@vlib|@vmodules"
& v -no-memory-limit -path $ModulePath -cc msvc -o $Executable $DemoDirectory
$UsesOnlyCheckedOutModules = @("imgui", "vulkan", "glfw") | ForEach-Object {
Test-Path (Join-Path $RepositoryParent "$_\v.mod")
} | Where-Object { -not $_ } | Measure-Object | Select-Object -ExpandProperty Count
$ModulePath = if ($UsesOnlyCheckedOutModules -eq 0) {
"$RepositoryParent|$RepositoryDirectory\modules|@vlib"
} else {
"$RepositoryParent|@vlib|@vmodules"
}
& $VCommand -no-memory-limit -path $ModulePath -cc msvc -o $Executable $DemoDirectory
if ($LASTEXITCODE -ne 0) {
throw "The demo did not compile. Update to the official vlang/v master branch and review the compiler output above."
}
Expand Down