Skip to content

Commit

Permalink
prefer Ninja when available
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Nov 9, 2020
1 parent 1ff9ddc commit 956e5ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cmakeutils/cmake_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
Njobs = ""
try:
import psutil

Ncpu = psutil.cpu_count(logical=False)
avail = psutil.virtual_memory().available
if avail < 1e9:
Expand Down Expand Up @@ -104,6 +105,8 @@ def cmake_build(src_root: Path, prefix: Path):
]
if prefix:
opts.append(f"-DCMAKE_INSTALL_PREFIX={prefix}")
if os.environ.get("CMAKE_GENERATOR") and os.environ["CMAKE_GENERATOR"] == "Ninja":
opts.append("-GNinja")

subprocess.check_call(["cmake", "-S", str(src_root), "-B", str(build_root)] + opts)

Expand Down

0 comments on commit 956e5ef

Please sign in to comment.