Implemented python wheel build using scikit-build-core backend

Added CMakeFiles.txt that perform sequential build of coriolis components
	Fixed some cmake files bugs
	Added extra files to coriolis python wheel to make shared library preload
This commit is contained in:
Serge Rabyking 2023-05-29 03:59:41 +01:00
parent 2046a1501f
commit d21e80353a
19 changed files with 271 additions and 509 deletions

126
CMakeLists.txt Normal file
View File

@ -0,0 +1,126 @@
cmake_minimum_required(VERSION 3.16)
project(coriolis)
if(NOT CMAKE_BUILD_PARALLEL_LEVEL)
cmake_host_system_information(RESULT Ncpu QUERY NUMBER_OF_LOGICAL_CORES)
math(EXPR CMAKE_BUILD_PARALLEL_LEVEL "${Ncpu}-1")
endif()
set(CORIOLIS_TMP_INSTALL_DIR ${CMAKE_BINARY_DIR}/install)
set(ENV{CORIOLIS_TOP} ${CORIOLIS_TMP_INSTALL_DIR})
function (build_coriolis_module target)
set(build_dir ${CMAKE_BINARY_DIR}/build_${target})
file(MAKE_DIRECTORY ${build_dir} ${build_dir}/build)
file(WRITE ${build_dir}/CMakeLists.txt "
cmake_minimum_required(VERSION 3.16)
project(build_${target})
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/cmake_modules)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${target} ${build_dir})
")
execute_process(COMMAND ${CMAKE_COMMAND} ${build_dir}
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX:PATH=${CORIOLIS_TMP_INSTALL_DIR}
-G "${CMAKE_GENERATOR}"
WORKING_DIRECTORY ${build_dir}/build
RESULT_VARIABLE ${target}_setup_result
)
if(NOT ${${target}_setup_result} EQUAL 0)
message(FATAL_ERROR "Failed to setup ${target} build\n")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build . --parallel ${CMAKE_BUILD_PARALLEL_LEVEL}
WORKING_DIRECTORY ${build_dir}/build
RESULT_VARIABLE ${target}_build_result
)
if(NOT ${${target}_build_result} EQUAL 0)
message(FATAL_ERROR "${target} build failed\n")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --install . --prefix "${CORIOLIS_TMP_INSTALL_DIR}"
WORKING_DIRECTORY ${build_dir}/build
RESULT_VARIABLE ${target}_install_result
)
if(NOT ${${target}_install_result} EQUAL 0)
message(FATAL_ERROR "Failed to installe ${target} into build environment\n")
endif()
endfunction()
build_coriolis_module(coloquinte)
build_coriolis_module(hurricane)
build_coriolis_module(crlcore)
build_coriolis_module(flute)
build_coriolis_module(etesian)
build_coriolis_module(anabatic)
build_coriolis_module(katana)
build_coriolis_module(equinox)
build_coriolis_module(solstice)
build_coriolis_module(oroshi)
build_coriolis_module(bora)
build_coriolis_module(karakaze)
#build_coriolis_module(knik)
build_coriolis_module(unicorn)
build_coriolis_module(tutorial)
build_coriolis_module(cumulus)
build_coriolis_module(stratus1)
##add_subdirectory(documentation)
#add_subdirectory(unittests)
file(GLOB SHARED_LIB_FILES LIST_DIRECTORIES false "${CORIOLIS_TMP_INSTALL_DIR}/lib/*.*")
install(FILES ${SHARED_LIB_FILES} DESTINATION coriolis/libs)
file(GLOB CORIOLIS_PACKAGE_SRCDIR "${CORIOLIS_TMP_INSTALL_DIR}/lib/*/*/coriolis")
function(coriolis_install_all)
foreach(srcdir ${ARGN})
file(GLOB_RECURSE CORIOLIS_PACKAGE_FILES RELATIVE "${srcdir}" "${srcdir}/*.*")
foreach(name ${CORIOLIS_PACKAGE_FILES})
if(NOT IS_DIRECTORY "${srcdir}/${name}")
get_filename_component(dstdir ${name} DIRECTORY)
install(FILES "${srcdir}/${name}" DESTINATION coriolis/${dstdir})
endif()
endforeach()
endforeach()
endfunction()
set(CORIOLIS_EXTRAS_DIR ${CMAKE_BINARY_DIR}/extras)
file(MAKE_DIRECTORY ${CORIOLIS_EXTRAS_DIR})
file(WRITE ${CORIOLIS_EXTRAS_DIR}/__init__.py
"import .libs
"
)
file(READ ${CORIOLIS_PACKAGE_SRCDIR}/__init__.py CORIOLIS_INIT_PY)
file(APPEND ${CORIOLIS_EXTRAS_DIR}/__init__.py "${CORIOLIS_INIT_PY}")
file(WRITE ${CORIOLIS_EXTRAS_DIR}/libs/__init__.py
"import os, os.path, ctypes
__libs=[]
def _preload_shared_libraries(dirname):
libs = []
for name in os.listdir(dirname):
if name.endswith('.so'):
libs.append(os.path.join(dirname,name))
nload = len(libs)
while nload > 0:
name=libs.pop(0)
try:
lib=ctypes.CDLL(name)
__libs.append(lib)
nload = len(libs)
except OSError:
libs.append(name)
nload -= 1
_preload_shared_libraries(os.path.dirname(os.path.realpath(__file__)))
"
)
coriolis_install_all(${CORIOLIS_PACKAGE_SRCDIR} ${CORIOLIS_EXTRAS_DIR})

