CMake: build WaylandX11GLESRenderer independently
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Wed, 2 Jan 2013 15:37:34 +0000 (07:37 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 14 Jan 2013 08:34:17 +0000 (00:34 -0800)
this renderer can now be built independently of all other renderers.
this allows building multiple renderers at once.

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
CMakeLists.txt
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/CMakeLists.txt
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/include/WaylandGLESRenderer.h
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/src/WaylandGLESRenderer.cpp
LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/CMakeLists.txt [new file with mode: 0644]
LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/include/WaylandX11GLESRenderer.h [new file with mode: 0644]
LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/src/WaylandX11GLESRenderer.cpp [new file with mode: 0644]

index b14ac92..ae72bd1 100644 (file)
@@ -70,38 +70,9 @@ option (WITH_TEXT_RENDERER          "Build text renderer (only logging)"
 #==============================================================================
 # Internal global settings not available to user
 #==============================================================================
-set (WITH_WAYLAND    OFF)
 set (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins" FORCE)
 
 #==============================================================================
-# make sure, only one wayland based renderer was selected
-#==============================================================================
-set(NumberOfWaylandRenderers 0)
-
-if (WITH_WAYLAND_X11)
-    set (WITH_GLESv2_LIB ON)
-    set (WITH_WAYLAND ON)
-    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
-endif(WITH_WAYLAND_X11)
-
-if (WITH_WAYLAND_FBDEV)
-    set (WITH_GLESv2_LIB)
-    set (WITH_WAYLAND ON)
-    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
-endif(WITH_WAYLAND_FBDEV)
-
-if (WITH_WAYLAND_DRM)
-    set (WITH_GLESv2_LIB ON)
-    set (WITH_WAYLAND ON)
-    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
-endif(WITH_WAYLAND_DRM)
-
-if(NumberOfWaylandRenderers GREATER 1) 
-    MESSAGE(FATAL_ERROR "More than one Wayland based renderer was selected. This is not supported.")
-endif(NumberOfWaylandRenderers GREATER 1)
-
-
-#==============================================================================
 # set default build parameters
 #==============================================================================
 add_subdirectory(cmake/optionalFeatures)
@@ -199,9 +170,13 @@ if (WITH_GLX_LIB)
     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicGLX)
 endif(WITH_GLX_LIB)
 
-if (WITH_WAYLAND)
+if (WITH_WAYLAND_X11)
+    add_subdirectory_once (LayerManagerUtils)
+    add_subdirectory_once (LayerManagerBase)
+    add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
     add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
-endif(WITH_WAYLAND)
+    add_subdirectory_once (LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer)
+endif(WITH_WAYLAND_X11)
 
 if (WITH_WAYLAND_X11_LIB)
     add_subdirectory_once (LayerManagerPlugins/Renderers/GraphicLib/LayerManagerGraphicWaylandX11GLESv2)
index 32933c6..76e99d8 100644 (file)
@@ -49,7 +49,6 @@ set(LIBS
     ${CMAKE_THREAD_LIBS_INIT}
     ${EGL_LIBRARY}
     ${GLESv2_LIBRARIES}
-    LayerManagerGraphicWaylandGLESv2
     LayerManagerUtils
 )
 
@@ -85,23 +84,7 @@ install(
 #===========================================================================
 # create statically linked plugin
 #===========================================================================
-if (WITH_STATIC_LIBRARIES)
-
-    add_library(${PROJECT_NAME} STATIC ${SRC_FILES})
-
-    set (STATICALLY_LINKED_PLUGINS ${STATICALLY_LINKED_PLUGINS}
-        ${PROJECT_NAME} CACHE INTERNAL "list of static plugins")
-
-#===========================================================================
-# create dynamically linked plugin
-#===========================================================================
-else(WITH_STATIC_LIBRARIES)
-
-    add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
-
-    install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
-
-endif(WITH_STATIC_LIBRARIES)
+add_library(${PROJECT_NAME} STATIC ${SRC_FILES})
 
 
 #===========================================================================
index 9ad1a62..43c4702 100644 (file)
@@ -49,9 +49,12 @@ public:
 
     // from PluginBase
     virtual HealthCondition pluginGetHealth();
-    virtual t_ilm_const_string pluginGetName() const;
 
-private:
+    // implement in inheriting classes
+    virtual WaylandBaseWindowSystem* getWindowSystem(const char* displayname) = 0;
+    virtual GLESGraphicsystem* getGraphicSystem(PfnShaderProgramCreator shaderProgram) = 0;
+
+protected:
     WaylandBaseWindowSystem* m_pWindowSystem;
     GLESGraphicsystem* m_pGraphicSystem;
     uint m_width;
index 57809c5..3499b13 100644 (file)
@@ -26,9 +26,6 @@
 #ifdef WITH_WAYLAND_FBDEV
 #include "WindowSystems/WaylandFbdevWindowSystem.h"
 #endif // WITH_WAYLAND_FBDEV
-#ifdef WITH_WAYLAND_X11
-#include "WindowSystems/WaylandX11WindowSystem.h"
-#endif // WITH_WAYLAND_X11
 #ifdef WITH_WAYLAND_DRM
 #include "WindowSystems/WaylandDrmWindowSystem.h"
 #include "GraphicSystems/DrmGLESGraphicSystem.h"
@@ -64,7 +61,7 @@ bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
     m_pWindowSystem = new WaylandFbdevWindowSystem(displayname, width, height, m_pScene, m_pInputManager);
 #endif
 #ifdef WITH_WAYLAND_X11
-    m_pWindowSystem = new WaylandX11WindowSystem(displayname, width, height, m_pScene, m_pInputManager);
+    m_pWindowSystem = getWindowSystem(displayname);
 #endif
 #ifdef WITH_WAYLAND_DRM
     m_pWindowSystem = new WaylandDrmWindowSystem(displayname, width, height, m_pScene, m_pInputManager);
@@ -78,7 +75,7 @@ bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
 #ifdef WITH_WAYLAND_DRM
     m_pGraphicSystem = new DrmGLESGraphicSystem(width,height, ShaderProgramGLES::createProgram);
 #else
-    m_pGraphicSystem = new GLESGraphicsystem(width,height, ShaderProgramGLES::createProgram);
+    m_pGraphicSystem = getGraphicSystem(ShaderProgramGLES::createProgram);
 #endif
 
     if (!m_pWindowSystem->init((BaseGraphicSystem<void*, void*>*) m_pGraphicSystem))
@@ -192,11 +189,6 @@ HealthCondition WaylandGLESRenderer::pluginGetHealth()
     return BaseRenderer::pluginGetHealth();
 }
 
-t_ilm_const_string WaylandGLESRenderer::pluginGetName() const
-{
-    return "WaylandGLESRenderer";
-}
-
 Shader* WaylandGLESRenderer::createShader(const string* vertexName, const string* fragmentName)  
 {
     Shader *result = NULL;
@@ -207,6 +199,4 @@ Shader* WaylandGLESRenderer::createShader(const string* vertexName, const string
     m_pGraphicSystem->releaseGraphicContext();
     m_pWindowSystem->setSystemState(IDLE_STATE);
     return result;
-}
-
-DECLARE_LAYERMANAGEMENT_PLUGIN(WaylandGLESRenderer)
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/CMakeLists.txt b/LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d4bceee
--- /dev/null
@@ -0,0 +1,103 @@
+
+############################################################################
+#
+# Copyright 2010-2012 BMW Car IT GmbH
+# Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+# Copyright (C) 2012 Bayerische Motorenwerke Aktiengesellschaft
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+############################################################################
+
+cmake_minimum_required (VERSION 2.6)
+
+#===========================================================================
+# plugin configuration
+#===========================================================================
+project(WaylandX11GLESRenderer)
+
+find_package(Wayland REQUIRED)
+find_package(EGL REQUIRED)
+find_package(GLESv2 REQUIRED)
+find_package(Threads REQUIRED)
+
+include_directories(
+    include
+    ${CMAKE_SOURCE_DIR}/LayerManagerBase/include
+    ${CMAKE_SOURCE_DIR}/LayerManagerUtils/include
+    ${CMAKE_SOURCE_DIR}/LayerManagerPlugins/Renderers/Base/include
+    ${CMAKE_SOURCE_DIR}/LayerManagerPlugins/Renderers/Graphic/include
+    ${CMAKE_SOURCE_DIR}/LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/include
+)
+
+set(LIBS
+    LayerManagerUtils
+    WaylandGLESRenderer
+    LayerManagerGraphicWaylandX11GLESv2
+)
+
+set(SRC_FILES
+    src/WaylandX11GLESRenderer.cpp
+)
+
+set(PLUGIN_INSTALL_PATH lib/layermanager/renderer)
+
+set(X11GLES_RENDERER_PATH ${CMAKE_SOURCE_DIR}/LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
+install(FILES   ${X11GLES_RENDERER_PATH}/renderer_frag_clear.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_no_blend.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_no_ualpha.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_add_uchromakey.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_no_blend_no_ualpha.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_blend.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_ualpha.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_blend_no_ualpha.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_ualpha_0.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_blend_no_ualpha_0.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_ualpha_1.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_frag_2surf_no_blend_no_ualpha_1.glslf
+                ${X11GLES_RENDERER_PATH}/renderer_vert.glslv
+                ${X11GLES_RENDERER_PATH}/renderer_vert_2surf.glslv
+    DESTINATION lib/layermanager/renderer
+)
+
+#===========================================================================
+# create statically linked plugin
+#===========================================================================
+if (WITH_STATIC_LIBRARIES)
+
+    add_library(${PROJECT_NAME} STATIC ${SRC_FILES})
+
+    set (STATICALLY_LINKED_PLUGINS ${STATICALLY_LINKED_PLUGINS}
+        ${PROJECT_NAME} CACHE INTERNAL "list of static plugins")
+
+#===========================================================================
+# create dynamically linked plugin
+#===========================================================================
+else(WITH_STATIC_LIBRARIES)
+
+    add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
+
+    install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
+
+endif(WITH_STATIC_LIBRARIES)
+
+
+#===========================================================================
+# external libraries
+#===========================================================================
+target_link_libraries(${PROJECT_NAME} ${LIBS})
+
+add_dependencies(${PROJECT_NAME} ${LIBS})
diff --git a/LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/include/WaylandX11GLESRenderer.h b/LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/include/WaylandX11GLESRenderer.h
new file mode 100644 (file)
index 0000000..4536260
--- /dev/null
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * 
+ * Copyright 2010-2012 BMW Car IT GmbH
+ * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
+#ifndef _WAYLANDX11GLESRENDERER_H_
+#define _WAYLANDX11GLESRENDERER_H_
+
+#include "WaylandGLESRenderer.h"
+
+class WaylandX11GLESRenderer : public WaylandGLESRenderer
+{
+public:
+    WaylandX11GLESRenderer(ICommandExecutor& executor, Configuration& config);
+
+    // from PluginBase
+    virtual t_ilm_const_string pluginGetName() const;
+
+    // from WaylandGLESRenderer
+    virtual WaylandBaseWindowSystem* getWindowSystem(const char* displayname);
+    virtual GLESGraphicsystem* getGraphicSystem(PfnShaderProgramCreator shaderProgram);
+};
+
+#endif /* _WAYLANDX11GLESRENDERER_H_*/
diff --git a/LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/src/WaylandX11GLESRenderer.cpp b/LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/src/WaylandX11GLESRenderer.cpp
new file mode 100644 (file)
index 0000000..9b0f958
--- /dev/null
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * 
+ * Copyright 2010, 2011 BMW Car IT GmbH
+ * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
+#include "WaylandX11GLESRenderer.h"
+#include "WindowSystems/WaylandX11WindowSystem.h"
+#include "Configuration.h"
+
+
+WaylandX11GLESRenderer::WaylandX11GLESRenderer(ICommandExecutor& executor, Configuration& config)
+: WaylandGLESRenderer(executor, config)
+{
+}
+
+t_ilm_const_string WaylandX11GLESRenderer::pluginGetName() const
+{
+    return "WaylandX11GLESRenderer";
+}
+
+WaylandBaseWindowSystem* WaylandX11GLESRenderer::getWindowSystem(const char* displayname)
+{
+    return new WaylandX11WindowSystem(displayname, m_width, m_height, m_pScene, m_pInputManager);
+}
+
+GLESGraphicsystem* WaylandX11GLESRenderer::getGraphicSystem(PfnShaderProgramCreator shaderProgram)
+{
+    return new GLESGraphicsystem(m_width, m_height, shaderProgram);
+}
+
+DECLARE_LAYERMANAGEMENT_PLUGIN(WaylandX11GLESRenderer)
\ No newline at end of file