From 3ed6536a72969969f05558f28994e4a5ed24afee Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Mon, 5 Dec 2011 11:24:19 +0100 Subject: [PATCH] auto-generate CmakeConfiguration.h, which includes all required configuration flags from build system --- LayerManagerService/CMakeLists.txt | 8 +++ LayerManagerService/include/.gitignore | 1 + .../include/CmakeConfiguration.h.in | 73 ++++++++++++++++++++++ LayerManagerService/src/main.cpp | 12 ++-- 4 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 LayerManagerService/include/CmakeConfiguration.h.in diff --git a/LayerManagerService/CMakeLists.txt b/LayerManagerService/CMakeLists.txt index d0bf872..92c0a37 100644 --- a/LayerManagerService/CMakeLists.txt +++ b/LayerManagerService/CMakeLists.txt @@ -36,6 +36,14 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.h ) +# generate cmake configuration header file, includes information on the +# project configuration, compiler settings, ... +message(STATUS "Generating CmakeConfiguration.h header file with build system configuration.") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/include/CmakeConfiguration.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/include/CmakeConfiguration.h +) + file(GLOB LM_SOURCES src/*.cpp src/shader/*.cpp) file(GLOB LM_INCLUDES include/*.h) diff --git a/LayerManagerService/include/.gitignore b/LayerManagerService/include/.gitignore index 38ba24e..b41e000 100644 --- a/LayerManagerService/include/.gitignore +++ b/LayerManagerService/include/.gitignore @@ -1 +1,2 @@ Version.h +CmakeConfiguration.h diff --git a/LayerManagerService/include/CmakeConfiguration.h.in b/LayerManagerService/include/CmakeConfiguration.h.in new file mode 100644 index 0000000..783f762 --- /dev/null +++ b/LayerManagerService/include/CmakeConfiguration.h.in @@ -0,0 +1,73 @@ +/*************************************************************************** + * + * Copyright 2010,2011 BMW Car IT 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. + * + ****************************************************************************/ +#ifndef _CMAKECONFIGURATION_H_ +#define _CMAKECONFIGURATION_H_ + +#include "Log.h" + +// Auto-generated. Do not modify. +// Variables configured by CMake build system + +//----------------------------------------------------------------------------- +// string variables +//----------------------------------------------------------------------------- +const char* ILM_VERSION = "${ILM_VERSION}"; +const char* CMAKE_BUILD_TYPE = "${CMAKE_BUILD_TYPE}"; +const char* CMAKE_CXX_FLAGS = "${CMAKE_CXX_FLAGS}"; +const char* CMAKE_INSTALL_PREFIX = "${CMAKE_INSTALL_PREFIX}"; + +//----------------------------------------------------------------------------- +// build flags +//----------------------------------------------------------------------------- +#cmakedefine WITH_CLIENTEXAMPLES +#cmakedefine WITH_DESKTOP +#cmakedefine WITH_EGL_EXAMPLE +#cmakedefine WITH_FORCE_COPY +#cmakedefine WITH_GLESv2_LIB +#cmakedefine WITH_GLX_EXAMPLE +#cmakedefine WITH_GLX_LIB +#cmakedefine WITH_INPUT_EVENTS +#cmakedefine WITH_TESTS +#cmakedefine WITH_X11_GLES +#cmakedefine WITH_XTHREADS + +//----------------------------------------------------------------------------- +// human readable report +//----------------------------------------------------------------------------- +void printCmakeConfiguration(void) +{ + LOG_INFO ("CmakeConfiguration", "LayerManager Version = " << ILM_VERSION); + LOG_DEBUG("CmakeConfiguration", "Build Type = " << CMAKE_BUILD_TYPE); + LOG_DEBUG("CmakeConfiguration", "Compiler Flags = " << CMAKE_CXX_FLAGS); + LOG_DEBUG("CmakeConfiguration", "Install Prefix = " << CMAKE_INSTALL_PREFIX); + + LOG_DEBUG("CmakeConfiguration", "WITH_CLIENTEXAMPLES = ${WITH_CLIENTEXAMPLES}"); + LOG_DEBUG("CmakeConfiguration", "WITH_DESKTOP = ${WITH_DESKTOP}"); + LOG_DEBUG("CmakeConfiguration", "WITH_EGL_EXAMPLE = ${WITH_EGL_EXAMPLE}"); + LOG_DEBUG("CmakeConfiguration", "WITH_FORCE_COPY = ${WITH_FORCE_COPY}"); + LOG_DEBUG("CmakeConfiguration", "WITH_GLESv2_LIB = ${WITH_GLESv2_LIB}"); + LOG_DEBUG("CmakeConfiguration", "WITH_GLX_EXAMPLE = ${WITH_GLX_EXAMPLE}"); + LOG_DEBUG("CmakeConfiguration", "WITH_GLX_LIB = ${WITH_GLX_LIB}"); + LOG_DEBUG("CmakeConfiguration", "WITH_INPUT_EVENTS = ${WITH_INPUT_EVENTS}"); + LOG_DEBUG("CmakeConfiguration", "WITH_TESTS = ${WITH_TESTS}"); + LOG_DEBUG("CmakeConfiguration", "WITH_X11_GLES = ${WITH_X11_GLES}"); + LOG_DEBUG("CmakeConfiguration", "WITH_XTHREADS = ${WITH_XTHREADS}"); +} + +#endif // _CMAKECONFIGURATION_H_ diff --git a/LayerManagerService/src/main.cpp b/LayerManagerService/src/main.cpp index cc576cd..3e83dbd 100644 --- a/LayerManagerService/src/main.cpp +++ b/LayerManagerService/src/main.cpp @@ -18,7 +18,7 @@ ****************************************************************************/ #include "Layermanager.h" -#include "Version.h" +#include "CmakeConfiguration.h" #include "IRenderer.h" #include "ICommunicator.h" #include "ISceneProvider.h" @@ -150,12 +150,12 @@ void parseCommandLine(int argc, char **argv) } break; case 'v': - printf("LayerManagerService\nVersion: %s\n",VERSION_STRING); + printf("LayerManagerService\nVersion: %s\n", ILM_VERSION); exit(-1); break; case '?': default: - printf("LayerManagerService\nVersion: %s\n",VERSION_STRING); + printf("LayerManagerService\nVersion: %s\n", ILM_VERSION); puts(USAGE_DESCRIPTION); exit(-1); } @@ -365,8 +365,10 @@ int main(int argc, char **argv) { parseCommandLine(argc, (char**) argv); char* pluginLookupPath = getenv("LM_PLUGIN_PATH"); - LOG_INFO("LayerManagerService", "Starting Layermanager - " << VERSION_STRING << " ."); - + LOG_INFO("LayerManagerService", "Starting Layermanager."); + + printCmakeConfiguration(); + if (pluginLookupPath != NULL ) { gPluginLookupPath = pluginLookupPath; -- 2.7.4