View File

@ -14,9 +14,9 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -13,8 +13,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES socbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -14,8 +14,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -14,10 +14,10 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( FILES ${doxExtras} DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -2,7 +2,7 @@
if(BUILD_DOC AND DOXYGEN_FOUND)
add_custom_target( doc ALL
cd ${VLSISAPD_SOURCE_DIR}/doc && ${DOXYGEN_EXECUTABLE} doxyfile )
endif()
install( DIRECTORY html/ DESTINATION share/doc/coriolis2/en/html/doc/vlsisapd )
install( DIRECTORY latex/ DESTINATION share/doc/coriolis2/en/latex/vlsisapd )
endif()

View File

@ -13,8 +13,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -13,8 +13,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -13,8 +13,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -13,8 +13,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES asimbook.cls DESTINATION ${latexInstallDir} )
endif()

View File

@ -1,44 +1,140 @@
[tool.poetry]
name = "Coriolis"
version = "0.0.0"
description = "Place and Route for semiconductors"
authors = ["Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>"]
readme = "README.rst"
build = "builder.py"
packages = [
{ include = "Coriolis"}
]
#[tool.poetry]
#name = "Coriolis"
#version = "0.0.0"
#description = "Place and Route for semiconductors"
#authors = ["Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>"]
#readme = "README.rst"
##build = "builder.py"
##packages = [
## { include = "Coriolis"}
##]
[tool.poetry-dynamic-versioning]
enable = true
dirty = true
vcs = "git"
style = "pep440"
metadata = "true"
pattern = '''
(?x)
^coriolis-((?P<epoch>\d+)!)?(?P<base>\d+(\.\d+)*)
([-._]?((?P<stage>[a-zA-Z]+)[-._]?(?P<revision>\d+)?))?
(\+(?P<tagged_metadata>.+))?$
'''
#[tool.poetry-dynamic-versioning]
#enable = true
##dirty = true
#vcs = "git"
##style = "pep440"
#metadata = "true"
##pattern = '''
## (?x)
## ^coriolis-((?P<epoch>\d+)!)?(?P<base>\d+(\.\d+)*)
## ([-._]?((?P<stage>[a-zA-Z]+)[-._]?(?P<revision>\d+)?))?
## (\+(?P<tagged_metadata>.+))?$
##'''
[tool.poetry.dependencies]
python = "^3.8"
find-libpython = "^0.3.0"
#[tool.poetry.dependencies]
#python = "^3.8"
#find-libpython = "^0.3.0"
[tool.poetry.dev-dependencies]
cmake = ">=3"
ninja = "^1.11.1"
#[tool.poetry.dev-dependencies]
#cmake = ">=3"
#ninja = "^1.11.1"
#[tool.poetry.scripts]
#blif2vst = 'Coriolis:blif2vst'
#tutorial = 'Coriolis:tutorial'
#unittests = 'Coriolis:unittests'
#yosys_coriolis = 'Coriolis:yosys_coriolis'
[project]
name = "coriolis"
version = "2.4.1"
#dynamic = ["version"]
[tool.poetry.scripts]
blif2vst = 'Coriolis:blif2vst'
tutorial = 'Coriolis:tutorial'
unittests = 'Coriolis:unittests'
yosys_coriolis = 'Coriolis:yosys_coriolis'
[build-system]
requires = ["poetry-core", "setuptools", "cmake", "ninja", "patchelf", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
#requires = ["scikit-build-core","poetry-core", "cmake", "ninja", "patchelf", "poetry-dynamic-versioning"]
requires = ["scikit-build-core", "cmake", "ninja", "patchelf"]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
# The PEP 517 build hooks will add ninja and/or cmake if the versions on the
# system are not at least these versions. Disabled by an empty string.
cmake.minimum-version = "3.15"
ninja.minimum-version = "1.5"
# Fallback on gmake/make if available and ninja is missing (Unix). Will only
# fallback on platforms without a known ninja wheel.
ninja.make-fallback = true
# Extra args for CMake. Pip, unlike build, does not support lists, so semicolon
# can be used to separate. Setting this in config or envvar will override the
# entire list. See also cmake.define.
cmake.args = []
# This activates verbose builds
cmake.verbose = false
# This controls the CMake build type
cmake.build-type = "Release"
# Display logs at or above this level.
logging.level = "WARNING"
# Include and exclude patterns, in gitignore syntax. Include overrides exclude.
# Wheels include packages included in the sdist; CMake has the final say.
sdist.include = []
sdist.exclude = []
# Make reproducible SDists (Python 3.9+ and UNIX recommended). Respects
# SOURCE_DATE_EPOCH when true (the default).
sdist.reproducible = true
# The root-level packages to include. Special default: if not given, the package
# is auto-discovered if it's name matches the main name.
wheel.packages = ["coriolis"]
# Setting py-api to "cp37" would build ABI3 wheels for Python 3.7+. If CPython
# is less than this value, or on PyPy, this will be ignored. Setting the api to
# "py3" or "py2.py3" would build wheels that don't depend on Python (ctypes,
# etc).
wheel.py-api = ""
# Setting this to true will expand tags (universal2 will add Intel and Apple
# Silicon tags, for pip <21.0.1 compatibility).
wheel.expand-macos-universal-tags = false
# This allows you to change the install dir, such as to the package name. The
# original dir is still at SKBUILD_PLATLIB_DIR (also SKBUILD_DATA_DIR, etc. are
# available)
wheel.install-dir = "."
# The licence file(s) to include in the wheel metadata directory.
wheel.license-files = ["LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*"]
# This will backport an internal copy of FindPython if CMake is less than this
# value. Set to 0 or the empty string to disable. The default will be kept in
# sync with the version of FindPython stored in scikit-build-core.
backport.find-python = "3.26.1"
# This is the only editable mode currently
editable.mode = "redirect"
# Enable auto rebuilds on import (experimental)
editable.rebuild = false
# Display output on stderr while rebuilding on import
editable.verbose = true
# Enable experimental features if any are available
experimental = false
# Strictly validate config options
strict-config = true
# This provides some backward compatibility if set. Defaults to the latest
# scikit-build-core version.
minimum-version = "0.2" # current version
# Build directory (empty will use a temporary directory). {cache_tag} and
# {wheel_tag} are available to provide a unique directory per interpreter.
build-dir = ""
[tool.scikit-build.cmake.define]
# Put CMake defines in this table.
[tool.scikit-build.metadata]
# List dynamic metadata fields and hook locations in this table
[tool.cibuildwheel.linux]
skip = ["cp36-*", "cp37-*", "pp*"]

View File

@ -1,38 +0,0 @@
# preload shared libraries
import os, ctypes
__libs=[]
__lib_folder=os.path.join(os.path.dirname(os.path.realpath(__file__)),'..','libs')
for name in (
"libdef.so",
"libpyflute.so",
"libcoloquinte.so",
"libhurricane.so",
"libutils.so",
"libpycrlconst.so",
"libconfiguration.so",
"libpytypemanager.so",
"libflute.so",
"liblef.so",
"libdefzlib.so",
"libisobar.so",
"libintervalTree.so",
"libviewer.so",
"liblefzlib.so",
"libanalog.so",
"libcrlcore.so",
"libtutorial.so",
"libequinox.so",
"libpycrlcore.so",
"liblibmanager.so",
"libetesian.so",
"libsolstice.so",
"libunicorn.so",
"libanabatic.so",
"libkatana.so",
"libpyanabatic.so",
"libbora.so",
"libpybora.so",
):
__libs.append(ctypes.CDLL(os.path.join(__lib_folder,name)))

View File

@ -1,245 +0,0 @@
#!/usr/bin/env python3
#
# This file is part of the Coriolis Software.
# Copyright (c) Sorbonne Université 2015-2021, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | C o r i o l i s - Generic Program Launcher |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : Jean-Paul.Chaput@lip6.fr |
# | =============================================================== |
# | Python : "./src/cgt.py" |
# +-----------------------------------------------------------------+
try:
import sys
import os.path
import optparse
from coriolis import helpers
helpers.loadUserSettings()
from coriolis import Cfg, Hurricane, Viewer, CRL, Etesian, Anabatic, \
Katana, Bora, Tutorial, Unicorn
except Exception as e:
helpers.io.showPythonTrace( sys.argv[0], e )
sys.exit(2)
def setCgtBanner ( banner ):
banner.setName('cgt')
banner.setPurpose('Coriolis Graphical Tool')
return banner
def credits ():
s = ''
s += ' Tool Credits\n'
s += ' Hurricane .................... Remy Escassut & Christian Masson\n'
s += ' Etesian - Placer .............................. Gabriel Gouvine\n'
s += ' Knik - Global Router ............................ Damien Dupuis\n'
s += ' Kite - Detailed Router ....................... Jean-Paul Chaput\n\n'
s += ' Contributors\n'
s += ' Sophie Belloeil, Hugo Clement, Marek Sroka, Wu Yifei\n'
s += ' Coloquinte software credits (used by Etesian)\n'
s += ' Author ........................................ Gabriel Gouvine\n'
s += ' FLUTE software credits (used by Knik)\n'
s += ' Author ........................................ Chris C. N. CHU\n'
s += ' Prof. Ident. ............................ Iowa State University\n'
s += ' URL ........................ http://home.eng.iastate.edu/~cnchu\n\n'
return s
def runScript ( scriptPath, editor ):
try:
sys.stdout.flush()
sys.stderr.flush()
kw = { }
if editor: kw[ 'editor' ] = editor
sys.path.insert( 0, os.path.dirname(scriptPath) )
module = __import__( os.path.basename(scriptPath), globals(), locals() )
if not 'scriptMain' in module.__dict__:
print( '[ERROR] Script module is missing function scriptMain().' )
print( ' "{}"'.format( scriptPath ))
return
if not callable( module.__dict__['scriptMain'] ):
print( '[ERROR] Script module symbol scriptMain is not callable (not a function?).' )
print( ' "{}"'.format( scriptPath ))
return
module.__dict__['scriptMain']( **kw )
except ImportError as e:
#module = str(e).split()[-1]
#print( '[ERROR] The "{}" script cannot be loaded.'.format(os.path.basename(scriptPath)) )
#print( ' Please check your design hierarchy or the Python syntax.' )
#print( ' Error was:' )
#print( ' {}\n'.format(e))
helpers.io.catch( e )
except Exception as e:
helpers.io.catch( e )
return
def run():
try:
usage = str(setCgtBanner(CRL.Banner()))
usage += '\ncgt [options]'
parser = optparse.OptionParser(usage)
parser.add_option( '--no-init' , action='store_true', dest='noInit' , help='Do not load any initialization.')
parser.add_option( '-c', '--cell' , type='string' , dest='cell' , help='The name of the cell to load, without extension.')
parser.add_option( '--acm-sigda-89' , type='string' , dest='acmSigdaName' , help='An ACM/SIGDA 89 bench name to load, without extension.')
parser.add_option( '--blif' , type='string' , dest='blifName' , help='A Blif (Yosys) design name to load, without extension.')
parser.add_option( '--ispd-05' , type='string' , dest='ispd05name' , help='An ISPD 05 bench (placement) name to load, without extension.')
parser.add_option( '--script' , type='string' , dest='script' , help='Run a Python or Stratus script.')
parser.add_option( '-v', '--verbose' , action='store_true', dest='verbose' , help='First level of verbosity.')
parser.add_option( '-V', '--very-verbose' , action='store_true', dest='veryVerbose' , help='Second level of verbosity.')
parser.add_option( '-i', '--info' , action='store_true', dest='info' , help='Display lots of informational messages.')
parser.add_option( '--paranoid' , action='store_true', dest='paranoid' , help='Display everything that *may be* suspicious...')
parser.add_option( '-b', '--bug' , action='store_true', dest='bug' , help='Display bug related messages.')
parser.add_option( '--show-conf' , action='store_true', dest='showConf' , help='Display Kite configuration.')
parser.add_option( '-D', '--core-dump' , action='store_true', dest='coreDump' , help='Enable core-dump when a crash occurs.')
parser.add_option( '-L', '--log-mode' , action='store_true', dest='logMode' , help='Disable ANSI escape sequences in console output.')
parser.add_option( '-t', '--text' , action='store_true', dest='textMode' , help='Run in command line mode.')
parser.add_option( '-K', '--use-katana' , action='store_true', dest='useKatana' , help='Use Katana instead of Knik/Kite router.')
parser.add_option( '-m', '--margin' , type='float' , dest='margin' , help='Percentage of free area to add to the minimal placement area.')
parser.add_option( '-P', '--place' , action='store_true', dest='place' , help='Run the analytical placer (Etesian).')
parser.add_option( '-G', '--global-route' , action='store_true', dest='globalRoute' , help='Run the global router (Knik).')
parser.add_option( '-g', '--load-global' , action='store_true', dest='loadGlobal' , help='Reload a global routing from disk.')
parser.add_option( '--save-global' , action='store_true', dest='saveGlobal' , help='Save the global routing solution.')
parser.add_option( '--htracks-local' , type='int' , dest='hTracksLocal' , help='The amount of horizontal tracks reserved for the GCell local routing.')
parser.add_option( '--vtracks-local' , type='int' , dest='vTracksLocal' , help='The amount of vertical tracks reserved for the GCell local routing .')
parser.add_option( '--events-limit' , type='int' , dest='eventsLimit' , help='The maximum number of iterations (events) that the router is allowed to perform.')
parser.add_option( '-R', '--detail-route' , action='store_true', dest='detailRoute' , help='Run the detailed router (Kite).')
parser.add_option( '-M', '--dump-measures' , action='store_true', dest='dumpMeasures' , help='Dump some statistical measurements on the disk.')
parser.add_option( '-s', '--save-design' , type='string' , dest='saveDesign' , help='Save the routed design.')
parser.add_option( '--top-routing-layer', type='string' , dest='topRoutingLayer', help='Sets the top (upper) routing layer.')
parser.add_option( '--vst-use-concat' , action='store_true', dest='vstUseConcat' , help='The VST driver will use "&" (concat) in PORT MAP.')
(options, args) = parser.parse_args()
args.insert(0, 'cgt')
useKatana = False
flags = 0
if options.noInit:
flags |= CRL.AllianceFramework.NoPythonInit
af = CRL.AllianceFramework.create( flags )
if helpers.io.isVL(2): print( af.getEnvironment().getPrint() )
Cfg.Configuration.pushDefaultPriority(Cfg.Parameter.Priority.CommandLine)
if options.coreDump: Cfg.getParamBool ('misc.catchCore' ).setBool(False)
if options.verbose: Cfg.getParamBool ('misc.verboseLevel1').setBool(True)
if options.veryVerbose: Cfg.getParamBool ('misc.verboseLevel2').setBool(True)
if options.info: Cfg.getParamBool ('misc.info' ).setBool(True)
if options.paranoid: Cfg.getParamBool ('misc.paranoid' ).setBool(True)
if options.bug: Cfg.getParamBool ('misc.bug' ).setBool(True)
if options.logMode: Cfg.getParamBool ('misc.logMode' ).setBool(True)
if options.showConf: Cfg.getParamBool ('misc.showConf' ).setBool(True)
if options.margin: Cfg.getParamPercentage('etesian.spaceMargin').setPercentage(options.margin)
if options.hTracksLocal: Cfg.getParamInt ('katana.hTracksReservedLocal').setInt(options.hTracksLocal)
if options.vTracksLocal: Cfg.getParamInt ('katana.vTracksReservedLocal').setInt(options.vTracksLocal)
if options.eventsLimit: Cfg.getParamInt ('katana.eventsLimit' ).setInt(options.eventsLimit)
if options.topRoutingLayer: Cfg.getParamString ('anabatic.topRoutingLayer' ).setString(options.topRoutingLayer)
if options.useKatana: useKatana = True
loadGlobal = options.loadGlobal
saveGlobal = options.saveGlobal
globalRoute = options.globalRoute
detailRoute = options.detailRoute
runEtesianTool = options.place
Cfg.Configuration.popDefaultPriority()
cell = None
if options.acmSigdaName:
cell = CRL.AcmSigda.load(options.acmSigdaName)
elif options.ispd05name:
cell = CRL.Ispd05.load(options.ispd05name)
elif options.blifName:
cell = CRL.Blif.load(options.blifName)
elif options.cell:
cell = af.getCell(options.cell, CRL.Catalog.State.Views)
else:
runEtesianTool = False
loadGlobal = False
saveGlobal = False
globalRoute = False
detailRoute = False
if not options.textMode:
# Run in graphic mode.
ha = Viewer.HApplication.create(args)
Viewer.Graphics.enable()
unicorn = Unicorn.UnicornGui.create()
unicorn.setApplicationName ('cgt')
unicorn.registerTool (Etesian.GraphicEtesianEngine.grab())
#unicorn.registerTool (Kite.GraphicKiteEngine.grab())
unicorn.registerTool (Katana.GraphicKatanaEngine.grab())
unicorn.registerTool (Bora.GraphicBoraEngine.grab())
unicorn.registerTool (Tutorial.GraphicTutorialEngine.grab())
#unicorn.setAnonNetSelectable(False)
unicorn.setLayerVisible ("grid" , False);
unicorn.setLayerVisible ("text.instance" , False);
unicorn.setLayerVisible ("text.component", False);
if options.script:
runScript(options.script,unicorn)
setCgtBanner(unicorn.getBanner())
#print( unicorn.getBanner() )
#print( credits() )
if cell: unicorn.setCell(cell)
unicorn.show()
ha.qtExec()
else:
# Run in command line mode.
if options.script: runScript(options.script,None)
kiteSuccess = True
if runEtesianTool:
etesian = Etesian.EtesianEngine.create(cell)
#if options.showConf: etesian.printConfiguration()
etesian.place()
if detailRoute and not (loadGlobal or globalRoute): globalRoute = True
runKiteTool = loadGlobal or globalRoute or detailRoute
if useKatana and runKiteTool:
runKiteTool = False
katana = Katana.KatanaEngine.create( cell )
#katana.printConfiguration ()
katana.digitalInit ()
#katana.runNegociatePreRouted()
katana.runGlobalRouter ( Katana.Flags.NoFlags )
katana.loadGlobalRouting ( Anabatic.EngineLoadGrByNet )
katana.layerAssign ( Anabatic.EngineNoNetLayerAssign )
katana.runNegociate ( Katana.Flags.NoFlags )
kiteSuccess = katana.isDetailedRoutingSuccess()
#katana.finalizeLayout()
katana.destroy()
if options.saveDesign:
views = CRL.Catalog.State.Physical
if options.vstUseConcat: views |= CRL.Catalog.State.VstUseConcat
if options.saveDesign != cell.getName():
cell.setName(options.saveDesign)
views |= CRL.Catalog.State.Logical
af.saveCell(cell, views)
sys.exit(not kiteSuccess)
except Exception as e:
helpers.io.showPythonTrace( sys.argv[0], e )
sys.exit(0)

View File

@ -1,177 +0,0 @@
import os, sys
import setuptools
def find_coriolis_install(root=None):
installs=[]
if root is None:
root=os.path.join(os.environ['HOME'],'coriolis-2.x')
for r,d,f in os.walk(root):
if "install" in d:
installs.append(os.path.join(r,'install'))
if not installs:
print("Error: Coriolis build not found.")
sys.exit(-1)
if len(installs)>1:
print("Error: Found several Coriolis builds. Work only with one.")
sys.exit(-2)
return installs[0]
VERSION = "2.4.0"
setup_path=os.path.dirname(os.path.realpath(__file__))
coriolis_install_path=find_coriolis_install()
coriolis_bin_path=os.path.join(coriolis_install_path,'bin')
for name in ["lib64","lib"]:
coriolis_lib_path=os.path.join(coriolis_install_path,'lib64')
if os.path.isdir(coriolis_lib_path):
break
coriolis_lib_path=None
if not coriolis_lib_path:
print("Error: lib64 or lib directory not found in Coriolis build.")
sys.exit(-3)
coriolis_python_path=None
for r,d,f in os.walk(coriolis_lib_path):
if "coriolis" in d:
coriolis_python_path=r
break
if not coriolis_python_path:
print("Error: 'coriolis' python module not found in Coriolis build.")
sys.exit(-4)
#for name in (setup_path,coriolis_install_path,coriolis_bin_path,coriolis_lib_path,coriolis_python_path):
# print(name)
def _add_preload_code(path,libs):
with open(path,"rt") as f:
code=f.read().strip()
if not code.startswith("# preload"):
with open(path,"wt") as f:
f.write(
"""# preload shared libraries
import os, ctypes
__libs=[]
__lib_folder=os.path.join(os.path.dirname(os.path.realpath(__file__)),'libs')
for name in (
""")
for lib in libs:
lib=lib.strip()
if not lib:
continue
f.write(f' "{lib}",\n')
f.write(
"""
):
__libs.append(ctypes.CDLL(os.path.join(__lib_folder,name)))
""")
f.write("\n")
f.write(code)
f.write("\n")
#_add_preload_code(os.path.join(setup_path,"coriolis_cmds","__init__.py"),
#"""
#libdef.so
#libpyflute.so
#libcoloquinte.so
#libhurricane.so
#libutils.so
#libpycrlconst.so
#libconfiguration.so
#libpytypemanager.so
#libflute.so
#liblef.so
#libdefzlib.so
#libisobar.so
#libintervalTree.so
#libviewer.so
#liblefzlib.so
#libanalog.so
#libcrlcore.so
#libtutorial.so
#libequinox.so
#libpycrlcore.so
#liblibmanager.so
#libetesian.so
#libsolstice.so
#libunicorn.so
#libanabatic.so
#libkatana.so
#libpyanabatic.so
#libbora.so
#libpybora.so
#""".split())
import sys, ctypes
def _files(folder):
files=[]
for f in os.listdir(folder):
path=os.path.join(folder,f)
if os.path.isfile(path):
files.append(path)
return files
def _print_ordered_preload_libs():
libs=_files(coriolis_lib_path)
libs_ordered=[]
__libs=[]
while libs:
name=libs.pop(0)
if not name.endswith(".so"):
continue
try:
lib=ctypes.CDLL(name)
__libs.append(lib)
libs_ordered.append(name)
except OSError:
libs.append(name)
for path in libs_ordered:
print(f' "{os.path.split(path)[-1]}",')
#_print_ordered_preload_libs()
def _coriolis_packages():
def _packages(prefix,folder):
root=prefix+[folder]
yield '.'.join(root)
for f in os.listdir(os.path.join(coriolis_python_path,*root)):
if f=="__pycache__":
continue
path=os.path.join(coriolis_python_path,*root,f)
if os.path.isdir(path):
yield from _packages(root,f)
yield from _packages([],"coriolis")
with open(os.path.join(coriolis_python_path,"coriolis","__init__.py"),"wt") as f:
f.write("from .cmds import *\n")
setuptools.setup(
name = "coriolis",
version = VERSION,
description = 'Coriolis is a free database, placement tool and routing tool for VLSI design.',
author = ', '.join(["Rémy ESCASSUT & Christian",
"Christophe ALEXANDRE",
"Sophie BELLOEIL",
"Damien DUPUIS",
"Jean-Paul CHAPUT"
]),
#author_email = 'martin@v.loewis.de',
url = 'https://www-soc.lip6.fr/sesi-docs/coriolis2-docs/coriolis2/en/latex/users-guide/UsersGuide.pdf',
long_description = '''
Coriolis provides several tools to perform the layout of VLSI circuits.
Its main components are the Hurricane database, the Etesian placer and
the Katana router, but other tools can use the Hurricane database and
the parsers provided.
''',
install_requires=['platformdirs'],
package_dir={"coriolis":os.path.join(coriolis_python_path,'coriolis'),
"coriolis.libs":coriolis_lib_path,
"coriolis.bin":coriolis_bin_path,
"coriolis.cmds":os.path.join(setup_path,"coriolis_cmds"),
},
packages=list(_coriolis_packages())+["coriolis.libs", "coriolis.bin", "coriolis.cmds"],
package_data={"":["*.so","*.so.*"],"coriolis.bin":['*']},
entry_points = {
'console_scripts': ['coriolis=coriolis.cmds.coriolis:run'],
}
)

View File

@ -13,7 +13,6 @@
man_stratus.tex
see_also.tex
)
endif()
set ( htmlInstallDir share/doc/coriolis2/en/html/doc/ )
set ( latexInstallDir share/doc/coriolis2/en/latex/stratus_developper )
@ -25,3 +24,4 @@
${LATEX_OUTPUT_PATH}/stratus_developper.dvi
${LATEX_OUTPUT_PATH}/stratus_developper.pdf DESTINATION ${latexInstallDir} )
install ( DIRECTORY ${LATEX_OUTPUT_PATH}/stratus_developper DESTINATION ${htmlInstallDir} )
endif()

