diff options
author | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2012-10-05 04:02:08 -0700 |
---|---|---|
committer | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2012-10-22 03:55:52 -0700 |
commit | fd4c79688809755965a5d52226947bd2e5155ec6 (patch) | |
tree | fb49296158aed3abc7f38ce175c27e6759e5f1d5 | |
parent | b3abf7abf6ef874f128023af848c698788a1faba (diff) | |
download | layer_management-fd4c79688809755965a5d52226947bd2e5155ec6.tar.gz |
BuildSystem: updated compiler warnings settings, added new build flags
Now 3 different compiler warning presets are used:
- 3rd party libs, unit tests: cmake default compiler settings
- Examples: strict compiler settings to catch many code flaws
- other: very strict compiler settings to detect portability issues
The new build flags allow disabling build of
- LayerManagerService
- ilmClient
- GenericCommunciator
This allows building e.g. only the examples or unit tests
-rw-r--r-- | 3rdParty/CMakeLists.txt | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 129 | ||||
-rw-r--r-- | LayerManagerClient/ilmClient/CMakeLists.txt | 2 | ||||
-rw-r--r-- | LayerManagerPlugins/Communicators/GenericCommunicator/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | LayerManagerPlugins/IpcModules/CMakeLists.txt | 11 | ||||
-rw-r--r-- | LayerManagerPlugins/Renderers/Graphic/CMakeLists.txt | 2 | ||||
-rw-r--r-- | LayerManagerService/CMakeLists.txt | 2 | ||||
-rw-r--r-- | LayerManagerUtils/CMakeLists.txt | 30 | ||||
-rw-r--r-- | config/res/config.h.cmake | 70 |
9 files changed, 167 insertions, 83 deletions
diff --git a/3rdParty/CMakeLists.txt b/3rdParty/CMakeLists.txt index 7049268..a32e509 100644 --- a/3rdParty/CMakeLists.txt +++ b/3rdParty/CMakeLists.txt @@ -19,6 +19,8 @@ if (WITH_TESTS) +set (CMAKE_CXX_FLAGS "") + include_directories (".") add_library(gtest gtest/gtest-all.cc gtest/gtest_main.cc) add_library(gmock gmock/gmock-gtest-all.cc gmock/gmock_main.cc) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec66e24..5519229 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/mo include(${CMAKE_MODULE_PATH}/CMakeVersions.txt) +#============================================================================== # set default build type, if not defined by user +#============================================================================== if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose build type: Debug, Release, RelWithDebInfo, MinSizeRel." @@ -33,8 +35,10 @@ if (NOT CMAKE_BUILD_TYPE) message(STATUS "Build type not defined. Using default build type 'Release'.") endif (NOT CMAKE_BUILD_TYPE) -# Platforms / A set of indiviual options at once +#============================================================================== +# Platforms / A set of indiviual options at once +#============================================================================== option (WITH_X11_GLES "Build for X11 with GLES 2.0" ON ) option (WITH_GLESv2_LIB "Build development library for GLES2 Based Renderers" OFF) option (WITH_EGL_EXAMPLE "Build EGL_EXAMPLE / X11" ON ) @@ -51,33 +55,38 @@ option (WITH_WAYLAND_FBDEV "Build Wayland with FBDEV backend" 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 +option (WITH_SERVICE_BIN "Build LayerManagerService Binary" ON) +option (WITH_CLIENT_LIB "Build LayerManagement Client Lib" ON) +option (WITH_COMMUNICATOR_GEN "Build Generic Communicator Plugin" ON) -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) +#============================================================================== +# Internal global settings not available to user +#============================================================================== +set (WITH_WAYLAND OFF) +set (BUILD_UTILS_LIB OFF) +set (INSTALL_UTILS_LIB OFF) + +#============================================================================== +# make sure, only one wayland based renderer was selected +#============================================================================== set(NumberOfWaylandRenderers 0) if (WITH_WAYLAND_X11) - set (WITH_GLESv2_LIB ON CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE) + 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 ON CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE) + 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 CACHE BOOL "Build development library for GLES2 Based Renderers" FORCE) + set (WITH_GLESv2_LIB ON) set (WITH_WAYLAND ON) MATH(EXPR NumberOfWaylandRenderers "${NumberOfWaylandRenderers} + 1") endif(WITH_WAYLAND_DRM) @@ -87,11 +96,10 @@ if(NumberOfWaylandRenderers GREATER 1) endif(NumberOfWaylandRenderers GREATER 1) - -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - +#============================================================================== +# set default build parameters +#============================================================================== add_subdirectory(cmake/optionalFeatures) - add_subdirectory(config) include_directories ("${PROJECT_SOURCE_DIR}/config") @@ -99,38 +107,30 @@ include_directories ("${PROJECT_SOURCE_DIR}/3rdParty/") # ilm_types are used internally to LM, so we can include them by default include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerClient/ilmClient/include") -add_subdirectory (3rdParty) -add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator) -add_subdirectory (LayerManagerPlugins/IpcModules) -add_subdirectory (LayerManagerClient/ilmClient) -add_subdirectory (LayerManagerCommands) -add_subdirectory (LayerManagerService) -add_subdirectory (LayerManagerUtils) -add_subdirectory (LayerManagerPlugins/Renderers/Graphic) -if (WITH_DESKTOP) - add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer) -endif(WITH_DESKTOP) +#============================================================================== +# default compiler settings for 3rd party components +#============================================================================== -if (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) +add_subdirectory (3rdParty) -if (WITH_X11_GLES) - add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer) -endif(WITH_X11_GLES) + +#============================================================================== +# use strict compiler settings for examples +#------------------------------------------------------------------------------ +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") +#============================================================================== if (WITH_EGL_EXAMPLE) add_subdirectory (LayerManagerExamples/EGLX11ApplicationExample) add_subdirectory (LayerManagerExamples/EGLX11MockNavigation) + set (BUILD_UTILS_LIB ON) endif(WITH_EGL_EXAMPLE) if (WITH_GLX_EXAMPLE) add_subdirectory (LayerManagerExamples/GLXApplicationExample) + set (BUILD_UTILS_LIB ON) endif(WITH_GLX_EXAMPLE) if (WITH_CLIENTEXAMPLES) @@ -138,17 +138,72 @@ if (WITH_CLIENTEXAMPLES) add_subdirectory (LayerManagerExamples/LayerManagerToolBox) add_subdirectory (LayerManagerExamples/LayerManagerControl) add_subdirectory (LayerManagerExamples/LayerSceneDescriptionExample) + set (BUILD_UTILS_LIB ON) endif(WITH_CLIENTEXAMPLES) if (WITH_WL_EXAMPLE) add_subdirectory (LayerManagerExamples/EGLWLApplicationExample) add_subdirectory (LayerManagerExamples/EGLWLMockNavigation) add_subdirectory (LayerManagerExamples/WLChromakeyExample) + set (BUILD_UTILS_LIB ON) endif(WITH_WL_EXAMPLE) +#============================================================================== +# use very strict compiler settings for internal components +#------------------------------------------------------------------------------ +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function") +#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +#============================================================================== + +if (WITH_COMMUNICATOR_GEN) + add_subdirectory (LayerManagerCommands) + add_subdirectory (LayerManagerPlugins/Communicators/GenericCommunicator) +endif(WITH_COMMUNICATOR_GEN) + +if (WITH_SERVICE_BIN OR WITH_CLIENT_LIB) + add_subdirectory (LayerManagerPlugins/IpcModules) + + if (WITH_SERVICE_BIN) + add_subdirectory (LayerManagerPlugins/Renderers/Graphic) + add_subdirectory (LayerManagerService) + set (BUILD_UTILS_LIB ON) + set (INSTALL_UTILS_LIB ON) + endif (WITH_SERVICE_BIN) + + if (WITH_CLIENT_LIB) + add_subdirectory (LayerManagerClient/ilmClient) + endif (WITH_CLIENT_LIB) + +endif (WITH_SERVICE_BIN OR WITH_CLIENT_LIB) + +if (WITH_DESKTOP) + set (WITH_GLX_LIB ON CACHE BOOL "Build X11 GLX development lib" FORCE) + add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer) +endif(WITH_DESKTOP) + +if (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) + set (WITH_GLESv2_LIB ON CACHE BOOL "Build X11 GLES development lib" FORCE) + add_subdirectory (LayerManagerPlugins/Renderers/Platform/X11GLESRenderer) +endif(WITH_X11_GLES) + +if (BUILD_UTILS_LIB) + add_subdirectory (LayerManagerUtils) +endif (BUILD_UTILS_LIB) + +#============================================================================== # enable ctest if building with tests # run 'make test' after build to run all tests # be aware that some tests require a running layermanager +#============================================================================== if (WITH_TESTS) enable_testing() endif(WITH_TESTS) diff --git a/LayerManagerClient/ilmClient/CMakeLists.txt b/LayerManagerClient/ilmClient/CMakeLists.txt index 8f3ccf3..e9f46f5 100644 --- a/LayerManagerClient/ilmClient/CMakeLists.txt +++ b/LayerManagerClient/ilmClient/CMakeLists.txt @@ -59,6 +59,8 @@ install ( if (WITH_TESTS) + set (CMAKE_CXX_FLAGS "") + enable_testing() add_executable(ilmClient_Test tests/IlmCommandTest.cpp tests/IlmNotificationTest.cpp src/generic_ilm_client.c) diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/test/CMakeLists.txt b/LayerManagerPlugins/Communicators/GenericCommunicator/test/CMakeLists.txt index 8e9c828..2ddfd27 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/test/CMakeLists.txt +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/test/CMakeLists.txt @@ -41,6 +41,8 @@ file(GLOB LM_SOURCES "${PROJECT_SOURCE_DIR}/LayerManagerService/src/Scene.cpp" file(GLOB DBUSCommunicator_SOURCES "../src/*.cpp") +set (CMAKE_CXX_FLAGS "") + add_executable(DBUSCommunicatorTest DBUSCommunicatorTest.cpp ${LM_SOURCES} ${DBUSCommunicator_SOURCES}) target_link_libraries(DBUSCommunicatorTest gmock LayerManagerCommands ${LIBS}) diff --git a/LayerManagerPlugins/IpcModules/CMakeLists.txt b/LayerManagerPlugins/IpcModules/CMakeLists.txt index 289d0d3..a80e812 100644 --- a/LayerManagerPlugins/IpcModules/CMakeLists.txt +++ b/LayerManagerPlugins/IpcModules/CMakeLists.txt @@ -19,7 +19,7 @@ cmake_minimum_required (VERSION 2.6) -add_subdirectory(IpcModuleLoader) +set (BUILD_LOADER OFF) #============================================================================== # TCP Socket IPC MODULE @@ -28,6 +28,7 @@ option (WITH_IPC_MODULE_TCP "Build with TCP Ipc Module" OFF) if (WITH_IPC_MODULE_TCP) add_subdirectory(TcpIpcModule) + set (BUILD_LOADER ON) endif (WITH_IPC_MODULE_TCP) #============================================================================== @@ -37,4 +38,12 @@ option (WITH_IPC_MODULE_DBUS "Build with D-Bus Ipc Module" ON) if (WITH_IPC_MODULE_DBUS) add_subdirectory(DbusIpcModule) + set (BUILD_LOADER ON) endif (WITH_IPC_MODULE_DBUS) + +#============================================================================== +# IPC MODULE LOADER +#============================================================================== +if (BUILD_LOADER) + add_subdirectory(IpcModuleLoader) +endif (BUILD_LOADER) diff --git a/LayerManagerPlugins/Renderers/Graphic/CMakeLists.txt b/LayerManagerPlugins/Renderers/Graphic/CMakeLists.txt index 945e3c1..488c5e0 100644 --- a/LayerManagerPlugins/Renderers/Graphic/CMakeLists.txt +++ b/LayerManagerPlugins/Renderers/Graphic/CMakeLists.txt @@ -386,6 +386,8 @@ endif(WITH_WAYLAND) if (WITH_TESTS) + set (CMAKE_CXX_FLAGS "") + enable_testing() add_subdirectory (tests) diff --git a/LayerManagerService/CMakeLists.txt b/LayerManagerService/CMakeLists.txt index 1405f2a..f6a7f76 100644 --- a/LayerManagerService/CMakeLists.txt +++ b/LayerManagerService/CMakeLists.txt @@ -55,7 +55,7 @@ install (FILES ${LM_INCLUDES} DESTINATION include/layermanager) if (WITH_TESTS) enable_testing() - +set (CMAKE_CXX_FLAGS "") add_executable(LayerManagerService_Test tests/SceneTest.cpp tests/LayermanagerTest.cpp diff --git a/LayerManagerUtils/CMakeLists.txt b/LayerManagerUtils/CMakeLists.txt index 90dcb82..16ac7c3 100644 --- a/LayerManagerUtils/CMakeLists.txt +++ b/LayerManagerUtils/CMakeLists.txt @@ -59,23 +59,27 @@ endif (WITH_DLT) include_directories(${INCLUDE_DIRS}) -install(FILES - include/Log.h - include/LogMessageBuffer.h - include/IlmMatrix.h - include/Bitmap.h - DESTINATION - include/layermanager -) +if (INSTALL_UTILS_LIB) + install(FILES + include/Log.h + include/LogMessageBuffer.h + include/IlmMatrix.h + include/Bitmap.h + DESTINATION + include/layermanager + ) -install(TARGETS - ${PROJECT_NAME} - DESTINATION - lib/layermanager/static -) + install(TARGETS + ${PROJECT_NAME} + DESTINATION + lib/layermanager/static + ) +endif (INSTALL_UTILS_LIB) if (WITH_TESTS) + set (CMAKE_CXX_FLAGS "") + add_executable(${PROJECT_NAME}_Test tests/BitmapTest.cpp tests/LogTest.cpp diff --git a/config/res/config.h.cmake b/config/res/config.h.cmake index bd8ebdb..17283e8 100644 --- a/config/res/config.h.cmake +++ b/config/res/config.h.cmake @@ -57,38 +57,44 @@ // force copy of graphic buffers #cmakedefine WITH_FORCE_COPY -// Build development library for GLES2 Based Renderers -#cmakedefine WITH_GLESv2_LIB - // build OpenGL/X11 examples #cmakedefine WITH_GLX_EXAMPLE -// Build development library for GLX Based Renderers -#cmakedefine WITH_GLX_LIB - // build unit tests for all projects #cmakedefine WITH_TESTS // build OpenGL ES 2.0 / X11 renderer #cmakedefine WITH_X11_GLES -// use OpenGL ES 2.0 / Wayland renderer -#cmakedefine WITH_WAYLAND - // use fbdev for wayland backend #cmakedefine WITH_WAYLAND_FBDEV // use x11 for wayland backend #cmakedefine WITH_WAYLAND_X11 +// use wayland-drm compositor +#cmakedefine WITH_WAYLAND_DRM + // use xthreads library #cmakedefine WITH_XTHREADS // use automotive dlt for logging #cmakedefine WITH_DLT -// use wayland-drm compositor -#cmakedefine WITH_WAYLAND_DRM +// build LayerManagement client library +#cmakedefine WITH_CLIENT_LIB + +// build LayerManagerService binary +#cmakedefine WITH_SERVICE_BIN + +// build generic communicator plugin +#cmakedefine WITH_COMMUNICATOR_GEN + +// build dbus ipc module +#cmakedefine WITH_IPC_MODULE_DBUS + +// build tcp/ip ipc module +#cmakedefine WITH_IPC_MODULE_TCP //----------------------------------------------------------------------------- // human readable report @@ -103,25 +109,27 @@ typedef struct } buildConfigurationFlag; #define buildConfigurationFlags \ -{ INFO_FLAG, "Build Version = ${ILM_VERSION}" }, \ -{ DEBUG_FLAG, "Build Type = ${CMAKE_BUILD_TYPE}" }, \ -{ DEBUG_FLAG, "Compiler Flags = ${CMAKE_CXX_FLAGS}" }, \ -{ DEBUG_FLAG, "Install Prefix = ${CMAKE_INSTALL_PREFIX}" }, \ -{ DEBUG_FLAG, "WITH_CLIENTEXAMPLES = ${WITH_CLIENTEXAMPLES}" }, \ -{ DEBUG_FLAG, "WITH_DESKTOP = ${WITH_DESKTOP}" }, \ -{ DEBUG_FLAG, "WITH_EGL_EXAMPLE = ${WITH_EGL_EXAMPLE}" }, \ -{ DEBUG_FLAG, "WITH_WL_EXAMPLE = ${WITH_WL_EXAMPLE}" }, \ -{ DEBUG_FLAG, "WITH_FORCE_COPY = ${WITH_FORCE_COPY}" }, \ -{ DEBUG_FLAG, "WITH_GLESv2_LIB = ${WITH_GLESv2_LIB}" }, \ -{ DEBUG_FLAG, "WITH_GLX_EXAMPLE = ${WITH_GLX_EXAMPLE}" }, \ -{ DEBUG_FLAG, "WITH_GLX_LIB = ${WITH_GLX_LIB}" }, \ -{ DEBUG_FLAG, "WITH_TESTS = ${WITH_TESTS}" }, \ -{ DEBUG_FLAG, "WITH_X11_GLES = ${WITH_X11_GLES}" }, \ -{ DEBUG_FLAG, "WITH_WAYLAND = ${WITH_WAYLAND}" }, \ -{ DEBUG_FLAG, "WITH_WAYLAND_FBDEV = ${WITH_WAYLAND_FBDEV}" }, \ -{ DEBUG_FLAG, "WITH_WAYLAND_X11 = ${WITH_WAYLAND_X11}" }, \ -{ DEBUG_FLAG, "WITH_WAYLAND_DRM = ${WITH_WAYLAND_DRM}" }, \ -{ DEBUG_FLAG, "WITH_XTHREADS = ${WITH_XTHREADS}" }, \ -{ DEBUG_FLAG, "WITH_DLT = ${WITH_DLT}" } +{ INFO_FLAG, "Build Version = ${ILM_VERSION}" }, \ +{ DEBUG_FLAG, "Build Type = ${CMAKE_BUILD_TYPE}" }, \ +{ DEBUG_FLAG, "Compiler Flags = ${CMAKE_CXX_FLAGS}" }, \ +{ DEBUG_FLAG, "Install Prefix = ${CMAKE_INSTALL_PREFIX}" }, \ +{ DEBUG_FLAG, "WITH_CLIENTEXAMPLES = ${WITH_CLIENTEXAMPLES}" }, \ +{ DEBUG_FLAG, "WITH_CLIENT_LIB = ${WITH_CLIENT_LIB}" }, \ +{ DEBUG_FLAG, "WITH_COMMUNICATOR_GEN = ${WITH_COMMUNICATOR_GEN}" }, \ +{ DEBUG_FLAG, "WITH_DESKTOP = ${WITH_DESKTOP}" }, \ +{ DEBUG_FLAG, "WITH_DLT = ${WITH_DLT}" }, \ +{ DEBUG_FLAG, "WITH_EGL_EXAMPLE = ${WITH_EGL_EXAMPLE}" }, \ +{ DEBUG_FLAG, "WITH_FORCE_COPY = ${WITH_FORCE_COPY}" }, \ +{ DEBUG_FLAG, "WITH_GLX_EXAMPLE = ${WITH_GLX_EXAMPLE}" }, \ +{ DEBUG_FLAG, "WITH_IPC_MODULE_DBUS = ${WITH_IPC_MODULE_DBUS}" }, \ +{ DEBUG_FLAG, "WITH_IPC_MODULE_TCP = ${WITH_IPC_MODULE_TCP}" }, \ +{ DEBUG_FLAG, "WITH_SERVICE_BIN = ${WITH_SERVICE_BIN}" }, \ +{ DEBUG_FLAG, "WITH_TESTS = ${WITH_TESTS}" }, \ +{ DEBUG_FLAG, "WITH_WAYLAND_DRM = ${WITH_WAYLAND_DRM}" }, \ +{ DEBUG_FLAG, "WITH_WAYLAND_FBDEV = ${WITH_WAYLAND_FBDEV}" }, \ +{ DEBUG_FLAG, "WITH_WAYLAND_X11 = ${WITH_WAYLAND_X11}" }, \ +{ DEBUG_FLAG, "WITH_WL_EXAMPLE = ${WITH_WL_EXAMPLE}" }, \ +{ DEBUG_FLAG, "WITH_X11_GLES = ${WITH_X11_GLES}" }, \ +{ DEBUG_FLAG, "WITH_XTHREADS = ${WITH_XTHREADS}" } #endif // __CONFIG_H__ |