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 800 additions and 2105 deletions
## 21.09.0 (in progress)
## Develop
See [documentation](docs/site/changelog/Develop.md).
## 22.10.0
IMPROVEMENTS
* Clients try to use ethernet over infiniband if available to retrieve data from the receiver.
BUILD CHANGES
* Repository and CI moved to DESY Gitlab.
## 22.03.0
FEATURES
* Monitoring: Added detailed monitoring and pipeline visualization
* Consumer API: return kDataNotInCache/AsapoDataNotInCacheError error if data is not in cache and cannot be on disk (due to the ingest mode producer used)
IMPROVEMENTS
* renamed and hid C++ macros from client code
BUG FIXES
* Producer API: fixed bug segfault in Python code when sending data object which memory is from some other object
VERSION COMPATIBILITY
* Previous C consumer & producer clients will break due to two extra parameters for instance id and pipeline step id in *asapo_create_source_credentials*.
INTERNAL
* Do not return error when receiver cannot get slot in shared cache - just allocate own memory slot
## 21.12.0
FEATURES
* Consumer API: Get last within consumer group returns message only once
* Producer API: An option to write raw data to core filesystem directly
* Consumer/Producer API - packages for Debian 11.1, wheel for Python 3.9
* Consumer/Producer API - dropped Python 2 support for wheels and packages for new Debian/CentOS versions
INTERNAL
* Improved logging - tags for beamline, beamtime, ...
* Updated orchestration tools to latest version
## 21.09.0
FEATURES
* Producer API: C client
* Introduce a token to send data in "raw" mode without LDAP authorization
* Introduce a token to send data in "raw" mode without LDAP authorization
IMPROVEMENTS
* Allow using ASAPO for commissioning beamtimes
* Implement token revocation
* Updated website
BUG FIXES
* Consumer/Producer API: fixed bug with "_" in stream name
INTERNAL
* Improved authoriation service caching
* Added profiling for Go services
* Added metrics and alerts for asapo services
## 21.06.0
FEATURES
* Consumer API: C client
* Producer API: An option to automatically generate message id (use sparingly, reduced performance possible)
* Consumer API: C client
* Producer API: An option to automatically generate message id (use sparingly, reduced performance possible)
IMPROVEMENTS
* Consumer/Producer API - allow any characters in source/stream/group names
* Consumer/Producer API - introduce stream metadata
* Consumer API - an option to auto discovery of data folder when consumer client uses file transfer service (has_filesystem=False)
* Improved build procedure - shared libaries, added pkg-config and cmake config for asapo clients
* Improved build procedure - shared libaries, added pkg-config and cmake config for asapo clients
BUG FIXES
* Consumer API: multiple consumers from same group receive stream finished error
* Consumer API: return ServiceUnavailable instead of Unauthorized in case an authorization service is unreachable
* Consumer API: multiple consumers from same group receive stream finished error
* Consumer API: return ServiceUnavailable instead of Unauthorized in case an authorization service is unreachable
## 21.03.3
BUG FIXES
* Consumer API: fix return error type when sending acknowledgement second time
* Consumer API: fix return error type when sending acknowledgement second time
* Producer API: fix GetStreamInfo/stream_info and GetLastStream/last_stream for datasets
## 21.03.2
FEATURES
* implemented possibility to delete stream (only metadata, not files yet)
* implemented possibility to delete stream (only metadata, not files yet)
IMPROVEMENTS
* Consumer API - retry file delivery/reading with timeout (can be useful for the case file arrives after was metadta ingested, e.g. for slow NFS transfer,...)
BUG FIXES
* Consumer API: fix race condition in GetStreamList/get_stream_list
* Producer API: fix segfault in send_stream_finished_flag
......@@ -50,10 +105,10 @@ BUG FIXES
## 21.03.0
IMPROVEMENTS
* Producer API - queue limits in Python, for C++ return original data in error custom data
* Producer API - queue limits in Python, for C++ return original data in error custom data
* Consumer API - add GetCurrentDatasetCount/get_current_dataset_count function with option to include or exclude incomplete datasets
* Consumer API - GetStreamList/get_stream_list - can filter finished/unfinished streams now
* Producer/Consumer API - StreamInfo structure/Python dictionary include more information (is stream finished or not, ...)
* Producer/Consumer API - StreamInfo structure/Python dictionary include more information (is stream finished or not, ...)
* Switch to JWT tokens (token has more symbols, expiration time, can be revoked and there are two type of tokens - with read/write access rights)
* Improved versioning. Producer/Consumer API - introduce GetVersionInfo/get_version_info, compatiblity check between clients and server
......@@ -69,9 +124,9 @@ FEATURES
IMPROVEMENTS
* Consumer API - change behavior of GetLast/get_last - do not change current pointer after call
* Consumer API - add interrupt_current_operation to allow interrupting (from a separate thread) long consumer operation
* Producer API - return original data in callback payload.
* Producer API - allow to set queue limits (number of pending requests and/or max memory), reject new requests if reached the limits
* Consumer API - add interrupt_current_operation to allow interrupting (from a separate thread) long consumer operation
* Producer API - return original data in callback payload.
* Producer API - allow to set queue limits (number of pending requests and/or max memory), reject new requests if reached the limits
* building rpm, deb and exe packages for client libs
BREAKING CHANGES
......@@ -84,7 +139,7 @@ BREAKING CHANGES
* use term `message` for blob of information we send around, rename related structs, parameters, ...
* C++ - get rid of duplicate functions with default stream
#### renaming - Producer API
* SendData/send_data -> Send/send
* SendData/send_data -> Send/send
* SendXX/send_xx -> swap parameters (stream to the end)
* id_in_subset -> dataset_substream
* subset_size -> dataset_size (and in general replace subset with dataset)
......@@ -102,10 +157,10 @@ BUG FIXES
## 20.09.1
FEATURES
* New function GetLastStream/last_stream in Producer API - returns info for a stream which was created last
* New function GetLastStream/last_stream in Producer API - returns info for a stream which was created last
IMPROVEMENTS
* Each message automatically gets a timestamp (nanoseconds from Linux epoch) at the moment it is being inserted to a database
* Each message automatically gets a timestamp (nanoseconds from Linux epoch) at the moment it is being inserted to a database
* GetStreamList/get_stream_list returns now sorted (by timestamp of the earliest message) list of streams. Parameter `from` allows to limit the list
BREAKING CHANGES
......@@ -114,7 +169,7 @@ BREAKING CHANGES
## 20.09.0
FEATURES
* implemented negative acknowledges and data redelivery - data will be redelivered automatically for get_next calls if it is not acknowledged during a given period or a consumer sent a negative acknowledge
* implemented negative acknowledges and data redelivery - data will be redelivered automatically for get_next calls if it is not acknowledged during a given period or a consumer sent a negative acknowledge
* introduced data source types - "raw" data is written to beamline filesystem and this can only be done from a certain IPs (detector PC,..),
"processed" data is written to core filesystem. File paths must now start with `raw/` or `processed/`
* Added RDMA support for the communication between consumer and receiver. (Improves transfer speeds while using less CPU resources)
......@@ -125,17 +180,17 @@ FEATURES
* Added new consumer broker API call 'CurrentConnectionType' to see what connection type is currently used
BUG FIXES
* fix data query images when beamtime_id starts with number
* fix data query images when beamtime_id starts with number
BREAKING CHANGES
* an extra parameter in producer constructor for data source type
* path of the files that are send from producer to asapo must start with `raw/` for raw source type or `processed/` for processed source type, otherwise the files will not be written and an error will be sent back
* path of the files that are send from producer to asapo must start with `raw/` for raw source type or `processed/` for processed source type, otherwise the files will not be written and an error will be sent back
## 20.06.3
BUG FIXES
* fix retrieve_data in Python modules for data ingested using metadata only mode
* fix asapo orchestration image stabilize nginx and update fluentd configuration to follow Nomad jobs log rotation
* fix asapo orchestration image stabilize nginx and update fluentd configuration to follow Nomad jobs log rotation
## 20.06.2
......
......@@ -10,9 +10,8 @@ if(ASTYLE_EXECUTABLE)
--max-instatement-indent=50 --pad-oper --align-pointer=type --quiet
"${PROJECT_SOURCE_DIR}/*.cpp" "${PROJECT_SOURCE_DIR}/*.h"
WORKING_DIRECTORY ..
VERBATIM
VERBATIM
)
else()
message(WARNING "Unable to find astyle. Code formatting will be skipped")
endif()
if(BUILD_PYTHON)
set(CMAKE_POLICY_DEFAULT_CMP0074 NEW) #allow use package_ROOT variable to find package
if (BUILD_PYTHON)
set(BUILD_PYTHON_PACKAGES "" CACHE STRING "which python packages to build")
set_property(CACHE BUILD_PYTHON_PACKAGES PROPERTY STRINGS source rpm deb win)
endif()
endif ()
set (CMAKE_PREFIX_PATH "${LIBCURL_DIR}")
find_package (CURL REQUIRED)
message (STATUS "Found cURL libraries: ${CURL_LIBRARIES}")
message (STATUS "cURL include: ${CURL_INCLUDE_DIRS}")
if(CURL_FOUND) #old FindCURL versions do not create CURL::libcurl target, so we do it here if CURL::libcurl is missing
if(NOT TARGET CURL::libcurl)
set(CMAKE_PREFIX_PATH "${LIBCURL_DIR}")
find_package(CURL REQUIRED)
message(STATUS "Found cURL libraries: ${CURL_LIBRARIES}")
message(STATUS "cURL include: ${CURL_INCLUDE_DIRS}")
if (CURL_FOUND) #old FindCURL versions do not create CURL::libcurl target, so we do it here if CURL::libcurl is missing
if (NOT TARGET CURL::libcurl)
add_library(CURL::libcurl UNKNOWN IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
set_target_properties(CURL::libcurl PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${CURL_LIBRARIES}")
endif()
endif()
endif ()
endif ()
if (NOT BUILD_CLIENTS_ONLY)
find_package(RdKafka REQUIRED)
message(STATUS "Found rdkafka++ libraries: ${RDKAFKA_LIBRARIES}")
message(STATUS "rdkafka++ include dir : ${RDKAFKA_INCLUDE_DIR}")
if (WIN32)
message(STATUS "rdkafka++ binary dir (dll): ${RDKAFKA_BIN_DIR}")
endif ()
endif ()
# python is needed anyway, even if no Python packages are build (e.g. to parse test results)
if ("${Python_EXECUTABLE}" STREQUAL "")
find_package (Python COMPONENTS Interpreter Development)
if (NOT Python_FOUND)
message (FATAL "Cannot find Python")
if(NOT Python_EXECUTABLE)
set(Python_EXECUTABLE $ENV{Python_EXECUTABLE})
endif()
if(NOT Python_EXECUTABLE)
set(python_components Interpreter)
if(BUILD_PYTHON)
list(APPEND python_components Development NumPy)
endif()
find_package(Python COMPONENTS REQUIRED ${python_components})
if (NOT Python_EXECUTABLE MATCHES "python3")
message(FATAL_ERROR "Expected python3, found ${Python_EXECUTABLE}")
endif ()
endif()
message (STATUS "Using Python: ${Python_EXECUTABLE}")
message(STATUS "Using Python: ${Python_EXECUTABLE}")
include(libfabric)
\ No newline at end of file
include(libfabric)
......@@ -32,10 +32,6 @@ ELSEIF(UNIX)
ENDIF(WIN32)
SET_PROPERTY(GLOBAL PROPERTY ASAPO_COMMON_IO_LIBRARIES ${ASAPO_COMMON_IO_LIBRARIES})
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DUNIT_TESTS)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (APPLE)
link_directories("/usr/local/lib")
endif()
\ No newline at end of file
endif()
......@@ -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_IN_DOCS ${ASAPO_TAG})
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()
string(REGEX REPLACE "\\.0([0-9]+)\\."
".\\1." ASAPO_WHEEL_VERSION_IN_DOCS
${ASAPO_VERSION_IN_DOCS})
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})
......
......@@ -3,20 +3,16 @@ project(ASAPO)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules/ ${PROJECT_SOURCE_DIR}/CMakeIncludes/)
set (ASAPO_VERSION_IN_DOCS 21.06.0) # is overwritten in master branch
set (ASAPO_EXAMPLES_DIR .)
#set (ASAPO_EXAMPLES_DIR ./frozen_versions/${ASAPO_VERSION_IN_DOCS})
#protocol version changes if one of the microservice API's change
set (ASAPO_CONSUMER_PROTOCOL "v0.4")
set (ASAPO_PRODUCER_PROTOCOL "v0.4")
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.4")
set (ASAPO_BROKER_API_VER "v0.7")
set (ASAPO_FILE_TRANSFER_SERVICE_API_VER "v0.2")
set (ASAPO_RECEIVER_API_VER "v0.4")
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
......@@ -26,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)
......@@ -46,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)
......@@ -68,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)
......@@ -89,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)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# 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)
This diff is collapsed.
......@@ -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