From f0a83e6aa12742ad0b071cc36f0558757132425e Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Wed, 1 Nov 2023 16:30:13 +0800 Subject: [PATCH] Fix building a debug version on Windows --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 32e63c2eb..d411237db 100644 --- a/setup.py +++ b/setup.py @@ -180,10 +180,15 @@ def build_extension(self, ext: setuptools.extension.Extension): cmake_args += extra_cmake_args + if "CMAKE_BUILD_TYPE=Release" in cmake_args: + config = "Release" + else: + config = "Debug" + if is_windows(): build_cmd = f""" cmake {cmake_args} -B {self.build_temp} -S {k2_dir} - cmake --build {self.build_temp} --target install --config Release -- -m + cmake --build {self.build_temp} --target install --config {config} -- -m """ print(f"build command is:\n{build_cmd}") ret = os.system(f"cmake {cmake_args} -B {self.build_temp} -S {k2_dir}") @@ -191,7 +196,7 @@ def build_extension(self, ext: setuptools.extension.Extension): raise Exception("Failed to build k2") ret = os.system( - f"cmake --build {self.build_temp} --target install --config Release -- -m" + f"cmake --build {self.build_temp} --target install --config {config} -- -m" ) if ret != 0: raise Exception("Failed to build k2")