From 16932413025db9dbac1dd5c060181911e7e999a5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 8 Oct 2023 23:11:45 +0200 Subject: [PATCH] Fix linking/compile problems in the meson configuration. * The Hurricane python module was not compiled at all. The name of Python module wrappers is a bit inconsistent: isobar --> Hurricane crlcore --> CRL anabatic --> Anabatic katana --> Katana * Use "py_mod_deps" and not only "py_deps" so the __PYTHON_MODULE__ flag is used for py.extension_module(). * In cumulus, the "cumulus" directory is not used for the installation in site-packages/coriolis/. * In designflow/pnr.py, temporarily disable Tramontana & Tutorial, until they are ported to meson. --- anabatic/src/meson.build | 15 ++++++++++----- bora/src/meson.build | 2 +- crlcore/src/ccore/Utilities.cpp | 26 +++++++++++++------------- crlcore/src/pyCRL/meson.build | 7 +++---- cumulus/meson.build | 20 ++++++++++---------- cumulus/src/designflow/pnr.py | 7 ++++--- cumulus/src/meson.build | 1 + documentation/build.py | 2 +- etesian/src/meson.build | 16 ++++++++++------ flute/src/3.1/meson.build | 2 +- hurricane/src/isobar/meson.build | 9 +++++++++ katana/src/meson.build | 2 +- unicorn/src/meson.build | 2 +- 13 files changed, 65 insertions(+), 46 deletions(-) diff --git a/anabatic/src/meson.build b/anabatic/src/meson.build index e614c485..66a224bd 100644 --- a/anabatic/src/meson.build +++ b/anabatic/src/meson.build @@ -1,3 +1,9 @@ + +anabatic_py = files([ + 'PyStyleFlags.cpp', + 'PyAnabatic.cpp' + ]) + anabatic = shared_library( 'anabatic', 'Constants.cpp', @@ -30,18 +36,17 @@ anabatic = shared_library( 'AntennaProtect.cpp', 'PreRouteds.cpp', 'AnabaticEngine.cpp', + anabatic_py, dependencies: [Etesian], install: true, ) py.extension_module( - 'pyanabatic', - 'PyStyleFlags.cpp', - 'PyAnabatic.cpp', - + 'Anabatic', + anabatic_py, link_with: [anabatic], - dependencies: [Etesian], + dependencies: [Etesian, py_mod_deps], install: true, subdir: 'coriolis' ) diff --git a/bora/src/meson.build b/bora/src/meson.build index 7ef45033..3bc62c33 100644 --- a/bora/src/meson.build +++ b/bora/src/meson.build @@ -61,7 +61,7 @@ py.extension_module( bora_py, link_with: [bora], - dependencies: [Katana, qwt], + dependencies: [Katana, qwt, py_mod_deps], install: true, subdir: 'coriolis' ) diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index 5113175b..62f59f27 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -23,6 +23,7 @@ #include #include namespace boptions = boost::program_options; +namespace bprocess = boost::process; #include "hurricane/utilities/Path.h" #include "hurricane/configuration/Configuration.h" @@ -256,26 +257,25 @@ namespace CRL { if (coriolis_top_env) { coriolis_top = coriolis_top_env; } else { - //We're running as a binary and PyCRL hasn't been instantiated - // use python to find our where we should look - using namespace boost::process; - std::error_code ec; - ipstream out; - //TODO: will need fixing for windoews - system("python3 -c 'from coriolis import CRL; import os; print(os.path.abspath(os.path.dirname(CRL.__file__)))'", std_out > out, ec); - if (ec) { - cerr << "Unable to find coriolis python package. Please set CORIOLIS_TOP environment variable\n"; - exit ( 1 ); + std::error_code rvalue; + bprocess::ipstream pipeout; + string command = "python3 -c 'from coriolis import CRL;" + "import os;" + "print( os.path.abspath(os.path.dirname( CRL.__file__ )))'"; + bprocess::system( command, bprocess::std_out > pipeout, rvalue ); + if (rvalue) { + cerr << "[ERROR] Unable to find coriolis python package.\n" + << " Please set CORIOLIS_TOP environment variable." << endl; + exit( 1 ); } - - out >> coriolis_top; + pipeout >> coriolis_top; } // Environment variables reading. boptions::options_description options ("Environment Variables"); options.add_options() ( "coriolis_top", boptions::value()->default_value(coriolis_top) - , "Location of Corilois module." ) + , "Location of Coriolis module." ) ( "stratus_mapping_name", boptions::value() , "Stratus virtual cells mapping." ); diff --git a/crlcore/src/pyCRL/meson.build b/crlcore/src/pyCRL/meson.build index 6efdb891..41bdaa1f 100644 --- a/crlcore/src/pyCRL/meson.build +++ b/crlcore/src/pyCRL/meson.build @@ -29,7 +29,7 @@ pyCRL_files = files([ py.extension_module( 'Constant', 'PyConstant.cpp', - dependencies: [qt_deps, py_deps, boost, Hurricane], + dependencies: [qt_deps, py_mod_deps, boost, Hurricane], include_directories: crlcore_includes, subdir: 'coriolis', install: true @@ -39,7 +39,7 @@ pycrlcore = shared_library( 'pycrlcore', pyCRL_files, link_with: crlcore, - dependencies: [qt_deps, py_deps, boost, Hurricane], + dependencies: [qt_deps, boost, Hurricane], include_directories: crlcore_includes, install: true, ) @@ -48,9 +48,8 @@ pycrlcore = shared_library( py.extension_module( 'CRL', pyCRL_files, - cpp_args: '-D__PYTHON_MODULE__=1', link_with: pycrlcore, - dependencies: [qt_deps, py_deps, boost, Hurricane], + dependencies: [qt_deps, py_mod_deps, boost, Hurricane], include_directories: crlcore_includes, subdir: 'coriolis', install: true diff --git a/cumulus/meson.build b/cumulus/meson.build index 4544bb20..6850e2be 100644 --- a/cumulus/meson.build +++ b/cumulus/meson.build @@ -3,16 +3,16 @@ subdir('src/designflow') subdir('src/plugins') subdir('src/tools') -py.install_sources(cumulus, subdir: 'coriolis/cumulus') -py.install_sources(designflow, subdir: 'coriolis/cumulus/designflow') -py.install_sources(plugins, subdir: 'coriolis/cumulus/plugins') -py.install_sources(block, subdir: 'coriolis/cumulus/plugins/block') -py.install_sources(chip, subdir: 'coriolis/cumulus/plugins/chip') -py.install_sources(core2chip, subdir: 'coriolis/cumulus/plugins/core2chip') -py.install_sources(harness, subdir: 'coriolis/cumulus/plugins/harness') -py.install_sources(macro, subdir: 'coriolis/cumulus/plugins/macro') -py.install_sources(sram, subdir: 'coriolis/cumulus/plugins/sram') -py.install_sources(tools, subdir: 'coriolis/cumulus/tools') +py.install_sources(cumulus, subdir: 'coriolis') +py.install_sources(designflow, subdir: 'coriolis/designflow') +py.install_sources(plugins, subdir: 'coriolis/plugins') +py.install_sources(block, subdir: 'coriolis/plugins/block') +py.install_sources(chip, subdir: 'coriolis/plugins/chip') +py.install_sources(core2chip, subdir: 'coriolis/plugins/core2chip') +py.install_sources(harness, subdir: 'coriolis/plugins/harness') +py.install_sources(macro, subdir: 'coriolis/plugins/macro') +py.install_sources(sram, subdir: 'coriolis/plugins/sram') +py.install_sources(tools, subdir: 'coriolis/tools') diff --git a/cumulus/src/designflow/pnr.py b/cumulus/src/designflow/pnr.py index 5c587c56..7eb80b55 100644 --- a/cumulus/src/designflow/pnr.py +++ b/cumulus/src/designflow/pnr.py @@ -65,7 +65,8 @@ class PnR ( FlowTask ): else: print( 'PnR.doTask() run in interactive CGT mode.' ) PnR.textMode = False - from .. import Etesian, Anabatic, Katana, Bora, Tramontana, Tutorial, Viewer, Unicorn + #from .. import Etesian, Anabatic, Katana, Bora, Tramontana, Tutorial, Viewer, Unicorn + from .. import Etesian, Anabatic, Katana, Bora, Viewer, Unicorn ShellEnv().export() if self.script and not callable(self.script): @@ -85,9 +86,9 @@ class PnR ( FlowTask ): unicorn.setApplicationName ( 'cgt') unicorn.registerTool ( Etesian.GraphicEtesianEngine.grab() ) unicorn.registerTool ( Katana.GraphicKatanaEngine.grab() ) - unicorn.registerTool ( Tramontana.GraphicTramontanaEngine.grab() ) + #unicorn.registerTool ( Tramontana.GraphicTramontanaEngine.grab() ) unicorn.registerTool ( Bora.GraphicBoraEngine.grab() ) - unicorn.registerTool ( Tutorial.GraphicTutorialEngine.grab() ) + #unicorn.registerTool ( Tutorial.GraphicTutorialEngine.grab() ) #unicorn.setAnonNetSelectable(False) unicorn.setLayerVisible ( "grid" , False ); unicorn.setLayerVisible ( "text.instance" , False ); diff --git a/cumulus/src/meson.build b/cumulus/src/meson.build index 00e6a9a0..41b1039e 100644 --- a/cumulus/src/meson.build +++ b/cumulus/src/meson.build @@ -1,3 +1,4 @@ + cumulus = files([ '__init__.py' ]) diff --git a/documentation/build.py b/documentation/build.py index 044ada0c..67ea9af3 100755 --- a/documentation/build.py +++ b/documentation/build.py @@ -78,7 +78,7 @@ class Configuration ( object ): self.onLepka = False self.onDocker = False hostname = socket.gethostname() - if hostname.startswith('lepka'): self.onLepka = True + if hostname.startswith('lepka'): self.onLepka = False else: self.onDocker = True scriptDir = os.path.abspath(os.getcwd()) if scriptDir.endswith( 'coriolis/documentation' ) and not self.onLepka: diff --git a/etesian/src/meson.build b/etesian/src/meson.build index ee63892d..2ca27dc3 100644 --- a/etesian/src/meson.build +++ b/etesian/src/meson.build @@ -5,6 +5,12 @@ etesian_mocs = qt.compile_moc( dependencies: [Hurricane, CrlCore, Coloquinte], ) +etesian_py = files([ + 'PyEtesian.cpp', + 'PyEtesianEngine.cpp', + 'PyGraphicEtesianEngine.cpp', + ]) + etesian = shared_library( 'etesian', 'Configuration.cpp', @@ -18,6 +24,7 @@ etesian = shared_library( 'BloatProperty.cpp', 'EtesianEngine.cpp', 'GraphicEtesianEngine.cpp', + etesian_py, etesian_mocs, dependencies: [Hurricane, CrlCore, Coloquinte], install: true, @@ -25,12 +32,9 @@ etesian = shared_library( py.extension_module( 'Etesian', - 'PyEtesian.cpp', - 'PyEtesianEngine.cpp', - 'PyGraphicEtesianEngine.cpp', - - link_with: [configuration], - dependencies: [Hurricane, CrlCore, Coloquinte], + etesian_py, + link_with: [configuration, etesian], + dependencies: [py_mod_deps, Hurricane, CrlCore, Coloquinte], install: true, subdir: 'coriolis' ) diff --git a/flute/src/3.1/meson.build b/flute/src/3.1/meson.build index 5d8abf49..f3d5d104 100644 --- a/flute/src/3.1/meson.build +++ b/flute/src/3.1/meson.build @@ -20,7 +20,7 @@ flute = shared_library( py.extension_module( 'Flute', 'PyFlute.cpp', - dependencies: [py_deps, Hurricane, CrlCore], + dependencies: [py_mod_deps, Hurricane, CrlCore], include_directories: flute_includes, subdir: 'coriolis', install: true diff --git a/hurricane/src/isobar/meson.build b/hurricane/src/isobar/meson.build index ddb7fdf2..3713f2b6 100644 --- a/hurricane/src/isobar/meson.build +++ b/hurricane/src/isobar/meson.build @@ -90,4 +90,13 @@ isobar = library( install: true, ) +py.extension_module( + 'Hurricane', + isobar_sources, + dependencies: [qt_deps, py_deps, boost], + link_with: [isobar, hurricane], + include_directories: hurricane_includes, + install: true, + subdir: 'coriolis' +) diff --git a/katana/src/meson.build b/katana/src/meson.build index df56d9db..401ed676 100644 --- a/katana/src/meson.build +++ b/katana/src/meson.build @@ -65,7 +65,7 @@ py.extension_module( katana_py, link_with: [katana], - dependencies: [Anabatic], + dependencies: [py_mod_deps, Anabatic], install: true, subdir: 'coriolis' ) diff --git a/unicorn/src/meson.build b/unicorn/src/meson.build index b2ed2211..aeb09546 100644 --- a/unicorn/src/meson.build +++ b/unicorn/src/meson.build @@ -37,7 +37,7 @@ py.extension_module( unicorn_py, link_with: [unicorn], - dependencies: [Katana], + dependencies: [py_mod_deps,Katana], install: true, subdir: 'coriolis' )