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 26, 2024
1 parent 11d1e44 commit 4b86fab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
11 changes: 11 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
"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",
"VCPKG_TARGET_TRIPLET": "arm64-linux-release"
}
}
]
}
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 = "yum install -y make"
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ 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])
with open('/project/build/release/vcpkg-manifest-install.log', 'r') as f:
print(f'!!!vcpkg-manifest-install.log: {f.read()}')
configure.check_returncode()

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

0 comments on commit 4b86fab

Please sign in to comment.