* All Tools:

- A complete sweep of cleanup to suppress allmost all compiler warnings.

  * ./kite:
    - New: Added Python support, for configuration & Unicorn.
This commit is contained in:
Jean-Paul Chaput 2012-11-16 12:54:28 +00:00
parent e8935c099f
commit 647d836916
9 changed files with 619 additions and 18 deletions

View File

@ -39,6 +39,6 @@
add_subdirectory(src)
add_subdirectory(cmake_modules)
if(BUILD_DOC AND DOXYGEN_FOUND)
if(BUILD_DOC AND DOXYGEN_FOUND AND IS_DIRECTORY doc)
add_subdirectory(doc)
endif(BUILD_DOC AND DOXYGEN_FOUND)
endif(BUILD_DOC AND DOXYGEN_FOUND AND IS_DIRECTORY doc)

View File

@ -6,6 +6,7 @@
${HURRICANE_INCLUDE_DIR}
${CONFIGURATION_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_PATH}
)
set ( includes kite/TrackSegmentCost.h
kite/TrackCost.h
@ -29,6 +30,9 @@
kite/KiteEngine.h
kite/GraphicKiteEngine.h
)
set ( pyIncludes kite/PyKiteEngine.h
kite/PyGraphicKiteEngine.h
)
set ( mocIncludes kite/GraphicKiteEngine.h )
set ( cpps TrackSegmentCost.cpp
TrackCost.cpp
@ -56,11 +60,15 @@
KiteEngine.cpp
GraphicKiteEngine.cpp
)
set ( pyCpps PyKite.cpp
PyKiteEngine.cpp
PyGraphicKiteEngine.cpp
)
set ( kitecpps KiteMain.cpp )
qt4_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( kite ${cpps} ${mocCpps} )
add_library ( kite ${cpps} ${mocCpps} ${pyCpps} )
set_target_properties ( kite PROPERTIES VERSION 1.0 SOVERSION 1 )
target_link_libraries ( kite ${KATABATIC_LIBRARIES}
${KNIK_LIBRARIES}
@ -81,11 +89,22 @@
${PYTHON_LIBRARIES} -lutil
)
add_library ( pyKite MODULE ${pyCpps} )
set_target_properties ( pyKite PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -D__PYTHON_MODULE__=1"
PREFIX ""
OUTPUT_NAME "Kite"
)
add_executable ( kite-text ${kitecpps} )
target_link_libraries ( kite-text kite )
install ( TARGETS kite DESTINATION lib${LIB_SUFFIX} )
install ( TARGETS kite-text DESTINATION bin )
target_link_libraries ( pyKite kite
${CORIOLIS_PYTHON_LIBRARIES}
)
install ( TARGETS kite DESTINATION lib${LIB_SUFFIX} )
install ( TARGETS kite-text DESTINATION bin )
install ( TARGETS pyKite DESTINATION ${PYTHON_SITE_PACKAGES} )
install ( FILES ${includes}
${mocIncludes} DESTINATION include/coriolis2/kite )
${mocIncludes}
${pyIncludes} DESTINATION include/coriolis2/kite )

View File

