From 0cdc446a1979ebacea9c784abb2258bccbf5167a Mon Sep 17 00:00:00 2001 From: miaooo0000OOOO <1683618861@qq.com> Date: Thu, 20 Feb 2025 11:09:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=B9=B6=E8=A1=8C=E7=BC=96?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ddd4835..69d676a 100644 --- a/setup.py +++ b/setup.py @@ -276,8 +276,13 @@ class CMakeBuild(BuildExtension): "-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))] if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ: + cpu_count = os.cpu_count() + if cpu_count is None: + cpu_count = 1 if hasattr(self, "parallel") and self.parallel: - build_args += [f"-j{self.parallel}"] + build_args += [f"--parallel={self.parallel}"] + else: + build_args += [f"--parallel={cpu_count}"] print("CMake args:", cmake_args) build_temp = Path(ext.sourcedir) / "build" if not build_temp.exists():