Attempt at ARM64 support.

This commit is contained in:
Pieter-Jan Briers
2020-04-27 11:32:05 +02:00
parent 525e16ce88
commit 8bcbd50914
2 changed files with 44 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ p = os.path.join
PLATFORM_WINDOWS = "windows"
PLATFORM_LINUX = "linux"
PLATFORM_LINUX_ARM64 = "linux-arm64"
PLATFORM_MACOS = "mac"
SHARED_IGNORED_RESOURCES = {
@@ -85,7 +86,7 @@ def main() -> None:
parser.add_argument("--platform",
"-p",
action="store",
choices=[PLATFORM_WINDOWS, PLATFORM_MACOS, PLATFORM_LINUX],
choices=[PLATFORM_WINDOWS, PLATFORM_MACOS, PLATFORM_LINUX, PLATFORM_LINUX_ARM64],
nargs="*",
help="Which platform to build for. If not provided, all platforms will be built")
@@ -117,6 +118,11 @@ def main() -> None:
wipe_bin()
build_linux(skip_build)
if PLATFORM_LINUX_ARM64 in platforms:
if not skip_build:
wipe_bin()
build_linux_arm64(skip_build)
if PLATFORM_MACOS in platforms:
if not skip_build:
wipe_bin()
@@ -253,7 +259,36 @@ def build_linux(skip_build: bool) -> None:
copy_content_assemblies(p("Resources", "Assemblies"), server_zip, server=True)
server_zip.close()
def publish_client_server(runtime: str, target_os: str) -> None:
def build_linux_arm64(skip_build: bool) -> None:
# Run a full build.
print(Fore.GREEN + "Building project for Linux ARM64 (SERVER ONLY)..." + Style.RESET_ALL)
if not skip_build:
subprocess.run([
"dotnet",
"build",
"SpaceStation14.sln",
"-c", "Release",
"--nologo",
"/v:m",
"/p:TargetOS=Linux",
"/t:Rebuild",
"/p:FullRelease=True"
], check=True)
publish_client_server("linux-arm64", "Linux", True)
print(Fore.GREEN + "Packaging Linux ARM64 server..." + Style.RESET_ALL)
server_zip = zipfile.ZipFile(p("release", "SS14.Server_Linux_ARM64.zip"), "w",
compression=zipfile.ZIP_DEFLATED)
copy_dir_into_zip(p("RobustToolbox", "bin", "Server", "linux-arm64", "publish"), "", server_zip)
copy_resources(p("Resources"), server_zip, server=True)
copy_content_assemblies(p("Resources", "Assemblies"), server_zip, server=True)
server_zip.close()
def publish_client_server(runtime: str, target_os: str, actually_only_server: bool = False) -> None:
# Runs dotnet publish on client and server.
base = [
"dotnet", "publish",
@@ -264,9 +299,12 @@ def publish_client_server(runtime: str, target_os: str) -> None:
"/p:FullRelease=True",
]
subprocess.run(base + ["RobustToolbox/Robust.Client/Robust.Client.csproj"], check=True)
if not actually_only_server:
subprocess.run(base + ["RobustToolbox/Robust.Client/Robust.Client.csproj"], check=True)
subprocess.run(base + ["RobustToolbox/Robust.Server/Robust.Server.csproj"], check=True)
def copy_resources(target, zipf, server):
# Content repo goes FIRST so that it won't override engine files as that's forbidden.
ignore_set = SHARED_IGNORED_RESOURCES
@@ -368,10 +406,12 @@ def copy_dir_or_file(src: str, dst: str):
else:
raise IOError("{} is neither file nor directory. Can't copy.".format(src))
def copy_client_natives(fileNames: List[str], zipf: zipfile.ZipFile, zipPath: str):
for fileName in fileNames:
zipf.write(p("RobustToolbox", "bin", "Client", fileName), p(zipPath, fileName))
print(f"writing native {fileName}")
if __name__ == '__main__':
main()