From 84c03cf4c46169a5fd3f95219372ee32b2cf6801 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Wed, 2 Mar 2022 13:59:38 -0600 Subject: [PATCH] setup.py: fix out of tree builds on Windows [wip] --- setup.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 95bd474..c3108ac 100644 --- a/setup.py +++ b/setup.py @@ -175,10 +175,20 @@ def run(self): else: platform = "x64" if IS_64_BIT else "x86" config = "Release" + properties = { + "Configuration": config, + "Platform": platform, + "IntermediateOutputPath": str(build_temp / platform / "obj") + "\\", # Must end with trailing slash. + "OutDir": str(build_temp / platform / config) + "\\", + #IntermediateOutputPath + #OutputPath + } + + property_values = ';'.join(f'{k}={v}' for k, v in properties.items()) + msbuild_cmd = f'msbuild -p:{property_values} {VS_PROJ}' try: - self.spawn(['cmd.exe', '/c', f'{VSENV_SCRIPT} && ' - f'msbuild -p:Configuration={config} -p:Platform={platform} {VS_PROJ}']) + self.spawn(['cmd.exe', '/c', f'{VSENV_SCRIPT} && {msbuild_cmd}']) except Exception as err: # See comment above for notes about this exception handler. raise LibusbBuildError(str(err)) from err