From 9afd13808aba75a54398a8533a00e0d852e8d179 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Thu, 10 May 2012 14:37:50 +0200 Subject: [PATCH] LayerManagement: enabled "profiling" build setting for GCC If LayerManagement is build on a GCC-based platform, an additional build setting named 'profiling' is available. Building with this setting results in intrumented versions. The result can be used with gprof-based tools. --- cmake/optionalFeatures/CMakeLists.txt | 1 + cmake/optionalFeatures/profiling/CMakeLists.txt | 41 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 cmake/optionalFeatures/profiling/CMakeLists.txt diff --git a/cmake/optionalFeatures/CMakeLists.txt b/cmake/optionalFeatures/CMakeLists.txt index 9863c5e..ab4a012 100644 --- a/cmake/optionalFeatures/CMakeLists.txt +++ b/cmake/optionalFeatures/CMakeLists.txt @@ -21,3 +21,4 @@ cmake_minimum_required (VERSION 2.6) add_subdirectory(codeCoverage) +add_subdirectory(profiling) diff --git a/cmake/optionalFeatures/profiling/CMakeLists.txt b/cmake/optionalFeatures/profiling/CMakeLists.txt new file mode 100644 index 0000000..a80de89 --- /dev/null +++ b/cmake/optionalFeatures/profiling/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# 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. +# +############################################################################ + +cmake_minimum_required (VERSION 2.6) + +# this file adds a new build-setting 'profiling', +# if all required tools are found + +if(CMAKE_COMPILER_IS_GNUCC) + message(STATUS "GCC detected, enabled 'profiling' build configuration") + + SET(GCC_PROFILING_FLAGS "-g -pg") + + # compiler + + SET(CMAKE_CXX_FLAGS_PROFILING "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE) + SET(CMAKE_C_FLAGS_PROFILING "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE) + + # linker + + SET(CMAKE_EXE_LINKER_FLAGS_PROFILING "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE) + SET(CMAKE_MODULE_LINKER_FLAGS_PROFILING "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE) + SET(CMAKE_SHARED_LINKER_FLAGS_PROFILING "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE) + +endif(CMAKE_COMPILER_IS_GNUCC) -- 2.7.4