From 08aa1aa1acff2bec491f27b21f1858a9b777e35e Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 27 May 2010 12:48:11 +0000 Subject: [PATCH] Pass the SYS_CONF_DIR to the compiler so that we can set a reasonable default for CORIOLIS_TOP. --- crlcore/src/ccore/CMakeLists.txt | 4 +++- crlcore/src/ccore/Environment.cpp | 26 ++++++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/crlcore/src/ccore/CMakeLists.txt b/crlcore/src/ccore/CMakeLists.txt index 26991f83..abf1297b 100644 --- a/crlcore/src/ccore/CMakeLists.txt +++ b/crlcore/src/ccore/CMakeLists.txt @@ -18,7 +18,9 @@ ${CRLCORE_SOURCE_DIR}/src/ccore/toolbox ) - add_definitions ( -DCORIOLIS_TOP="${PROJECT_BINARY_DIR}" ) + add_definitions ( -DCORIOLIS_TOP="${PROJECT_BINARY_DIR}" + -DSYS_CONF_DIR="${SYS_CONF_DIR}" + ) set ( includes crlcore/Utilities.h crlcore/Memory.h diff --git a/crlcore/src/ccore/Environment.cpp b/crlcore/src/ccore/Environment.cpp index 402ffb91..39a9c45d 100644 --- a/crlcore/src/ccore/Environment.cpp +++ b/crlcore/src/ccore/Environment.cpp @@ -35,10 +35,6 @@ #include "crlcore/Environment.h" -#undef CORIOLIS_TOP -#define CORIOLIS_TOP "/opt/coriolis2" - - namespace { @@ -57,6 +53,8 @@ namespace { "Environment::Environment() :\n" " %s logical format \"%s\" incoherent with physical format \"%s\".\n"; + const string sysConfDir = SYS_CONF_DIR; + class XmlEnvironmentParser : public XmlParser { @@ -210,8 +208,12 @@ namespace { XmlEnvironmentParser ep ( env ); string envPath = path; - if ( path.empty() ) - envPath = env.getCORIOLIS_TOP() + "/etc/coriolis2/environment.alliance.xml" ; + if ( path.empty() ) { + if ( sysConfDir[0] == '/' ) + envPath = sysConfDir + "/coriolis2/environment.alliance.xml" ; + else + envPath = env.getCORIOLIS_TOP() + sysConfDir + "/coriolis2/environment.alliance.xml" ; + } return ep._load ( envPath, warnNotFound ); } @@ -525,9 +527,9 @@ namespace CRL { : _CORIOLIS_TOP (CORIOLIS_TOP) , _displayStyle () , _SCALE_X (10) - , _SYMBOLIC_TECHNOLOGY(CORIOLIS_TOP "/etc/coriolis2/technology.symbolic.xml") + , _SYMBOLIC_TECHNOLOGY("") , _LEF_TECHNOLOGY ("") - , _DISPLAY (CORIOLIS_TOP "/etc/coriolis2/display.xml") + , _DISPLAY ("") , _IN_LO ("vst") , _IN_PH ("ap") , _OUT_LO ("vst") @@ -535,6 +537,14 @@ namespace CRL { , _CATALOG ("CATAL") , _inConstructor (true) { + if ( sysConfDir[0] == '/' ) { + _SYMBOLIC_TECHNOLOGY = sysConfDir + "/coriolis2/technology.symbolic.xml"; + _DISPLAY = sysConfDir + "/coriolis2/display.xml"; + } else { + _SYMBOLIC_TECHNOLOGY = _CORIOLIS_TOP + sysConfDir + "/coriolis2/technology.symbolic.xml"; + _DISPLAY = _CORIOLIS_TOP + sysConfDir + "/coriolis2/display.xml"; + } + setPOWER ( "vdd" ); setGROUND ( "vss" ); setCLOCK ( "^ck$" );