Skip to content

Commit c7903bd

Browse files
committed
setup.py: honor CMAKE_GENERATOR_PLATFORM for the Windows -A flag
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.
1 parent aababd1 commit c7903bd

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
@@ -119,7 +119,10 @@ def build_extension(self, ext):
119119
os.path.join(extdir, "openpmd_api")
120120
)
121121
]
122-
if sys.maxsize > 2**32:
122+
generator_platform = os.environ.get("CMAKE_GENERATOR_PLATFORM")
123+
if generator_platform:
124+
cmake_args += ['-A', generator_platform]
125+
elif sys.maxsize > 2**32:
123126
cmake_args += ['-A', 'x64']
124127
build_args += ['--', '/m']
125128
else:

0 commit comments

Comments
 (0)