Skip to content

Commit

Permalink
Use ninja by default
Browse files Browse the repository at this point in the history
  • Loading branch information
1yefuwang1 committed Jun 14, 2024
1 parent 2e53d92 commit defe79a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"name": "dev",
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake",
"binaryDir": "${sourceDir}/build/dev",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "1"
Expand All @@ -14,6 +15,7 @@
"name": "release",
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake",
"binaryDir": "${sourceDir}/build/release",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_EXPORT_COMPILE_COMMANDS": "1"
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
requires = [
"setuptools>=59",
"wheel",
"cmake"
"cmake",
"ninja"
]

build-backend = "setuptools.build_meta"
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from setuptools import Extension, setup
import cmake
import subprocess
import ninja

VERSION = '0.1.0'
PACKAGE_NAME = 'vectorlite_py'
Expand All @@ -19,6 +20,7 @@
print(f'cmake bin dir: {cmake.CMAKE_BIN_DIR}. cwd: {os.getcwd()}')
cmake_path = os.path.join(cmake.CMAKE_BIN_DIR, 'cmake')
ctest_path = os.path.join(cmake.CMAKE_BIN_DIR, 'ctest')
ninja_path = os.path.join(ninja.BIN_DIR, 'ninja')
cmake_version = subprocess.run(['cmake', '--version'], check=True)
cmake_version.check_returncode()

Expand All @@ -38,7 +40,7 @@ def get_lib_name():
class CMakeBuild(build_ext):
def build_extension(self, ext: CMakeExtension) -> None:
print(f'Building extension for {self.plat_name} {self.compiler.compiler_type}')
configure = subprocess.run([cmake_path, '--preset', 'release'])
configure = subprocess.run([cmake_path, '--preset', 'release', f'-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_path}'])
configure.check_returncode()

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

0 comments on commit defe79a

Please sign in to comment.