From e2cb4339627fdd2165bdb2244f63bbda2c0dd310 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 21 Apr 2013 15:36:06 +0000 Subject: [PATCH] * ./crlcore: - Change: Switch from boost::filestem to VLSISAPD path. --- crlcore/CMakeLists.txt | 2 +- crlcore/src/ccore/AllianceFramework.cpp | 10 ++--- crlcore/src/ccore/Histogram.cpp | 13 +++--- crlcore/src/ccore/Utilities.cpp | 60 ++++++++++++------------- crlcore/src/ccore/crlcore/Utilities.h | 60 ++++++++++++------------- crlcore/src/cyclop/CMakeLists.txt | 2 + crlcore/src/cyclop/CyclopMain.cpp | 23 +++------- crlcore/src/x2y/CMakeLists.txt | 6 ++- 8 files changed, 80 insertions(+), 96 deletions(-) diff --git a/crlcore/CMakeLists.txt b/crlcore/CMakeLists.txt index dc9188fc..9aa7f3f3 100644 --- a/crlcore/CMakeLists.txt +++ b/crlcore/CMakeLists.txt @@ -16,7 +16,7 @@ check_distribution() set_lib_link_mode() setup_sysconfdir("${CMAKE_INSTALL_PREFIX}") - setup_boost(program_options filesystem python regex wave) + setup_boost(program_options python regex wave) message(STATUS "${Boost_LIBRARIES}") find_package(LibXml2 REQUIRED) diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index b54264e4..0eada408 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2013, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -16,6 +16,7 @@ #include +#include "vlsisapd/utilities/Path.h" #include "hurricane/Warning.h" #include "hurricane/Technology.h" #include "hurricane/DataBase.h" @@ -23,7 +24,6 @@ #include "hurricane/Cell.h" #include "hurricane/Instance.h" #include "hurricane/viewer/Graphics.h" - #include "crlcore/Utilities.h" #include "crlcore/GraphicsParser.h" #include "crlcore/SymbolicTechnologyParser.h" @@ -392,9 +392,9 @@ namespace CRL { { if ( library == NULL ) return; - bfs::path libPath ( getString(library->getPath()) ); - if ( not bfs::exists(libPath) ) { - bfs::create_directory(libPath); + Utilities::Path libPath ( getString(library->getPath()) ); + if ( not libPath.exists() ) { + libPath.mkdir(); } forEach ( Cell*, icell, library->getLibrary()->getCells() ) { diff --git a/crlcore/src/ccore/Histogram.cpp b/crlcore/src/ccore/Histogram.cpp index 3259bf0a..5d0d0f68 100644 --- a/crlcore/src/ccore/Histogram.cpp +++ b/crlcore/src/ccore/Histogram.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2013, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -19,10 +19,7 @@ #include #include #include -#include -#include -namespace bfs = boost::filesystem; - +#include "vlsisapd/utilities/Path.h" #include "crlcore/Histogram.h" @@ -114,11 +111,11 @@ namespace CRL { void Histogram::toGnuplot ( const string& basename ) { - bfs::path datFile = basename + _fileExtension + ".dat"; + Utilities::Path datFile ( basename+_fileExtension+".dat" ); toFile ( datFile.string() ); - bfs::path pltFile = basename + _fileExtension + ".plt"; - bfs::ofstream fd ( pltFile ); + Utilities::Path pltFile ( basename+_fileExtension+".plt" ); + ofstream fd ( pltFile.string() ); if ( not _mainTitle.empty() ) fd << "set title \"" << _mainTitle << "\"\n"; diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index 906661d3..544d5d95 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2013, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,6 +24,7 @@ #include namespace boptions = boost::program_options; +#include "vlsisapd/utilities/Path.h" #include "vlsisapd/configuration/Configuration.h" #include "hurricane/Backtrace.h" #include "hurricane/Warning.h" @@ -89,8 +90,8 @@ namespace { void stratus1MappingNameChanged ( Cfg::Parameter* p ) { - bfs::path stratusMappingName = p->asString(); - if ( not stratusMappingName.has_root_directory() ) { + Utilities::Path stratusMappingName ( p->asString() ); + if ( not stratusMappingName.absolute() ) { stratusMappingName = System::getPath("etc") / stratusMappingName; } setenv ( "STRATUS_MAPPING_NAME", stratusMappingName.string().c_str(), 1 ); @@ -249,9 +250,6 @@ namespace CRL { boptions::store ( boptions::parse_environment(options,environmentMapper), arguments ); boptions::notify ( arguments ); - if ( bfs::path::default_name_check_writable() ) - bfs::path::default_name_check ( bfs::portable_posix_name ); - // Force creation of singleton at this stage. // cerr << "In System singleton creation." << endl; // AllianceFramework::get(); @@ -266,8 +264,8 @@ namespace CRL { ); } - bfs::path sysConfDir ( SYS_CONF_DIR ); - if ( not sysConfDir.has_root_path() ) { + Utilities::Path sysConfDir ( SYS_CONF_DIR ); + if ( not sysConfDir.absolute() ) { if ( arguments.count("coriolis_top") ) { // const boptions::variable_value& value = arguments["coriolis_top"]; // cerr << "value:" @@ -297,12 +295,12 @@ namespace CRL { _pathes.insert ( make_pair("home",arguments["home"].as()) ); // Early setting of python pathes to be able to execute configuration scripts. - bfs::path pythonSitePackages = PYTHON_SITE_PACKAGES; + Utilities::Path pythonSitePackages ( PYTHON_SITE_PACKAGES ); pythonSitePackages = arguments["coriolis_top"].as() / pythonSitePackages; _pathes.insert ( make_pair("pythonSitePackages",pythonSitePackages.string()) ); - bfs::path crlcoreDir = pythonSitePackages / "crlcore"; - bfs::path stratusDir = pythonSitePackages / "stratus"; - bfs::path cumulusDir = pythonSitePackages / "cumulus"; + Utilities::Path crlcoreDir = pythonSitePackages / "crlcore"; + Utilities::Path stratusDir = pythonSitePackages / "stratus"; + Utilities::Path cumulusDir = pythonSitePackages / "cumulus"; Isobar::Script::addPath ( sysConfDir.string() ); Isobar::Script::addPath ( pythonSitePackages.string() ); @@ -331,7 +329,7 @@ namespace CRL { logModeChanged ( Cfg::getParamBool("misc.logMode" ) ); traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) ); - bfs::path stratusMappingName; + Utilities::Path stratusMappingName; if ( arguments.count("stratus_mapping_name") ) { Cfg::getParamString( "stratus1.mappingName")->setString ( arguments["stratus_mapping_name"].as() ); } @@ -406,11 +404,11 @@ namespace CRL { } - const bfs::path& System::_getPath ( const string& key ) + const Utilities::Path& System::_getPath ( const string& key ) { - static bfs::path nullPath ("no_path"); + static Utilities::Path nullPath ("no_path"); - map::const_iterator ipath = _pathes.find ( key ); + map::const_iterator ipath = _pathes.find( key ); if ( ipath == _pathes.end() ) return nullPath; return (*ipath).second; @@ -420,13 +418,13 @@ namespace CRL { void System::_runPythonInit () { Cfg::Configuration* conf = Cfg::Configuration::get (); - bfs::path sysConfDir = getPath("etc"); - bfs::path pythonSitePackages = getPath("pythonSitePackages"); + Utilities::Path sysConfDir = getPath("etc"); + Utilities::Path pythonSitePackages = getPath("pythonSitePackages"); #if XML_NOT_DISABLED - bool systemConfFound = false; - bfs::path systemConfFile = sysConfDir / "tools.configuration.xml"; - if ( bfs::exists(systemConfFile) ) { + bool systemConfFound = false; + Utilities::Path systemConfFile = sysConfDir / "tools.configuration.xml"; + if ( systemConfFile.exists() ) { systemConfFound = true; conf->readFromFile ( systemConfFile.string() ); } else { @@ -435,14 +433,14 @@ namespace CRL { } #endif - bool systemConfFound = false; - bfs::path systemConfFile = pythonSitePackages / "crlcore" / "coriolisInit.py"; - if ( bfs::exists(systemConfFile) ) { + bool systemConfFound = false; + Utilities::Path systemConfFile = pythonSitePackages / "crlcore" / "coriolisInit.py"; + if ( systemConfFile.exists() ) { systemConfFound = true; //cout << " o Reading python dot configuration:" << endl; //cout << " - <" << systemConfFile.string() << ">." << endl; - Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem()); + Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem().string()); systemScript->runFunction("coriolisConfigure",NULL,Isobar::Script::NoScriptArgs); systemScript->destroy(); } else { @@ -450,17 +448,17 @@ namespace CRL { ,systemConfFile.string().c_str()) << endl; } - bool homeConfFound = false; - bfs::path homeConfFile = getPath("home"); + bool homeConfFound = false; + Utilities::Path homeConfFile = getPath("home"); homeConfFile /= ".coriolis2.configuration.xml"; - if ( bfs::exists(homeConfFile) ) { + if ( homeConfFile.exists() ) { homeConfFound = true; conf->readFromFile ( homeConfFile.string() ); } - bool dotConfFound = false; - bfs::path dotConfFile = "./.coriolis2.configuration.xml"; - if ( bfs::exists(dotConfFile) ) { + bool dotConfFound = false; + Utilities::Path dotConfFile = "./.coriolis2.configuration.xml"; + if ( dotConfFile.exists() ) { dotConfFound = true; conf->readFromFile ( dotConfFile.string() ); } diff --git a/crlcore/src/ccore/crlcore/Utilities.h b/crlcore/src/ccore/crlcore/Utilities.h index 940b375c..14682d51 100644 --- a/crlcore/src/ccore/crlcore/Utilities.h +++ b/crlcore/src/ccore/crlcore/Utilities.h @@ -15,23 +15,19 @@ // +-----------------------------------------------------------------+ -#ifndef __CRL_UTILITIES_H__ -#define __CRL_UTILITIES_H__ +#ifndef CRL_UTILITIES_H +#define CRL_UTILITIES_H #include #include - #include #include #include - -#include -namespace bfs = boost::filesystem; - -#include "hurricane/Commons.h" -#include "hurricane/Error.h" -#include "hurricane/Slot.h" -#include "hurricane/DbU.h" +#include "vlsisapd/utilities/Path.h" +#include "hurricane/Commons.h" +#include "hurricane/Error.h" +#include "hurricane/Slot.h" +#include "hurricane/DbU.h" namespace CRL { @@ -50,31 +46,31 @@ namespace CRL { class System { public: - static System* get (); - static inline bool getCatchCore (); - static inline const bfs::path& getPath ( const std::string& ); - static inline bool setCatchCore ( bool catchCore ); - static inline void runPythonInit (); + static System* get (); + static inline bool getCatchCore (); + static inline const Utilities::Path& getPath ( const std::string& ); + static inline bool setCatchCore ( bool catchCore ); + static inline void runPythonInit (); private: - static System* _singleton; - bool _catchCore; - std::map _pathes; + static System* _singleton; + bool _catchCore; + std::map _pathes; private: - System (); - System ( const System &other ); - System& operator= ( const System &other ); - static void _trapSig ( int sig ); - inline bool _getCatchCore (); - const bfs::path& _getPath ( const std::string& ); - inline bool _setCatchCore ( bool catchCore ); - void _runPythonInit (); + System (); + System ( const System &other ); + System& operator= ( const System &other ); + static void _trapSig ( int sig ); + inline bool _getCatchCore (); + const Utilities::Path& _getPath ( const std::string& ); + inline bool _setCatchCore ( bool catchCore ); + void _runPythonInit (); }; - inline bool System::getCatchCore () { return get()->_getCatchCore(); } - inline const bfs::path& System::getPath ( const std::string& key ) { return get()->_getPath(key); } - inline bool System::setCatchCore ( bool catchCore ) { return get()->_setCatchCore(catchCore); } - inline void System::runPythonInit () { return get()->_runPythonInit(); } + inline bool System::getCatchCore () { return get()->_getCatchCore(); } + inline const Utilities::Path& System::getPath ( const std::string& key ) { return get()->_getPath(key); } + inline bool System::setCatchCore ( bool catchCore ) { return get()->_setCatchCore(catchCore); } + inline void System::runPythonInit () { return get()->_runPythonInit(); } // ------------------------------------------------------------------- @@ -461,4 +457,4 @@ inline linefill& linefill::operator<< ( const T* t ) LINEFILL_PR_SUPPORT(std::string); -# endif +#endif // CRL_UTILITIES diff --git a/crlcore/src/cyclop/CMakeLists.txt b/crlcore/src/cyclop/CMakeLists.txt index 73b7ce58..8195f2cb 100644 --- a/crlcore/src/cyclop/CMakeLists.txt +++ b/crlcore/src/cyclop/CMakeLists.txt @@ -2,6 +2,7 @@ include ( ${QT_USE_FILE} ) include_directories ( ${CRLCORE_SOURCE_DIR}/src/ccore ${HURRICANE_INCLUDE_DIR} + ${UTILITIES_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ) @@ -27,6 +28,7 @@ ${AGDS_LIBRARY} ${CIF_LIBRARY} ${CONFIGURATION_LIBRARY} + ${UTILITIES_LIBRARY} ${LEFDEF_LIBRARIES} ${OA_LIBRARIES} ${QT_LIBRARIES} diff --git a/crlcore/src/cyclop/CyclopMain.cpp b/crlcore/src/cyclop/CyclopMain.cpp index 4a40e493..9ff23a33 100644 --- a/crlcore/src/cyclop/CyclopMain.cpp +++ b/crlcore/src/cyclop/CyclopMain.cpp @@ -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 2008-2013, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | C y c l o p - S i m p l e V i e w e r | // | | @@ -17,10 +12,8 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./CyclopMain.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ + #include #include @@ -30,14 +23,12 @@ using namespace std; #include namespace boptions = boost::program_options; -#include -namespace bfs = boost::filesystem; - #include #if (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) and not defined (__APPLE__) # include #endif +#include "vlsisapd/utilities/Path.h" #include "hurricane/DataBase.h" #include "hurricane/Technology.h" #include "hurricane/Layer.h" @@ -100,8 +91,6 @@ int main ( int argc, char *argv[] ) int returnCode = 0; try { - bfs::path::default_name_check ( bfs::portable_posix_name ); - unsigned int traceLevel; bool verbose1; bool verbose2; @@ -129,7 +118,7 @@ int main ( int argc, char *argv[] ) boptions::store ( boptions::parse_command_line(argc,argv,options), arguments ); boptions::notify ( arguments ); - bfs::path userConfFile = "ma/configuration"; + Utilities::Path userConfFile ( "ma/configuration" ); cerr << "Mark:" << userConfFile.string() << endl; if ( arguments.count("help") ) { diff --git a/crlcore/src/x2y/CMakeLists.txt b/crlcore/src/x2y/CMakeLists.txt index 4c11bee2..480a3246 100644 --- a/crlcore/src/x2y/CMakeLists.txt +++ b/crlcore/src/x2y/CMakeLists.txt @@ -2,6 +2,7 @@ include ( ${QT_USE_FILE} ) include_directories ( ${CRLCORE_SOURCE_DIR}/src/ccore ${HURRICANE_INCLUDE_DIR} + ${UTILITIES_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ) @@ -11,6 +12,7 @@ add_executable ( cx2y ${cpps} ) target_link_libraries ( cx2y crlcore - ${LIBEXECINFO_LIBRARIES} - ) + ${UTILITIES_LIBRARY} + ${LIBEXECINFO_LIBRARIES} + ) install ( TARGETS cx2y DESTINATION bin )