Skip to content
Permalink
Browse files
Dont use PREFIX on linux (or anywhere else). On linux assume prefix i…
…s appdirpath/.

This fixes issues where qgis is nor relocatable after building, and removes cmake warnings about duplicate definition of PREFIX. Note that to be relocatable you should not build using rpath support..


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8472 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed May 19, 2008
1 parent ecbd407 commit bca65ebbaa697147dbb628456cd77854682df6d7
Showing with 59 additions and 23 deletions.
  1. +0 −4 CMakeLists.txt
  2. +0 −2 cmake_templates/qgsconfig.h.in
  3. +15 −1 src/app/qgisapp.cpp
  4. +36 −8 src/core/qgsapplication.cpp
  5. +8 −8 src/core/qgsapplication.h
@@ -229,10 +229,6 @@ ELSE (WIN32)
SET (DEFAULT_PLUGIN_SUBDIR lib/qgis)
SET (DEFAULT_INCLUDE_SUBDIR include/qgis)

IF (UNIX AND NOT APPLE)
ADD_DEFINITIONS(-DPREFIX=${CMAKE_INSTALL_PREFIX})
ENDIF (UNIX AND NOT APPLE)

ENDIF (WIN32)


@@ -15,8 +15,6 @@
//used in main.cpp and anywhere else where the release name is needed
#define RELEASE_NAME "${RELEASE_NAME}"

#define PREFIX "${CMAKE_INSTALL_PREFIX}"

#define QGIS_PLUGIN_SUBDIR "${QGIS_PLUGIN_SUBDIR}"
#define QGIS_DATA_SUBDIR "${QGIS_DATA_SUBDIR}"

@@ -1198,7 +1198,14 @@ void QgisApp::createStatusBar()
QString myIconPath = QgsApplication::themePath();
myProjPixmap.load(myIconPath+"/mIconProjectionDisabled.png");
mOnTheFlyProjectionStatusButton->setPixmap(myProjPixmap);
assert(!myProjPixmap.isNull());
QgsDebugMsg("Icon Path: " + myIconPath.toLocal8Bit());
if (myProjPixmap.isNull())
{
QMessageBox::critical(this, tr("Resource Location Error"),
tr("Error reading icon resources from: \n %1\n Quitting...").arg(myIconPath));

exit(0);
}
mOnTheFlyProjectionStatusButton->setWhatsThis(tr("This icon shows whether on the fly projection is enabled or not. Click the icon to bring up the project properties dialog to alter this behaviour."));
mOnTheFlyProjectionStatusButton->setToolTip(tr("Projection status - Click to open projection dialog"));
connect(mOnTheFlyProjectionStatusButton, SIGNAL(clicked()),
@@ -1624,6 +1631,7 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
{
QSettings mySettings;

QgsDebugMsg("\n\n*************************************************");
QgsDebugMsg("Restoring plugins from last session " + thePluginDirString);

#ifdef WIN32
@@ -1664,6 +1672,10 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)

loadPlugin(myName(), myDescription(), myFullPath);
}
else
{
QgsDebugMsg("Plugin was not active last session, leaving disabled: " + myEntryName);
}
}
else
{
@@ -1718,6 +1730,8 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
}
}
#endif
QgsDebugMsg("Loading plugins completed");
QgsDebugMsg("*************************************************\n\n");
}


@@ -21,6 +21,7 @@
#include <QDir>

#include <qgsconfig.h>
#include <qgslogger.h>

// for htonl
#ifdef WIN32
@@ -50,42 +51,69 @@ QString QgsApplication::mThemePath;
QgsApplication::QgsApplication(int & argc, char ** argv, bool GUIenabled)
: QApplication(argc, argv, GUIenabled)
{
QgsDebugMsg("\n**********************************");
QgsDebugMsg("\nInitialising QgsApplication...");
#if defined(Q_WS_MACX) || defined(Q_WS_WIN32) || defined(WIN32)
setPrefixPath(applicationDirPath(), TRUE);
setPrefixPath(applicationDirPath(), true);
#else
setPrefixPath(PREFIX, TRUE);
QDir myDir(applicationDirPath());
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
QgsDebugMsg("Prefix: " + myPrefix.toLocal8Bit());
setPrefixPath(myPrefix, true);
#endif
QgsDebugMsg("\nPlugin Path:" + mPluginPath);
QgsDebugMsg("\nPkgData Path:" + mPkgDataPath);
QgsDebugMsg("\nTheme Path:" + mThemePath);
QgsDebugMsg("\n**********************************\n");
}

