Skip to content
Snippets Groups Projects
Commit 19d3804c authored by Joseph Boudreau's avatar Joseph Boudreau
Browse files

set the gxpluginpath if it is not set by environment variable

parent 506097da
No related branches found
No related tags found
No related merge requests found
Pipeline #1682875 passed with warnings
......@@ -6,6 +6,8 @@ set(MYLIB_VERSION_PATCH 0)
set( CMAKE_BUILD_TYPE DEBUG )
set(CMAKE_CXX_FLAGS "-fPIC -O0 -g -gdwarf-2" )
project ( "gmex" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX )
find_package( Coin REQUIRED )
......@@ -16,7 +18,6 @@ endif()
find_package( Qt5 COMPONENTS Core Gui Widgets OpenGL PrintSupport Network )
# Find the header and source files.
file( GLOB SOURCES src/*.cxx )
file( GLOB HEADERS RunVP1Light/*.h )
......@@ -39,6 +40,7 @@ include_directories(${Qt5Network_INCLUDE_DIRS} )
include_directories(${Coin_INCLUDE_DIRS} )
include_directories(${SoQt_INCLUDE_DIRS} )
add_definitions ( -DINSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
add_definitions (${Qt5Core_DEFINITIONS})
add_definitions (${Qt5Gui_DEFINITIONS})
add_definitions (${Qt5OpenGL_DEFINITIONS})
......
......@@ -18,28 +18,36 @@
// C++ includes
#include <iostream>
#include <cstdlib>
#define STR_VALUE(arg) #arg
#define STR_NAME(name) STR_VALUE(name)
int main(int argc, char** argv)
{
auto pManip= [] (const char * variable, const char *plus) {
const char *path=getenv(variable);
if (path) {
std::string newPath=std::string(path)+":"+plus;
setenv(variable, newPath.c_str(), true);
}
else {
setenv(variable, plus, true);
}
};
// JFB Put some defaults. This depends upon architecture. The list should
// be expanded to include other architectures and/or passed in through the
// compiler.
#ifdef __APPLE__
pManip("GXPLUGINPATH","/usr/local/lib/gxplugins");
auto pManip= [] (const char * variable, const char *plus) {
const char *path=getenv(variable);
if (path) {
std::string newPath=std::string(path)+":"+plus;
setenv(variable, newPath.c_str(), true);
}
else {
setenv(variable, plus, true);
}
};
// Preprocessor: we are passing the install directory to this
// class. Drivers will be loaded from this install directory.
// However in some cases "linux" is part of the install directory
// name and that may be defined in a macro to be 1. So if that is
// the case we temporarily undef it.
#ifdef linux
#define waslinux linux
#undef linux
const char * standardPlaces = STR_NAME( INSTALL_PREFIX );
#define linux waslinux
#else
const char * standardPlaces = STR_NAME( INSTALL_PREFIX );
#endif
std::string gxpluginpath= std::string(standardPlaces)+"/lib/gxplugins";
pManip("GXPLUGINPATH",gxpluginpath.c_str());
QStringList arguments;
for (int i = 0; i<=argc; i++){
arguments << argv[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment