Skip to content

Commit

Permalink
Ensure Capstone is build for the architecture according to cibuildwheel
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Aug 15, 2024
1 parent cf3137d commit 33e0e0f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,28 @@ option(CAPSTONE_INSTALL "Generate install target" ${PROJECT_IS_TOP_LEVEL})

# If building for OSX it's best to allow CMake to handle building both architectures
if(APPLE AND NOT CAPSTONE_BUILD_MACOS_THIN)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
# The cibuildwheel on Github Actions sets this env variable
# with the architecture flags it wants to build for.
if(DEFINED ENV{ARCHFLAGS})
if("$ENV{ARCHFLAGS}" STREQUAL "-arch arm64 -arch x86_64")
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
elseif("$ENV{ARCHFLAGS}" STREQUAL "-arch arm64")
set(CMAKE_OSX_ARCHITECTURES "arm64")
elseif("$ENV{ARCHFLAGS}" STREQUAL "-arch x86_64")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
else()
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
endif()
endif()

if (DEFINED ENV{VSCMD_ARG_TGT_ARCH})
# The cibuildwheel on Github Actions sets this env variable
# with the architecture it wants to build for (for Windows).
# We need to handle the x86 case here.
if("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "x86")
set(CMAKE_GENERATOR_PLATFORM "Win32")
endif()
endif()

list(LENGTH SUPPORTED_ARCHITECTURES count)
Expand Down

0 comments on commit 33e0e0f

Please sign in to comment.