LayerManagement: improved build system
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 24 May 2012 11:42:23 +0000 (13:42 +0200)
committerMichael Schuldt <michael.schuldt@bmw.de>
Tue, 29 May 2012 15:03:32 +0000 (17:03 +0200)
- WITH_DESKTOP, WITH_X11_GLES and WITH_WAYLAND_* can now be built in parallel
- LayerManagerUtils now include dlt libs, if WITH_DLT is enabled
- improved dependency tracking of options (WITH_DESKTOP enables WITH_GLX_LIB)
- unit test binary names now consistently and with _Test

CMakeLists.txt
LayerManagerPlugins/Communicators/DBUSCommunicator/test/CMakeLists.txt
LayerManagerPlugins/Renderers/Graphic/CMakeLists.txt
LayerManagerPlugins/Renderers/Graphic/tests/CMakeLists.txt
LayerManagerUtils/CMakeLists.txt
cmake/modules/FindDRM.cmake

index 96fe3c6..62f9e52 100644 (file)
@@ -48,25 +48,58 @@ option (WITH_XTHREADS       "Build with usage of X11 Threading"
 option (WITH_CLIENTEXAMPLES "Build client examples "                              ON )
 option (WITH_TESTS          "Build Available Tests "                              OFF)
 option (WITH_DLT            "Build with DLT support "                             OFF)
-option (WITH_WAYLAND        "Build plugin of Wayland GBS"                         OFF)
 option (WITH_WAYLAND_FBDEV  "Build Wayland with FBDEV backend"                    OFF)
 option (WITH_WAYLAND_X11    "Build Wayland with X11 backend"                      OFF)
 option (WITH_WAYLAND_DRM    "Build Wayland with drm backend"                      OFF)
 
+# check and resolve option dependencies
+# make sure, only one walynad based renderer was selected
+
+if (WITH_DESKTOP)
+    set (WITH_GLX_LIB ON CACHE BOOL "Build development library for GLX Based Renderers" FORCE)
+endif(WITH_DESKTOP)
+
+if (WITH_X11_GLES)
+    set (WITH_GLESv2_LIB ON CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE)
+endif(WITH_X11_GLES)
+
+set(NumberOfWaylandRenderers 0)
+
+if (WITH_WAYLAND_X11)
+    set (WITH_GLESv2_LIB ON CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE)
+    set (WITH_WAYLAND ON)
+    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
+endif(WITH_WAYLAND_X11)
+
+if (WITH_WAYLAND_FBDEV)
+    set (WITH_GLESv2_LIB ON CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE)
+    set (WITH_WAYLAND ON)
+    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
+endif(WITH_WAYLAND_FBDEV)
+
+if (WITH_WAYLAND_DRM)
+    set (WITH_GLESv2_LIB ON CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE)
+    set (WITH_WAYLAND ON)
+    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
+endif(WITH_WAYLAND_DRM)
+
+if (WITH_WAYLAND_VIVANTE_GAL)
+    set (WITH_WAYLAND ON)
+    MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1")
+endif(WITH_WAYLAND_VIVANTE_GAL)
+
+if(NumberOfWaylandRenderers GREATER 1) 
+    MESSAGE(FATAL_ERROR "More than one Wayland based renderer was selected. This is not supported.")
+endif(NumberOfWaylandRenderers GREATER 1)
+
+
+
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
 
 add_subdirectory(cmake/optionalFeatures)
 
 add_subdirectory(config)
 
-if (WITH_DESKTOP)
-    set (WITH_GLX_LIB ON CACHE STRING "" FORCE)
-endif(WITH_DESKTOP)     
-
-if (WITH_X11_GLES OR WITH_WAYLAND)
-    set (WITH_GLESv2_LIB ON CACHE STRING "" FORCE)
-endif(WITH_X11_GLES OR WITH_WAYLAND)
-
 include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/")
 
 add_subdirectory (3rdParty)
@@ -75,28 +108,23 @@ add_subdirectory (LayerManagerClient/ilmClient)
 add_subdirectory (LayerManagerCommands)
 add_subdirectory (LayerManagerService)
 add_subdirectory (LayerManagerUtils)
-
-if (WITH_GLESv2_LIB OR WITH_GLX_LIB)
-    add_subdirectory (LayerManagerPlugins/Renderers/Graphic)
-endif(WITH_GLESv2_LIB OR WITH_GLX_LIB)
+add_subdirectory (LayerManagerPlugins/Renderers/Graphic)
 
 if (WITH_DESKTOP)
     add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
 endif(WITH_DESKTOP)     
 
 if (WITH_WAYLAND)
-    if (NOT WITH_WAYLAND_FBDEV AND NOT WITH_WAYLAND_X11 AND NOT WITH_WAYLAND_DRM)
-        message(FATAL_ERROR "Consider to specify WITH_WAYLAND_FBDEV or WITH_WAYLAND_X11 or WITH_WAYLAND_DRM")
-    endif(NOT WITH_WAYLAND_FBDEV AND NOT WITH_WAYLAND_X11 AND NOT WITH_WAYLAND_DRM)
-    if (WITH_WAYLAND_FBDEV AND WITH_WAYLAND_X11)
-        message(FATAL_ERROR "WITH_WAYLAND_FBDEV and WITH_WAYLAND_X11 can't be specified at the same time")
-    endif(WITH_WAYLAND_FBDEV AND WITH_WAYLAND_X11)
-    add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
-endif(WITH_WAYLAND)     
+    if (WITH_WAYLAND_VIVANTE_GAL)
+        add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandVivanteRenderer)
+    else (WITH_WAYLAND_VIVANTE_GAL)
+        add_subdirectory (LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer)
+    endif (WITH_WAYLAND_VIVANTE_GAL)
+endif(WITH_WAYLAND)
 
 if (WITH_X11_GLES)
     add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer)
