Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • asapo/asapo
  • joao.alvim/asapo
  • philipp.middendorf/asapo
  • stefan.dietrich/asapo
4 results
Show changes
Showing
with 753 additions and 2108 deletions
......@@ -22,4 +22,4 @@ endif()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libcurl4-openssl-dev")
set(CPACK_RPM_PACKAGE_REQUIRES "libcurl-devel")
include(CPack)
\ No newline at end of file
include(CPack)
string(TIMESTAMP TIMESTAMP "%H:%M:%S %d.%m.%Y UTC" UTC)
configure_file( ${PROJECT_SOURCE_DIR}/common/cpp/include/asapo/common/internal/version.h.in ../common/cpp/include/asapo/common/internal/version.h @ONLY)
configure_file( ${PROJECT_SOURCE_DIR}/common/go/src/asapo_common/version/version_lib.go.in ../common/go/src/asapo_common/version/version_lib.go @ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/common/cpp/include/asapo/common/internal/version.h.in
${PROJECT_SOURCE_DIR}/common/cpp/include/asapo/common/internal/version.h @ONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/common/go/src/asapo_common/version/version_lib.go.in
${PROJECT_SOURCE_DIR}/common/go/src/asapo_common/version/version_lib.go @ONLY
)
function(cleanup varname)
string (REPLACE "-" "_" out ${${varname}})
SET( ${varname} ${out} PARENT_SCOPE)
string(REPLACE "-" "_" out ${${varname}})
SET(${varname} ${out} PARENT_SCOPE)
endfunction()
execute_process(COMMAND git describe --tags --abbrev=0
OUTPUT_VARIABLE ASAPO_TAG
WORKING_DIRECTORY ..)
if (DEFINED ENV{CI_COMMIT_REF_NAME})
# this is gitlab CI
if (DEFINED ENV{CI_COMMIT_TAG})
# both refname and tag are defined - this is a tagged build
SET(ASAPO_VERSION $ENV{CI_COMMIT_TAG})
SET(PYTHON_ASAPO_VERSION ${ASAPO_VERSION})
SET(ASAPO_VERSION_COMMIT "")
SET(ASAPO_VERSION_DOCKER_TAG $ENV{CI_COMMIT_TAG})
SET(ASAPO_VERSION_DOCKER_SUFFIX "")
else ()
# tag is not defined, this is the developer build
SET(ASAPO_VERSION $ENV{CI_COMMIT_REF_NAME})
string(REPLACE "_" "-" ASAPO_VERSION ${ASAPO_VERSION})
SET(ASAPO_VERSION 100.0.${ASAPO_VERSION})
SET(PYTHON_ASAPO_VERSION 100.0.dev2)
SET(ASAPO_VERSION_COMMIT ", build $ENV{CI_COMMIT_SHORT_SHA}")
SET(ASAPO_VERSION_DOCKER_TAG $ENV{CI_COMMIT_SHORT_SHA})
SET(ASAPO_VERSION_DOCKER_SUFFIX "-dev")
endif ()
SET(ASAPO_VERSION_DOCKER_REPOSITORY $ENV{CI_REGISTRY_IMAGE})
SET(ASAPO_VERSION_DOCKER_REPOSITORY_USERNAME $ENV{CI_REGISTRY_IMAGE_USERNAME})
SET(ASAPO_VERSION_DOCKER_REPOSITORY_PASSWORD $ENV{CI_REGISTRY_IMAGE_PASSWORD})
message("Asapo Version: " ${ASAPO_VERSION})
message("Python Asapo Version: " ${PYTHON_ASAPO_VERSION})
message("Asapo commit: " ${ASAPO_VERSION_COMMIT})
return ()
endif ()
# Enable running CMake from a directory which is not a subdirectory of
# ${CMAKE_SOURCE_DIR}. See https://git-scm.com/docs/git#Documentation/git.txt--Cltpathgt
# for more information on `git -C <path>`.
set(GIT_CMD git -C "${CMAKE_SOURCE_DIR}")
execute_process(COMMAND ${GIT_CMD} describe --tags --abbrev=0
OUTPUT_VARIABLE ASAPO_TAG
WORKING_DIRECTORY ..)
string(STRIP ${ASAPO_TAG} ASAPO_TAG)
execute_process(COMMAND git rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE BRANCH
WORKING_DIRECTORY ..)
execute_process(COMMAND ${GIT_CMD} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE BRANCH
WORKING_DIRECTORY ..)
string(STRIP ${BRANCH} BRANCH)
cleanup(BRANCH)
execute_process(COMMAND git rev-parse --short=10 HEAD
execute_process(COMMAND ${GIT_CMD} rev-parse --short=10 HEAD
OUTPUT_VARIABLE ASAPO_VERSION_COMMIT
WORKING_DIRECTORY ..)
string(STRIP ${ASAPO_VERSION_COMMIT} ASAPO_VERSION_COMMIT)
if (${BRANCH} STREQUAL "master")
SET (ASAPO_VERSION ${ASAPO_TAG})
SET (ASAPO_VERSION_COMMIT "")
SET (ASAPO_VERSION_DOCKER_SUFFIX "")
SET (PYTHON_ASAPO_VERSION ${ASAPO_VERSION})
SET(ASAPO_VERSION ${ASAPO_TAG})
SET(ASAPO_VERSION_COMMIT "")
SET(ASAPO_VERSION_DOCKER_SUFFIX "")
SET(PYTHON_ASAPO_VERSION ${ASAPO_VERSION})
string(REGEX REPLACE "\\.0([0-9]+)\\."
".\\1." ASAPO_WHEEL_VERSION
${ASAPO_VERSION})
else()
SET (ASAPO_VERSION ${BRANCH})
SET (ASAPO_VERSION_COMMIT ", build ${ASAPO_VERSION_COMMIT}")
SET (ASAPO_VERSION_DOCKER_SUFFIX "-dev")
else ()
SET(ASAPO_VERSION ${BRANCH})
SET(ASAPO_VERSION_COMMIT ", build ${ASAPO_VERSION_COMMIT}")
SET(ASAPO_VERSION_DOCKER_SUFFIX "-dev")
string(REPLACE "_" "-" ASAPO_VERSION ${ASAPO_VERSION})
SET (ASAPO_VERSION 100.0.${ASAPO_VERSION})
SET (PYTHON_ASAPO_VERSION ${ASAPO_VERSION})
SET (ASAPO_WHEEL_VERSION ${ASAPO_VERSION})
endif()
SET(ASAPO_VERSION 100.0.${ASAPO_VERSION})
if (${BRANCH} STREQUAL "develop")
SET(PYTHON_ASAPO_VERSION 100.0.dev0)
else ()
string(FIND ${BRANCH} feature_ASAPO pos)
if( ${pos} EQUAL 0)
string(SUBSTRING ${ASAPO_VERSION} 20 -1 TMP)
string(REGEX MATCH "^([0-9]+)|.+$" ISSUE_NUM "${TMP}")
if (ISSUE_NUM STREQUAL "")
SET(PYTHON_ASAPO_VERSION 100.0.dev2)
else ()
SET(PYTHON_ASAPO_VERSION 100.0.dev${ISSUE_NUM})
endif ()
else ()
SET(PYTHON_ASAPO_VERSION 100.0.dev2)
endif ()
endif ()
SET(ASAPO_WHEEL_VERSION ${ASAPO_VERSION})
endif ()
SET(ASAPO_VERSION_DOCKER_REPOSITORY yakser)
SET(ASAPO_VERSION_DOCKER_REPOSITORY_USERNAME "")
SET(ASAPO_VERSION_DOCKER_REPOSITORY_PASSWORD "")
SET(ASAPO_VERSION_DOCKER_TAG ${ASAPO_VERSION})
message("Asapo Version: " ${ASAPO_VERSION})
message("Python Asapo Version: " ${PYTHON_ASAPO_VERSION})
......
......@@ -4,15 +4,15 @@ project(ASAPO)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules/ ${PROJECT_SOURCE_DIR}/CMakeIncludes/)
#protocol version changes if one of the microservice API's change
set (ASAPO_CONSUMER_PROTOCOL "v0.5")
set (ASAPO_PRODUCER_PROTOCOL "v0.5")
set (ASAPO_CONSUMER_PROTOCOL "v0.7")
set (ASAPO_PRODUCER_PROTOCOL "v0.7")
set (ASAPO_DISCOVERY_API_VER "v0.1")
set (ASAPO_AUTHORIZER_API_VER "v0.2")
set (ASAPO_BROKER_API_VER "v0.5")
set (ASAPO_BROKER_API_VER "v0.7")
set (ASAPO_FILE_TRANSFER_SERVICE_API_VER "v0.2")
set (ASAPO_RECEIVER_API_VER "v0.5")
set (ASAPO_RECEIVER_API_VER "v0.7")
set (ASAPO_RDS_API_VER "v0.1")
set (DB_SCHEMA_VER "v0.1")
set (DB_SCHEMA_VER "v0.1") # TODO: Remove later.
#global settings
......@@ -22,6 +22,7 @@ set(ConfigPackageLocation lib/cmake/Asapo)
# options
option(BUILD_PYTHON "Build python libs" ON)
option(BUILD_CLIENTS_ONLY "Build clients only" OFF)
option(BUILD_CONSUMER_TOOLS "Build consumer tools" OFF)
......@@ -42,6 +43,8 @@ option(BUILD_ASAPO_SITE "Build the asapo web site" OFF)
option(ENABLE_LIBFABRIC "Enables LibFabric support for RDMA transfers" OFF)
option(ENABLE_LIBFABRIC_LOCALHOST "Emulates LibFabric stack over TCP. Only for localhost and testing purposes." OFF)
option(ENABLE_NEW_RECEIVER_MONITORING "Enables the new monitoring for the receiver, but requires gRPC" OFF)
option(BUILD_SHARED_CLIENT_LIBS "Build shared consumer and producer libs" ON)
option(BUILD_STATIC_CLIENT_LIBS "Build static consumer and producer libs" ON)
......@@ -64,12 +67,16 @@ add_subdirectory(common/cpp)
add_subdirectory(producer)
add_subdirectory(consumer)
if (NOT BUILD_CLIENTS_ONLY)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND GO_OPTS -gcflags "all=-N -l")
endif()
add_subdirectory(broker)
add_subdirectory(receiver)
add_subdirectory(discovery)
add_subdirectory(authorizer)
add_subdirectory(asapo_tools)
add_subdirectory(file_transfer)
add_subdirectory(monitoring)
endif()
add_subdirectory(deploy)
......@@ -85,4 +92,3 @@ endif()
add_subdirectory(docs)
add_subdirectory(install)
# Copyright (c) 2012 - 2017, Lars Bilke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products processed from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# CHANGES:
#
# 2012-01-31, Lars Bilke
# - Enable Code Coverage
#
# 2013-09-17, Joakim Söderberg
# - Added support for Clang.
# - Some additional usage instructions.
#
# 2016-02-03, Lars Bilke
# - Refactored functions to use named parameters
#
# 2017-06-02, Lars Bilke
# - Merged with modified version from github.com/ufz/ogs
#
#
# USAGE:
#
# 1. Copy this file into your cmake modules path.
#
# 2. Add the following line to your CMakeLists.txt:
# include(CodeCoverage)
#
# 3. Append necessary compiler flags:
# APPEND_COVERAGE_COMPILER_FLAGS()
#
# 4. If you need to exclude additional directories from the report, specify them
# using the COVERAGE_EXCLUDES variable before calling SETUP_TARGET_FOR_COVERAGE.
# Example:
# set(COVERAGE_EXCLUDES 'dir1/*' 'dir2/*')
#
# 5. Use the functions described below to create a custom make target which
# runs your test executable and produces a code coverage report.
#
# 6. Build a Debug build:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
#
include(CMakeParseArguments)
# Check prereqs
find_program( GCOV_PATH gcov )
find_program( LCOV_PATH lcov )
find_program( GENHTML_PATH genhtml )
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
if(NOT GCOV_PATH)
message(FATAL_ERROR "gcov not found! Aborting...")
endif() # NOT GCOV_PATH
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()
set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")
set(CMAKE_CXX_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE )
set(CMAKE_C_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE )
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE )
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
mark_as_advanced(
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(ERROR "Code coverage results with an optimised (non-Debug) build may be misleading")
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# SETUP_TARGET_FOR_COVERAGE(
# NAME testrunner_coverage # New target name
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES testrunner # Dependencies to build first
# )
function(SETUP_TARGET_FOR_COVERAGE)
set(options NONE)
set(oneValueArgs NAME)
set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT LCOV_PATH)
message(FATAL_ERROR "lcov not found! Aborting...")
endif() # NOT LCOV_PATH
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif() # NOT GENHTML_PATH
# Setup target
add_custom_target(${Coverage_NAME}
# Cleanup lcov
COMMAND ${LCOV_PATH} --directory . --zerocounters
COMMAND rm -f ${PROJECT_BINARY_DIR}/${Coverage_NAME}.txt
# Create baseline to make sure untouched files show up in the report
COMMAND ${LCOV_PATH} -b ${CMAKE_CURRENT_SOURCE_DIR} -no-external -c -i -d ${CMAKE_CURRENT_BINARY_DIR} -o ${Coverage_NAME}.base
# Run tests
COMMAND ${Coverage_EXECUTABLE}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} -b ${CMAKE_CURRENT_SOURCE_DIR} -no-external --directory . --capture --output-file ${Coverage_NAME}.info
# add baseline counters
COMMAND ${LCOV_PATH} -b ${CMAKE_CURRENT_SOURCE_DIR} -no-external -a ${Coverage_NAME}.base -a ${Coverage_NAME}.info --output-file ${Coverage_NAME}.total
COMMAND ${LCOV_PATH} --remove ${Coverage_NAME}.total ${COVERAGE_EXCLUDES} --output-file ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned
COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned
| grep -A 3 "Overall coverage rate" | grep lines | cut -d ":" -f 2 | cut -d "." -f 1
> ${PROJECT_BINARY_DIR}/${Coverage_NAME}.txt
COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.info ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned
# COMMAND echo bar OUTPUT_VARIABLE FOO)
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
endfunction() # SETUP_TARGET_FOR_COVERAGE
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# SETUP_TARGET_FOR_COVERAGE_COBERTURA(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# )
function(SETUP_TARGET_FOR_COVERAGE_COBERTURA)
set(options NONE)
set(oneValueArgs NAME)
set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Combine excludes to several -e arguments
set(COBERTURA_EXCLUDES "")
foreach(EXCLUDE ${COVERAGE_EXCLUDES})
set(COBERTURA_EXCLUDES "-e ${EXCLUDE} ${COBERTURA_EXCLUDES}")
endforeach()
add_custom_target(${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE}
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} ${COBERTURA_EXCLUDES}
-o ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
)
endfunction() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
function(APPEND_COVERAGE_COMPILER_FLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endfunction() # APPEND_COVERAGE_COMPILER_FLAGS
......@@ -7,10 +7,10 @@
# LIBFABRIC_LIBRARY - Path to the library
# LIBFABRIC_INCLUDE_DIR - Path to the include dir
cmake_minimum_required(VERSION 2.6)
find_path(LIBFABRIC_INCLUDE_DIR fabric.h HINT ENV LIBFABRIC_INCLUDE_DIR)
get_filename_component(LIBFABRIC_INCLUDE_DIR ${LIBFABRIC_INCLUDE_DIR} DIRECTORY)
find_path(LIBFABRIC_INCLUDE_DIR "rdma/fabric.h" HINT ENV LIBFABRIC_INCLUDE_DIR)
if(NOT LIBFABRIC_INCLUDE_DIR)
message(FATAL_ERROR "Could not find libfabric include directory that contains 'rdma/fabric.h'")
endif()
find_library(LIBFABRIC_LIBRARY fabric)
......
# Find the Python NumPy package
# PYTHON_NUMPY_INCLUDE_DIR
# PYTHON_NUMPY_FOUND
# will be set by this script
cmake_minimum_required(VERSION 2.6)
if(NOT Python3_EXECUTABLE)
if(NumPy_FIND_QUIETLY)
find_package(Python3 QUIET)
else()
find_package(Python3)
set(__numpy_out 1)
endif()
endif()
if (Python3_EXECUTABLE)
# Find out the include path
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c
"from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
OUTPUT_VARIABLE __numpy_path)
# And the version
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c
"from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
OUTPUT_VARIABLE __numpy_version)
elseif(__numpy_out)
message(STATUS "Python executable not found.")
endif(Python3_EXECUTABLE)
find_path(PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h
HINTS "${__numpy_path}" "${PYTHON_INCLUDE_PATH}" NO_DEFAULT_PATH)
if(PYTHON_NUMPY_INCLUDE_DIR)
set(PYTHON_NUMPY_FOUND 1 CACHE INTERNAL "Python numpy found")
endif(PYTHON_NUMPY_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NumPy REQUIRED_VARS PYTHON_NUMPY_INCLUDE_DIR
VERSION_VAR __numpy_version)
\ No newline at end of file
# ~~~
# Copyright 2019 Google LLC
#
# 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
#
# https://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.
# ~~~
#[=======================================================================[.rst:
FindProtobufWithTargets
-------------------
A module to use ``Protobuf`` with less complications.
Using ``find_package(Protobuf)`` should be simple, but it is not.
CMake provides a ``FindProtobuf`` module. Unfortunately it does not generate
``protobuf::*`` targets until CMake-3.9, and ``protobuf::protoc`` does not
appear until CMake-3.10.
The CMake-config files generated by ``protobuf`` always create these targets,
but on some Linux distributions (e.g. Fedora>=29, and openSUSE-Tumbleweed) there
are system packages for protobuf, but these packages are installed without the
CMake-config files. One must either use the ``FindProtobuf`` module, find the
libraries via ``pkg-config``, or find the libraries manually.
When the CMake-config files are installed they produce the same targets as
recent versions of ``FindProtobuf``. However, they do not produce the
``Protobuf_LIBRARY``, ``Protobuf_INCLUDE_DIR``, etc. that are generated by the
module. Furthermore, the ``protobuf::protoc`` library is not usable when loaded
from the CMake-config files: its ``IMPORTED_LOCATION`` variable is not defined.
This module is designed to provide a single, uniform, ``find_package()``
module that always produces the same outputs:
- It always generates the ``protobuf::*`` targets.
- It always defines ``ProtobufWithTargets_FOUND`` and
``ProtobufWithTargets_VERSION``.
- It *prefers* using the CMake config files if they are available.
- It fallsback on the ``FindProtobuf`` module if the config files are not found.
- It populates any missing targets and their properties.
The following ``IMPORTED`` targets are defined:
``protobuf::libprotobuf``
The protobuf library.
``protobuf::libprotobuf-lite``
The protobuf lite library.
``protobuf::libprotoc``
The protoc library.
``protobuf::protoc``
The protoc compiler.
Example:
.. code-block:: cmake
find_package(ProtobufWithTargets REQUIRED)
add_executable(bar bar.cc)
target_link_libraries(bar PRIVATE protobuf::libprotobuf)
#]=======================================================================]
if (protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"protobuf_USE_STATIC_LIBS = ${protobuf_USE_STATIC_LIBS}"
" ProtobufWithTargets = ${ProtobufWithTargets_FOUND}")
endif ()
# Always load thread support, even on Windows.
find_package(Threads REQUIRED)
# First try to use the ``protobufConfig.cmake`` or ``protobuf-config.cmake``
# file if it was installed. This is common on systems (or package managers)
# where protobuf was compiled and installed with `CMake`. Note that on Linux
# this *must* be all lowercase ``protobuf``, while on Windows it does not
# matter.
find_package(Protobuf CONFIG QUIET)
if (protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"Protobuf_FOUND = ${Protobuf_FOUND}"
" Protobuf_VERSION = ${Protobuf_VERSION}")
endif ()
if (NOT Protobuf_FOUND)
find_package(Protobuf QUIET)
endif ()
if (Protobuf_FOUND)
set(ProtobufWithTargets_FOUND 1)
set(ProtobufWithTargets_VERSION ${Protobuf_VERSION})
if (NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf INTERFACE IMPORTED)
set_property(
TARGET protobuf::libprotobuf PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${Protobuf_INCLUDE_DIR})
set_property(
TARGET protobuf::libprotobuf
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_LIBRARY}
Threads::Threads)
endif ()
if (NOT TARGET protobuf::libprotobuf-lite)
add_library(protobuf::libprotobuf-lite INTERFACE IMPORTED)
set_property(
TARGET protobuf::libprotobuf-lite
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Protobuf_INCLUDE_DIR})
set_property(
TARGET protobuf::libprotobuf-lite
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_LITE_LIBRARY}
Threads::Threads)
endif ()
if (NOT TARGET protobuf::libprotoc)
add_library(protobuf::libprotoc INTERFACE IMPORTED)
set_property(
TARGET protobuf::libprotoc PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${Protobuf_INCLUDE_DIR})
set_property(
TARGET protobuf::libprotoc
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ${Protobuf_PROTOC_LIBRARY}
Threads::Threads)
endif ()
if (NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
# Discover the protoc compiler location.
find_program(
_protobuf_PROTOC_EXECUTABLE
NAMES protoc
DOC "The Google Protocol Buffers Compiler")
if (protobuf_DEBUG)
message(
STATUS
"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"ProtobufWithTargets_FOUND = ${ProtobufWithTargets_FOUND}"
" ProtobufWithTargets_VERSION = ${ProtobufWithTargets_VERSION}"
" EXE = ${_protobuf_PROTOC_EXECUTABLE}")
endif ()
set_property(TARGET protobuf::protoc
PROPERTY IMPORTED_LOCATION ${_protobuf_PROTOC_EXECUTABLE})
set_property(
TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION_DEBUG
${_protobuf_PROTOC_EXECUTABLE})
set_property(
TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION_RELEASE
${_protobuf_PROTOC_EXECUTABLE})
unset(_protobuf_PROTOC_EXECUTABLE)
if (protobuf_DEBUG)
get_target_property(_protobuf_PROTOC_EXECUTABLE protobuf::protoc
IMPORTED_LOCATION)
message(
STATUS
"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"LOCATION=${_protobuf_PROTOC_EXECUTABLE}")
endif ()
endif ()
endif ()
if (protobuf_DEBUG)
message(
STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"ProtobufWithTargets_FOUND = ${ProtobufWithTargets_FOUND}"
" ProtobufWithTargets_VERSION = ${ProtobufWithTargets_VERSION}")
endif ()
if (protobuf_DEBUG)
message(
STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"ProtobufWithTargets_FOUND = ${ProtobufWithTargets_FOUND}"
" ProtobufWithTargets_VERSION = ${ProtobufWithTargets_VERSION}")
if (ProtobufWithTargets_FOUND)
foreach (_target protobuf::libprotobuf protobuf::libprotobuf-lite
protobuf::libprotoc)
if (NOT TARGET ${_target})
message(
STATUS
"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"target=${_target} is NOT a target")
endif ()
endforeach ()
unset(_target)
endif ()
endif ()
find_package_handle_standard_args(
ProtobufWithTargets REQUIRED_VARS ProtobufWithTargets_FOUND
ProtobufWithTargets_VERSION)
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPython
----------
Find Python interpreter, compiler and development environment (include
directories and libraries).
Three components are supported:
* ``Interpreter``: search for Python interpreter.
* ``Compiler``: search for Python compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries).
* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python COMPONENTS Interpreter Development)
This module looks preferably for version 3 of Python. If not found, version 2
is searched.
To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and
:module:`FindPython2` modules rather than this one.
.. note::
If components ``Interpreter`` and ``Development`` are both specified, this
module search only for interpreter with same platform architecture as the one
defined by ``CMake`` configuration. This contraint does not apply if only
``Interpreter`` component is specified.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :ref:`Imported Targets <Imported Targets>`
(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python::Interpreter``
Python interpreter. Target defined if component ``Interpreter`` is found.
``Python::Compiler``
Python compiler. Target defined if component ``Compiler`` is found.
``Python::Python``
Python library. Target defined if component ``Development`` is found.
``Python::NumPy``
NumPy Python library. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project
(see :ref:`Standard Variable Names <CMake Developer Standard Variable Names>`):
``Python_FOUND``
System has the Python requested components.
``Python_Interpreter_FOUND``
System has the Python interpreter.
``Python_EXECUTABLE``
Path to the Python interpreter.
``Python_INTERPRETER_ID``
A short string unique to the interpreter. Possible values include:
* Python
* ActivePython
* Anaconda
* Canopy
* IronPython
``Python_STDLIB``
Standard platform independent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``.
``Python_STDARCH``
Standard platform dependent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``.
``Python_SITELIB``
Third-party platform independent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``.
``Python_SITEARCH``
Third-party platform dependent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
``Python_Compiler_FOUND``
System has the Python compiler.
``Python_COMPILER``
Path to the Python compiler. Only offered by IronPython.
``Python_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
``Python_Development_FOUND``
System has the Python development artifacts.
``Python_INCLUDE_DIRS``
The Python include directories.
``Python_LIBRARIES``
The Python libraries.
``Python_LIBRARY_DIRS``
The Python library directories.
``Python_RUNTIME_LIBRARY_DIRS``
The Python runtime library directories.
``Python_VERSION``
Python version.
``Python_VERSION_MAJOR``
Python major version.
``Python_VERSION_MINOR``
Python minor version.
``Python_VERSION_PATCH``
Python patch version.
``Python_NumPy_FOUND``
System has the NumPy.
``Python_NumPy_INCLUDE_DIRS``
The NumPy include directries.
``Python_NumPy_VERSION``
The NumPy version.
Hints
^^^^^
``Python_ROOT_DIR``
Define the root directory of a Python installation.
``Python_USE_STATIC_LIBS``
* If not defined, search for shared libraries and static libraries in that
order.
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.
``Python_FIND_REGISTRY``
On Windows the ``Python_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables.
the ``Python_FIND_REGISTRY`` variable can be set to empty or one of the
following:
* ``FIRST``: Try to use registry before environment variables.
This is the default.
* ``LAST``: Try to use registry after environment variables.
* ``NEVER``: Never try to use registry.
``CMAKE_FIND_FRAMEWORK``
On OS X the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of
preference between Apple-style and unix-style package components.
.. note::
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
.. note::
If a Python virtual environment is configured, set variable
``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with
value ``LAST`` or ``NEVER`` to select it preferably.
Commands
^^^^^^^^
This module defines the command ``Python_add_library`` (when
:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
:command:`add_library`, but takes care of Python module naming rules
(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python::Python``::
Python_add_library (my_module MODULE src1.cpp)
If library type is not specified, ``MODULE`` is assumed.
#]=======================================================================]
set (_PYTHON_PREFIX Python)
if (DEFINED Python_FIND_VERSION)
set (_Python_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR})
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
else()
# iterate over versions in quiet and NOT required modes to avoid multiple
# "Found" messages and prematurally failure.
set (_Python_QUIETLY ${Python_FIND_QUIETLY})
set (_Python_REQUIRED ${Python_FIND_REQUIRED})
set (Python_FIND_QUIETLY TRUE)
set (Python_FIND_REQUIRED FALSE)
set (_Python_REQUIRED_VERSIONS 3 2)
set (_Python_REQUIRED_VERSION_LAST 2)
foreach (_Python_REQUIRED_VERSION_MAJOR IN LISTS _Python_REQUIRED_VERSIONS)
set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR})
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
if (Python_FOUND OR
_Python_REQUIRED_VERSION_MAJOR EQUAL _Python_REQUIRED_VERSION_LAST)
break()
endif()
# clean-up some CACHE variables to ensure look-up restart from scratch
foreach (_Python_ITEM IN LISTS _Python_CACHED_VARS)
unset (${_Python_ITEM} CACHE)
endforeach()
endforeach()
unset (Python_FIND_VERSION)
set (Python_FIND_QUIETLY ${_Python_QUIETLY})
set (Python_FIND_REQUIRED ${_Python_REQUIRED})
if (Python_FIND_REQUIRED OR NOT Python_FIND_QUIETLY)
# call again validation command to get "Found" or error message
find_package_handle_standard_args (Python HANDLE_COMPONENTS
REQUIRED_VARS ${_Python_REQUIRED_VARS}
VERSION_VAR Python_VERSION)
endif()
endif()
if (COMMAND __Python_add_library)
macro (Python_add_library)
__Python_add_library (Python ${ARGV})
endmacro()
endif()
unset (_PYTHON_PREFIX)
\ No newline at end of file
This diff is collapsed.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindPython3
-----------
Find Python 3 interpreter, compiler and development environment (include
directories and libraries).
Three components are supported:
* ``Interpreter``: search for Python 3 interpreter
* ``Compiler``: search for Python 3 compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries)
* ``NumPy``: search for NumPy include directories.
If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed.
To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` and ``NumPy``, specify all components at the same time::
find_package (Python3 COMPONENTS Interpreter Development)
This module looks only for version 3 of Python. This module can be used
concurrently with :module:`FindPython2` module to use both Python versions.
The :module:`FindPython` module can be used if Python version does not matter
for you.
.. note::
If components ``Interpreter`` and ``Development`` are both specified, this
module search only for interpreter with same platform architecture as the one
defined by ``CMake`` configuration. This contraint does not apply if only
``Interpreter`` component is specified.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :ref:`Imported Targets <Imported Targets>`
(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
``Python3::Interpreter``
Python 3 interpreter. Target defined if component ``Interpreter`` is found.
``Python3::Compiler``
Python 3 compiler. Target defined if component ``Compiler`` is found.
``Python3::Python``
Python 3 library. Target defined if component ``Development`` is found.
``Python3::NumPy``
NumPy library for Python 3. Target defined if component ``NumPy`` is found.
Result Variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project
(see :ref:`Standard Variable Names <CMake Developer Standard Variable Names>`):
``Python3_FOUND``
System has the Python 3 requested components.
``Python3_Interpreter_FOUND``
System has the Python 3 interpreter.
``Python3_EXECUTABLE``
Path to the Python 3 interpreter.
``Python3_INTERPRETER_ID``
A short string unique to the interpreter. Possible values include:
* Python
* ActivePython
* Anaconda
* Canopy
* IronPython
``Python3_STDLIB``
Standard platform independent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``.
``Python3_STDARCH``
Standard platform dependent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``.
``Python3_SITELIB``
Third-party platform independent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``.
``Python3_SITEARCH``
Third-party platform dependent installation directory.
Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
``Python3_Compiler_FOUND``
System has the Python 3 compiler.
``Python3_COMPILER``
Path to the Python 3 compiler. Only offered by IronPython.
``Python3_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
``Python3_Development_FOUND``
System has the Python 3 development artifacts.
``Python3_INCLUDE_DIRS``
The Python 3 include directories.
``Python3_LIBRARIES``
The Python 3 libraries.
``Python3_LIBRARY_DIRS``
The Python 3 library directories.
``Python3_RUNTIME_LIBRARY_DIRS``
The Python 3 runtime library directories.
``Python3_VERSION``
Python 3 version.
``Python3_VERSION_MAJOR``
Python 3 major version.
``Python3_VERSION_MINOR``
Python 3 minor version.
``Python3_VERSION_PATCH``
Python 3 patch version.
``Python3_NumPy_FOUND``
System has the NumPy.
``Python3_NumPy_INCLUDE_DIRS``
The NumPy include directries.
``Python3_NumPy_VERSION``
The NumPy version.
Hints
^^^^^
``Python3_ROOT_DIR``
Define the root directory of a Python 3 installation.
``Python3_USE_STATIC_LIBS``
* If not defined, search for shared libraries and static libraries in that
order.
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.
``Python3_FIND_REGISTRY``
On Windows the ``Python3_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables.
the ``Python3_FIND_REGISTRY`` variable can be set to empty or one of the
following:
* ``FIRST``: Try to use registry before environment variables.
This is the default.
* ``LAST``: Try to use registry after environment variables.
* ``NEVER``: Never try to use registry.
``CMAKE_FIND_FRAMEWORK``
On OS X the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of
preference between Apple-style and unix-style package components.
.. note::
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
.. note::
If a Python virtual environment is configured, set variable
``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with
value ``LAST`` or ``NEVER`` to select it preferably.
Commands
^^^^^^^^
This module defines the command ``Python3_add_library`` (when
:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
:command:`add_library`, but takes care of Python module naming rules
(only applied if library is of type ``MODULE``), and adds a dependency to target
``Python3::Python``::
Python3_add_library (my_module MODULE src1.cpp)
If library type is not specified, ``MODULE`` is assumed.
#]=======================================================================]
set (_PYTHON_PREFIX Python3)
set (_Python3_REQUIRED_VERSION_MAJOR 3)
include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake)
if (COMMAND __Python3_add_library)
macro (Python3_add_library)
__Python3_add_library (Python3 ${ARGV})
endmacro()
endif()
unset (_PYTHON_PREFIX)
\ No newline at end of file
# FindRdKafka
# -------------
#
# Tries to find RdKafka on the system
#
# Available variables
# RDKAFKA_LIBRARIES - Path to the library
# RDKAFKA_INCLUDE_DIR - Path to the include dir
cmake_minimum_required(VERSION 3.7)
find_path(RDKAFKA_INCLUDE_DIR librdkafka/rdkafka.h HINTS ${RdKafka_DIR}/include)
find_library(RDKAFKA_LIBRARIES rdkafka++ HINTS ${RdKafka_DIR}/lib ${RdKafka_DIR}/lib64)
find_library(RDKAFKA_C_LIBRARIES rdkafka HINTS ${RdKafka_DIR}/lib ${RdKafka_DIR}/lib64)
IF(WIN32)
find_path(RDKAFKA_BIN_DIR rdkafka++.dll HINTS ${RdKafka_DIR}/bin ${RdKafka_DIR}/lib)
mark_as_advanced(RDKAFKA_BIN_DIR)
find_package_handle_standard_args(RdKafka REQUIRED_VARS RDKAFKA_INCLUDE_DIR RDKAFKA_C_LIBRARIES RDKAFKA_LIBRARIES RDKAFKA_BIN_DIR)
ELSE()
find_package_handle_standard_args(RdKafka REQUIRED_VARS RDKAFKA_INCLUDE_DIR RDKAFKA_C_LIBRARIES RDKAFKA_LIBRARIES)
ENDIF()
mark_as_advanced(RDKAFKA_LIBRARIES RDKAFKA_INCLUDE_DIR)
# ~~~
# Copyright 2019 Google LLC
#
# 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
#
# https://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.
# ~~~
#[=======================================================================[.rst:
FindgRPC
--------
Locate and configure the ``gRPC`` library.
The following variables can be set and are optional:
``gRPC_DEBUG``
Show debug messages.
``gRPC_USE_STATIC_LIBS``
Set to ON to force the use of the static libraries.
Default is OFF.
Defines the following variables:
``gRPC_FOUND``
Found the gRPC library
``gRPC_VERSION``
Version of package found.
The following ``IMPORTED`` targets are also defined:
``gRPC::grpc++``
The gRPC C++ library.
``gRPC::grpc``
The gRPC C core library.
``gRPC::cpp_plugin``
The C++ plugin for the Protobuf protoc compiler.
The following cache variables are also available to set or use:
Example:
.. code-block:: cmake
find_package(gRPC REQUIRED)
add_executable(bar bar.cc)
target_link_libraries(bar PRIVATE gRPC::grpc++)
#]=======================================================================]
if (gRPC_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"gRPC_USE_STATIC_LIBS = ${gRPC_USE_STATIC_LIBS}"
" gRPC_FOUND = ${gRPC_FOUND}")
endif ()
# gRPC always requires Thread support.
find_package(Threads REQUIRED)
# Load the module to find protobuf with proper targets. Do not use
# `find_package()` because we (have to) install this module in non-standard
# locations.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_package(ProtobufWithTargets)
# The gRPC::grpc_cpp_plugin target is sometimes defined, but without a
# IMPORTED_LOCATION
function (_grpc_fix_grpc_cpp_plugin_target)
# The target may already exist, do not create it again if it does.
if (NOT TARGET gRPC::grpc_cpp_plugin)
add_executable(gRPC::grpc_cpp_plugin IMPORTED)
endif ()
get_target_property(_gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
IMPORTED_LOCATION)
if (gRPC_DEBUG)
message(
STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"LOCATION=${_gRPC_CPP_PLUGIN_EXECUTABLE}")
endif ()
# Even if the target exists, gRPC CMake support files do not define the
# executable for the imported target (at least they do not in v1.19.1), so
# we need to define it ourselves.
if (NOT _gRPC_CPP_PLUGIN_EXECUTABLE)
find_program(_gRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin
DOC "The gRPC C++ plugin for protoc")
mark_as_advanced(_gRPC_CPP_PLUGIN_EXECUTABLE)
if (_gRPC_CPP_PLUGIN_EXECUTABLE)
set_property(
TARGET gRPC::grpc_cpp_plugin
PROPERTY IMPORTED_LOCATION ${_gRPC_CPP_PLUGIN_EXECUTABLE})
else ()
set(gRPC_FOUND "grpc_cpp_plugin-NOTFOUND")
endif ()
endif ()
endfunction ()
# The gRPC::* targets sometimes lack the right definitions to compile cleanly on
# WIN32
function (_grpc_fix_grpc_target_definitions)
# Including gRPC headers without this definition results in a build error.
if (WIN32)
set_property(
TARGET gRPC::grpc
APPEND
PROPERTY INTERFACE_COMPILE_DEFINITIONS _WIN32_WINNT=0x600)
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY INTERFACE_COMPILE_DEFINITIONS _WIN32_WINNT=0x600)
endif ()
endfunction ()
# First try to use the `gRPCConfig.cmake` or `grpc-config.cmake` file if it was
# installed. This is common on systems (or package managers) where gRPC was
# compiled and installed with `CMake`.
find_package(gRPC NO_MODULE QUIET)
if (gRPC_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"NO_MODULE result gRPC_FOUND = ${gRPC_FOUND}")
endif ()
if (gRPC_FOUND)
_grpc_fix_grpc_cpp_plugin_target()
_grpc_fix_grpc_target_definitions()
return()
endif ()
include(SelectLibraryConfigurations)
# Internal function: search for normal library as well as a debug one if the
# debug one is specified also include debug/optimized keywords in *_LIBRARIES
# variable
function (_gRPC_find_library name filename)
if (${name}_LIBRARY)
# Use result recorded by a previous call.
return()
else ()
find_library(${name}_LIBRARY_RELEASE NAMES ${filename})
mark_as_advanced(${name}_LIBRARY_RELEASE)
find_library(${name}_LIBRARY_DEBUG NAMES ${filename}d ${filename})
mark_as_advanced(${name}_LIBRARY_DEBUG)
select_library_configurations(${name})
if (gRPC_DEBUG)
message(
STATUS
"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"${name} ${filename} RELEASE=${${name}_LIBRARY}"
" DEBUG=${${name}_LIBRARY_DEBUG} DEFAULT=${${name}_LIBRARY}"
)
endif ()
set(${name}_LIBRARY
"${${name}_LIBRARY}"
PARENT_SCOPE)
endif ()
endfunction ()
#
# Main
#
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
if (_gRPC_USE_STATIC_LIBS)
set(_gRPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if (WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else ()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif ()
endif ()
_grpc_find_library(_gRPC_grpc grpc)
_grpc_find_library(_gRPC_grpc++ grpc++)
if (NOT _gRPC_INCLUDE_DIR)
find_path(_gRPC_INCLUDE_DIR grpcpp/grpcpp.h)
mark_as_advanced(_gRPC_INCLUDE_DIR)
endif ()
if (gRPC_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
" _gRPC_grpc_LIBRARY = ${_gRPC_grpc_LIBRARY}")
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
" _gRPC_grpc++_LIBRARY = ${_gRPC_grpc++_LIBRARY}")
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
" _gRPC_INCLUDE_DIR = ${_gRPC_INCLUDE_DIR}")
endif ()
if (_gRPC_grpc_LIBRARY)
if (NOT TARGET gRPC::grpc)
add_library(gRPC::grpc UNKNOWN IMPORTED)
set_target_properties(
gRPC::grpc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${_gRPC_INCLUDE_DIR}")
if (EXISTS "${_gRPC_grpc_LIBRARY}")
set_target_properties(gRPC::grpc PROPERTIES IMPORTED_LOCATION
"${_gRPC_grpc_LIBRARY}")
endif ()
if (EXISTS "${_gRPC_grpc_LIBRARY_RELEASE}")
set_property(
TARGET gRPC::grpc
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(
gRPC::grpc PROPERTIES IMPORTED_LOCATION_RELEASE
"${_gRPC_grpc_LIBRARY_RELEASE}")
endif ()
if (EXISTS "${_gRPC_grpc_LIBRARY_DEBUG}")
set_property(
TARGET gRPC::grpc
APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(
gRPC::grpc PROPERTIES IMPORTED_LOCATION_DEBUG
"${_gRPC_grpc_LIBRARY_DEBUG}")
endif ()
set_property(
TARGET gRPC::grpc
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES protobuf::libprotobuf
Threads::Threads)
endif ()
endif ()
if (_gRPC_grpc++_LIBRARY)
if (NOT TARGET gRPC::grpc++)
add_library(gRPC::grpc++ UNKNOWN IMPORTED)
set_target_properties(
gRPC::grpc++ PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${_gRPC++_INCLUDE_DIR}")
if (EXISTS "${_gRPC_grpc++_LIBRARY}")
set_target_properties(
gRPC::grpc++ PROPERTIES IMPORTED_LOCATION
"${_gRPC_grpc++_LIBRARY}")
endif ()
if (EXISTS "${_gRPC_grpc++_LIBRARY_RELEASE}")
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(
gRPC::grpc++ PROPERTIES IMPORTED_LOCATION_RELEASE
"${_gRPC_grpc++_LIBRARY_RELEASE}")
endif ()
if (EXISTS "${_gRPC_grpc++_LIBRARY_DEBUG}")
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(
gRPC::grpc++ PROPERTIES IMPORTED_LOCATION_DEBUG
"${_gRPC_grpc++_LIBRARY_DEBUG}")
endif ()
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES gRPC::grpc protobuf::libprotobuf
Threads::Threads)
if (CMAKE_VERSION VERSION_GREATER 3.8)
# gRPC++ requires C++14 (soon), but only CMake-3.8 introduced a
# compiler feature to meet that requirement.
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_14)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# CMake 3.5 is still alive and kicking in some older distros, use
# the compiler-specific versions in these cases.
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS "-std=c++14")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_property(
TARGET gRPC::grpc++
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS "-std=c++14")
else ()
message(
WARNING
"gRPC::grpc++ requires C++14, but this module"
" (${CMAKE_CURRENT_LIST_FILE})"
" cannot enable it for the library target in your CMake and"
" compiler versions. You need to enable C++14 in the"
" CMakeLists.txt for your project. Consider filing a bug"
" so we can fix this problem.")
endif ()
endif ()
endif ()
# Restore original find library prefixes
if (_gRPC_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_PREFIXES "${_gRPC_ORIG_FIND_LIBRARY_PREFIXES}")
endif ()
file(
WRITE "${CMAKE_BINARY_DIR}/get_gRPC_version.cc"
[====[
#include <grpcpp/grpcpp.h>
#include <iostream>
int main() {
std::cout << grpc::Version(); // no newline to simplify CMake module
return 0;
}
]====])
try_run(
_gRPC_GET_VERSION_STATUS
_gRPC_GET_VERSION_COMPILE_STATUS
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/get_gRPC_version.cc"
LINK_LIBRARIES
gRPC::grpc++
gRPC::grpc
COMPILE_OUTPUT_VARIABLE _gRPC_GET_VERSION_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE gRPC_VERSION)
file(REMOVE "${CMAKE_BINARY_DIR}/get_gRPC_version.cc")
_grpc_fix_grpc_cpp_plugin_target()
if (gRPC_DEBUG)
foreach (
_var
_gRPC_CPP_PLUGIN_EXECUTABLE
_gRPC_VERSION_RAW
_gRPC_GET_VERSION_STATUS
_gRPC_GET_VERSION_COMPILE_STATUS
_gRPC_GET_VERSION_COMPILE_OUTPUT
_gRPC_grpc_LIBRARY
_gRPC_grpc++_LIBRARY
_gRPC_INCLUDE_DIR)
message(
STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"${_var} = ${${_var}}")
endforeach ()
unset(_var)
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
gRPC
REQUIRED_VARS _gRPC_grpc_LIBRARY _gRPC_INCLUDE_DIR
VERSION_VAR gRPC_VERSION)
......@@ -77,4 +77,4 @@ macro(select_library_configurations basename)
mark_as_advanced( ${basename}_LIBRARY_RELEASE
${basename}_LIBRARY_DEBUG
)
endmacro()
\ No newline at end of file
endmacro()
......@@ -18,9 +18,8 @@ if (( coverage < ASAPO_MINIMUM_COVERAGE )); then
echo "*****"
echo
echo ${TARGET} coverage is ${coverage}% - less than required ${ASAPO_MINIMUM_COVERAGE}%
echo
echo
echo "*****"
echo
exit 1
fi
......@@ -29,9 +29,8 @@ if (( coverage < ASAPO_MINIMUM_COVERAGE )); then
echo "*****"
echo
echo coverage is ${coverage}% - less than required ${ASAPO_MINIMUM_COVERAGE}%
echo
echo
echo "*****"
echo
exit 1
fi
......@@ -4,6 +4,7 @@ function(prepare_asapo)
get_target_property(DISCOVERY_FULLPATH asapo-discovery EXENAME)
get_target_property(AUTHORIZER_FULLPATH asapo-authorizer EXENAME)
get_target_property(FILE_TRANSFER_FULLPATH asapo-file-transfer EXENAME)
get_target_property(MONITORING_SERVER_FULLPATH asapo-monitoring-server EXENAME)
get_target_property(BROKER_FULLPATH asapo-broker EXENAME)
set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
......@@ -32,12 +33,19 @@ function(prepare_asapo)
else()
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/settings/receiver_tcp.json.tpl.lin.in receiver_tcp.json.tpl @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/settings/receiver_fabric.json.tpl.lin.in receiver_fabric.json.tpl @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/settings/receiver_kafka.json.tpl.lin.in receiver_kafka.json.tpl @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/settings/authorizer_settings.json.tpl.lin authorizer.json.tpl COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/settings/monitoring_server_settings.json.tpl monitoring_server.json.tpl COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/nomad/monitoring.nmd.in monitoring.nmd @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/common_scripts/start_services.sh start_services.sh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/common_scripts/stop_services.sh stop_services.sh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/nomad/receiver_tcp.nmd.in receiver_tcp.nmd @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/nomad/receiver_fabric.nmd.in receiver_fabric.nmd @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/nomad/receiver_kafka.nmd.in receiver_kafka.nmd @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/nomad/nginx_kill_lin.nmd nginx_kill.nmd @ONLY)
endif()
......
......@@ -16,39 +16,64 @@ set (TOKENS "${TOKENS};BT_AAA_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGk
set (TOKENS "${TOKENS};BT_TEST_RUN_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjMTk0NjYzaXB0Mzdma2w0YmVrMCIsInN1YiI6ImJ0X3Rlc3RfcnVuIiwiRXh0cmFDbGFpbXMiOnsiQWNjZXNzVHlwZXMiOlsicmVhZCJdfX0.QJjoGOlzMvOUk7dK2bbDgSEM5-1mO6wmpmESYL6McdU")
set (TOKENS "${TOKENS};BT_TEST_RUN_RW_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjMjlzNDByaXB0M2JuczJtaTA1MCIsInN1YiI6ImJ0X3Rlc3RfcnVuIiwiRXh0cmFDbGFpbXMiOnsiQWNjZXNzVHlwZXMiOlsicmVhZCIsIndyaXRlIl19fQ.vwOak8smIF23TaRo5KzRgvA8d_fPLKnd9dXglMsm7d8")
function(add_coverage_targets)
find_program(GENHTML genhtml REQUIRED)
set(coverage_report_dir "${CMAKE_BINARY_DIR}/reports/coverage")
message(STATUS "coverage_report_dir=${coverage_report_dir}")
set(FASTCOV_CMD ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/3d_party/fastcov/fastcov.py)
set(LCOV_TO_COBERTURA_CMD ${Python_EXECUTABLE}
${CMAKE_SOURCE_DIR}/3d_party/lcov-to-cobertura-xml/lcov_cobertura/lcov_cobertura.py)
add_custom_target(
coverage_generate_report
COMMAND ${CMAKE_COMMAND} -E make_directory ${coverage_report_dir}
COMMAND ${FASTCOV_CMD} --process-gcno --gcov gcov --dump-statistic
--lcov -o "${coverage_report_dir}/cov.info"
--exclude "/usr/include/" "/usr/local/" "tests/" "unittests/" "3d_party/"
COMMAND ${GENHTML} "${coverage_report_dir}/cov.info" -o "${coverage_report_dir}"
COMMAND ${LCOV_TO_COBERTURA_CMD} "${coverage_report_dir}/cov.info"
--output "${coverage_report_dir}/coverage.xml"
--demangle --base-dir="${CMAKE_SOURCE_DIR}" --excludes "${CMAKE_BINARY_DIR}"
VERBATIM
)
add_custom_target(
coverage_reset_counters
COMMAND ${FASTCOV_CMD} --zerocounters
VERBATIM
)
endfunction()
if (BUILD_TESTS)
set(ASAPO_MINIMUM_COVERAGE 70)
find_package(GTest REQUIRED)
set(GTEST_LIBS GTest::gmock GTest::gmock_main)
add_definitions(-DUNIT_TESTS)
find_package(Threads)
find_program(MEMORYCHECK_COMMAND valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS
"--trace-children=yes --leak-check=full --error-exitcode=1 --suppressions=${CMAKE_SOURCE_DIR}/tests/valgrind.suppressions")
if (NOT "$ENV{gtest_SOURCE_DIR}" STREQUAL "")
set(gtest_SOURCE_DIR $ENV{gtest_SOURCE_DIR})
endif ()
message(STATUS "Will look for google test at ${gtest_SOURCE_DIR}")
if (CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
endif ()
"--trace-children=yes --leak-check=full --error-exitcode=1 --num-callers=20 --suppressions=${CMAKE_SOURCE_DIR}/tests/valgrind.suppressions")
if (ENABLE_COVERAGE)
if (CMAKE_COMPILER_IS_GNUCXX)
set(COVERAGE_COMPILER_FLAGS "-g -O0 --coverage" CACHE INTERNAL "")
list(APPEND CMAKE_C_FLAGS "${COVERAGE_COMPILER_FLAGS}")
list(APPEND CMAKE_CXX_FLAGS "${COVERAGE_COMPILER_FLAGS}")
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
add_coverage_targets()
endif ()
endif()
endif ()
#TODO: Call add_plain_unit_test in gtest
function(add_plain_unit_test target test_source_files linktarget)
if (BUILD_TESTS)
include_directories(SYSTEM ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
link_directories(${gtest_SOURCE_DIR}/lib)
add_executable(test-${target} ${test_source_files})
if (NOT ${libs} STREQUAL "")
target_link_libraries(test-${target} ${libs})
endif ()
IF (WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(GTEST_LIBS gtestd gtest_maind gmockd)
ELSE ()
set(GTEST_LIBS gtest gmock gtest_main)
ENDIF (WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
target_link_libraries(test-${target} ${GTEST_LIBS} ${CMAKE_THREAD_LIBS_INIT})
GET_PROPERTY(ASAPO_COMMON_IO_LIBRARIES GLOBAL PROPERTY ASAPO_COMMON_IO_LIBRARIES)
......@@ -67,32 +92,18 @@ endfunction()
function(gtest target test_source_files linktarget)
if (BUILD_TESTS)
include_directories(SYSTEM ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
link_directories(${gtest_SOURCE_DIR}/lib)
unset(libs)
FOREACH (lib ${linktarget})
if (NOT ${lib} STREQUAL "")
get_target_property(target_type ${lib} TYPE)
if (target_type STREQUAL "OBJECT_LIBRARY")
list(APPEND OBJECT "$<TARGET_OBJECTS:${lib}>")
else ()
list(APPEND libs "${lib}")
endif ()
list(APPEND libs "${lib}")
endif ()
ENDFOREACH ()
add_executable(test-${target} ${test_source_files} ${OBJECT})
add_executable(test-${target} ${test_source_files})
if (NOT ${libs} STREQUAL "")
if (libs)
target_link_libraries(test-${target} ${libs})
endif ()
IF (WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(GTEST_LIBS gtestd gtest_maind gmockd)
ELSE ()
set(GTEST_LIBS gtest gmock gtest_main)
ENDIF (WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
target_link_libraries(test-${target} ${GTEST_LIBS} ${CMAKE_THREAD_LIBS_INIT})
GET_PROPERTY(ASAPO_COMMON_IO_LIBRARIES GLOBAL PROPERTY ASAPO_COMMON_IO_LIBRARIES)
......@@ -105,28 +116,7 @@ function(gtest target test_source_files linktarget)
add_test(NAME test-${target} COMMAND test-${target})
set_tests_properties(test-${target} PROPERTIES LABELS "unit;all")
message(STATUS "Added test 'test-${target}'")
if (ARGN)
LIST(GET ARGN 0 NOCOV)
endif()
if (CMAKE_COMPILER_IS_GNUCXX AND NOT 1${NOCOV} STREQUAL "1nocov")
set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" "*/python/*")
if (ARGN)
set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN})
endif ()
SETUP_TARGET_FOR_COVERAGE(NAME coverage-${target} EXECUTABLE test-${target} ${target})
add_test(NAME coveragetest-${target}
COMMAND ${PROJECT_SOURCE_DIR}/CMakeModules/check_test.sh
coverage-${target} ${CMAKE_BINARY_DIR} ${ASAPO_MINIMUM_COVERAGE})
set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all")
message(STATUS "Added test 'test-${target}-coverage'")
SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target})
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
endif ()
add_memory_test(${target} test-${target} "" "" "unit")
endif ()
endfunction()
......
......@@ -6,13 +6,14 @@ if (BUILD_TESTS)
set(ASAPO_MINIMUM_COVERAGE 80)
find_program(MEMORYCHECK_COMMAND valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS
"--trace-children=yes --leak-check=full --error-exitcode=1 --suppressions=${CMAKE_SOURCE_DIR}/tests/valgrind.suppressions")
"--trace-children=yes --leak-check=full --error-exitcode=1 --num-callers=20 --suppressions=${CMAKE_SOURCE_DIR}/tests/valgrind.suppressions")
endif ()
function(gotest target source_dir test_source_files)
if (BUILD_TESTS)
add_test(NAME test-${target} COMMAND go test ${test_source_files}
WORKING_DIRECTORY ${source_dir})
set_tests_properties(test-${target} PROPERTIES LABELS "unit;all")
message(STATUS "Added test 'test-${target}'")
if (CMAKE_COMPILER_IS_GNUCXX)
add_test(NAME coveragetest-${target}
......
# Contributing
Contributions are welcome! Before submitting a merge request, do the followings:
- Run `pre-commit run -a` to make sure that all files are correctly formated.
For more information on architecture decisions made for the development of `ASAP::O`,
check the [ADRs](docs/contributing/architecture/decisions/README.md) (Architecture
Decision Records).