Skip to content

Commit

Permalink
Use makefile instead of ninja on arm64 linux
Browse files Browse the repository at this point in the history
  • Loading branch information
1yefuwang1 committed Sep 25, 2024
1 parent 11d1e44 commit 4b9f691
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
10 changes: 10 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_EXPORT_COMPILE_COMMANDS": "1"
}
},
{
"name": "linux_arm64_release",
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake",
"binaryDir": "${sourceDir}/build/release",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_EXPORT_COMPILE_COMMANDS": "1"
}
}
]
}
10 changes: 2 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,5 @@ before-build = "yum install -y ninja-build"

[[tool.cibuildwheel.overrides]]
select = "*aarch64*"
environment = {VCPKG_FORCE_SYSTEM_BINARIES="1"}
before-build = [
"yum update",
"yum install -y curl zip unzip tar",
"git clone https://github.com/ninja-build/ninja.git",
"cd ninja && python3 configure.py --bootstrap",
"mv ninja /usr/bin/ && cd .. && rm -rf ninja"
]
# ninja-build is not installable via yum on aarch64
before-build = ""
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def build_extension(self, ext: CMakeExtension) -> None:
extra_args = []
# if system.lower() == 'windows':
# extra_args = ['-DCMAKE_CXX_COMPILER=cl', '-DCMAKE_C_COMPILER=cl']
configure = subprocess.run([cmake_path, '--preset', 'release', *extra_args])
preset = 'release'
if system.lower() == 'linux' and machine.lower() == 'aarch64':
preset = 'linux_arm64_release'
configure = subprocess.run([cmake_path, '--preset', preset, *extra_args])
configure.check_returncode()

subprocess.run([cmake_path, '--build', os.path.join('build', 'release'), '-j8'], check=True)
Expand Down

0 comments on commit 4b9f691

Please sign in to comment.