QgsApplication::~QgsApplication()
{}

void QgsApplication::setPrefixPath(const QString& thePrefixPath, bool useDefaultPaths)
void QgsApplication::setPrefixPath(const QString thePrefixPath, bool useDefaultPaths)
{
mPrefixPath = thePrefixPath;
if (useDefaultPaths)
{
setPluginPath(mPrefixPath + QString("/") + QString(QGIS_PLUGIN_SUBDIR));
setPkgDataPath(mPrefixPath + QString("/") + QString(QGIS_DATA_SUBDIR));
setPluginPath(mPrefixPath + QDir::separator() + QString(QGIS_PLUGIN_SUBDIR));
setPkgDataPath(mPrefixPath + QDir::separator() + QString(QGIS_DATA_SUBDIR));
}
}

void QgsApplication::setPluginPath(const QString& thePluginPath)
void QgsApplication::setPluginPath(const QString thePluginPath)
{
mPluginPath = thePluginPath;
QgsDebugMsg("\n\n\n\n\n +++++++++++++++++++++++\n plugin path changed\n" + mPluginPath + "\n +++++++++++++++++ \n\n\n\n");
}

void QgsApplication::setPkgDataPath(const QString& thePkgDataPath)
void QgsApplication::setPkgDataPath(const QString thePkgDataPath)
{
mPkgDataPath = thePkgDataPath;
mThemePath = mPkgDataPath + QString("/themes/default/");
}

const QString QgsApplication::prefixPath()
{
return mPrefixPath;
}
const QString QgsApplication::pluginPath()
{
return mPluginPath;
}
const QString QgsApplication::pkgDataPath()
{
return mPkgDataPath;
}
const QString QgsApplication::themePath()
{
return mThemePath;
}

/*!
Set the theme path to the specified theme.
*/
void QgsApplication::selectTheme(const QString& theThemeName)
void QgsApplication::selectTheme(const QString theThemeName)
{
mThemePath = mPkgDataPath + QString("/themes/") + theThemeName + QString("/");
}
@@ -25,7 +25,7 @@ class CORE_EXPORT QgsApplication: public QApplication
virtual ~QgsApplication();

//! Set the theme path to the specified theme.
static void selectTheme(const QString& theThemeName);
static void selectTheme(const QString theThemeName);

//! Returns the path to the authors file.
static const QString authorsFilePath();
@@ -67,25 +67,25 @@ class CORE_EXPORT QgsApplication: public QApplication
static const QString svgPath();

//! Returns the path to the application prefix directory.
static const QString& prefixPath() { return mPrefixPath; }
static const QString prefixPath();

//! Returns the path to the application plugin directory.
static const QString& pluginPath() { return mPluginPath; }
static const QString pluginPath();

//! Returns the common root path of all application data directories.
static const QString& pkgDataPath() { return mPkgDataPath; }
static const QString pkgDataPath();

//! Returns the path to the current theme directory.
static const QString& themePath() { return mThemePath; }
static const QString themePath();

//! Alters prefix path - used by 3rd party apps
static void setPrefixPath(const QString& thePrefixPath, bool useDefaultPaths = FALSE);
static void setPrefixPath(const QString thePrefixPath, bool useDefaultPaths = FALSE);

//! Alters plugin path - used by 3rd party apps
static void setPluginPath(const QString& thePluginPath);
static void setPluginPath(const QString thePluginPath);

//! Alters pkg data path - used by 3rd party apps
static void setPkgDataPath(const QString& thePkgDataPath);
static void setPkgDataPath(const QString thePkgDataPath);

//! loads providers
static void initQgis();

0 comments on commit bca65eb

Please sign in to comment.