Skip to content

Commit 8b18779

Browse files
committed
Someone forgot to commit the new NUKE scripts
1 parent a99bba0 commit 8b18779

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

build/nuke/Build.Support.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,16 @@ static int IndexOfOrThrow(string x, char y)
4949
return idx;
5050
}
5151

52-
Dictionary<string, string> CreateEnvVarDictionary()
52+
Dictionary<string, string> CreateEnvVarDictionary([CanBeNull] IReadOnlyDictionary<string, string> concat = null)
5353
=> Environment.GetEnvironmentVariables()
5454
.Cast<DictionaryEntry>()
55+
.Concat((concat ?? Enumerable.Empty<KeyValuePair<string, string>>()).Select(x => new DictionaryEntry(x.Key, x.Value)))
5556
.ToDictionary(x => (string) x.Key, x => (string) x.Value);
5657

57-
IProcess InheritedShell(string cmd, [CanBeNull] string workDir = null)
58+
IProcess InheritedShell(string cmd, [CanBeNull] string workDir = null, [CanBeNull] IReadOnlyDictionary<string, string> envVars = null)
5859
=> OperatingSystem.IsWindows()
59-
? StartProcess("powershell", $"-Command {cmd.DoubleQuote()}", workDir, CreateEnvVarDictionary())
60-
: StartProcess("bash", $"-c {cmd.DoubleQuote()}", workDir, CreateEnvVarDictionary());
60+
? StartProcess("powershell", $"-Command {cmd.DoubleQuote()}", workDir, CreateEnvVarDictionary(envVars))
61+
: StartProcess("bash", $"-c {cmd.DoubleQuote()}", workDir, CreateEnvVarDictionary(envVars));
6162

6263
void AddToPath(string dir)
6364
{

build/nuke/Native/SwiftShader.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,25 @@ partial class Build {
7171
{
7272
foreach (var (triple, rid) in new[]
7373
{
74-
("x86_64-linux-gnu", "linux-x64"),
75-
("arm-linux-gnueabihf", "linux-arm"),
76-
("aarch64-linux-gnu", "linux-arm64"),
74+
("zig-toolchain-x86_64-linux-gnu.2.17", "linux-x64"),
75+
("zig-toolchain-arm-linux-gnueabihf.2.17", "linux-arm"),
76+
("zig-toolchain-aarch64-linux-gnu.2.17", "linux-arm64"),
7777
})
7878
{
7979
EnsureCleanDirectory(buildDir);
80-
81-
InheritedShell($"{prepare} {GetCMakeToolchainFlag(triple)}", buildDir).AssertZeroExitCode();
82-
InheritedShell(build, buildDir).AssertZeroExitCode();
83-
84-
InheritedShell($"{triple}-strip --strip-unneeded Linux/libvk_swiftshader.so", buildDir).AssertZeroExitCode();
80+
InheritedShell($"{prepare} {GetCMakeToolchainFlag(triple)} -DCMAKE_C_FLAGS_RELEASE=\"-s -Wl,--undefined-version\" -DCMAKE_CXX_FLAGS_RELEASE=\"-s -Wl,--undefined-version\"", buildDir).AssertZeroExitCode();
81+
InheritedShell
82+
(
83+
build,
84+
buildDir,
85+
new Dictionary<string, string>
86+
{
87+
// zig cc doesn't recognise generic as a valid -mtune for some reason
88+
{"SILKDOTNET_ReplaceArchitectureZigCcFlags", "generic="},
89+
// https://issues.chromium.org/issues/40242425#comment3
90+
{"LDFLAGS", "-Wl,--undefined-version"}
91+
}
92+
).AssertZeroExitCode();
8593

8694
CopyFile(buildDir / "Linux" / "libvk_swiftshader.so", runtimes / rid / "native" / "libvk_swiftshader.so", FileExistsPolicy.Overwrite);
8795
CopyFile(buildDir / "Linux" / "vk_swiftshader_icd.json", runtimes / rid / "native" / "vk_swiftshader_icd.json", FileExistsPolicy.Overwrite);

0 commit comments

Comments
 (0)