Skip to content

Commit 085006b

Browse files
jdolanclaude
andcommitted
Windows: download SDL3 on demand instead of borrowing from ObjectivelyMVC
The Windows VS build sourced its SDL3 headers and libs from ObjectivelyMVC's bundled libs/sdl, inverting the dependency graph (MVC sits on top of GPU, not beneath it). Add sdl3.targets, which downloads the official SDL3 VC development package from libsdl.org on demand and caches it under libs/. CI and local developers now share a single code path, and GPU owns its SDL3 core dependency directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0db5c4c commit 085006b

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Examples/HelloCompute
1818
Frameworks/
1919
Makefile
2020
Makefile.in
21+
ObjectivelyGPU.vs15/libs/
2122
aclocal.m4
2223
autom4te.cache/
2324
build/

ObjectivelyGPU.vs15/ObjectivelyGPU.vcxproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
<PropertyGroup>
7070
<OutDir>bin\$(Platform)$(Configuration)\</OutDir>
7171
<IntDir>tmp\$(ProjectName)\$(Platform)$(Configuration)\</IntDir>
72-
<!-- SDL3 headers come from ObjectivelyMVC's bundled libs (repos are checked out side-by-side) -->
73-
<IncludePath>Sources\;..\Sources\;..\..\Objectively\Sources\;..\..\Objectively\Objectively.vs15\Sources\;..\..\ObjectivelyMVC\ObjectivelyMVC.vs15\libs\sdl\;$(IncludePath)</IncludePath>
74-
<LibraryPath>..\..\Objectively\Objectively.vs15\bin\$(Platform)$(Configuration)\;..\..\ObjectivelyMVC\ObjectivelyMVC.vs15\libs\sdl\lib\$(Platform)\;$(LibraryPath)</LibraryPath>
72+
<!-- SDL3 search paths are provided by sdl3.targets, which downloads SDL3 on demand. -->
73+
<IncludePath>Sources\;..\Sources\;..\..\Objectively\Sources\;..\..\Objectively\Objectively.vs15\Sources\;$(IncludePath)</IncludePath>
74+
<LibraryPath>..\..\Objectively\Objectively.vs15\bin\$(Platform)$(Configuration)\;$(LibraryPath)</LibraryPath>
7575
<UseMultiToolTask>true</UseMultiToolTask>
7676
</PropertyGroup>
7777
<ItemDefinitionGroup>
@@ -108,6 +108,7 @@
108108
</Link>
109109
</ItemDefinitionGroup>
110110
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
111+
<Import Project="sdl3.targets" />
111112
<ImportGroup Label="ExtensionTargets">
112113
</ImportGroup>
113114
</Project>

ObjectivelyGPU.vs15/sdl3.targets

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!--
5+
Fetches the official SDL3 VC development libraries from libsdl.org and wires
6+
them into the compiler and linker search paths. This mirrors what CI does,
7+
so local developers and CI share a single code path: the libraries are
8+
downloaded once, on demand, and cached under libs/ (which is .gitignored).
9+
Bump SDL3Version to upgrade; delete libs/ to force a re-download.
10+
-->
11+
<PropertyGroup>
12+
<SDL3Version>3.4.2</SDL3Version>
13+
<SDL3Dir>$(MSBuildThisFileDirectory)libs\SDL3-$(SDL3Version)\</SDL3Dir>
14+
<SDL3LibArch Condition="'$(Platform)' == 'Win32'">x86</SDL3LibArch>
15+
<SDL3LibArch Condition="'$(SDL3LibArch)' == ''">x64</SDL3LibArch>
16+
</PropertyGroup>
17+
18+
<PropertyGroup>
19+
<IncludePath>$(SDL3Dir)include\;$(IncludePath)</IncludePath>
20+
<LibraryPath>$(SDL3Dir)lib\$(SDL3LibArch)\;$(LibraryPath)</LibraryPath>
21+
</PropertyGroup>
22+
23+
<Target Name="DownloadSDL3"
24+
BeforeTargets="ClCompile"
25+
Condition="!Exists('$(SDL3Dir)include\SDL3\SDL.h')">
26+
<Message Importance="high" Text="Downloading SDL3 $(SDL3Version) development libraries..." />
27+
<Exec WorkingDirectory="$(MSBuildThisFileDirectory)"
28+
Command="powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;$ErrorActionPreference = 'Stop'; New-Item -ItemType Directory -Force libs | Out-Null; Invoke-WebRequest -Uri 'https://github.com/libsdl-org/SDL/releases/download/release-$(SDL3Version)/SDL3-devel-$(SDL3Version)-VC.zip' -OutFile 'libs\sdl3.zip'; Expand-Archive -Force 'libs\sdl3.zip' 'libs'; Remove-Item 'libs\sdl3.zip'&quot;" />
29+
</Target>
30+
31+
</Project>

0 commit comments

Comments
 (0)