From 54649d1b7a6e7168a89ef34b812b90400f4fa225 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 20 May 2012 16:06:32 -0500 Subject: Make profiling builds work with Clang --- CMakeLists.txt | 14 +++++++++++++- acprep | 25 ++++++++++++++++++++----- src/CMakeLists.txt | 1 - 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db74b8dc..b91eaa29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,11 @@ else() set(DEBUG_MODE 0) endif() +if(CLANG_GCOV) + set(PROFILE_LIBS profile_rt) + set(CMAKE_REQUIRED_LIBRARIES ${PROFILE_LIBS}) +endif() + ######################################################################## find_package(PythonInterp) # Used for running tests @@ -111,7 +116,7 @@ endif() cmake_push_check_state() set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} ${Boost_INCLUDE_DIRS}) -set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES} icuuc) +set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES} icuuc ${PROFILE_LIBS}) check_cxx_source_runs(" #include @@ -239,6 +244,7 @@ macro(add_ledger_library_dependencies _target) if(HAVE_BOOST_REGEX_UNICODE) target_link_libraries(${_target} icuuc) endif() + target_link_libraries(${_target} ${PROFILE_LIBS}) endmacro(add_ledger_library_dependencies _target) ######################################################################## @@ -256,6 +262,12 @@ configure_file( ${PROJECT_SOURCE_DIR}/src/system.hh.in ${PROJECT_BINARY_DIR}/system.hh) +if(CMAKE_CXX_COMPILER MATCHES "clang") + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") +elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+") + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") +endif() + add_subdirectory(src) if(BUILD_DOCS) add_subdirectory(doc) diff --git a/acprep b/acprep index 8f52b88e..7439b0f8 100755 --- a/acprep +++ b/acprep @@ -739,9 +739,15 @@ class PrepareBuild(CommandLineApp): # else branch inside assert statements. self.configure_args.append('-DBUILD_DEBUG=1') self.configure_args.append('-DNO_ASSERTS=1') + self.configure_args.append('-DCLANG_GCOV=1') self.CXXFLAGS.append('-fprofile-arcs') self.CXXFLAGS.append('-ftest-coverage') + self.LDFLAGS.append('-fprofile-arcs') + self.LDFLAGS.append('-ftest-coverage') + + if not self.options.compiler or self.options.compiler == "clang-3.1": + self.LDFLAGS.append('-lprofile_rt') def setup_flavor_gprof(self): self.configure_args.append('-DBUILD_DEBUG=1') @@ -847,6 +853,9 @@ class PrepareBuild(CommandLineApp): make_args.append('-j%d' % self.options.jobs) make_args.append('ARGS=-j%d' % self.options.jobs) + if self.options.verbose: + make_args.append('VERBOSE=1') + self.log.debug('Configure arguments => ' + str(config_args)) self.log.debug('Makefile arguments => ' + str(make_args)) @@ -935,20 +944,26 @@ class PrepareBuild(CommandLineApp): self.configure_flavor('opt', reset=False) self.log.info('=== Testing opt ===') - self.phase_make('fullcheck') + # jww (2012-05-20): Can't use fullcheck yet + #self.phase_make('fullcheck') + self.phase_make('test') self.configure_flavor('gcov', reset=False) self.log.info('=== Testing gcov ===') - self.phase_make('check') + #self.phase_make('check') + self.phase_make('test') self.configure_flavor('debug', reset=False) self.log.info('=== Testing debug ===') - self.phase_make('fullcheck') + #self.phase_make('fullcheck') + self.phase_make('test') self.configure_flavor('default', reset=False) self.log.info('=== Testing default ===') - self.phase_make('fullcheck') - self.phase_make('docs') + #self.phase_make('fullcheck') + self.phase_make('test') + # jww (2012-05-20): docs are not working yet + #self.phase_make('docs') def phase_makeall(self, reset=False, *args): self.log.info('Executing phase: makeall') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6f44e1be..cc325aa2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -134,7 +134,6 @@ set(LEDGER_INCLUDES if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_CXX_COMPILER MATCHES "clang") - set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") add_definitions( -Weverything -Wno-padded -- cgit v1.2.3