From 15e07277eb7de6a0b5ff66ca7250e0482431e114 Mon Sep 17 00:00:00 2001 From: John Lindsay Date: Sun, 19 May 2024 05:40:40 -0400 Subject: [PATCH] Update build.py --- build.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/build.py b/build.py index c4bc2519..1dd65253 100755 --- a/build.py +++ b/build.py @@ -4,17 +4,22 @@ # To use this script: # -# python3 build.py do_clean exclude_runner zip +# python3 build.py [args] +# +# Script Keyword Arguments: # -# Where 'do_clean' is true or false and determines whether or not to clean existing files first; -# 'exclude_runner' is true or false and determines whether the WhiteboxTools Runner app is excluded -# from the build; and, 'create_zip_artifact' is true or false and determines whether a zip file -# of the WBT folder is also created. +# do_clean If present, the existing files will be cleaned before compiling. +# exclude_runner Excludes the WhiteboxTools Runner app from the build (Windows and macos). +# zip Creates a zip file output in addition to the WBT folder # +# Notes: # You will need Rust installed before running the script. The output will be contained within a -# folder named 'WBT'. +# folder named 'WBT'. The WhiteboxTools Runner app will always be excluded from Linux builds. +# Compiling the Runner causes an error on our Ubuntu compile target. # -# Note that the WhiteboxTools Runner app will always be excluded from Linux builds. +# Example: +# python3 build.py do_clean exclude_runner zip + def build(do_clean=False, exclude_runner=False, create_zip_artifact=False): # Set the directory variables @@ -61,6 +66,10 @@ def build(do_clean=False, exclude_runner=False, create_zip_artifact=False): print(result.stdout) else: print("Compiling for musl target...") + result = subprocess.run(['rustup', 'target', "add", "x86_64-unknown-linux-musl"], stdout=subprocess.PIPE) + if len(result.stdout) > 0: + print(result.stdout) + result = subprocess.run(['cargo', 'build', "--release", "--target=x86_64-unknown-linux-musl"], stdout=subprocess.PIPE) if len(result.stdout) > 0: print(result.stdout)