@ -223,7 +223,7 @@ namespace Kite {
KiteEngine* kite = KiteEngine::get ( getCell() );
if ( kite ) {
kite->finalizeLayout ();
kite->dumpMeasures ();
//kite->dumpMeasures ();
kite->destroy ();
}
emit cellPostModificated ();

View File

@ -0,0 +1,123 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyGraphicKiteEngine.cpp" |
// +-----------------------------------------------------------------+
#include "kite/PyGraphicKiteEngine.h"
#include "hurricane/isobar/PyCell.h"
#include "hurricane/Cell.h"
#undef ACCESS_OBJECT
#undef ACCESS_CLASS
#define ACCESS_OBJECT _baseObject._object
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(GraphicKiteEngine,gtool,function)
namespace Kite {
using namespace Hurricane;
using namespace Isobar;
extern "C" {
// +=================================================================+
// | "PyGraphicKiteEngine" Python Module Code Part |
// +=================================================================+
#if defined(__PYTHON_MODULE__)
// +-------------------------------------------------------------+
// | "PyGraphicKiteEngine" Attribute Methods |
// +-------------------------------------------------------------+
static PyObject* PyGraphicKiteEngine_grab ( PyObject* )
{
trace << "PyGraphicKiteEngine_grab()" << endl;
PyGraphicKiteEngine* pyGraphicKiteEngine = NULL;
HTRY
pyGraphicKiteEngine = PyObject_NEW ( PyGraphicKiteEngine, &PyTypeGraphicKiteEngine );
if ( pyGraphicKiteEngine == NULL ) return NULL;
pyGraphicKiteEngine->ACCESS_OBJECT = GraphicKiteEngine::grab();
HCATCH
return (PyObject*)pyGraphicKiteEngine;
}
static PyObject* PyGraphicKiteEngine_getCell ( PyGraphicKiteEngine* self )
{
trace << "PyGraphicKiteEngine_getCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD("GraphicKiteEngine.getCell()")
cell = gtool->getCell ();
HCATCH
if (cell == NULL) Py_RETURN_NONE;
return PyCell_Link(cell);
}
GetNameMethod(GraphicKiteEngine, gtool)
// Standart destroy (Attribute).
PyMethodDef PyGraphicKiteEngine_Methods[] =
{ { "grab" , (PyCFunction)PyGraphicKiteEngine_grab , METH_NOARGS|METH_STATIC
, "Returns the GraphicKiteEngine singleton." }
, { "getName" , (PyCFunction)PyGraphicKiteEngine_getName , METH_NOARGS
, "Returns the name of the GraphicKiteEngine (class attribute)." }
, { "getCell" , (PyCFunction)PyGraphicKiteEngine_getCell , METH_NOARGS
, "Returns the Cell on which this GraphicKiteEngine is attached." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// PyGraphicKiteEngine Type Methods.
PythonOnlyDeleteMethod(GraphicKiteEngine)
PyTypeObjectLinkPyType(GraphicKiteEngine)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyGraphicKiteEngine" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
LinkCreateMethod(GraphicKiteEngine)
PyTypeInheritedObjectDefinitions(GraphicKiteEngine,GraphicTool)
#endif // End of Shared Library Code Part.
} // extern "C".
} // CRL namespace.

104
kite/src/PyKite.cpp Normal file
View File

@ -0,0 +1,104 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyKite.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/isobar/PyCell.h"
#include "kite/PyKiteEngine.h"
#include "kite/PyGraphicKiteEngine.h"
namespace Kite {
using std::cerr;
using std::endl;
using Hurricane::tab;
using Hurricane::in_trace;
using Isobar::__cs;
using CRL::PyTypeToolEngine;
using CRL::PyTypeGraphicTool;
#if !defined(__PYTHON_MODULE__)
// x=================================================================x
// | "PyKite" Shared Library Code Part |
// x=================================================================x
# else // End of PyHurricane Shared Library Code Part.
// x=================================================================x
// | "PyKite" Python Module Code Part |
// x=================================================================x
extern "C" {
// x-------------------------------------------------------------x
// | "PyKite" Module Methods |
// x-------------------------------------------------------------x
static PyMethodDef PyKite_Methods[] =
{ {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// Module Initialization : "initKite ()"
DL_EXPORT(void) initKite () {
trace << "initKite()" << endl;
PyKiteEngine_LinkPyType ();
PyGraphicKiteEngine_LinkPyType ();
PYTYPE_READY_SUB ( KiteEngine , ToolEngine );
PYTYPE_READY_SUB ( GraphicKiteEngine, GraphicTool );
PyObject* module = Py_InitModule ( "Kite", PyKite_Methods );
if ( module == NULL ) {
cerr << "[ERROR]\n"
<< " Failed to initialize Kite module." << endl;
return;
}
Py_INCREF ( &PyTypeKiteEngine );
PyModule_AddObject ( module, "KiteEngine", (PyObject*)&PyTypeKiteEngine );
Py_INCREF ( &PyTypeGraphicKiteEngine );
PyModule_AddObject ( module, "GraphicKiteEngine", (PyObject*)&PyTypeGraphicKiteEngine );
PyObject* dictionnary = PyModule_GetDict(module);
PyObject* constant;
LoadObjectConstant(dictionnary,BuildGlobalSolution,"BuildGlobalSolution");
LoadObjectConstant(dictionnary,LoadGlobalSolution ,"LoadGlobalSolution" );
}
} // End of extern "C".
#endif // End of Python Module Code Part.
} // End of Kite namespace.

249
kite/src/PyKiteEngine.cpp Normal file
View File

@ -0,0 +1,249 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyKiteEngine.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyCell.h"
#include "hurricane/Cell.h"
#include "kite/PyKiteEngine.h"
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(KiteEngine,kite,function)
namespace Kite {
using std::cerr;
using std::endl;
using std::hex;
using std::ostringstream;
using Hurricane::tab;
using Hurricane::in_trace;
using Hurricane::Error;
using Hurricane::Warning;
using Isobar::ProxyProperty;
using Isobar::ProxyError;
using Isobar::ConstructorError;
using Isobar::HurricaneError;
using Isobar::HurricaneWarning;
using Isobar::ParseOneArg;
using Isobar::ParseTwoArg;
using Isobar::PyCell;
using Isobar::PyCell_Link;
using CRL::PyToolEngine;
extern "C" {
#if defined(__PYTHON_MODULE__)
// +=================================================================+
// | "PyKiteEngine" Python Module Code Part |
// +=================================================================+
static PyObject* PyKiteEngine_get ( PyObject*, PyObject* args )
{
trace << "PyKiteEngine_get()" << endl;
KiteEngine* kite = NULL;
HTRY
PyObject* arg0;
if (not ParseOneArg("Kite.get", args, CELL_ARG, &arg0)) return NULL;
kite = KiteEngine::get(PYCELL_O(arg0));
HCATCH
return PyKiteEngine_Link(kite);
}
static PyObject* PyKiteEngine_create ( PyObject*, PyObject* args )
{
trace << "PyKiteEngine_create()" << endl;
KiteEngine* kite = NULL;
HTRY
PyObject* arg0;
if (not ParseOneArg("Kite.get", args, CELL_ARG, &arg0)) return NULL;
Cell* cell = PYCELL_O(arg0);
kite = KiteEngine::get(cell);
if (kite == NULL) {
kite = KiteEngine::create(cell);
if (cmess1.enabled())
kite->getKiteConfiguration()->print(cell);
} else
cerr << Warning("%s already has a Kite engine.",getString(cell).c_str()) << endl;
HCATCH
return PyKiteEngine_Link(kite);
}
PyObject* PyKiteEngine_runGlobalRouter ( PyKiteEngine* self, PyObject* args )
{
trace << "PyKiteEngine_runGlobalRouter()" << endl;
HTRY
METHOD_HEAD("KiteEngine.runGlobalRouter()")
unsigned int flags = 0;
if (PyArg_ParseTuple(args,"I:KiteEngine.runGlobalRouter", &flags)) {
kite->runGlobalRouter(flags);
} else {
PyErr_SetString(ConstructorError, "KiteEngine.runGlobalRouter(): Invalid number/bad type of parameter.");
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
PyObject* PyKiteEngine_loadGlobalRouting ( PyKiteEngine* self, PyObject* args )
{
trace << "PyKiteEngine_loadGlobalRouting()" << endl;
HTRY
METHOD_HEAD("KiteEngine.loadGlobalRouting()")
unsigned int flags = 0;
PyObject* pyRoutingNets = NULL;
if (PyArg_ParseTuple(args,"IO:KiteEngine.loadGlobalRouting", &flags, &pyRoutingNets)) {
// This is a MEMORY LEAK. Router should copy & clean.
KatabaticEngine::NetSet* routingNets = new KatabaticEngine::NetSet();
if (PyObject_IsTrue(pyRoutingNets)) {
if (not PyIter_Check(pyRoutingNets)) {
PyErr_SetString(ConstructorError, "KiteEngine.loadGlobalRouting(): Second parameter do not support iterator protocol.");
return NULL;
}
Cell* cell = kite->getCell();
PyObject* iterator = PyObject_GetIter(pyRoutingNets);
PyObject* pyNetName = NULL;
while( pyNetName = PyIter_Next(iterator) ) {
if (not PyString_Check(pyNetName)) {
PyErr_SetString(ConstructorError, "KiteEngine.loadGlobalRouting(): The second argument must be a container of strings.");
return NULL;
}
Net* net = cell->getNet(Name(PyString_AsString(pyNetName)));
routingNets->insert(net);
Py_DECREF(pyNetName);
}
Py_DECREF(iterator);
}
kite->loadGlobalRouting(flags,*routingNets);
} else {
PyErr_SetString(ConstructorError, "KiteEngine.loadGlobalRouting(): Invalid number/bad type of parameter.");
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
PyObject* PyKiteEngine_layerAssign ( PyKiteEngine* self, PyObject* args )
{
trace << "PyKiteEngine_layerAssign()" << endl;
HTRY
METHOD_HEAD("KiteEngine.layerAssign()")
unsigned int flags = 0;
if (PyArg_ParseTuple(args,"I:KiteEngine.layerAssign", &flags)) {
kite->layerAssign(flags);
} else {
PyErr_SetString(ConstructorError, "KiteEngine.layerAssign(): Invalid number/bad type of parameter.");
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
// Standart Accessors (Attributes).
DirectVoidMethod(KiteEngine,kite,runNegociate)
DirectVoidMethod(KiteEngine,kite,printConfiguration)
DirectVoidMethod(KiteEngine,kite,saveGlobalSolution)
DirectVoidMethod(KiteEngine,kite,finalizeLayout)
DirectVoidMethod(KiteEngine,kite,dumpMeasures)
DirectGetBoolAttribute(PyKiteEngine_getToolSuccess,getToolSuccess,PyKiteEngine,KiteEngine)
// Standart Destroy (Attribute).
DBoDestroyAttribute(PyKiteEngine_destroy,PyKiteEngine)
PyMethodDef PyKiteEngine_Methods[] =
{ { "get" , (PyCFunction)PyKiteEngine_get , METH_VARARGS|METH_STATIC
, "Returns the Kite engine attached to the Cell, None if there isnt't." }
, { "create" , (PyCFunction)PyKiteEngine_create , METH_VARARGS|METH_STATIC
, "Create a Kite engine on this cell." }
, { "printConfiguration", (PyCFunction)PyKiteEngine_printConfiguration, METH_NOARGS
, "Display on the console the configuration of Kite." }
, { "saveGlobalSolution", (PyCFunction)PyKiteEngine_saveGlobalSolution, METH_NOARGS
, "Save the global routing solution on disk." }
, { "getToolSuccess" , (PyCFunction)PyKiteEngine_getToolSuccess , METH_NOARGS
, "Returns True if the detailed routing has been successful." }
, { "loadGlobalRouting" , (PyCFunction)PyKiteEngine_loadGlobalRouting , METH_VARARGS
, "Read/load the global routing and build topologies for Kite." }
, { "runGlobalRouter" , (PyCFunction)PyKiteEngine_runGlobalRouter , METH_VARARGS
, "Run the global router (Knik)." }
, { "layerAssign" , (PyCFunction)PyKiteEngine_layerAssign , METH_VARARGS
, "Run the layer assigment stage." }
, { "runNegociate" , (PyCFunction)PyKiteEngine_runNegociate , METH_NOARGS
, "Run the negociation stage of the detailed router." }
, { "finalizeLayout" , (PyCFunction)PyKiteEngine_finalizeLayout , METH_NOARGS
, "Revert to a pure Hurricane database, remove router's additionnal data structures." }
, { "dumpMeasures" , (PyCFunction)PyKiteEngine_dumpMeasures , METH_NOARGS
, "Dump to disk lots of statistical informations about the routing." }
, { "destroy" , (PyCFunction)PyKiteEngine_destroy , METH_NOARGS
, "Destroy the associated hurricane object. The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
DBoDeleteMethod(KiteEngine)
PyTypeObjectLinkPyType(KiteEngine)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyKiteEngine" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
PyTypeInheritedObjectDefinitions(KiteEngine,PyToolEngine)
DBoLinkCreateMethod(KiteEngine)
#endif // Shared Library Code Part.
} // extern "C".
} // Kite namespace.

View File

@ -2,14 +2,9 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
@ -17,10 +12,7 @@
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./KiteEngine.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#ifndef __KITE_KITE_ENGINE__

View File

@ -0,0 +1,56 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./kite/PyGraphicKiteEngine.h" |
// +-----------------------------------------------------------------+
#ifndef __KITE_PY_GRAPHIC_KITE_ENGINE__
#define __KITE_PY_GRAPHIC_KITE_ENGINE__
#include "crlcore/PyGraphicToolEngine.h"
#include "kite/GraphicKiteEngine.h"
namespace Kite {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyGraphicKiteEngine".
typedef struct {
CRL::PyGraphicTool _baseObject;
} PyGraphicKiteEngine;
// -------------------------------------------------------------------
// Functions & Types exported to "PyKite.ccp".
extern PyTypeObject PyTypeGraphicKiteEngine;
extern PyMethodDef PyGraphicKiteEngine_Methods[];
extern void PyGraphicKiteEngine_LinkPyType ();
#define IsPyGraphicKiteEngine(v) ( (v)->ob_type == &PyTypeGraphicKiteEngine )
#define PY_GRAPHIC_KITE_ENGINE(v) ( (PyGraphicKiteEngine*)(v) )
#define PY_GRAPHIC_KITE_ENGINE_O(v) ( PY_GRAPHIC_KITE_ENGINE(v)->_baseObject._object )
} // End of extern "C".
} // Kite namespace.
#endif // __KITE_PYGRAPHICKITEENGINE__

View File

@ -0,0 +1,58 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./kite/PyKiteEngine.cpp" |
// +-----------------------------------------------------------------+
#ifndef __PY_KITE_ENGINE__
#define __PY_KITE_ENGINE__
#include "hurricane/isobar/PyHurricane.h"
#include "crlcore/PyToolEngine.h"
#include "kite/KiteEngine.h"
namespace Kite {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyKiteEngine".
typedef struct {
CRL::PyToolEngine _baseObject;
} PyKiteEngine;
// -------------------------------------------------------------------
// Functions & Types exported to "PyKite.ccp".
extern PyTypeObject PyTypeKiteEngine;
extern PyMethodDef PyKiteEngine_Methods[];
extern PyObject* PyKiteEngine_Link ( Kite::KiteEngine* );
extern void PyKiteEngine_LinkPyType ();
#define IsPyKiteEngine(v) ( (v)->ob_type == &PyTypeKiteEngine )
#define PYKITEENGINE(v) ( (PyKiteEngine*)(v) )
#define PYKITEENGINE_O(v) ( PYKITEENGINE(v)->_baseObject._object )
} // extern "C".
} // Kite namespace.
#endif // __PY_KITE_ENGINE__