Skip to content

Commit 91965e3

Browse files
authored
setup.py: honor CMAKE_GENERATOR_PLATFORM for the Windows -A flag (#592)
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 773d28e commit 91965e3

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
@@ -156,7 +156,10 @@ def build_extension(self, ext):
156156
cfg.upper(), os.path.join(extdir, "amrex")
157157
),
158158
]
159-
if sys.maxsize > 2**32:
159+
generator_platform = os.environ.get("CMAKE_GENERATOR_PLATFORM")
160+
if generator_platform:
161+
cmake_args += ["-A", generator_platform]
162+
elif sys.maxsize > 2**32:
160163
cmake_args += ["-A", "x64"]
161164
else:
162165
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]

0 commit comments

Comments
 (0)