Skip to content
Open
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
3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public BuildPlayerOptions ModifyOptions(BuildPlayerOptions playerOptions)
string[] commandLineArgs = Environment.GetCommandLineArgs();
playerOptions.locationPathName = commandLineArgs[Array.IndexOf(commandLineArgs, "-builtTestRunnerPath") + 1]; ;

// Enable parallel linking for IL2CPP builds
SetParallelLinking();

// Instruct the cleanup to exit the Editor if the run came from the command line.
// The variable is static because the cleanup is being invoked in a new instance of the class.
s_RunningPlayerTests = true;
Expand All @@ -45,5 +48,46 @@ private static bool IsRunningTestsFromCommandLine()
var commandLineArgs = Environment.GetCommandLineArgs();
return commandLineArgs.Any(value => value == "-runTests");
}

private static void SetParallelLinking()
{
string additionalArgs = PlayerSettings.additionalIl2CppArgs;

// Determine number of parallel jobs (use CPU count, or default to 2)
int numJobs = Environment.ProcessorCount;
if (numJobs <= 0) numJobs = 2;

// Use host platform (where Unity is running) instead of target platform to support cross-compilation
// Platform-specific parallel linking flags based on the host platform
RuntimePlatform hostPlatform = Application.platform;
switch (hostPlatform)
{
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
string cgthreadsFlag = $"--linker-flags=/CGTHREADS:{numJobs}";
if (!additionalArgs.Contains("/CGTHREADS:"))
{
additionalArgs = string.IsNullOrEmpty(additionalArgs)
? cgthreadsFlag
: $"{additionalArgs} {cgthreadsFlag}";
}
break;

case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:
if (!additionalArgs.Contains("--threads"))
{
additionalArgs = string.IsNullOrEmpty(additionalArgs)
? $"-Wl,--threads={numJobs}"
: $"{additionalArgs} -Wl,--threads={numJobs}";
}
break;
}

PlayerSettings.additionalIl2CppArgs = additionalArgs;
Debug.Log($"IL2CPP parallel linking enabled with {numJobs} jobs on host platform {hostPlatform}. Additional args: {additionalArgs}");
}
}
}
1 change: 1 addition & 0 deletions src/model/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const Docker = {
--cidfile "${cidfile}" \
--rm \
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
--env BEE_CACHE_DIRECTORY=c:/github/workspace/Library/bee_cache \
--env TEST_PLATFORMS="${testPlatforms}" \
--env GITHUB_WORKSPACE="c:/github/workspace" \
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
Expand Down