Skip to content

Commit 93de007

Browse files
authored
setup.py: honor CMAKE_GENERATOR_PLATFORM for the Windows -A flag (#7019)
The Windows build hardcoded the Visual Studio target architecture to x64 for any 64-bit interpreter (`if sys.maxsize > 2**32: -A x64`). On win-arm64 the interpreter is 64-bit but the architecture is ARM, so this mis-targeted the build and find_package(Python) then failed. Honor an explicit CMAKE_GENERATOR_PLATFORM (e.g. "ARM64") from the environment, falling back to the previous behavior otherwise. Same as openPMD/openPMD-api#1910
1 parent f314899 commit 93de007

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ def build_extension(self, ext):
187187
cfg.upper(), os.path.join(extdir, "pywarpx")
188188
)
189189
]
190-
if sys.maxsize > 2**32:
190+
generator_platform = os.environ.get("CMAKE_GENERATOR_PLATFORM")
191+
if generator_platform:
192+
cmake_args += ["-A", generator_platform]
193+
elif sys.maxsize > 2**32:
191194
cmake_args += ["-A", "x64"]
192195
else:
193196
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]

0 commit comments

Comments
 (0)