diff --git a/build-without-conan.md b/build-without-conan.md index affe4fdfd7..e231efa581 100644 --- a/build-without-conan.md +++ b/build-without-conan.md @@ -255,3 +255,7 @@ This needs the shared `tklog` and `tket` libraries to be installed. cd ${TKET_DIR}/pytket NO_CONAN=1 pip install -v -e . ``` + +(You can use the environment variable `PYTKET_CMAKE_N_THREADS` to restrict the +number of threads used in the above command; otherwise one thread per CPU is +used.) \ No newline at end of file diff --git a/pytket/setup.py b/pytket/setup.py index f4280641b7..f6e6f9e971 100755 --- a/pytket/setup.py +++ b/pytket/setup.py @@ -65,7 +65,12 @@ def run(self): ["cmake", f"-DCMAKE_INSTALL_PREFIX={install_dir}", os.pardir], cwd=build_dir ) subprocess.run( - ["cmake", "--build", os.curdir, f"-j{multiprocessing.cpu_count()}"], + [ + "cmake", + "--build", + os.curdir, + f"-j{os.getenv('PYTKET_CMAKE_N_THREADS', multiprocessing.cpu_count())}", + ], cwd=build_dir, ) subprocess.run(["cmake", "--install", os.curdir], cwd=build_dir)