From f0cd6e602afe3028607c5851a0601d66dacd43d9 Mon Sep 17 00:00:00 2001 From: Robert Taylor Date: Thu, 22 Dec 2022 10:57:53 +0000 Subject: [PATCH] Use ninja for build --- builder.py | 8 ++++---- poetry.lock | 31 ++++++++++++++++++++++++++++++- pyproject.toml | 3 ++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/builder.py b/builder.py index 530bcc7e..d527388e 100644 --- a/builder.py +++ b/builder.py @@ -1,5 +1,6 @@ import io import glob +import ninja import os import platform import re @@ -10,7 +11,6 @@ from distutils.version import LooseVersion from distutils.dir_util import copy_tree, remove_tree from distutils.sysconfig import get_python_inc from distutils import sysconfig -from find_libpython import find_libpython from typing import Any, Dict from setuptools.command.build_ext import build_ext @@ -56,6 +56,9 @@ class ExtensionBuilder(build_ext): extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) cmake_args = [] + ninja_executable_path = os.path.join(ninja.BIN_DIR, "ninja") + cmake_args += ["-GNinja","-DCMAKE_MAKE_PROGRAM:FILEPATH=" + ninja_executable_path] + cfg = "Debug" if self.debug else "Release" # cfg = 'Debug' build_args = ["--config", cfg] @@ -65,9 +68,6 @@ class ExtensionBuilder(build_ext): if platform.system() == "Windows": if sys.maxsize > 2 ** 32: cmake_args += ["-A", "x64"] - build_args += ["--", "/m"] - else: - build_args += ["--", "-j4", "VERBOSE=1"] env = os.environ.copy() env["CXXFLAGS"] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get("CXXFLAGS", ""), self.distribution.get_version()) diff --git a/poetry.lock b/poetry.lock index eadf4b85..efa10893 100644 --- a/poetry.lock +++ b/poetry.lock @@ -41,7 +41,36 @@ files = [ {file = "find_libpython-0.3.0.tar.gz", hash = "sha256:6e7fe5d9af7fad6dc066cb5515a0e9c90a71f1feb2bb2f8e4cdbb4f83276e9e5"}, ] +[[package]] +name = "ninja" +version = "1.11.1" +description = "Ninja is a small build system with a focus on speed" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "ninja-1.11.1-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl", hash = "sha256:f48c3c6eea204062f6bbf089dfc63e1ad41a08640e1da46ef2b30fa426f7ce23"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:edec1053e141253076b2df7ec03a246ff581e9270aa1ca9759397b21e2760e57"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:817e2aee2a4d28a708a67bcfba1817ae502c32c6d8ef80e50d63b0f23adf3a08"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df11b8afea0501883e33faeb1c43d2ef67f466d5f4bd85f9c376e9a93a43a277"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7a564fe755ddfbdbccb07b0b758e3f8460e5f8ba1adaab40a5eaa2f8c01ce68"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c474326e11fba3f8c2582715d79216292e327d3335367c0e87e9647a002cc4a"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f6465a7efe6473a2a34edab83633594de19d59406a727316e1367ebcc528908"}, + {file = "ninja-1.11.1-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:642cb64d859276998f14972724850e0c5b7febbc1bce3d2065b7e0cb7d3a0b79"}, + {file = "ninja-1.11.1-py2.py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:60179bb4f22c88279c53a5402bb5fe81c97c627a28d93c737d1fa067d892115d"}, + {file = "ninja-1.11.1-py2.py3-none-musllinux_1_1_i686.whl", hash = "sha256:34753459493543782d87267e4cad63dd4639b07f8394ffe6d4417e9eda05c8a8"}, + {file = "ninja-1.11.1-py2.py3-none-musllinux_1_1_ppc64le.whl", hash = "sha256:779f228e407c54a8b6e4cbf8f835489998dd250f67bf1b9bd7b8a8ab6bdcdc7b"}, + {file = "ninja-1.11.1-py2.py3-none-musllinux_1_1_s390x.whl", hash = "sha256:ba50a32424912e5f3ee40d791b506a160dc0eeda7de5ad8faebe7aa8006244dc"}, + {file = "ninja-1.11.1-py2.py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:3b28b595ed580752240ade7821b6cb7a5a4c6a604c865dc474bd38f06e2eb7f5"}, + {file = "ninja-1.11.1-py2.py3-none-win32.whl", hash = "sha256:3329b4b7c1694730772522a3ba0ba40fd15c012476ed3e1c9f0fd9e76190394e"}, + {file = "ninja-1.11.1-py2.py3-none-win_amd64.whl", hash = "sha256:4e547bc759c570773d83d110c41fd5ca9a94c0a9a8388f5a3ea37bdf97d002b0"}, + {file = "ninja-1.11.1.tar.gz", hash = "sha256:c833a47d39b2d1eee3f9ca886fa1581efd5be6068b82734ac229961ee8748f90"}, +] + +[package.extras] +test = ["codecov (>=2.0.5)", "coverage (>=4.2)", "flake8 (>=3.0.4)", "pytest (>=4.5.0)", "pytest-cov (>=2.7.1)", "pytest-runner (>=5.1)", "pytest-virtualenv (>=1.7.0)", "virtualenv (>=15.0.3)"] + [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "abbc1ba1fde22ac8e6b5fc0fe7430c18cad5c97aea6a80ea9283c0b11099c71d" +content-hash = "9435910787871e20dc257e6f7a54a88e17e99e52b0b0c42903efe80b67ff1d93" diff --git a/pyproject.toml b/pyproject.toml index 498127b0..31cc57ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ find-libpython = "^0.3.0" [tool.poetry.dev-dependencies] cmake = ">=3" +ninja = "^1.11.1" [tool.poetry.scripts] blif2vst = 'Coriolis:blif2vst' @@ -22,7 +23,7 @@ unittests = 'Coriolis:unittests' yosys_coriolis = 'Coriolis:yosys_coriolis' [build-system] -requires = ["poetry-core", "setuptools", "cmake", "patchelf", "find-libpython"] +requires = ["poetry-core", "setuptools", "cmake", "ninja", "patchelf"] build-backend = "poetry.core.masonry.api" [tool.cibuildwheel.linux]