From 4b9f6912e20249b9c67be7732f2d093b546e7954 Mon Sep 17 00:00:00 2001 From: yefuwang <1yefuwang1@gmail.com> Date: Wed, 25 Sep 2024 15:30:45 +0000 Subject: [PATCH] Use makefile instead of ninja on arm64 linux --- CMakePresets.json | 10 ++++++++++ pyproject.toml | 10 ++-------- setup.py | 5 ++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index c30e1ad..9da5c31 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -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" + } } ] } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 456285c..4162ff2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" - ] \ No newline at end of file +# ninja-build is not installable via yum on aarch64 +before-build = "" \ No newline at end of file diff --git a/setup.py b/setup.py index ed38b06..64b786d 100644 --- a/setup.py +++ b/setup.py @@ -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)