Merge pull request #61 from MonsterDruide1/master

tools: Add `create_build_dir` to custom `setup.py`
This commit is contained in:
Léo Lam 2021-08-21 01:01:29 +02:00 committed by GitHub
commit ad9b3e8a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

@ -1 +1 @@
Subproject commit 7c9a9cb7e4633595f7aab54cd03ed9d7367bc3a1
Subproject commit f4fa8946437071cb79c17ef1d2245e53fe8e4b10

View File

@ -3,6 +3,7 @@
import argparse
import hashlib
from pathlib import Path
import subprocess
import tempfile
import urllib.request
from typing import Optional
@ -77,6 +78,17 @@ def prepare_executable(original_nso: Optional[Path]):
setup.fail("internal error while preparing executable (missing ELF); please report")
def create_build_dir():
build_dir = setup.ROOT / "build"
if build_dir.is_dir():
print(">>> build directory already exists: nothing to do")
return
subprocess.check_call(
"cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=toolchain/ToolchainNX64.cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -B build/".split(" "))
print(">>> created build directory")
def main():
parser = argparse.ArgumentParser(
"setup.py", description="Set up the Breath of the Wild decompilation project")
@ -87,7 +99,7 @@ def main():
setup.install_viking()
prepare_executable(args.original_nso)
setup.set_up_compiler("4.0.1")
setup.create_build_dir()
create_build_dir()
if __name__ == "__main__":