Browse Source

cmake: Add coverage support.

v0.7.4-release
Tom Hughes 14 years ago
committed by Ryan Dahl
parent
commit
b46f10a11f
  1. 22
      CMakeLists.txt
  2. 5
      Makefile.cmake
  3. 4
      README.cmake
  4. 9
      cmake/configure.cmake

22
CMakeLists.txt

@ -1,6 +1,20 @@
cmake_minimum_required(VERSION 2.6)
project(node)
if(USE_GCOV)
set(CMAKE_BUILD_TYPE "Debug")
# Set global c and c++ flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
# Link flags used for creating executables
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs")
# Link flags used for creating shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -profile-arcs")
endif()
#
# options
#
@ -72,5 +86,9 @@ if(${OPENSSL_FOUND} MATCHES TRUE)
message(" OpenSSL: ${OPENSSL_LIBRARIES}")
endif()
# message(" CCFLAGS: ${CCFLAGS}")
# message(" CPPFLAGS: ${CPPFLAGS}")
if(USE_GCOV)
message(" gcov: enabled")
endif()
message(" CCFLAGS: ${CCFLAGS}")
message(" CPPFLAGS: ${CPPFLAGS}")

5
Makefile.cmake

@ -30,4 +30,7 @@ test: $(BUILD)/Makefile
cdash: $(BUILD)/Makefile
cd $(BUILD) && make Experimental
.PHONY: build install clean doc package test cdash
cdash-cov: $(BUILD)/Makefile
cd $(BUILD) && $(CMAKE) -DUSE_GCOV=True .. && make Experimental
.PHONY: build install clean doc package test cdash cdash-cov

4
README.cmake

@ -30,6 +30,10 @@ To submit test results (see http://my.cdash.org/index.php?project=node):
make -f Makefile.cmake cdash
To submit coverage test results:
make -f Makefile.cmake cdash-cov
Using cmake directly:
cd ~/your-node-source-dir
mkdir name-of-build-dir (can be anything)

9
cmake/configure.cmake

@ -38,17 +38,16 @@ set(CMAKE_C_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CFLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CXXFLAGS}")
if(${node_platform} MATCHES sunos)
# shouldn't this be added to CMAE_C_FLAGS or something?
add_definitions(-threads)
elseif(NOT ${node_platform} MATCHES cygwin*)
# shouldn't this be added to CMAE_C_FLAGS or something?
add_definitions(-pthread)
set(CMAKE_C_FLAGS -rdynamic)
set(CMAKE_EXE_LINKER_FLAGS -pthread)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
endif()
if(${node_platform} MATCHES darwin)
set(CMAKE_EXE_LINKER_FLAGS "-framework Carbon")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Carbon")
endif()
check_function_exists(fdatasync HAVE_FDATASYNC)

Loading…
Cancel
Save