Skip to content

Commit f319da0

Browse files
committed
Fix Windows reusing the same obj folder
1 parent e859ae7 commit f319da0

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,4 @@ FodyWeavers.xsd
398398
*.sln.iml
399399

400400
# Build output
401-
build/
401+
mojoshaderbuild/

build/BuildLinuxTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public sealed class BuildLinuxTask : FrostingTask<BuildContext>
1111

1212
public override void Run(BuildContext context)
1313
{
14-
var buildWorkingDir = "build/";
14+
var buildWorkingDir = "mojoshaderbuild/";
1515
context.ReplaceTextInFiles("mojoshader/CMakeLists.txt", "ADD_LIBRARY(mojoshader", "ADD_LIBRARY(mojoshader SHARED ");
1616
context.ReplaceRegexInFiles("mojoshader/CMakeLists.txt", @"find_package\(SDL2\).+?ENDIF\(SDL2_FOUND\)", "", RegexOptions.Singleline);
1717
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "../mojoshader/CMakeLists.txt -DCMAKE_OSX_ARCHITECTURES=\"x86_64;arm64\" -DPROFILE_SPIRV=OFF -DPROFILE_GLSPIRV=OFF" });

build/BuildMacOSTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public sealed class BuildMacOSTask : FrostingTask<BuildContext>
1111

1212
public override void Run(BuildContext context)
1313
{
14-
var buildWorkingDir = "build/";
14+
var buildWorkingDir = "mojoshaderbuild/";
1515
context.ReplaceTextInFiles("mojoshader/CMakeLists.txt", "ADD_LIBRARY(mojoshader", "ADD_LIBRARY(mojoshader SHARED ");
1616
context.ReplaceRegexInFiles("mojoshader/CMakeLists.txt", @"find_package\(SDL2\).+?ENDIF\(SDL2_FOUND\)", "", RegexOptions.Singleline);
1717
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "../mojoshader/CMakeLists.txt -DCMAKE_OSX_ARCHITECTURES=\"x86_64;arm64\" -DPROFILE_SPIRV=OFF -DPROFILE_GLSPIRV=OFF" });

build/BuildWindowsTask.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,21 @@ public sealed class BuildWindowsTask : FrostingTask<BuildContext>
1111

1212
public override void Run(BuildContext context)
1313
{
14-
var buildWorkingDir = "build/";
14+
var buildWorkingDir = "mojoshaderbuild/";
1515
context.ReplaceTextInFiles("mojoshader/CMakeLists.txt", "ADD_LIBRARY(mojoshader", "ADD_LIBRARY(mojoshader SHARED ");
1616
context.ReplaceRegexInFiles("mojoshader/CMakeLists.txt", @"find_package\(SDL2\).+?ENDIF\(SDL2_FOUND\)", "", RegexOptions.Singleline);
1717
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "../mojoshader/CMakeLists.txt -DPROFILE_SPIRV=OFF -DPROFILE_GLSPIRV=OFF" });
18+
19+
// Fix generated projects using the same obj folder
20+
var dirProps = @"""
21+
<Project>
22+
<PropertyGroup>
23+
<BaseIntermediateOutputPath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
24+
</PropertyGroup>
25+
</Project>
26+
""";
27+
context.FileWriteText(System.IO.Path.Combine(buildWorkingDir, "Directory.Build.props"), dirProps);
28+
1829
context.StartProcess("cmake", new ProcessSettings { WorkingDirectory = buildWorkingDir, Arguments = "--build ." });
1930
context.CopyFile(System.IO.Path.Combine(buildWorkingDir, "mojoshader.dll"), $"{context.ArtifactsDir}/mojoshader.dll");
2031
}

0 commit comments

Comments
 (0)