View File

@ -44,7 +44,6 @@
man_dpgenxnor2.tex
man_dpgenxor2.tex
)
endif()
set ( htmlInstallDir share/doc/coriolis2/en/html/doc/ )
set ( latexInstallDir share/doc/coriolis2/en/latex/dpgen )
@ -57,3 +56,4 @@
${LATEX_OUTPUT_PATH}/dpgen.dvi
${LATEX_OUTPUT_PATH}/dpgen.pdf DESTINATION ${latexInstallDir} )
install ( DIRECTORY ${LATEX_OUTPUT_PATH}/dpgen DESTINATION ${htmlInstallDir} )
endif()

View File

@ -7,7 +7,6 @@
CACHE STRING "Custom arguments passeds to latex2html" FORCE )
add_latex_document ( patterns.tex )
endif()
set ( htmlInstallDir share/doc/coriolis2/en/html/doc/ )
set ( latexInstallDir share/doc/coriolis2/en/latex/patterns )
@ -19,3 +18,4 @@
${LATEX_OUTPUT_PATH}/patterns.dvi
${LATEX_OUTPUT_PATH}/patterns.pdf DESTINATION ${latexInstallDir} )
install ( DIRECTORY ${LATEX_OUTPUT_PATH}/patterns DESTINATION ${htmlInstallDir} )
endif()

View File

@ -46,7 +46,6 @@
man_stratus.tex
see_also.tex
IMAGE_DIRS images )
endif()
set ( htmlInstallDir share/doc/coriolis2/en/html/doc/ )
set ( latexInstallDir share/doc/coriolis2/en/latex/stratus/ )
@ -58,3 +57,4 @@
${LATEX_OUTPUT_PATH}/stratus.dvi
${LATEX_OUTPUT_PATH}/stratus.pdf DESTINATION ${latexInstallDir} )
install ( DIRECTORY ${LATEX_OUTPUT_PATH}/stratus DESTINATION ${htmlInstallDir} )
endif()

View File

@ -13,8 +13,8 @@
&& ${DOXYGEN_EXECUTABLE} doxyfile
&& cp -f ${doxExtras} html
)
endif()
install ( DIRECTORY html/ DESTINATION ${htmlInstallDir} )
install ( DIRECTORY latex/ DESTINATION ${latexInstallDir} )
install ( FILES socbook.cls DESTINATION ${latexInstallDir} )
endif()