Move to packaging requiring no changes to CMake

This commit is contained in:
Robert Taylor 2022-11-26 02:41:26 +00:00 committed by Jean-Paul Chaput
parent 806018b740
commit f8afd5bded
4 changed files with 74 additions and 17 deletions

View File

@ -1,5 +1,4 @@
if(UNIX)
if(UNIX AND NOT POETRY)
if(NOT Python_FOUND)
message(FATAL_ERROR "Python has not been found, maybe forgot to call find_package(Python). ")
endif()
@ -46,4 +45,4 @@ if(UNIX)
else(FindPythonSitePackages_FOUND)
message ( FATAL_ERROR "Python site packages directory was not found (pythonV.R/site-packages/)." )
endif(FindPythonSitePackages_FOUND)
endif(UNIX)
endif(UNIX AND NOT POETRY)

View File

@ -48,7 +48,7 @@ class ExtensionBuilder(build_ext):
def build_cmake_extension(self, ext: CMakeExtension) -> None:
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
cmake_args = ["-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir, "-DPYTHON_EXECUTABLE=" + sys.executable]
cmake_args = []
cfg = "Debug" if self.debug else "Release"
# cfg = 'Debug'
@ -56,7 +56,6 @@ class ExtensionBuilder(build_ext):
install_args = ["--config", cfg]
if platform.system() == "Windows":
cmake_args += ["-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), extdir)]
if sys.maxsize > 2 ** 32:
cmake_args += ["-A", "x64"]
build_args += ["--", "/m"]
@ -69,25 +68,48 @@ class ExtensionBuilder(build_ext):
env["CXXFLAGS"] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get("CXXFLAGS", ""), self.distribution.get_version())
build_dir = os.path.join(self.build_temp, ext.sourcedir_rel)
install_dir = os.path.join(self.build_temp, "install")
os.makedirs(build_dir,exist_ok=True)
os.makedirs(os.path.join(install_dir, cfg), exist_ok=True)
cmake_args += [f"-DCMAKE_MODULE_PATH={os.path.abspath('bootstrap/cmake_modules')};"
f"{os.path.join(install_dir, 'share/cmake/Modules')}"]
cmake_args += [f"-DCMAKE_INSTALL_PREFIX={install_dir}"]
f"{os.path.join(extdir, 'share/cmake/Modules')}"]
cmake_args += [f"-DCMAKE_INSTALL_PREFIX={extdir}"]
cmake_args += [f"-DPython_CORIOLISLIB={extdir}"]
cmake_args += [f"-DPython_CORIOLISARCH={extdir}"]
cmake_args += [f"-DSYS_CONF_DIR={extdir}"]
cmake_args += [f"-DCORIOLIS_TOP={extdir}"]
cmake_args += [f"-DCORIOLIS_USER_TOP={extdir}"]
cmake_args += [f"-DPOETRY=1"]
cmake_args += [f"-DWITH_QT5=1"]
subprocess.check_call(["cmake", "--debug-find", "--trace-redirect=build.cmake.trace", "--trace-expand", ext.sourcedir] + cmake_args, cwd=build_dir, env=env)
subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=build_dir)
subprocess.check_call(["cmake", "--install", ".", "--prefix", install_dir] + install_args, cwd=build_dir)
subprocess.check_call(["cmake", "--install", ".", "--prefix", extdir] + install_args, cwd=build_dir)
def build(setup_kwargs: Dict[str, Any]) -> None:
cmake_modules = [CMakeExtension("coriolis.hurricane", sourcedir="coriolis/hurricane"),
CMakeExtension("coriolis.crlcore", sourcedir="coriolis/crlcore")]
cmake_modules = [
CMakeExtension("Coriolis.coloquinte", sourcedir="coloquinte"),
CMakeExtension("Coriolis.hurricane", sourcedir="hurricane"),
CMakeExtension("Coriolis.crlcore", sourcedir="crlcore"),
CMakeExtension("Coriolis.flute", sourcedir="flute"),
CMakeExtension("Coriolis.etesian", sourcedir="etesian"),
CMakeExtension("Coriolis.anabatic", sourcedir="anabatic"),
CMakeExtension("Coriolis.katana", sourcedir="katana"),
CMakeExtension("Coriolis.equinox", sourcedir="equinox"),
CMakeExtension("Coriolis.solstice", sourcedir="solstice"),
CMakeExtension("Coriolis.oroshi", sourcedir="oroshi"),
CMakeExtension("Coriolis.bora", sourcedir="bora"),
CMakeExtension("Coriolis.karakaze", sourcedir="karakaze"),
CMakeExtension("Coriolis.unicorn", sourcedir="unicorn"),
CMakeExtension("Coriolis.tutorial", sourcedir="tutorial"),
CMakeExtension("Coriolis.ispd", sourcedir="ispd"),
CMakeExtension("Coriolis.cumulus", sourcedir="cumulus"),
CMakeExtension("Coriolis.stratus1", sourcedir="stratus1"),
CMakeExtension("Coriolis.documentation", sourcedir="documentation"),
CMakeExtension("Coriolis.unittests", sourcedir="unittests")
]
ext_modules = cmake_modules
setup_kwargs.update(
{

37
poetry.lock generated
View File

@ -20,10 +20,29 @@ python-versions = "*"
[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)"]
[[package]]
name = "pyside2"
version = "5.13.2"
description = "Python bindings for the Qt cross-platform application and UI framework"
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
shiboken2 = "5.13.2"
[[package]]
name = "shiboken2"
version = "5.13.2"
description = "Python / C++ bindings helper module"
category = "main"
optional = false
python-versions = "*"
[metadata]
lock-version = "1.1"
python-versions = "^3.9"
content-hash = "d16f582433e9abd89fc7975a1aed410d63635e101eb4544194039e6e287755e8"
content-hash = "04f9bd7992db8607c14b934f1e11623b06e860fd3814a9d68bebd91837e6a232"
[metadata.files]
cmake = [
@ -62,3 +81,19 @@ ninja = [
{file = "ninja-1.11.1-py2.py3-none-win_amd64.whl", hash = "sha256:4e547bc759c570773d83d110c41fd5ca9a94c0a9a8388f5a3ea37bdf97d002b0"},
{file = "ninja-1.11.1.tar.gz", hash = "sha256:c833a47d39b2d1eee3f9ca886fa1581efd5be6068b82734ac229961ee8748f90"},
]
pyside2 = [
{file = "PySide2-5.13.2-5.13.2-cp27-cp27m-macosx_10_12_intel.whl", hash = "sha256:ede8ed6e7021232184829d16614eb153f188ea250862304eac35e04b2bd0120c"},
{file = "PySide2-5.13.2-5.13.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:63cc845434388b398b79b65f7b5312b9b5348fbc772d84092c9245efbf341197"},
{file = "PySide2-5.13.2-5.13.2-cp35.cp36.cp37-abi3-macosx_10_12_intel.whl", hash = "sha256:ed6d22c7a3a99f480d4c9348bcced97ef7bc0c9d353ad3665ae705e8eb61feb5"},
{file = "PySide2-5.13.2-5.13.2-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl", hash = "sha256:7c57fe60ed57a3a8b95d9163abca9caa803a1470f29b40bff8ef4103b97a96c8"},
{file = "PySide2-5.13.2-5.13.2-cp35.cp36.cp37-none-win32.whl", hash = "sha256:7c61a6883f3474939097b9dabc80f028887046be003ce416da1b3565a08d1f92"},
{file = "PySide2-5.13.2-5.13.2-cp35.cp36.cp37-none-win_amd64.whl", hash = "sha256:589b90944c24046d31bf76694590a600d59d20130015086491b793a81753629a"},
]
shiboken2 = [
{file = "shiboken2-5.13.2-5.13.2-cp27-cp27m-macosx_10_12_intel.whl", hash = "sha256:7c766c4160636a238e0e4430e2f40b504b13bcc4951902eb78cd5c971f26c898"},
{file = "shiboken2-5.13.2-5.13.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:e6543506cb353d417961b9ec3c6fc726ec2f72eeab609dc88943c2e5cb6d6408"},
{file = "shiboken2-5.13.2-5.13.2-cp35.cp36.cp37-abi3-macosx_10_12_intel.whl", hash = "sha256:ca08a3c95b1b20ac2b243b7b06379609bd73929dbc27b28c01415feffe3bcea1"},
{file = "shiboken2-5.13.2-5.13.2-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl", hash = "sha256:81fa9b288c6c4b4c91220fcca2002eadb48fc5c3238e8bd88e982e00ffa77c53"},
{file = "shiboken2-5.13.2-5.13.2-cp35.cp36.cp37-none-win32.whl", hash = "sha256:e2f72b5cfdb8b48bdb55bda4b42ec7d36d1bce0be73d6d7d4a358225d6fb5f25"},
{file = "shiboken2-5.13.2-5.13.2-cp35.cp36.cp37-none-win_amd64.whl", hash = "sha256:5e84a4b4e7ab08bb5db0a8168e5d0316fbf3c25b788012701a82079faadfb19b"},
]

View File

@ -1,14 +1,15 @@
[tool.poetry]
name = "coriolis"
name = "Coriolis"
version = "0.1.0"
description = "Place and Route for semiconductors"
authors = ["Your Name <you@example.com>"]
build = "build.py"
packages = [
{ include = "Coriolis"}
]
[tool.poetry.dependencies]
python = "^3.9"
PySide2 = "^5.0"
python = "^3.8"
[tool.poetry.dev-dependencies]
ninja = ">=1.10"