Skip to content
Snippets Groups Projects
Commit b20b04e6 authored by Tom Fischer's avatar Tom Fischer
Browse files

Merge branch 'master' of github.com:ufz/ogs

parents 291c4fcf f0418bf9
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,12 @@ ENDIF() # GCC AND GPROF_PATH
# Disable Qt
OPTION(OGS_DONT_USE_QT "Disables all Qt specific code." OFF)
# Print CMake variable values
IF (OGS_CMAKE_DEBUG)
INCLUDE(ListAllCMakeVariableValues)
list_all_cmake_variable_values()
ENDIF (OGS_CMAKE_DEBUG)
######################
### Subdirectories ###
######################
......
......@@ -39,6 +39,8 @@ LINK_LIBRARIES(gcov)
# Param _testrunner The name of the target which runs the tests
# Param _outputname lcov output is generated as _outputname.info
# HTML report is generated in _outputname/index.html
# Optional fourth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
IF(NOT LCOV_PATH)
......@@ -56,7 +58,7 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
${LCOV_PATH} --directory . --zerocounters
# Run tests
COMMAND ${_testrunner}
COMMAND ${_testrunner} ${ARGV3}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
......@@ -64,7 +66,6 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
DEPENDS ${_testrunner}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
......@@ -79,8 +80,9 @@ ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests
# Param _outputname lcov output is generated as _outputname.info
# HTML report is generated in _outputname/index.html
# Param _outputname cobertura output is generated as _outputname.xml
# Optional fourth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
IF(NOT PYTHON_EXECUTABLE)
......@@ -94,10 +96,10 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname
ADD_CUSTOM_TARGET(${_targetname}
# Run tests
${_testrunner}
${_testrunner} ${ARGV3}
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -o ${_outputname}.xml
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
......@@ -108,4 +110,4 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
\ No newline at end of file
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
# The module defines the following variables:
# MSYSGIT_BIN_DIR - path to the tool binaries
# MSYSGIT_FOUND - true if the command line client was found
# Example usage:
# FIND_PACKAGE(MsysGit)
# IF(MSYSGIT_FOUND)
# MESSAGE("msysGit tools found in: ${MSYSGIT_BIN_DIR}")
# ENDIF()
if(GIT_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} --version
OUTPUT_VARIABLE git_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF (git_version MATCHES "^git version [0-9]")
STRING(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
IF (git_version MATCHES "msysgit")
SET(GIT_IS_MSYSGIT TRUE)
ELSE()
SET(GIT_IS_MSYSGIT FALSE)
ENDIF()
ENDIF()
UNSET(git_version)
ENDIF(GIT_EXECUTABLE)
IF(GIT_IS_MSYSGIT)
GET_FILENAME_COMPONENT(MSYS_DIR ${GIT_EXECUTABLE} PATH)
FIND_PATH(MSYSGIT_BIN_DIR
NAMES date.exe grep.exe unzip.exe git.exe PATHS ${MSYS_DIR}/../bin NO_DEFAULT_PATH)
ELSE()
FIND_PATH(MSYSGIT_BIN_DIR
NAMES date.exe grep.exe unzip.exe git.exe PATH_SUFFIXES Git/bin)
ENDIF()
# Handle the QUIETLY and REQUIRED arguments and set MSYSGIT_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MsysGit
REQUIRED_VARS MSYSGIT_BIN_DIR)
\ No newline at end of file
# - Find NetCDF
# Find the native NetCDF includes and library
#
# NETCDF_INCLUDES - where to find netcdf.h, etc
# NETCDF_LIBRARIES - Link these libraries when using NetCDF
# NETCDF_FOUND - True if NetCDF found including required interfaces (see below)
#
# Your package can require certain interfaces to be FOUND by setting these
#
# NETCDF_CXX - require the C++ interface and link the C++ library
# NETCDF_F77 - require the F77 interface and link the fortran library
# NETCDF_F90 - require the F90 interface and link the fortran library
#
# The following are not for general use and are included in
# NETCDF_LIBRARIES if the corresponding option above is set.
#
# NETCDF_LIBRARIES_C - Just the C interface
# NETCDF_LIBRARIES_CXX - C++ interface, if available
# NETCDF_LIBRARIES_F77 - Fortran 77 interface, if available
# NETCDF_LIBRARIES_F90 - Fortran 90 interface, if available
#
# Normal usage would be:
# set (NETCDF_F90 "YES")
# find_package (NetCDF REQUIRED)
# target_link_libraries (uses_f90_interface ${NETCDF_LIBRARIES})
# target_link_libraries (only_uses_c_interface ${NETCDF_LIBRARIES_C})
if (NETCDF_INCLUDES AND NETCDF_LIBRARIES)
# Already in cache, be silent
set (NETCDF_FIND_QUIETLY TRUE)
endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES)
find_path (NETCDF_INCLUDES netcdf.h
HINTS NETCDF_DIR ENV NETCDF_DIR)
find_library (NETCDF_LIBRARIES_C NAMES netcdf)
mark_as_advanced(NETCDF_LIBRARIES_C)
set (NetCDF_has_interfaces "YES") # will be set to NO if we're missing any interfaces
set (NetCDF_libs "${NETCDF_LIBRARIES_C}")
get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARIES_C}" PATH)
macro (NetCDF_check_interface lang header libs)
if (NETCDF_${lang})
find_path (NETCDF_INCLUDES_${lang} NAMES ${header}
HINTS "${NETCDF_INCLUDES}" NO_DEFAULT_PATH)
find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs}
HINTS "${NetCDF_lib_dirs}" NO_DEFAULT_PATH)
mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang})
if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang})
list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last
else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang})
set (NetCDF_has_interfaces "NO")
message (STATUS "Failed to find NetCDF interface for ${lang}")
endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang})
endif (NETCDF_${lang})
endmacro (NetCDF_check_interface)
NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++)
NetCDF_check_interface (F77 netcdf.inc netcdff)
NetCDF_check_interface (F90 netcdf.mod netcdff)
set (NETCDF_LIBRARIES "${NetCDF_libs}" CACHE STRING "All NetCDF libraries required for interface level")
# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if
# all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces)
mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES)
\ No newline at end of file
###############################################################################
# Find QVTK
#
# This sets the following variables:
#
# QVTK_FOUND - True if QVTK was found
# QVTK_INCLUDE_DIR - Directory containing the QVTK include files
# QVTK_LIBRARY - QVTK library
#
# If QVTK_FOUND then QVTK_INCLUDE_DIR is appended to VTK_INCLUDE_DIRS and
# QVTK_LIBRARY is appended to QVTK_LIBRARY_DIR.
#
find_library (QVTK_LIBRARY QVTK HINTS ${VTK_DIR} ${VTK_DIR}/bin
PATH_SUFFIXES Release Debug)
find_path (QVTK_INCLUDE_DIR QVTKWidget.h HINT ${VTK_INCLUDE_DIRS})
find_package_handle_standard_args(QVTK DEFAULT_MSG
QVTK_LIBRARY QVTK_INCLUDE_DIR)
if(NOT QVTK_FOUND)
set (VTK_USE_QVTK OFF)
else(NOT QVTK_FOUND)
get_filename_component (QVTK_LIBRARY_DIR ${QVTK_LIBRARY} PATH)
set (VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS} ${QVTK_LIBRARY_DIR})
set (VTK_INCLUDE_DIRS ${VTK_INCLUDE_DIRS} ${QVTK_INCLUDE_DIR})
set (VTK_USE_QVTK ON)
endif(NOT QVTK_FOUND)
# From http://www.kitware.com/blog/home/post/300
#
# Usage:
#
# INCLUDE(ListAllCMakeVariableValues)
# list_all_cmake_variable_values()
function(list_all_cmake_variable_values)
message(STATUS "")
get_cmake_property(vs VARIABLES)
foreach(v ${vs})
message(STATUS "${v}='${${v}}'")
endforeach(v)
message(STATUS "")
endfunction()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment