Skip to content

Commit 73365c1

Browse files
committed
allow user to build with ninja
1 parent b3f52fa commit 73365c1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def build_extension(self, ext):
170170
os.mkdir(ext.build_dir)
171171

172172
build_type = 'Release'
173+
use_ninja = False
173174

174175
if _check_env_flag('DEBUG'):
175176
build_type = 'Debug'
@@ -193,6 +194,10 @@ def build_extension(self, ext):
193194
if _check_env_flag("DPCPP_ENABLE_PROFILING"):
194195
cmake_args += ['-DDPCPP_ENABLE_PROFILING=1']
195196

197+
if _check_env_flag("USE_NINJA"):
198+
use_ninja = True
199+
cmake_args += ['-GNinja']
200+
196201
build_args = ['-j', str(multiprocessing.cpu_count())]
197202

198203
env = os.environ.copy()
@@ -203,7 +208,10 @@ def build_extension(self, ext):
203208
check_call([self.cmake, ext.project_dir] + cmake_args, cwd=ext.build_dir, env=env)
204209

205210
# build_args += ['VERBOSE=1']
206-
check_call(['make'] + build_args, cwd=ext.build_dir, env=env)
211+
if use_ninja:
212+
check_call(['ninja'] + build_args, cwd=ext.build_dir, env=env)
213+
else:
214+
check_call(['make'] + build_args, cwd=ext.build_dir, env=env)
207215

208216

209217
ipex_git_sha, torch_git_sha = get_git_head_sha(base_dir)

0 commit comments

Comments
 (0)