From 7ae60e99b2cc2774fa46cf8032ffe7472307d2aa Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Thu, 24 Nov 2011 16:55:59 +0100 Subject: [PATCH] modified version string handling in build system; cmake now generate Version.h file which is used by main.cpp --- CMakeLists.txt | 1 - LayerManagerService/CMakeLists.txt | 7 +++++++ LayerManagerService/include/.gitignore | 1 + LayerManagerService/include/Version.h.in | 25 +++++++++++++++++++++++++ LayerManagerService/src/main.cpp | 5 +++-- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 LayerManagerService/include/.gitignore create mode 100644 LayerManagerService/include/Version.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index d272b64..dd4a42f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,6 @@ message(STATUS "Build for Version ${VERSION} build ${ILM_VERSION}" ) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DILM_VERSION='\"${ILM_VERSION}\"' " CACHE STRING "" FORCE) ##################### RPM CONFIG ######################## set(GENIVI_RPM_RELEASE "1${ILM_VERSION}") diff --git a/LayerManagerService/CMakeLists.txt b/LayerManagerService/CMakeLists.txt index 600fc15..828e3c9 100644 --- a/LayerManagerService/CMakeLists.txt +++ b/LayerManagerService/CMakeLists.txt @@ -28,6 +28,13 @@ include_directories ("${PROJECT_SOURCE_DIR}/LayerManagerCommands/include") link_directories ("${PROJECT_SOURCE_DIR}/LayerManagerUtils/bin") link_directories ("${PROJECT_SOURCE_DIR}/LayerManagerCommands") +# generate version header file, used in main.cpp +message("-- Generating Version.h header file") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.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 new file mode 100644 index 0000000..38ba24e --- /dev/null +++ b/LayerManagerService/include/.gitignore @@ -0,0 +1 @@ +Version.h diff --git a/LayerManagerService/include/Version.h.in b/LayerManagerService/include/Version.h.in new file mode 100644 index 0000000..946f704 --- /dev/null +++ b/LayerManagerService/include/Version.h.in @@ -0,0 +1,25 @@ +/*************************************************************************** + * + * 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 _VERSION_H_ +#define _VERSION_H_ + +// Version string provided by cmake build system +const char* VERSION_STRING = "${ILM_VERSION}"; + +#endif // _VERSION_H_ \ No newline at end of file diff --git a/LayerManagerService/src/main.cpp b/LayerManagerService/src/main.cpp index a68318c..76c345f 100644 --- a/LayerManagerService/src/main.cpp +++ b/LayerManagerService/src/main.cpp @@ -18,6 +18,7 @@ ****************************************************************************/ #include "Layermanager.h" +#include "Version.h" #include "IRenderer.h" #include "ICommunicator.h" #include "ISceneProvider.h" @@ -70,7 +71,7 @@ const char* USAGE_DESCRIPTION = "Usage:\t LayerManagerService [options]\n" "\t-v: show version info\t\n" "\nexample: LayerManagerService -w800 -h480 -d:0\n"; -const char* VERSION_STRING = ILM_VERSION; + template T* getCreateFunction(string libname) { @@ -345,7 +346,7 @@ int main(int argc, char **argv) { parseCommandLine(argc, (char**) argv); char* pluginLookupPath = getenv("LM_PLUGIN_PATH"); - LOG_INFO("LayerManagerService", "Starting Layermanager - " << ILM_VERSION << " ."); + LOG_INFO("LayerManagerService", "Starting Layermanager - " << VERSION_STRING << " ."); if (pluginLookupPath != NULL ) { -- 2.7.4