-endif(WITH_X11_GLES)   
+endif(WITH_X11_GLES)
 
 if (WITH_EGL_EXAMPLE)
     add_subdirectory (LayerManagerExamples/EGLX11ApplicationExample)
index a45e32f..f9f4f5d 100644 (file)
@@ -42,7 +42,7 @@ file(GLOB LM_SOURCES "${PROJECT_SOURCE_DIR}/LayerManagerService/src/Scene.cpp"
 
 file(GLOB DBUSCommunicator_SOURCES "../src/*.cpp")
 
-add_executable(DBUSCommunicatorTest DBUSCommunicatorTest.cpp ${LM_SOURCES} ${DBUSCommunicator_SOURCES})
-target_link_libraries(DBUSCommunicatorTest gmock LayerManagerCommands ${LIBS})
+add_executable(DBUSCommunicator_Test DBUSCommunicatorTest.cpp ${LM_SOURCES} ${DBUSCommunicator_SOURCES})
+target_link_libraries(DBUSCommunicator_Test gmock LayerManagerCommands ${LIBS})
 
-add_test(DBUSCommunicatorTest DBUSCommunicatorTest)
+add_test(DBUSCommunicator DBUSCommunicator_Test)
index 878e7ed..bd7516f 100644 (file)
 
 cmake_minimum_required (VERSION 2.6)
 
-include_directories ("include")
-include_directories ("../Base/include")
-include_directories ("${PROJECT_SOURCE_DIR}/config")
-include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerService/include")
-link_directories ("${PROJECT_SOURCE_DIR}/LayerManagerService/bin")
-include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerUtils/include")
-link_directories ("${PROJECT_SOURCE_DIR}/LayerManagerUtils/bin")
-
-if (WITH_GLESv2_LIB AND NOT WITH_WAYLAND) 
-set(GRAPHIC_LIB_NAME LayerManagerGraphicGLESv2)
-file(GLOB SOURCES 
-        ../Base/src/BaseRenderer.cpp 
-        src/GraphicSystems/GLESGraphicSystem.cpp
-        src/WindowSystems/X11WindowSystem.cpp  
-        src/TextureBinders/X11Copy.cpp
-        src/TextureBinders/X11CopyGLES.cpp
-        src/TextureBinders/X11EglImage.cpp
-        src/Transformation/ViewportTransform.cpp
-        )
-
-file(GLOB GRAPHIC_BASE_INCLUDES 
-    ../Base/include/*.h
-)
-
-file(GLOB GRAPHIC_GRAPHICSYSTEM_INCLUDES 
-    include/GraphicSystems/BaseGraphicSystem.h
-    include/GraphicSystems/GLESGraphicSystem.h
-       include/GraphicSystems/DrmGLESGraphicSystem.h
-)
-
-file(GLOB GRAPHIC_TEXTUREBINDERS_INCLUDES 
-    include/TextureBinders/ITextureBinder.h
-    include/TextureBinders/X11Copy.h
-    include/TextureBinders/X11CopyGLES.h
-    include/TextureBinders/X11EglImage.h
-)
-
-file(GLOB GRAPHIC_PLATFORM_INCLUDES 
-    include/PlatformSurfaces/XPlatformSurface.h
-    include/PlatformSurfaces/EglXPlatformSurface.h
-)
-
-file(GLOB GRAPHIC_WINDOWSYSTEMS_INCLUDES 
-    include/WindowSystems/BaseWindowSystem.h
-    include/WindowSystems/X11WindowSystem.h
-)
-
-file(GLOB GRAPHIC_TRANSFORM_INCLUDES 
-    include/Transformation/ViewportTransform.h
+#===========================================================================
+# Common
+#===========================================================================
+
+include_directories(
+    "include"
+    "../Base/include"
+    "${PROJECT_SOURCE_DIR}/config"
+    "${PROJECT_SOURCE_DIR}/LayerManagerService/include"
+    "${PROJECT_SOURCE_DIR}/LayerManagerService/bin"
+    "${PROJECT_SOURCE_DIR}/LayerManagerUtils/include"
+    "${PROJECT_SOURCE_DIR}/LayerManagerUtils/bin"
 )
 
-endif(WITH_GLESv2_LIB AND NOT WITH_WAYLAND) 
-
+#===========================================================================
+if (WITH_GLESv2_LIB)
+#===========================================================================
+
+    set(GRAPHIC_LIB_NAME LayerManagerGraphicGLESv2)
+
+    find_package(X11 REQUIRED)
+    find_package(EGL REQUIRED)
+    find_package(GLESv2 REQUIRED)
+    find_package(Threads)
+
+    include_directories(
+        ${X11_INCLUDE_DIR}
+        ${EGL_INCLUDE_DIR}
+        ${GLESv2_INCLUDE_DIR}
+    )
+
+    set(SOURCES 
+            ../Base/src/BaseRenderer.cpp 
+            src/GraphicSystems/GLESGraphicSystem.cpp
+            src/WindowSystems/X11WindowSystem.cpp  
+            src/TextureBinders/X11Copy.cpp
+            src/TextureBinders/X11CopyGLES.cpp
+            src/TextureBinders/X11EglImage.cpp
+            src/Transformation/ViewportTransform.cpp
+            )
+   
+    set(LIBS
+        ${CMAKE_THREAD_LIBS_INIT}
+        ${X11_X11_LIB}
+        ${X11_Xcomposite_LIB}
+        ${X11_Xdamage_LIB}
+        ${EGL_LIBRARY}
+        ${GLESv2_LIBRARIES}
+        LayerManagerUtils
+    )
+
+    add_library(${GRAPHIC_LIB_NAME} SHARED ${SOURCES})
+
+    target_link_libraries(${GRAPHIC_LIB_NAME} ${LIBS})
+    
+    add_dependencies(${GRAPHIC_LIB_NAME}
+        LayerManagerService
+        LayerManagerUtils
+    )
+
+    set(GRAPHIC_GRAPHICSYSTEM_INCLUDES 
+        include/GraphicSystems/BaseGraphicSystem.h
+        include/GraphicSystems/GLESGraphicSystem.h
+    )
+    
+    set(GRAPHIC_TEXTUREBINDERS_INCLUDES 
+        include/TextureBinders/ITextureBinder.h
+        include/TextureBinders/X11Copy.h
+        include/TextureBinders/X11CopyGLES.h
+        include/TextureBinders/X11EglImage.h
+    )
+    
+    set(GRAPHIC_PLATFORM_INCLUDES 
+        include/PlatformSurfaces/XPlatformSurface.h
+        include/PlatformSurfaces/EglXPlatformSurface.h
+    )
+    
+    set(GRAPHIC_WINDOWSYSTEMS_INCLUDES 
+        include/WindowSystems/BaseWindowSystem.h
+        include/WindowSystems/X11WindowSystem.h
+    )
+    
+    install(TARGETS
+                ${GRAPHIC_LIB_NAME}
+            DESTINATION
+                lib
+    )
+    
+    install(FILES
+                ${GRAPHIC_GRAPHICSYSTEM_INCLUDES}
+            DESTINATION
+                include/layermanager/graphic/GraphicSystems
+    )
+    
+    install(FILES
+                ${GRAPHIC_TEXTUREBINDERS_INCLUDES}
+            DESTINATION
+                include/layermanager/graphic/TextureBinders
+    )
+    
+    install(FILES
+                ${GRAPHIC_PLATFORM_INCLUDES}
+            DESTINATION
+                include/layermanager/graphic/PlatformSurfaces
+    )
+
+    install(FILES
+                ${GRAPHIC_WINDOWSYSTEMS_INCLUDES}
+            DESTINATION
+                include/layermanager/graphic/WindowSystems
+    )
+
+    install(FILES
+                include/Transformation/ViewportTransform.h
+            DESTINATION
+                include/layermanager/graphic/Transformation
+    )
+
+    install(FILES
+                ../Base/include/BaseRenderer.h
+                ../Base/include/RenderUtil.h
+            DESTINATION
+                include/layermanager/graphic/Base
+    )
+
+endif(WITH_GLESv2_LIB) 
+
+
+#===========================================================================
 if (WITH_GLX_LIB) 
-set(GRAPHIC_LIB_NAME LayerManagerGraphicGLX)
-file(GLOB SOURCES 
-    ../Base/src/BaseRenderer.cpp 
-    src/GraphicSystems/GLXGraphicSystem.cpp
-    src/WindowSystems/X11WindowSystem.cpp  
-    src/TextureBinders/X11TextureFromPixmap.cpp
-    src/TextureBinders/X11CopyGLX.cpp
-    src/TextureBinders/X11Copy.cpp
-    src/Transformation/ViewportTransform.cpp    
-)
+#===========================================================================
 
-file(GLOB GRAPHIC_BASE_INCLUDES 
-    ../Base/include/*.h
-)
+    set(GRAPHIC_LIB_NAME LayerManagerGraphicGLX)
 
-file(GLOB GRAPHIC_WINDOWSYSTEMS_INCLUDES 
-    include/WindowSystems/BaseWindowSystem.h
-    include/WindowSystems/X11WindowSystem.h
-)
-
-
-file(GLOB GRAPHIC_GRAPHICSYSTEM_INCLUDES 
-    include/GraphicSystems/BaseGraphicSystem.h
-    include/GraphicSystems/GLXGraphicsystem.h
-)
+    find_package(X11 REQUIRED)
+    find_package(GLX REQUIRED)
+    find_package(Threads)
 
-file(GLOB GRAPHIC_TEXTUREBINDERS_INCLUDES 
-    include/TextureBinders/ITextureBinder.h
-    include/TextureBinders/X11Copy.h    
-    include/TextureBinders/X11CopyGLX.h
-    include/TextureBinders/X11TextureFromPixmap.h
-)
+    include_directories(
+        ${X11_INCLUDE_DIR}
+        ${GLX_INCLUDE_DIR}
+    )
 
-file(GLOB GRAPHIC_PLATFORM_INCLUDES 
-    include/PlatformSurfaces/XPlatformSurface.h
-    include/PlatformSurfaces/GLXPlatformSurface.h
-)        
-file(GLOB GRAPHIC_TRANSFORM_INCLUDES 
-    include/Transformation/ViewportTransform.h
-)
+    set(SOURCES 
+        ../Base/src/BaseRenderer.cpp 
+        src/GraphicSystems/GLXGraphicSystem.cpp
+        src/WindowSystems/X11WindowSystem.cpp  
+        src/TextureBinders/X11TextureFromPixmap.cpp
+        src/TextureBinders/X11CopyGLX.cpp
+        src/TextureBinders/X11Copy.cpp
+        src/Transformation/ViewportTransform.cpp    
+    )
+
+    set(LIBS
+        ${CMAKE_THREAD_LIBS_INIT}
+        ${X11_X11_LIB}
+        ${X11_Xcomposite_LIB}
+        ${X11_Xdamage_LIB}
+        ${GLX_LIBRARIES}
+        LayerManagerUtils
+    )
+    
+    add_library(${GRAPHIC_LIB_NAME} SHARED ${SOURCES})
+
+    install(TARGETS
+                ${GRAPHIC_LIB_NAME}
+            DESTINATION
+                lib
+    )
+    
+    install(FILES
+                include/GraphicSystems/BaseGraphicSystem.h
+                include/GraphicSystems/GLXGraphicsystem.h
+            DESTINATION
+                include/layermanager/graphic/GraphicSystems
+    )
+    
+    install(FILES
+                include/TextureBinders/ITextureBinder.h
+                include/TextureBinders/X11Copy.h
+                include/TextureBinders/X11CopyGLX.h
+                include/TextureBinders/X11TextureFromPixmap.h
+            DESTINATION
+                include/layermanager/graphic/TextureBinders
+    )
+    
+    install(FILES
+                include/PlatformSurfaces/XPlatformSurface.h
+                include/PlatformSurfaces/GLXPlatformSurface.h
+            DESTINATION
+                include/layermanager/graphic/PlatformSurfaces
+    )
+    
+    install(FILES
+                include/WindowSystems/BaseWindowSystem.h
+                include/WindowSystems/X11WindowSystem.h
+            DESTINATION
+                include/layermanager/graphic/WindowSystems
+    )
+
+    install(FILES
+                include/Transformation/ViewportTransform.h
+            DESTINATION
+                include/layermanager/graphic/Transformation
+    )
+
+    install(FILES
+                ../Base/include/BaseRenderer.h
+                ../Base/include/RenderUtil.h
+            DESTINATION
+                include/layermanager/graphic/Base
+    )
 
 endif(WITH_GLX_LIB)
 
-if (WITH_WAYLAND) 
-set(GRAPHIC_LIB_NAME LayerManagerGraphicWaylandGLESv2)
 
-if (WITH_WAYLAND_FBDEV)
-file(GLOB SOURCES 
-        ../Base/src/BaseRenderer.cpp 
-        src/GraphicSystems/GLESGraphicSystem.cpp
-        src/WindowSystems/WaylandBaseWindowSystem.cpp
-        src/WindowSystems/WaylandFbdevWindowSystem.cpp
-        src/WindowSystems/WaylandServerinfoProtocol.cpp
-        src/TextureBinders/WaylandCopyGLES.cpp
-        src/TextureBinders/WaylandEglImage.cpp
-        src/Transformation/ViewportTransform.cpp
+#===========================================================================
+if (WITH_WAYLAND) 
+#===========================================================================
+
+    find_package(Wayland)
+
+    set(LIBS
+            ${LIBS}
+            ${WAYLAND_SERVER_LIBRARIES}
+            ${WAYLAND_CLIENT_LIBRARIES}
+    )
+    
+    include_directories(${WAYLAND_SERVER_INCLUDE_DIR})
+
+    #=======================================================================
+    if (WITH_WAYLAND_X11)
+    #=======================================================================
+
+        set(GRAPHIC_LIB_NAME LayerManagerGraphicWaylandGLESv2)
+
+        find_package(X11 REQUIRED)
+        
+        include_directories(${X11_INCLUDE_DIR})
+        
+        set(LIBS
+                ${LIBS}
+                ${X11_X11_LIB}
         )
-elseif (WITH_WAYLAND_X11)
-file(GLOB SOURCES
-        ../Base/src/BaseRenderer.cpp
-        src/GraphicSystems/GLESGraphicSystem.cpp
-        src/WindowSystems/WaylandBaseWindowSystem.cpp
-        src/WindowSystems/WaylandX11WindowSystem.cpp
-        src/WindowSystems/WaylandServerinfoProtocol.cpp  
-        src/TextureBinders/WaylandCopyGLES.cpp
-        src/TextureBinders/WaylandEglImage.cpp
-        src/Transformation/ViewportTransform.cpp
+        
+        set(SOURCES
+            ../Base/src/BaseRenderer.cpp
+            src/GraphicSystems/GLESGraphicSystem.cpp
+            src/WindowSystems/WaylandBaseWindowSystem.cpp
+            src/WindowSystems/WaylandX11WindowSystem.cpp
+            src/WindowSystems/WaylandServerinfoProtocol.cpp  
+            src/TextureBinders/WaylandCopyGLES.cpp
+            src/TextureBinders/WaylandEglImage.cpp
+            src/Transformation/ViewportTransform.cpp
         )
-elseif (WITH_WAYLAND_DRM)
-file(GLOB SOURCES
-        ../Base/src/BaseRenderer.cpp
-        src/GraphicSystems/GLESGraphicSystem.cpp
-        src/GraphicSystems/DrmGLESGraphicSystem.cpp
-        src/WindowSystems/WaylandBaseWindowSystem.cpp
-        src/WindowSystems/WaylandDrmWindowSystem.cpp
-        src/WindowSystems/WaylandServerinfoProtocol.cpp
-        src/TextureBinders/WaylandCopyGLES.cpp
-        src/TextureBinders/WaylandEglImage.cpp
-        src/Transformation/ViewportTransform.cpp
+        
+    endif (WITH_WAYLAND_X11)
+    
+    #=======================================================================
+    if (WITH_WAYLAND_FBDEV)
+    #=======================================================================
+
+        set(GRAPHIC_LIB_NAME LayerManagerGraphicWaylandGLESv2)
+
+        file(GLOB SOURCES 
+            ../Base/src/BaseRenderer.cpp
+            src/GraphicSystems/GLESGraphicSystem.cpp
+            src/WindowSystems/WaylandBaseWindowSystem.cpp
+            src/WindowSystems/WaylandX11WindowSystem.cpp
+            src/WindowSystems/WaylandServerinfoProtocol.cpp  
+            src/TextureBinders/WaylandCopyGLES.cpp
+            src/TextureBinders/WaylandEglImage.cpp
+            src/Transformation/ViewportTransform.cpp
         )
-endif ()
-
-file(GLOB GRAPHIC_BASE_INCLUDES 
-    ../Base/include/*.h
-)
-
-file(GLOB GRAPHIC_GRAPHICSYSTEM_INCLUDES 
-    include/GraphicSystems/BaseGraphicSystem.h
-    include/GraphicSystems/GLESGraphicSystem.h
-    include/GraphicSystems/DrmGLESGraphicSystem.h
-)
-
-file(GLOB GRAPHIC_TEXTUREBINDERS_INCLUDES 
-    include/TextureBinders/ITextureBinder.h
-    include/TextureBinders/WaylandCopyGLES.h
-)
 
-file(GLOB GRAPHIC_PLATFORM_INCLUDES 
-    include/PlatformSurfaces/WaylandPlatformSurface.h
-    include/PlatformSurfaces/EglWaylandPlatformSurface.h
-)
+    endif (WITH_WAYLAND_FBDEV)
+    
+    #=======================================================================
+    if (WITH_WAYLAND_DRM)
+    #=======================================================================
+
+        set(GRAPHIC_LIB_NAME LayerManagerGraphicWaylandGLESv2)
+
+        find_package (DRM REQUIRED)
+        
+        include_directories(${DRM_INCLUDE_DIR})
+        
+        set(LIBS
+                ${LIBS}
+                ${GRAPHIC_NATIVE_LIBS}
+                ${UDEV_LIBRARIES}
+                ${GBM_LIBRARIES}
+                ${DRM_LIBRARIES}
+                ${WAYLAND_EGL_LIBRARIES}
+        )
+        
+
+        file(GLOB SOURCES
+            ../Base/src/BaseRenderer.cpp
+            src/GraphicSystems/GLESGraphicSystem.cpp
+            src/GraphicSystems/DrmGLESGraphicSystem.cpp
+            src/WindowSystems/WaylandBaseWindowSystem.cpp
+            src/WindowSystems/WaylandDrmWindowSystem.cpp
+            src/WindowSystems/WaylandServerinfoProtocol.cpp
+            src/TextureBinders/WaylandCopyGLES.cpp
+            src/TextureBinders/WaylandEglImage.cpp
+            src/Transformation/ViewportTransform.cpp
+        )
 
-file(GLOB GRAPHIC_WINDOWSYSTEMS_INCLUDES 
-    include/WindowSystems/BaseWindowSystem.h
-    include/WindowSystems/WaylandBaseWindowSystem.h
-    include/WindowSystems/WaylandFbdevWindowSystem.h
-    include/WindowSystems/WaylandX11WindowSystem.h
-    include/WindowSystems/WaylandDrmWindowSystem.h
-)
+    endif (WITH_WAYLAND_DRM)
+
+
+    #=======================================================================
+    # common
+    #=======================================================================
+
+    add_library(${GRAPHIC_LIB_NAME} SHARED ${SOURCES})
+    
+    target_link_libraries(${GRAPHIC_LIB_NAME} ${LIBS})
+
+    install(TARGETS
+                ${GRAPHIC_LIB_NAME}
+            DESTINATION
+                lib
+    )
+
+    install(FILES
+                include/GraphicSystems/BaseGraphicSystem.h
+                include/GraphicSystems/GLESGraphicSystem.h
+                include/GraphicSystems/DrmGLESGraphicSystem.h
+            DESTINATION
+                include/layermanager/graphic/GraphicSystems
+    )
+
+    install(FILES
+                include/TextureBinders/ITextureBinder.h
+                include/TextureBinders/WaylandCopyGLES.h
+                include/TextureBinders/WaylandNullTexture.h
+            DESTINATION
+                include/layermanager/graphic/TextureBinders
+    )
+
+    install(FILES
+                include/PlatformSurfaces/WaylandPlatformSurface.h
+                include/PlatformSurfaces/EglWaylandPlatformSurface.h
+            DESTINATION
+                include/layermanager/graphic/PlatformSurfaces
+    )
+
+    install(FILES
+                include/WindowSystems/BaseWindowSystem.h
+                include/WindowSystems/WaylandBaseWindowSystem.h
+                include/WindowSystems/WaylandFbdevWindowSystem.h
+                include/WindowSystems/WaylandX11WindowSystem.h
+                include/WindowSystems/WaylandDrmWindowSystem.h
+            DESTINATION
+                include/layermanager/graphic/WindowSystems
+    )
+
+    install(FILES
+                include/Transformation/ViewportTransform.h
+            DESTINATION
+                include/layermanager/graphic/Transformation
+    )
+
+    install(FILES
+                ../Base/include/BaseRenderer.h
+                ../Base/include/RenderUtil.h
+            DESTINATION
+                include/layermanager/graphic/Base
+    )
 
-file(GLOB GRAPHIC_TRANSFORM_INCLUDES 
-    include/Transformation/ViewportTransform.h
-)
+endif(WITH_WAYLAND)
 
-if (WITH_WAYLAND_X11)
-find_package(X11 REQUIRED)
-include_directories(${X11_INCLUDE_DIR})
-endif (WITH_WAYLAND_X11)
 
-endif(WITH_WAYLAND)
+#===========================================================================
+# Tests
+#===========================================================================
 
 if (WITH_TESTS)
+
     enable_testing()
     add_subdirectory (tests)
+    
 endif(WITH_TESTS)
 
-add_library(${GRAPHIC_LIB_NAME} SHARED ${SOURCES})
-
-if (NOT WITH_WAYLAND)
-find_package(X11 REQUIRED)
-include_directories(${X11_INCLUDE_DIR})
-find_package (Threads)
-endif (NOT WITH_WAYLAND)
-
-if (WITH_GLESv2_LIB) 
-find_package(EGL REQUIRED)
-include_directories(${EGL_INCLUDE_DIR})
-
-find_package(GLESv2 REQUIRED)
-include_directories(${GLESv2_INCLUDE_DIR})
-
-set(GRAPHIC_NATIVE_LIBS ${EGL_LIBRARY} ${GLESv2_LIBRARIES})
-endif (WITH_GLESv2_LIB)
-
-if (WITH_GLX_LIB) 
-find_package(GLX REQUIRED)
-include_directories(${GLX_INCLUDE_DIR})
-set(GRAPHIC_NATIVE_LIBS ${GLX_LIBRARIES})
-endif(WITH_GLX_LIB)
-
-set(GRAPHIC_DRM_LIBS ${UDEV_LIBRARIES} ${GBM_LIBRARIES} ${DRM_LIBRARIES})
-
-if (WITH_WAYLAND)
-       find_package (Wayland)
-       include_directories(${WAYLAND_SERVER_INCLUDE_DIR})
-       if (WITH_WAYLAND_DRM)
-               find_package (DRM)
-               include_directories(${DRM_INCLUDE_DIR})
-               set(LIBS ${LIBS} ${GRAPHIC_NATIVE_LIBS} ${GRAPHIC_DRM_LIBS} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
-               target_link_libraries(${GRAPHIC_LIB_NAME} ${LIBS})
-       else (WITH_WAYLAND_DRM)
-               set(LIBS ${LIBS} ${WAYLAND_SERVER_LIBRARIES})
-       endif (WITH_WAYLAND_DRM)
-       if (WITH_WAYLAND_X11)
-               set(LIBS ${LIBS} ${X11_X11_LIB})
-       endif (WITH_WAYLAND_X11)
-else(WITH_WAYLAND)
-       set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT} ${X11_X11_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${GRAPHIC_NATIVE_LIBS} LayerManagerUtils )
-endif(WITH_WAYLAND)
-target_link_libraries(${GRAPHIC_LIB_NAME} ${LIBS})
-
-
-add_dependencies(${GRAPHIC_LIB_NAME} LayerManagerService)
-add_dependencies(${GRAPHIC_LIB_NAME} LayerManagerUtils)
-
-install (TARGETS ${GRAPHIC_LIB_NAME} DESTINATION lib)
-install (FILES ${GRAPHIC_BASE_INCLUDES} DESTINATION include/layermanager/graphic/Base)
-install (FILES ${GRAPHIC_GRAPHICSYSTEM_INCLUDES} DESTINATION include/layermanager/graphic/GraphicSystems)
-install (FILES ${GRAPHIC_TEXTUREBINDERS_INCLUDES} DESTINATION include/layermanager/graphic/TextureBinders)
-install (FILES ${GRAPHIC_TRANSFORM_INCLUDES} DESTINATION include/layermanager/graphic/Transformation)
-install (FILES ${GRAPHIC_PLATFORM_INCLUDES} DESTINATION include/layermanager/graphic/PlatformSurfaces)
-install (FILES ${GRAPHIC_WINDOWSYSTEMS_INCLUDES} DESTINATION include/layermanager/graphic/WindowSystems)
-
index 1625f2e..93c5868 100644 (file)
@@ -43,15 +43,15 @@ file(GLOB LM_SOURCES
 
 enable_testing()
 
-add_executable(ViewportTransformTest
+add_executable(ViewportTransform_Test
     ${LM_SOURCES}
     ../src/Transformation/ViewportTransform.cpp
     ViewportTransformTest.cpp
 )
 
-target_link_libraries(ViewportTransformTest
+target_link_libraries(ViewportTransform_Test
     ${LIBS}
     gtest
 )
 
-add_test(ViewportTransformations ViewportTransformTest)
+add_test(ViewportTransformations ViewportTransform_Test)
index 7b8b5e3..90dcb82 100644 (file)
 
 cmake_minimum_required (VERSION 2.6)
 
-include_directories ("include")
-include_directories ("${PROJECT_SOURCE_DIR}/config")
+project(LayerManagerUtils)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+
+add_library(${PROJECT_NAME} STATIC
+    src/Bitmap.cpp
+    src/IlmMatrix.cpp
+    src/Log.cpp
+    src/LogMessageBuffer.cpp
+)
+
+set(INCLUDE_DIRS
+    "include"
+    "${CMAKE_SOURCE_DIR}/config"
+)
+
+set(LIBS
+    ${LIBS}
+)
+
 if (WITH_DLT)
-find_package(AutomotiveDlt REQUIRED)
-include_directories(${DLT_INCLUDE_DIR})
+
+    find_package(AutomotiveDlt REQUIRED)
+    
+    set(INCLUDE_DIRS
+        ${INCLUDE_DIRS}
+        ${DLT_INCLUDE_DIR}
+    )
+    
+    set(LIBS
+        ${LIBS}
+        ${DLT_LIBRARY}
+    )
+    
+    target_link_libraries(${PROJECT_NAME} ${LIBS})
+    
 endif (WITH_DLT)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-add_library(LayerManagerUtils STATIC src/Bitmap.cpp src/IlmMatrix.cpp src/Log.cpp src/LogMessageBuffer.cpp)
-install (FILES include/Log.h include/LogMessageBuffer.h include/IlmMatrix.h include/Bitmap.h DESTINATION include/layermanager)
+include_directories(${INCLUDE_DIRS})
+
+install(FILES
+            include/Log.h
+            include/LogMessageBuffer.h
+            include/IlmMatrix.h
+            include/Bitmap.h
+        DESTINATION
+            include/layermanager
+)
 
-install (TARGETS LayerManagerUtils ARCHIVE DESTINATION lib/layermanager/static)
+install(TARGETS
+            ${PROJECT_NAME}
+        DESTINATION
+            lib/layermanager/static
+)
 
 if (WITH_TESTS)
 
-add_executable(UtilsTest tests/BitmapTest.cpp tests/LogTest.cpp)
-target_link_libraries(UtilsTest LayerManagerUtils gtest pthread ${DLT_LIBRARY})
-enable_testing()
-add_test(Utilities UtilsTest)
+    add_executable(${PROJECT_NAME}_Test
+        tests/BitmapTest.cpp
+        tests/LogTest.cpp
+    )
 
+    target_link_libraries(${PROJECT_NAME}_Test
+        LayerManagerUtils
+        gtest
+        pthread
+        ${DLT_LIBRARY}
+    )
+    
+    enable_testing()
+    add_test(${PROJECT_NAME} ${PROJECT_NAME}_Test)
+    
 endif(WITH_TESTS) 
index 8675942..f8cc55e 100644 (file)
@@ -37,7 +37,7 @@ PATHS /usr/lib
 )
 
 FIND_PATH(DRM_INCLUDE_DIR /drm.h
-/usr/include/drm /usr/include/libdrm
+/usr/include/libdrm /usr/include/drm
 )
 
 FIND_LIBRARY(DRM_LIBRARIES