Skip to content

Commit

Permalink
Update build.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jblindsay committed May 19, 2024
1 parent 07c56d9 commit 15e0727
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 15e0727

Please sign in to comment.