Skip to content

Commit

Permalink
allow user to override build parallel level
Browse files Browse the repository at this point in the history
  • Loading branch information
chillenb committed Jul 4, 2024
1 parent a0bb0e1 commit 582ea85
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ def build_extensions(self):
print("Python3: ", sys.executable)
print("Build Dir: ", self.build_temp)

if 'CMAKE_BUILD_PARALLEL_LEVEL' in os.environ:
cmake_parallel_flags = []
else:
cmake_parallel_flags = ['--parallel', '2']

for ext in self.extensions:

extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
Expand Down Expand Up @@ -123,7 +128,7 @@ def build_extensions(self):
)

subprocess.check_call(
["cmake", "--build", ".", "--config", cfg, "--", "--jobs=2"],
["cmake", "--build", ".", "--config", cfg, "--", *cmake_parallel_flags],
cwd=self.build_temp,
)

Expand All @@ -135,7 +140,7 @@ def build_extensions(self):
)

subprocess.check_call(
["cmake", "--build", ".", "--config", cfg, "--", "--jobs=2"],
["cmake", "--build", ".", "--config", cfg, "--", *cmake_parallel_flags],
cwd=self.build_temp,
)

Expand Down

0 comments on commit 582ea85

Please sign in to comment.