From 556c4e6408c7fffd5d49fcd418338e2d929fb780 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Fri, 6 Jul 2012 04:42:57 -0700 Subject: [PATCH] LayerManagement: fixed plugin path handling The generic communicator and the GLESGraphicSystem now use the configuration flag CMAKE_INSTALL_PREFIX to determine the default plugin search path. Additionally the GeniviDemo.sh script was updated, since exporting LM_PLUGIN_PATH is not required any more. The script still contains a hint, that the plugin search path may be modified. --- GeniviDemo.sh | 5 ++++- .../GenericCommunicator/test/DBUSCommunicatorTest.cpp | 4 ++-- .../Graphic/src/GraphicSystems/GLESGraphicSystem.cpp | 16 +++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/GeniviDemo.sh b/GeniviDemo.sh index 98e5e83..12e76e2 100755 --- a/GeniviDemo.sh +++ b/GeniviDemo.sh @@ -19,7 +19,10 @@ ############################################################################ export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib -export LM_PLUGIN_PATH=/usr/local/lib/layermanager + +# set plugin path, if installation path is not used +#export LM_PLUGIN_PATH=/usr/local/lib/layermanager + export DISPLAY=:0.0 PIDSURFACE1=/tmp/surface1.pid PIDSURFACE2=/tmp/surface2.pid diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp b/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp index 995ac3a..75df07a 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp @@ -821,8 +821,8 @@ TEST_F(DBUSCommunicatorTest, CreateShader) { EXPECT_CALL(this->mockCommandExecutor, execute(ShaderCreateCommandEq(std::string("test123.glslv"),std::string("differentshader.glslv")))).Times(1); ASSERT_NE(-1, system((DBUSCOMMAND + std::string("CreateShader string:test123.glslv string:differentshader.glslv")).c_str())); - EXPECT_CALL(this->mockCommandExecutor, execute(ShaderCreateCommandEq(std::string("/usr/lib/shadertest.glslv"),std::string("foobar")))).Times(1); - ASSERT_NE(-1, system((DBUSCOMMAND + std::string("CreateShader string:/usr/lib/shadertest.glslv string:foobar")).c_str())); + EXPECT_CALL(this->mockCommandExecutor, execute(ShaderCreateCommandEq(std::string("/test/path/shadertest.glslv"),std::string("foobar")))).Times(1); + ASSERT_NE(-1, system((DBUSCOMMAND + std::string("CreateShader string:/test/path/shadertest.glslv string:foobar")).c_str())); } MATCHER_P(ShaderDestroyCommandEq, id, "%(*)s") { diff --git a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp index 3019a72..8d60500 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp @@ -24,6 +24,8 @@ #include "GLES2/gl2.h" #include "Bitmap.h" #include "Transformation/ViewportTransform.h" +#include "config.h" +#include static const float vertices[8 * 12] = { 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, @@ -403,11 +405,19 @@ bool GLESGraphicsystem::initOpenGLES(EGLint displayWidth, EGLint displayHeight) m_defaultShaderNoUniformAlpha = Shader::createShader("default", "default_no_uniform_alpha"); #ifdef DRAW_LAYER_DEBUG - m_layerShader = Shader::createShader("/usr/lib/layermanager/renderer/renderer_layer.glslv", "/usr/lib/layermanager/renderer/renderer_layer.glslf"); - if (m_layerShader==0) + std::string pluginLookupPath = getenv("LM_PLUGIN_PATH"); + std::string vertexShaderPath; + std::string fragmentShaderPath; + + if (pluginLookupPath.empty()) { - m_layerShader = Shader::createShader("/usr/local/lib/layermanager/renderer/renderer_layer.glslv", "/usr/local/lib/layermanager/renderer/renderer_layer.glslf"); + pluginLookupPath = CMAKE_INSTALL_PREFIX"/lib/layermanager"; } + + vertexShaderPath = pluginLookupPath + "/renderer/renderer_layer.glslv"; + fragmentShaderPath = pluginLookupPath + "/renderer/renderer_layer.glslf"; + + m_layerShader = Shader::createShader(vertexShaderPath, fragmentShaderPath); #endif if ( !m_defaultShader || !m_defaultShaderNoUniformAlpha -- 2.7.4