Reorganize repository

* Move the project top-level CMakeLists.txt to the root of the project;
  this allows building Cyclone as part of ROS2 without any special
  tricks;

* Clean up the build options:

  ENABLE_SSL:    whether to check for and include OpenSSL support if a
                 library can be found (default = ON); this used to be
                 called DDSC_ENABLE_OPENSSL, the old name is deprecated
                 but still works
  BUILD_DOCS:    whether to build docs (default = OFF)
  BUILD_TESTING: whether to build test (default = OFF)

* Collect all documentation into top-level "docs" directory;

* Move the examples to the top-level directory;

* Remove the unused and somewhat misleading pseudo-default
  cyclonedds.xml;

* Remove unused cmake files

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-07-26 09:43:53 +02:00 committed by eboasson
parent 4e80559763
commit 9cf4b97f1a
102 changed files with 627 additions and 1925 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
# Copyright(c) 2019 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
@ -11,208 +11,20 @@
#
cmake_minimum_required(VERSION 3.7)
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
if(NOT ${PROJECT_NAME} STREQUAL "CycloneDDS")
get_filename_component(dir ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
message(FATAL_ERROR "Top-level CMakeLists.txt was moved to the top-level directory. Please run cmake on ${dir} instead of ${CMAKE_CURRENT_LIST_DIR}")
endif()
# By default don't treat warnings as errors, else anyone building it with a different compiler that
# just happens to generate a warning, as well as anyone adding or modifying something and making a
# small mistake would run into errors. CI builds can be configured differently.
option(WERROR "Treat compiler warnings as errors" OFF)
FUNCTION(PREPEND var prefix)
SET(listVar "")
FOREACH(f ${ARGN})
LIST(APPEND listVar "${prefix}/${f}")
ENDFOREACH(f)
SET(${var} "${listVar}" PARENT_SCOPE)
ENDFUNCTION(PREPEND)
# Update the git submodules
execute_process(COMMAND git submodule init
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
execute_process(COMMAND git submodule update
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# Set module path before defining project so platform files will work.
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
set(CMAKE_PROJECT_NAME_FULL "Eclipse Cyclone DDS")
set(PROJECT_NAME "CycloneDDS")
project(${PROJECT_NAME} VERSION 0.1.0)
# Set some convenience variants of the project-name
string(REPLACE " " "-" CMAKE_PROJECT_NAME_DASHED "${CMAKE_PROJECT_NAME_FULL}")
string(TOUPPER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_CAPS)
string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_SMALL)
set(CMAKE_C_STANDARD 99)
if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
add_definitions(-std=c99)
endif()
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -xc99 -D__restrict=restrict -D__deprecated__=")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m64")
endif()
# Conan
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
if(APPLE)
# By default Conan strips all RPATHs (see conanbuildinfo.cmake), which
# causes tests to fail as the executables cannot find the library target.
# By setting KEEP_RPATHS, Conan does not set CMAKE_SKIP_RPATH and the
# resulting binaries still have the RPATH information. This is fine because
# CMake will strip the build RPATH information in the install step.
#
# NOTE:
# Conan's default approach is to use the "imports" feature, which copies
# all the dependencies into the bin directory. Of course, this doesn't work
# quite that well for libraries generated in this Project (see Conan
# documentation).
#
# See the links below for more information.
# https://github.com/conan-io/conan/issues/337
# https://docs.conan.io/en/latest/howtos/manage_shared_libraries/rpaths.html
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
conan_basic_setup(KEEP_RPATHS)
else()
conan_basic_setup()
endif()
conan_define_targets()
endif()
# Set reasonably strict warning options for clang, gcc, msvc
# Enable coloured ouput if Ninja is used for building
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
#message(STATUS clang)
add_compile_options(-Wall -Wextra -Wconversion -Wunused -Wmissing-prototypes)
if(${WERROR})
add_compile_options(-Werror)
endif()
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
add_compile_options(-Xclang -fcolor-diagnostics)
endif()
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
#message(STATUS gcc)
add_compile_options(-Wall -Wextra -Wconversion -Wmissing-prototypes)
if(${WERROR})
add_compile_options(-Werror)
endif()
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
add_compile_options(-fdiagnostics-color=always)
endif()
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
#message(STATUS msvc)
add_compile_options(/W3)
if(${WERROR})
add_compile_options(/WX)
endif()
endif()
# I don't know how to enable warnings properly so that it ends up in Xcode projects as well
if(${CMAKE_GENERATOR} STREQUAL "Xcode")
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SHADOW YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_CONSTANT_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_FLOAT_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INT_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_NON_LITERAL_NULL_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_IMPLICIT_SIGN_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INFINITE_RECURSION YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_RETURN_TYPE YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_MISSING_PARENTHESES YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_ASSIGN_ENUM YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SIGN_COMPARE YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_STRICT_PROTOTYPES YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_COMMA YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNINITIALIZED_AUTOS YES_AGGRESSIVE)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_FUNCTION YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_LABEL YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_PARAMETER YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VALUE YES)
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VARIABLE YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DOCUMENTATION_COMMENTS YES)
set (CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_MISSING_PROTOTYPES YES)
endif()
# Make it easy to enable one of Clang's/gcc's analyzers, and default to using
# the address sanitizer for ordinary debug builds; gcc is giving some grief on
# Travis, so don't enable it for gcc by default
if(NOT USE_SANITIZER)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND
NOT (${CMAKE_GENERATOR} STREQUAL "Xcode") AND
(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
OR ${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang"))
message(STATUS "Enabling address sanitizer; set USE_SANITIZER=none to prevent this")
set(USE_SANITIZER address)
else()
set(USE_SANITIZER none)
endif()
endif()
if(NOT (${USE_SANITIZER} STREQUAL "none"))
message(STATUS "Sanitizer set to ${USE_SANITIZER}")
add_compile_options(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})
link_libraries(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})
endif()
include(GNUInstallDirs)
include(AnalyzeBuild)
if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()
# Include Coverage before CTest so that COVERAGE_COMMAND can be modified
# in the Coverage module should that ever be necessary.
include(Coverage)
set(MEMORYCHECK_COMMAND_OPTIONS "--track-origins=yes --leak-check=full --trace-children=yes --child-silent-after-fork=yes --xml=yes --xml-file=TestResultValgrind_%p.xml --tool=memcheck --show-reachable=yes --leak-resolution=high")
# By default building the testing tree is enabled by including CTest, but
# since not everybody has CUnit, and because it is not strictly required to
# build the product itself, switch to off by default.
option(BUILD_TESTING "Build the testing tree." OFF)
include(CTest)
# Build all executables and libraries into the top-level /bin and /lib folders.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
add_subdirectory(idlc)
add_subdirectory(ddsrt)
add_subdirectory(etc)
# some of the tests in the core rely on preprocessing IDL, so idlc has to
# come first
if(BUILD_IDLC)
add_subdirectory(idlc)
endif()
add_subdirectory(core)
add_subdirectory(tools)
add_subdirectory(scripts)
option(USE_DOCS "Enable documentation." OFF)
if(USE_DOCS)
add_subdirectory(docs)
else()
message(STATUS "${CMAKE_PROJECT_NAME} documentation: disabled (-DUSE_DOCS=1 to enable)")
endif()
add_subdirectory(examples)
if(BUILD_TESTING AND HAVE_MULTI_PROCESS)
if(BUILD_TESTING AND HAVE_MULTI_PROCESS AND BUILD_IDLC)
add_subdirectory(mpt)
endif()
# Pull-in CPack and support for generating <Package>Config.cmake and packages.
include(Packaging)

View file

@ -1,31 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
cmake_minimum_required(VERSION 3.5)
set(COVERAGE_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
set(COVERAGE_RUN_DIR "@CMAKE_BINARY_DIR@")
set(COVERAGE_OUTPUT_DIR "@CMAKE_BINARY_DIR@/coverage")
# TODO: Make this a list instead of separate variables when more directories
# need to be excluded. Currently there's actually only one directory to
# be excluded, but when the test(s) are moved, more directories will be
# added. I just added two directories to indicate how the coverage
# generators handle multiple exclusion directories.
#
# Do not include the various test directories.
set(COVERAGE_EXCLUDE_TESTS "tests")
set(COVERAGE_EXCLUDE_EXAMPLES "examples")
set(COVERAGE_EXCLUDE_BUILD_SUPPORT "cmake")
# Add this flag when you want to suppress LCOV and ctest outputs during coverage collecting.
#set(COVERAGE_QUIET_FLAG "--quiet")

View file

@ -1,26 +0,0 @@
@echo off
REM Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
REM
REM This program and the accompanying materials are made available under the
REM terms of the Eclipse Public License v. 2.0 which is available at
REM http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
REM v. 1.0 which is available at
REM http://www.eclipse.org/org/documents/edl-v10.php.
REM
REM SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
REM VxWorks toolchain requires WIND_BASE to be exported, should the user be
REM compiling for VxWorks and not have WIND_BASE exported, do that here before
REM invoking the compiler.
if "%WIND_BASE%" == "" (
set WIND_BASE="@WIND_BASE@"
)
REM Strip C compiler from command line arguments for compatibility because
REM this launcher may also be used from an integrated development environment
REM at some point.
if "%1" == "@CMAKE_C_COMPILER@" (
shift
)
"@CMAKE_C_COMPILER@" %*

View file

@ -1,40 +0,0 @@
#!/bin/sh
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
# VxWorks toolchain requires WIND_BASE to be exported, should the user be
# compiling for VxWorks and not have WIND_BASE exported, to that here before
# invoking the compiler.
if [ -z "${WIND_BASE}" ] && [ -n "@WIND_BASE@" ]; then
WIND_BASE="@WIND_BASE@"
export WIND_BASE
fi
if [ -n "@WIND_LMAPI@" ]; then
if [ -z "${LD_LIBRARY_PATH}" ]; then
LD_LIBRARY_PATH="@WIND_LMAPI@"
export LD_LIBRARY_PATH
elif [[ "${LD_LIBRARY_PATH}" == ?(*:)"@WIND_LMAPI@"?(:*) ]]; then
LD_LIBRARY_PATH="@WIND_LMAPI@:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
fi
fi
# Strip C compiler from command line arguments for compatibility because this
# launcher may also be used from an integrated development environment at some
# point.
if [ "$1" = "@CMAKE_C_COMPILER@" ]; then
shift
fi
exec "@CMAKE_C_COMPILER@" "$@"

View file

@ -1,26 +0,0 @@
@echo off
REM Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
REM
REM This program and the accompanying materials are made available under the
REM terms of the Eclipse Public License v. 2.0 which is available at
REM http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
REM v. 1.0 which is available at
REM http://www.eclipse.org/org/documents/edl-v10.php.
REM
REM SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
REM VxWorks toolchain requires WIND_BASE to be exported, should the user be
REM compiling for VxWorks and not have WIND_BASE exported, do that here before
REM invoking the compiler.
if "%WIND_BASE%" == "" (
set WIND_BASE="@WIND_BASE@"
)
REM Strip C compiler from command line arguments for compatibility because
REM this launcher may also be used from an integrated development environment
REM at some point.
if "%1" == "@CMAKE_CXX_COMPILER@" (
shift
)
"@CMAKE_CXX_COMPILER@" %*

View file

@ -1,40 +0,0 @@
#!/bin/sh
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
# VxWorks toolchain requires WIND_BASE to be exported, should the user be
# compiling for VxWorks and not have WIND_BASE exported, to that here before
# invoking the compiler.
if [ -z "${WIND_BASE}" ] && [ -n "@WIND_BASE@" ]; then
WIND_BASE="@WIND_BASE@"
export WIND_BASE
fi
if [ -n "@WIND_LMAPI@" ]; then
if [ -z "${LD_LIBRARY_PATH}" ]; then
LD_LIBRARY_PATH="@WIND_LMAPI@"
export LD_LIBRARY_PATH
elif [[ "${LD_LIBRARY_PATH}" == ?(*:)"@WIND_LMAPI@"?(:*) ]]; then
LD_LIBRARY_PATH="@WIND_LMAPI@:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
fi
fi
# Strip C compiler from command line arguments for compatibility because this
# launcher may also be used from an integrated development environment at some
# point.
if [ "$1" = "@CMAKE_CXX_COMPILER@" ]; then
shift
fi
exec "@CMAKE_CXX_COMPILER@" "$@"

View file

@ -1,65 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
cmake_minimum_required(VERSION 3.3) # For IN_LIST
option(ANALYZE_BUILD "Enable static analysis during build" OFF)
if(ANALYZE_BUILD)
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
set(scan_build_supported Clang AppleClang GNU)
if("C" IN_LIST languages)
include(CheckCCompilerFlag)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
set(ANALYZE_C_BUILD_FLAG "/analyze")
elseif(CMAKE_C_COMPILER_ID IN_LIST scan_build_supported)
message(STATUS "Static analysis for C using ${CMAKE_C_COMPILER_ID}-compiler is available by using 'scan-build' manually only")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
CHECK_C_COMPILER_FLAG(${ANALYZE_C_BUILD_FLAG} C_COMPILER_HAS_ANALYZE_BUILD)
if(C_COMPILER_HAS_ANALYZE_BUILD)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
# $<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
add_compile_options(${ANALYZE_C_BUILD_FLAG})
else()
add_compile_options($<$<COMPILE_LANGUAGE:C>:${ANALYZE_C_BUILD_FLAG}>)
endif()
endif()
endif()
endif()
if("CXX" IN_LIST languages)
include(CheckCXXCompilerFlag)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ANALYZE_CXX_BUILD_FLAG "/analyze")
elseif(CMAKE_C_COMPILER_ID IN_LIST scan_build_supported)
message(STATUS "Static analysis for CXX using ${CMAKE_CXX_COMPILER_ID}-compiler is available by using 'scan-build' manually only")
endif()
if(DEFINED ANALYZE_CXX_BUILD_FLAG)
CHECK_CXX_COMPILER_FLAG(${ANALYZE_CXX_BUILD_FLAG} CXX_COMPILER_HAS_ANALYZE_BUILD)
if(CXX_COMPILER_HAS_ANALYZE_BUILD)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
add_compile_options(${ANALYZE_CXX_BUILD_FLAG})
else()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${ANALYZE_CXX_BUILD_FLAG}>)
endif()
endif()
endif()
endif()
endif()

View file

@ -1,311 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
find_package(CUnit REQUIRED)
set(CUNIT_DIR "${CMAKE_CURRENT_LIST_DIR}/CUnit")
function(get_cunit_header_file SOURCE_FILE HEADER_FILE)
# Return a unique (but consistent) filename where Theory macros can be
# written. The path that will be returned is the location to a header file
# located in the same relative directory, using the basename of the source
# file postfixed with .h. e.g. <project>/foo/bar.h would be converted to
# <project>/build/foo/bar.h.
get_filename_component(SOURCE_FILE "${SOURCE_FILE}" ABSOLUTE)
file(RELATIVE_PATH SOURCE_FILE "${PROJECT_SOURCE_DIR}" "${SOURCE_FILE}")
get_filename_component(basename "${SOURCE_FILE}" NAME_WE)
get_filename_component(dir "${SOURCE_FILE}" DIRECTORY)
set(${HEADER_FILE} "${CMAKE_BINARY_DIR}/${dir}/${basename}.h" PARENT_SCOPE)
endfunction()
function(parse_cunit_fixtures INPUT TEST_DISABLED TEST_TIMEOUT)
if(INPUT MATCHES ".disabled${s}*=${s}*([tT][rR][uU][eE]|[0-9]+)")
set(${TEST_DISABLED} "TRUE" PARENT_SCOPE)
else()
set(${TEST_DISABLED} "FALSE" PARENT_SCOPE)
endif()
if(INPUT MATCHES ".timeout${s}*=${s}*([0-9]+)")
set(${TEST_TIMEOUT} "${CMAKE_MATCH_1}" PARENT_SCOPE)
else()
set(${TEST_TIMEOUT} "0" PARENT_SCOPE)
endif()
endfunction()
# Parse a single source file, generate a header file with theory definitions
# (if applicable) and return suite and test definitions.
function(process_cunit_source_file SOURCE_FILE HEADER_FILE SUITES TESTS)
set(x "\\*")
set(s "[ \t\r\n]")
set(s_or_x "[ \t\r\n\\*]")
set(w "[_a-zA-Z0-9]")
set(ident_expr "(${s}*${w}+${s}*)")
# Very basic type recognition, only things that contain word characters and
# pointers are handled. And since this script does not actually have to
# compile any code, type checking is left to the compiler. An error (or
# warning) will be thrown if something is off.
#
# The "type" regular expression below will match things like:
# - <word> <word>
# - <word> *<word>
# - <word>* <word> *<word>
set(type_expr "(${s}*${w}+${x}*${s}+${s_or_x}*)+")
set(param_expr "${type_expr}${ident_expr}")
# Test fixture support (based on test fixtures as implemented in Criterion),
# to enable per-test (de)initializers, which is very different from
# per-suite (de)initializers, and timeouts.
#
# The following fixtures are supported:
# - init
# - fini
# - disabled
# - timeout
set(data_expr "(${s}*,${s}*\\.${w}+${s}*=[^,\\)]+)*")
set(suites_wo_init_n_clean)
set(suites_w_init)
set(suites_w_clean)
file(READ "${SOURCE_FILE}" content)
# CU_Init and CU_Clean
#
# Extract all suite initializers and deinitializers so that the list of
# suites can be probably populated when tests and theories are parsed. Suites
# are only registered if it contains at least one test or theory.
set(suite_expr "CU_(Init|Clean)${s}*\\(${ident_expr}\\)")
string(REGEX MATCHALL "${suite_expr}" matches "${content}")
foreach(match ${matches})
string(REGEX REPLACE "${suite_expr}" "\\2" suite "${match}")
if("${match}" MATCHES "CU_Init")
list(APPEND suites_w_init ${suite})
elseif("${match}" MATCHES "CU_Clean")
list(APPEND suites_w_deinit ${suite})
endif()
endforeach()
# CU_Test
set(test_expr "CU_Test${s}*\\(${ident_expr},${ident_expr}${data_expr}\\)")
string(REGEX MATCHALL "${test_expr}" matches "${content}")
foreach(match ${matches})
string(REGEX REPLACE "${test_expr}" "\\1" suite "${match}")
string(REGEX REPLACE "${test_expr}" "\\2" test "${match}")
# Remove leading and trailing whitespace
string(STRIP "${suite}" suite)
string(STRIP "${test}" test)
# Extract fixtures that must be handled by CMake (.disabled and .timeout).
parse_cunit_fixtures("${match}" disabled timeout)
list(APPEND suites_wo_init_n_clean "${suite}")
list(APPEND tests "${suite}:${test}:${disabled}:${timeout}")
endforeach()
# CU_Theory
#
# CU_Theory signatures must be recognized in order to generate structures to
# hold the CU_DataPoints declarations. The generated type is added to the
# compile definitions and inserted by the preprocessor when CU_TheoryDataPoints
# is expanded.
#
# NOTE: Since not all compilers support pushing function-style definitions
# from the command line (CMake will generate a warning too), a header
# file is generated instead. A define is pushed and expanded at
# compile time. It is included by CUnit/Theory.h.
get_cunit_header_file("${SOURCE_FILE}" header)
set(theory_expr "CU_Theory${s}*\\(${s}*\\((${param_expr}(,${param_expr})*)\\)${s}*,${ident_expr},${ident_expr}${data_expr}\\)")
string(REGEX MATCHALL "${theory_expr}" matches "${content}")
foreach(match ${matches})
if(NOT theories)
# Ensure generated header is truncated before anything is written.
file(WRITE "${header}" "")
endif()
string(REGEX REPLACE "${theory_expr}" "\\1" params "${match}")
string(REGEX REPLACE "${theory_expr}" "\\7" suite "${match}")
string(REGEX REPLACE "${theory_expr}" "\\8" test "${match}")
# Remove leading and trailing whitespace
string(STRIP "${params}" params)
string(STRIP "${suite}" suite)
string(STRIP "${test}" test)
# Convert parameters from a string to a list
string(REGEX REPLACE "${s}*,${s}*" ";" params "${params}")
# Extract fixtures that must be handled by CMake (.disabled and .timeout)
parse_cunit_fixtures("${match}" disabled timeout)
list(APPEND suites_wo_init_n_clean "${suite}")
list(APPEND theories "${suite}:${test}:${disabled}:${timeout}")
set(sep)
set(size "CU_TheoryDataPointsSize_${suite}_${test}(datapoints) (")
set(slice "CU_TheoryDataPointsSlice_${suite}_${test}(datapoints, index) (")
set(typedef "CU_TheoryDataPointsTypedef_${suite}_${test}() {")
foreach(param ${params})
string(
REGEX REPLACE "(${type_expr})${ident_expr}" "\\3" name "${param}")
string(
REGEX REPLACE "(${type_expr})${ident_expr}" "\\1" type "${param}")
string(STRIP "${name}" name)
string(STRIP "${type}" type)
set(slice "${slice}${sep} datapoints.${name}.p[index]")
if (NOT sep)
set(size "${size} datapoints.${name}.n")
set(sep ",")
endif()
set(typedef "${typedef} struct { size_t n; ${type} *p; } ${name};")
endforeach()
set(typedef "${typedef} }")
set(slice "${slice} )")
set(size "${size} )")
file(APPEND "${header}" "#define ${size}\n")
file(APPEND "${header}" "#define ${slice}\n")
file(APPEND "${header}" "#define ${typedef}\n")
endforeach()
# Propagate suites, tests and theories extracted from the source file.
if(suites_wo_init_n_clean)
list(REMOVE_DUPLICATES suites_wo_init_n_clean)
list(SORT suites_wo_init_n_clean)
foreach(suite ${suites_wo_init_n_clean})
set(init "FALSE")
set(clean "FALSE")
if(${suite} IN_LIST suites_w_init)
set(init "TRUE")
endif()
if(${suite} IN_LIST suites_w_deinit)
set(clean "TRUE")
endif()
list(APPEND suites "${suite}:${init}:${clean}")
endforeach()
endif()
if(theories)
set(${HEADER_FILE} "${header}" PARENT_SCOPE)
else()
unset(${HEADER_FILE} PARENT_SCOPE)
endif()
set(${SUITES} ${suites} PARENT_SCOPE)
set(${TESTS} ${tests};${theories} PARENT_SCOPE)
endfunction()
function(add_cunit_executable TARGET)
# Retrieve location of shared libary, which is need to extend the PATH
# environment variable on Microsoft Windows, so that the operating
# system can locate the .dll that it was linked against.
# On macOS, this mechanism is used to set the DYLD_LIBRARY_PATH.
get_target_property(CUNIT_LIBRARY_TYPE CUnit TYPE)
get_target_property(CUNIT_IMPORTED_LOCATION CUnit IMPORTED_LOCATION)
get_filename_component(CUNIT_LIBRARY_DIR "${CUNIT_IMPORTED_LOCATION}" PATH)
set(decls)
set(defns)
set(sources)
foreach(source ${ARGN})
if((EXISTS "${source}" OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${source}"))
unset(suites)
unset(tests)
process_cunit_source_file("${source}" header suites tests)
if(header)
set_property(
SOURCE "${source}"
PROPERTY COMPILE_DEFINITIONS CU_THEORY_INCLUDE_FILE=\"${header}\")
endif()
# Disable missing-field-initializers warnings as not having to specify
# every member, aka fixture, is intended behavior.
if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR
${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang" OR
${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
set_property(
SOURCE "${source}"
PROPERTY COMPILE_FLAGS -Wno-missing-field-initializers)
endif()
foreach(suite ${suites})
string(REPLACE ":" ";" suite ${suite})
list(GET suite 2 clean)
list(GET suite 1 init)
list(GET suite 0 suite)
set(init_func "NULL")
set(clean_func "NULL")
if(init)
set(decls "${decls}\nCU_InitDecl(${suite});")
set(init_func "CU_InitName(${suite})")
endif()
if(clean)
set(decls "${decls}\nCU_CleanDecl(${suite});")
set(clean_func "CU_CleanName(${suite})")
endif()
set(defns "${defns}\nADD_SUITE(${suite}, ${init_func}, ${clean_func});")
endforeach()
foreach(test ${tests})
string(REPLACE ":" ";" test ${test})
list(GET test 3 timeout)
list(GET test 2 disabled)
list(GET test 0 suite)
list(GET test 1 test)
set(enable "true")
if(disabled)
set(enable "false")
endif()
if(NOT timeout)
set(timeout 10)
endif()
set(decls "${decls}\nCU_TestDecl(${suite}, ${test});")
set(defns "${defns}\nADD_TEST(${suite}, ${test}, ${enable});")
set(ctest "CUnit_${suite}_${test}")
add_test(
NAME ${ctest}
COMMAND ${TARGET} -a -r "${suite}-${test}" -s ${suite} -t ${test})
set_property(TEST ${ctest} PROPERTY TIMEOUT ${timeout})
set_property(TEST ${ctest} PROPERTY DISABLED ${disabled})
if(APPLE)
set_property(
TEST ${ctest}
PROPERTY ENVIRONMENT
"DYLD_LIBRARY_PATH=${CUNIT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}")
elseif(WIN32 AND ${CUNIT_LIBRARY_TYPE} STREQUAL "SHARED_LIBRARY")
set_property(
TEST ${ctest}
PROPERTY ENVIRONMENT
"PATH=${CUNIT_LIBRARY_DIR};$ENV{PATH}")
endif()
endforeach()
list(APPEND sources "${source}")
endif()
endforeach()
configure_file(
"${CUNIT_DIR}/src/main.c.in" "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.c" @ONLY)
if("2.1.3" VERSION_LESS_EQUAL
"${CUNIT_VERSION_MAJOR}.${CUNIT_VERSION_MINOR}.${CUNIT_VERSION_PATCH}")
set_property(
SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.c"
PROPERTY COMPILE_DEFINITIONS HAVE_ENABLE_JUNIT_XML)
endif()
add_executable(
${TARGET} "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.c" ${sources})
target_link_libraries(${TARGET} PRIVATE CUnit)
target_include_directories(${TARGET} PRIVATE "${CUNIT_DIR}/include")
endfunction()

View file

@ -1,96 +0,0 @@
#ifndef CUNIT_TEST_H
#define CUNIT_TEST_H
#include <stdbool.h>
#include <CUnit/CUnit.h>
#include <CUnit/CUError.h>
#if defined (__cplusplus)
extern "C" {
#endif
typedef void(*cu_test_init_func_t)(void);
typedef void(*cu_test_fini_func_t)(void);
typedef struct {
cu_test_init_func_t init;
cu_test_fini_func_t fini;
int disabled; /* Parsed by CMake, used at test registration in main. */
int timeout; /* Parsed by CMake, used at test registration in CMake. */
} cu_data_t;
#define CU_InitName(suite) \
CU_Init_ ## suite
#define CU_CleanName(suite) \
CU_Fini_ ## suite
#define CU_TestName(suite, test) \
CU_Test_ ## suite ## _ ## test
#define CU_TestProxyName(suite, test) \
CU_TestProxy_ ## suite ## _ ## test
#define CU_InitDecl(suite) \
extern int CU_InitName(suite)(void)
#define CU_Init(suite) \
CU_InitDecl(suite); \
int CU_InitName(suite)(void)
#define CU_CleanDecl(suite) \
extern int CU_CleanName(suite)(void)
#define CU_Clean(suite) \
CU_CleanDecl(suite); \
int CU_CleanName(suite)(void)
/* CU_Test generates a wrapper function that takes care of per-test
initialization and deinitialization, if provided in the CU_Test
signature. */
#define CU_Test(suite, test, ...) \
static void CU_TestName(suite, test)(void); \
void CU_TestProxyName(suite, test)(void); \
\
void CU_TestProxyName(suite, test)(void) { \
cu_data_t data = CU_Fixture(__VA_ARGS__); \
\
if (data.init != NULL) { \
data.init(); \
} \
\
CU_TestName(suite, test)(); \
\
if (data.fini != NULL) { \
data.fini(); \
} \
} \
\
static void CU_TestName(suite, test)(void)
#define CU_TestDecl(suite, test) \
extern void CU_TestProxyName(suite, test)(void)
/* Microsoft Visual Studio does not like empty struct initializers, i.e.
no fixtures are specified. To work around that issue CU_Fixture inserts a
NULL initializer as fall back. */
#define CU_Comma() ,
#define CU_Reduce(one, ...) one
#ifdef _WIN32
/* Microsoft Visual Studio does not expand __VA_ARGS__ correctly. */
#define CU_Fixture__(...) CU_Fixture____((__VA_ARGS__))
#define CU_Fixture____(tuple) CU_Fixture___ tuple
#else
#define CU_Fixture__(...) CU_Fixture___(__VA_ARGS__)
#endif /* _WIN32 */
#define CU_Fixture___(throw, away, value, ...) value
#define CU_Fixture(...) \
CU_Fixture_( CU_Comma CU_Reduce(__VA_ARGS__,) (), __VA_ARGS__ )
#define CU_Fixture_(throwaway, ...) \
CU_Fixture__(throwaway, ((cu_data_t){ 0 }), ((cu_data_t){ __VA_ARGS__ }))
#if defined (__cplusplus)
}
#endif
#endif /* CUNIT_TEST_H */

View file

@ -1,73 +0,0 @@
#ifndef CUNIT_THEORY_H
#define CUNIT_THEORY_H
/* Function-style macros cannot be defined on the command line. */
#ifdef CU_THEORY_INCLUDE_FILE
#include CU_THEORY_INCLUDE_FILE
#endif
#include "CUnit/Test.h"
#if defined (__cplusplus)
extern "C" {
#endif
#define CU_TheoryDataPointsName(suite, test) \
CU_TheoryDataPoints_ ## suite ## _ ## test
#define CU_TheoryDataPointsTypeName(suite, test) \
CU_TheoryDataPointsType_ ## suite ## _ ## test
#define CU_TheoryDataPointsSize(suite, test) \
CU_TheoryDataPointsSize_ ## suite ## _ ## test ( \
CU_TheoryDataPointsName(suite, test))
#define CU_TheoryDataPointsSlice(suite, test, index) \
CU_TheoryDataPointsSlice_ ## suite ## _ ## test ( \
CU_TheoryDataPointsName(suite, test), index)
#define CU_TheoryDataPointsTypedef(suite, test) \
CU_TheoryDataPointsTypedef_ ## suite ## _ ## test()
#define CU_TheoryDataPoints(suite, test) \
struct CU_TheoryDataPointsTypeName(suite, test) \
CU_TheoryDataPointsTypedef(suite, test) ; \
\
static struct CU_TheoryDataPointsTypeName(suite, test) \
CU_TheoryDataPointsName(suite, test)
#define CU_DataPoints(type, ...) { \
.p = (type[]) { __VA_ARGS__ }, \
.n = (sizeof((type[]) { __VA_ARGS__ }) / sizeof(type)) \
}
#define CU_Theory(signature, suite, test, ...) \
static void CU_TestName(suite, test) signature; \
void CU_TestProxyName(suite, test)(void); \
\
void CU_TestProxyName(suite, test)(void) { \
cu_data_t data = CU_Fixture(__VA_ARGS__); \
size_t i, n; \
\
if (data.init != NULL) { \
data.init(); \
} \
\
for (i = 0, n = CU_TheoryDataPointsSize(suite, test); i < n; i++) { \
CU_TestName(suite, test) CU_TheoryDataPointsSlice(suite, test, i) ; \
} \
\
if (data.fini != NULL) { \
data.fini(); \
} \
} \
\
static void CU_TestName(suite, test) signature
#if defined (__cplusplus)
}
#endif
#endif /* CUNIT_THEORY_H */

View file

@ -1,239 +0,0 @@
/*
* Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define EX_USAGE (64)
#define EX_SOFTWARE (70)
#include <CUnit/Basic.h>
#include <CUnit/Automated.h>
#include "CUnit/Test.h"
static struct {
bool print_help;
bool automated;
bool junit;
const char *results;
CU_BasicRunMode mode;
CU_ErrorAction error_action;
const char *suite;
const char *test;
} opts = {
false,
false,
false,
NULL,
CU_BRM_NORMAL,
CUEA_IGNORE,
"*",
"*"
};
static int patmatch(const char *pat, const char *str)
{
while (*pat) {
if (*pat == '?') {
/* any character will do */
if (*str++ == 0) {
return 0;
}
pat++;
} else if (*pat == '*') {
/* collapse a sequence of wildcards, requiring as many
characters in str as there are ?s in the sequence */
while (*pat == '*' || *pat == '?') {
if (*pat == '?' && *str++ == 0) {
return 0;
}
pat++;
}
/* try matching on all positions where str matches pat */
while (*str) {
if (*str == *pat && patmatch(pat+1, str+1)) {
return 1;
}
str++;
}
return *pat == 0;
} else {
/* only an exact match */
if (*str++ != *pat++) {
return 0;
}
}
}
return *str == 0;
}
static void usage(const char *name)
{
fprintf(stderr, "Usage: %s OPTIONS\n", name);
fprintf(stderr, "Try '%s -h' for more information\n", name);
}
static void help(const char *name)
{
printf("Usage: %s [OPTIONS]\n", name);
printf("\n");
printf("Possible options:\n");
printf(" -a run in automated mode\n");
printf(" -f fail fast\n");
printf(" -h display this help and exit\n");
printf(" -j junit format results \n");
printf(" -r FILENAME results file for automated run\n");
printf(" -s PATTERN run only tests in suites matching pattern\n");
printf(" -t PATTERN run only test matching pattern\n");
printf("\n");
printf("Exit codes:\n");
printf(" %-2d Successful termination\n", EXIT_SUCCESS);
printf(" %-2d One or more failing test cases\n", EXIT_FAILURE);
printf(" %-2d Command line usage error\n", EX_USAGE);
printf(" %-2d Internal software error\n", EX_SOFTWARE);
}
static int parse_options(int argc, char *argv[])
{
int err = 0;
for (int i = 1; err == 0 && i < argc; i++) {
switch ((argv[i][0] == '-') ? argv[i][1] : 0) {
case 'a':
opts.automated = true;
break;
case 'f':
opts.error_action = CUEA_FAIL;
break;
case 'h':
opts.print_help = true;
break;
case 'j':
opts.junit = true;
break;
case 'r':
if((i+1) < argc){
opts.results = argv[++i];
break;
}
/* FALLS THROUGH */
case 's':
if ((i+1) < argc) {
opts.suite = argv[++i];
break;
}
/* FALLS THROUGH */
case 't':
if ((i+1) < argc) {
opts.test = argv[++i];
break;
}
/* FALLS THROUGH */
default:
err = 1;
break;
}
}
return err;
}
static void
add_suite(
const char *suite,
CU_InitializeFunc pInitFunc,
CU_CleanupFunc pCleanFunc)
{
CU_pSuite pSuite;
pSuite = CU_get_suite(suite);
if (pSuite == NULL) {
pSuite = CU_add_suite(suite, pInitFunc, pCleanFunc);
CU_set_suite_active(pSuite, patmatch(opts.suite, suite));
}
}
#define ADD_SUITE(suite, init, clean) \
add_suite(#suite, init, clean)
static void
add_test(
const char *suite,
const char *test,
CU_TestFunc pTestFunc,
bool enable)
{
CU_pSuite pSuite;
CU_pTest pTest;
pSuite = CU_get_suite(suite);
pTest = CU_add_test(pSuite, test, pTestFunc);
CU_set_test_active(pTest, enable && patmatch(opts.test, test));
}
#define ADD_TEST(suite, test, enable) \
add_test(#suite, #test, CU_TestProxyName(suite, test), enable)
/* CMake will expand the macro below to declare generated functions. */
@decls@
int main(int argc, char *argv[])
{
int ret = EXIT_SUCCESS;
if (parse_options(argc, argv) != 0) {
usage(argv[0]);
return EX_USAGE;
} else if (opts.print_help) {
help(argv[0]);
return ret;
} else if (CU_initialize_registry() != CUE_SUCCESS) {
fprintf(stderr, "CU_initialize_registry: %s\n", CU_get_error_msg());
return EX_SOFTWARE;
}
/* CMake will expand the macro below to register all suites and tests. */
@defns@
CU_set_error_action(opts.error_action);
if (opts.automated) {
if (opts.results != NULL) {
CU_set_output_filename(opts.results);
}
#if defined(HAVE_ENABLE_JUNIT_XML)
if (opts.junit) {
CU_automated_enable_junit_xml(CU_TRUE);
} else
#endif
{
CU_list_tests_to_file();
}
CU_automated_run_tests();
} else {
CU_basic_set_mode(opts.mode);
CU_basic_run_tests();
}
if (CU_get_error() != CUE_SUCCESS) {
ret = EX_SOFTWARE;
} else if (CU_get_number_of_failures() != 0) {
ret = EXIT_FAILURE;
}
CU_cleanup_registry();
return ret;
}

View file

@ -1,50 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if("${CMAKE_BUILD_TYPE}" STREQUAL "Coverage")
set(BUILD_TYPE_SUPPORTED False)
mark_as_advanced(BUILD_TYPE_SUPPORTED)
if(CMAKE_COMPILER_IS_GNUCXX)
set(BUILD_TYPE_SUPPORTED True)
elseif(("${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") AND
("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "3.0.0"))
set(BUILD_TYPE_SUPPORTED True)
endif()
if(NOT BUILD_TYPE_SUPPORTED)
message(FATAL_ERROR "Coverage build type not supported. (GCC or Clang "
">3.0.0 required)")
endif()
# NOTE: Since either GCC or Clang is required for now, and the coverage
# flags are the same for both, there is no need for seperate branches
# to set compiler flags. That might change in the future.
# CMake has per build type compiler and linker flags. If 'Coverage' is
# chosen, the flags below are automatically inserted into CMAKE_C_FLAGS.
#
# Any optimizations are disabled to ensure coverage results are correct.
# See https://gcc.gnu.org/onlinedocs/gcc/Gcov-and-Optimization.html.
set(CMAKE_C_FLAGS_COVERAGE
"-DNDEBUG -g -O0 --coverage -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS_COVERAGE
"-DNDEBUG -g -O0 --coverage -fprofile-arcs -ftest-coverage")
mark_as_advanced(
CMAKE_C_FLAGS_COVERAGE
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE)
configure_file(${CMAKE_MODULE_PATH}/../CoverageSettings.cmake.in CoverageSettings.cmake @ONLY)
message(STATUS "Coverage build type available")
endif()

View file

@ -1,90 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
set(CUNIT_HEADER "CUnit/CUnit.h")
if(CONAN_INCLUDE_DIRS)
find_path(CUNIT_INCLUDE_DIR ${CUNIT_HEADER} HINTS ${CONAN_INCLUDE_DIRS})
else()
find_path(CUNIT_INCLUDE_DIR ${CUNIT_HEADER})
endif()
mark_as_advanced(CUNIT_INCLUDE_DIR)
if(CUNIT_INCLUDE_DIR AND EXISTS "${CUNIT_INCLUDE_DIR}/${CUNIT_HEADER}")
set(PATTERN "^#define CU_VERSION \"([0-9]+)\\.([0-9]+)\\-([0-9]+)\"$")
file(STRINGS "${CUNIT_INCLUDE_DIR}/${CUNIT_HEADER}" CUNIT_H REGEX "${PATTERN}")
string(REGEX REPLACE "${PATTERN}" "\\1" CUNIT_VERSION_MAJOR "${CUNIT_H}")
string(REGEX REPLACE "${PATTERN}" "\\2" CUNIT_VERSION_MINOR "${CUNIT_H}")
string(REGEX REPLACE "${PATTERN}" "\\3" CUNIT_VERSION_PATCH "${CUNIT_H}")
set(CUNIT_VERSION "${CUNIT_VERSION_MAJOR}.${CUNIT_VERSION_MINOR}-${CUNIT_VERSION_PATCH}")
endif()
if(CONAN_LIB_DIRS)
find_library(CUNIT_LIBRARY cunit HINTS ${CONAN_LIB_DIRS})
else()
find_library(CUNIT_LIBRARY cunit)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
CUnit
REQUIRED_VARS
CUNIT_LIBRARY CUNIT_INCLUDE_DIR
VERSION_VAR
CUNIT_VERSION)
if(CUNIT_FOUND)
set(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
set(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
if(WIN32)
get_filename_component(CUNIT_LIBRARY_DIR "${CUNIT_LIBRARY}}" PATH)
get_filename_component(CUNIT_BASENAME "${CUNIT_LIBRARY}}" NAME_WE)
get_filename_component(CUNIT_PREFIX "${CUNIT_LIBRARY_DIR}" PATH)
find_program(
CUNIT_DLL
"${CMAKE_SHARED_LIBRARY_PREFIX}${CUNIT_BASENAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
HINTS
${CUNIT_PREFIX}
PATH_SUFFIXES
bin
NO_DEFAULT_PATH)
mark_as_advanced(CUNIT_DLL)
# IMPORTANT:
# Providing a .dll file as the value for IMPORTED_LOCATION can only be
# done for "SHARED" libraries, otherwise the location of the .dll will be
# passed to linker, causing it to fail.
if(CUNIT_DLL)
add_library(CUnit SHARED IMPORTED)
set_target_properties(
CUnit PROPERTIES IMPORTED_IMPLIB "${CUNIT_LIBRARY}")
set_target_properties(
CUnit PROPERTIES IMPORTED_LOCATION "${CUNIT_DLL}")
else()
add_library(CUnit STATIC IMPORTED)
set_target_properties(
CUnit PROPERTIES IMPORTED_LOCATION "${CUNIT_LIBRARY}")
endif()
else()
add_library(CUnit UNKNOWN IMPORTED)
set_target_properties(
CUnit PROPERTIES IMPORTED_LOCATION "${CUNIT_LIBRARY}")
endif()
set_target_properties(
CUnit PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CUNIT_INCLUDE_DIR}")
endif()

View file

@ -1,83 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if(DEFINED ENV{M2})
list(APPEND _mvn_hints "$ENV{M2}")
endif()
if(DEFINED ENV{M2_HOME})
list(APPEND _mvn_hints "$ENV{M2_HOME}/bin")
endif()
# Chocolatey installs packages under C:\ProgramData\chocolatey.
if(NOT "$ENV{ProgramData}" STREQUAL "")
if(IS_DIRECTORY "$ENV{ProgramData}/chocolatey/bin")
list(APPEND _mvn_paths "$ENV{ProgramData}/chocolatey/bin")
endif()
if(IS_DIRECTORY "$ENV{ProgramData}/chocolatey/bin")
list(APPEND _dirs "$ENV{ProgramData}/chocolatey/lib/maven")
endif()
endif()
# Maven documentation mentions intalling maven under C:\Program Files on
# Windows and under /opt on *NIX platforms.
if(WIN32)
foreach(_env "ProgramFiles" "ProgramFiles(x86)")
if(ENV{${_env}} AND IS_DIRECTORY "$ENV{${_env}}")
list(APPEND _dirs "$ENV{${_env}}")
endif()
endforeach()
else()
list(APPEND _dirs "/opt")
endif()
foreach(_dir ${_dirs})
file(GLOB _mvn_dirs "${_dir}/apache-maven-*")
foreach(_mvn_dir ${_mvn_dirs})
if((IS_DIRECTORY "${_mvn_dir}") AND (IS_DIRECTORY "${_mvn_dir}/bin"))
list(APPEND _mvn_paths "${_mvn_dir}/bin")
endif()
endforeach()
endforeach()
if(WIN32)
set(_mvn_names "mvn.cmd" "mvn.exe")
else()
set(_mvn_names "mvn")
endif()
find_program(Maven_EXECUTABLE
NAMES ${_mvn_names}
HINTS ${_mvn_hints}
PATHS ${_mvn_paths})
if(Maven_EXECUTABLE)
execute_process(COMMAND ${Maven_EXECUTABLE} -version
RESULT_VARIABLE res
OUTPUT_VARIABLE var
ERROR_VARIABLE var
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if(NOT res)
if(var MATCHES "Apache Maven ([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(Maven_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Maven
FOUND_VAR Maven_FOUND
VERSION_VAR Maven_VERSION
REQUIRED_VARS Maven_EXECUTABLE Maven_VERSION)
mark_as_advanced(Maven_FOUND Maven_EXECUTABLE Maven_VERSION)

View file

@ -1,34 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if(TARGET CONAN_PKG::OpenSSL)
add_library(OpenSSL::SSL INTERFACE IMPORTED)
target_link_libraries(OpenSSL::SSL INTERFACE CONAN_PKG::OpenSSL)
set(OPENSSL_FOUND TRUE)
else()
# Loop over a list of possible module paths (without the current directory).
get_filename_component(DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
foreach(MODULE_DIR ${CMAKE_MODULE_PATH} ${CMAKE_ROOT}/Modules)
get_filename_component(MODULE_DIR "${MODULE_DIR}" ABSOLUTE)
if(NOT MODULE_DIR STREQUAL DIR)
if(EXISTS "${MODULE_DIR}/FindOpenSSL.cmake")
set(FIND_PACKAGE_FILE "${MODULE_DIR}/FindOpenSSL.cmake")
break()
endif()
endif()
endforeach()
if(FIND_PACKAGE_FILE)
include("${FIND_PACKAGE_FILE}")
endif()
endif()

View file

@ -1,324 +0,0 @@
#
# Copyright(c) 2019 Jeroen Koekkoek
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
include(FindPackageHandleStandardArgs)
macro(_Sphinx_find_executable _exe)
string(TOUPPER "${_exe}" _uc)
# sphinx-(build|quickstart)-3 x.x.x
# FIXME: This works on Fedora (and probably most other UNIX like targets).
# Windows targets and PIP installs might need some work.
find_program(
SPHINX_${_uc}_EXECUTABLE
NAMES "sphinx-${_exe}-3" "sphinx-${_exe}" "sphinx-${_exe}.exe")
if(SPHINX_${_uc}_EXECUTABLE)
execute_process(
COMMAND "${SPHINX_${_uc}_EXECUTABLE}" --version
RESULT_VARIABLE _result
OUTPUT_VARIABLE _output
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_result EQUAL 0 AND _output MATCHES " ([0-9]+\\.[0-9]+\\.[0-9]+)$")
set(SPHINX_${_uc}_VERSION "${CMAKE_MATCH_1}")
endif()
add_executable(Sphinx::${_exe} IMPORTED GLOBAL)
set_target_properties(Sphinx::${_exe} PROPERTIES
IMPORTED_LOCATION "${SPHINX_${_uc}_EXECUTABLE}")
set(Sphinx_${_exe}_FOUND TRUE)
else()
set(Sphinx_${_exe}_FOUND FALSE)
endif()
unset(_uc)
endmacro()
macro(_Sphinx_find_extension _ext)
if(_SPHINX_PYTHON_EXECUTABLE)
execute_process(
COMMAND ${_SPHINX_PYTHON_EXECUTABLE} -c "import ${_ext}"
RESULT_VARIABLE _result)
if(_result EQUAL 0)
set(Sphinx_${_ext}_FOUND TRUE)
else()
set(Sphinx_${_ext}_FOUND FALSE)
endif()
elseif(CMAKE_HOST_WIN32 AND SPHINX_BUILD_EXECUTABLE)
# script-build on Windows located under (when PIP is used):
# C:/Program Files/PythonXX/Scripts
# C:/Users/username/AppData/Roaming/Python/PythonXX/Sripts
#
# Python modules are installed under:
# C:/Program Files/PythonXX/Lib
# C:/Users/username/AppData/Roaming/Python/PythonXX/site-packages
#
# To verify a given module is installed, use the Python base directory
# and test if either Lib/module.py or site-packages/module.py exists.
get_filename_component(_dirname "${SPHINX_BUILD_EXECUTABLE}" DIRECTORY)
get_filename_component(_dirname "${_dirname}" DIRECTORY)
if(IS_DIRECTORY "${_dirname}/Lib/${_ext}" OR
IS_DIRECTORY "${_dirname}/site-packages/${_ext}")
set(Sphinx_${_ext}_FOUND TRUE)
else()
set(Sphinx_${_ext}_FOUND FALSE)
endif()
endif()
endmacro()
#
# Find sphinx-build and sphinx-quickstart.
#
_Sphinx_find_executable(build)
_Sphinx_find_executable(quickstart)
#
# Verify both executables are part of the Sphinx distribution.
#
if(SPHINX_BUILD_EXECUTABLE AND SPHINX_QUICKSTART_EXECUTABLE)
if(NOT SPHINX_BUILD_VERSION STREQUAL SPHINX_QUICKSTART_VERSION)
message(FATAL_ERROR "Versions for sphinx-build (${SPHINX_BUILD_VERSION})"
"and sphinx-quickstart (${SPHINX_QUICKSTART_VERSION})"
"do not match")
endif()
endif()
#
# To verify the required Sphinx extensions are available, the right Python
# installation must be queried (2 vs 3). Of course, this only makes sense on
# UNIX-like systems.
#
if(NOT CMAKE_HOST_WIN32 AND SPHINX_BUILD_EXECUTABLE)
file(READ "${SPHINX_BUILD_EXECUTABLE}" _contents)
if(_contents MATCHES "^#!([^\n]+)")
string(STRIP "${CMAKE_MATCH_1}" _shebang)
if(EXISTS "${_shebang}")
set(_SPHINX_PYTHON_EXECUTABLE "${_shebang}")
endif()
endif()
endif()
foreach(_comp IN LISTS Sphinx_FIND_COMPONENTS)
if(_comp STREQUAL "build")
# Do nothing, sphinx-build is always required.
elseif(_comp STREQUAL "quickstart")
# Do nothing, sphinx-quickstart is optional, but looked up by default.
elseif(_comp STREQUAL "breathe")
_Sphinx_find_extension(${_comp})
else()
message(WARNING "${_comp} is not a valid or supported Sphinx extension")
set(Sphinx_${_comp}_FOUND FALSE)
continue()
endif()
endforeach()
find_package_handle_standard_args(
Sphinx
VERSION_VAR SPHINX_VERSION
REQUIRED_VARS SPHINX_BUILD_EXECUTABLE SPHINX_BUILD_VERSION
HANDLE_COMPONENTS)
# Generate a conf.py template file using sphinx-quickstart.
#
# sphinx-quickstart allows for quiet operation and a lot of settings can be
# specified as command line arguments, therefore its not required to parse the
# generated conf.py.
function(_Sphinx_generate_confpy _target _cachedir)
if(NOT TARGET Sphinx::quickstart)
message(FATAL_ERROR "sphinx-quickstart is not available, needed by"
"sphinx_add_docs for target ${_target}")
endif()
if(NOT DEFINED SPHINX_PROJECT)
set(SPHINX_PROJECT ${PROJECT_NAME})
endif()
if(NOT DEFINED SPHINX_AUTHOR)
set(SPHINX_AUTHOR "${SPHINX_PROJECT} committers")
endif()
if(NOT DEFINED SPHINX_COPYRIGHT)
string(TIMESTAMP "%Y, ${SPHINX_AUTHOR}" SPHINX_COPYRIGHT)
endif()
if(NOT DEFINED SPHINX_VERSION)
set(SPHINX_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
endif()
if(NOT DEFINED SPHINX_RELEASE)
set(SPHINX_RELEASE "${PROJECT_VERSION}")
endif()
if(NOT DEFINED SPHINX_LANGUAGE)
set(SPHINX_LANGUAGE "en")
endif()
set(_known_exts autodoc doctest intersphinx todo coverage imgmath mathjax
ifconfig viewcode githubpages)
if(DEFINED SPHINX_EXTENSIONS)
foreach(_ext ${SPHINX_EXTENSIONS})
set(_is_known_ext FALSE)
foreach(_known_ext ${_known_exsts})
if(_ext STREQUAL _known_ext)
set(_opts "${opts} --ext-${_ext}")
set(_is_known_ext TRUE)
break()
endif()
endforeach()
if(NOT _is_known_ext)
if(_exts)
set(_exts "${_exts},${_ext}")
else()
set(_exts "${_ext}")
endif()
endif()
endforeach()
endif()
if(_exts)
set(_exts "--extensions=${_exts}")
endif()
set(_templatedir "${CMAKE_CURRENT_BINARY_DIR}/${_target}.template")
file(MAKE_DIRECTORY "${_templatedir}")
execute_process(
COMMAND "${SPHINX_QUICKSTART_EXECUTABLE}"
-q --no-makefile --no-batchfile
-p "${SPHINX_PROJECT}"
-a "${SPHINX_AUTHOR}"
-v "${SPHINX_VERSION}"
-r "${SPHINX_RELEASE}"
-l "${SPHINX_LANGUAGE}"
${_opts} ${_exts} "${_templatedir}"
RESULT_VARIABLE _result
OUTPUT_QUIET)
if(_result EQUAL 0 AND EXISTS "${_templatedir}/conf.py")
file(COPY "${_templatedir}/conf.py" DESTINATION "${_cachedir}")
endif()
file(REMOVE_RECURSE "${_templatedir}")
if(NOT _result EQUAL 0 OR NOT EXISTS "${_cachedir}/conf.py")
message(FATAL_ERROR "Sphinx configuration file not generated for "
"target ${_target}")
endif()
endfunction()
function(sphinx_add_docs _target)
set(_opts)
set(_single_opts BUILDER OUTPUT_DIRECTORY SOURCE_DIRECTORY)
set(_multi_opts BREATHE_PROJECTS)
cmake_parse_arguments(_args "${_opts}" "${_single_opts}" "${_multi_opts}" ${ARGN})
unset(SPHINX_BREATHE_PROJECTS)
if(NOT _args_BUILDER)
message(FATAL_ERROR "Sphinx builder not specified for target ${_target}")
elseif(NOT _args_SOURCE_DIRECTORY)
message(FATAL_ERROR "Sphinx source directory not specified for target ${_target}")
else()
if(NOT IS_ABSOLUTE "${_args_SOURCE_DIRECTORY}")
get_filename_component(_sourcedir "${_args_SOURCE_DIRECTORY}" ABSOLUTE)
else()
set(_sourcedir "${_args_SOURCE_DIRECTORY}")
endif()
if(NOT IS_DIRECTORY "${_sourcedir}")
message(FATAL_ERROR "Sphinx source directory '${_sourcedir}' for"
"target ${_target} does not exist")
endif()
endif()
set(_builder "${_args_BUILDER}")
if(_args_OUTPUT_DIRECTORY)
set(_outputdir "${_args_OUTPUT_DIRECTORY}")
else()
set(_outputdir "${CMAKE_CURRENT_BINARY_DIR}/${_target}")
endif()
if(_args_BREATHE_PROJECTS)
if(NOT Sphinx_breathe_FOUND)
message(FATAL_ERROR "Sphinx extension 'breathe' is not available. Needed"
"by sphinx_add_docs for target ${_target}")
endif()
list(APPEND SPHINX_EXTENSIONS breathe)
foreach(_doxygen_target ${_args_BREATHE_PROJECTS})
if(TARGET ${_doxygen_target})
list(APPEND _depends ${_doxygen_target})
# Doxygen targets are supported. Verify that a Doxyfile exists.
get_target_property(_dir ${_doxygen_target} BINARY_DIR)
set(_doxyfile "${_dir}/Doxyfile.${_doxygen_target}")
if(NOT EXISTS "${_doxyfile}")
message(FATAL_ERROR "Target ${_doxygen_target} is not a Doxygen"
"target, needed by sphinx_add_docs for target"
"${_target}")
endif()
# Read the Doxyfile, verify XML generation is enabled and retrieve the
# output directory.
file(READ "${_doxyfile}" _contents)
if(NOT _contents MATCHES "GENERATE_XML *= *YES")
message(FATAL_ERROR "Doxygen target ${_doxygen_target} does not"
"generate XML, needed by sphinx_add_docs for"
"target ${_target}")
elseif(_contents MATCHES "OUTPUT_DIRECTORY *= *([^ ][^\n]*)")
string(STRIP "${CMAKE_MATCH_1}" _dir)
set(_name "${_doxygen_target}")
set(_dir "${_dir}/xml")
else()
message(FATAL_ERROR "Cannot parse Doxyfile generated by Doxygen"
"target ${_doxygen_target}, needed by"
"sphinx_add_docs for target ${_target}")
endif()
elseif(_doxygen_target MATCHES "([^: ]+) *: *(.*)")
set(_name "${CMAKE_MATCH_1}")
string(STRIP "${CMAKE_MATCH_2}" _dir)
endif()
if(_name AND _dir)
if(_breathe_projects)
set(_breathe_projects "${_breathe_projects}, \"${_name}\": \"${_dir}\"")
else()
set(_breathe_projects "\"${_name}\": \"${_dir}\"")
endif()
if(NOT _breathe_default_project)
set(_breathe_default_project "${_name}")
endif()
endif()
endforeach()
endif()
set(_cachedir "${CMAKE_CURRENT_BINARY_DIR}/${_target}.cache")
file(MAKE_DIRECTORY "${_cachedir}")
file(MAKE_DIRECTORY "${_cachedir}/_static")
_Sphinx_generate_confpy(${_target} "${_cachedir}")
if(_breathe_projects)
file(APPEND "${_cachedir}/conf.py"
"\nbreathe_projects = { ${_breathe_projects} }"
"\nbreathe_default_project = '${_breathe_default_project}'")
endif()
add_custom_target(
${_target}
COMMAND ${SPHINX_BUILD_EXECUTABLE}
-b ${_builder}
-d "${CMAKE_CURRENT_BINARY_DIR}/${_target}.cache/_doctrees"
-c "${CMAKE_CURRENT_BINARY_DIR}/${_target}.cache"
"${_sourcedir}"
"${_outputdir}"
DEPENDS ${_depends})
endfunction()

View file

@ -1,51 +0,0 @@
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
function(GENERATE_DUMMY_EXPORT_HEADER _target)
set(_opts)
set(_single_opts BASE_NAME EXPORT_FILE_NAME)
set(_multi_opts)
cmake_parse_arguments(_args "${_opts}" "${_single_opts}" "${_multi_opts}" ${ARGN})
if(NOT _target)
message(FATAL_ERROR "Target not specified")
elseif(NOT TARGET ${_target})
message(FATAL_ERROR "Target ${_target} does not exist")
endif()
string(TOUPPER _target_uc "${_target}")
string(TOLOWER _target_lc "${_target}")
if(_args_EXPORT_FILE_NAME)
set(_path "${_args_EXPORT_FILE_NAME}")
else()
set(_path "${CMAKE_CURRENT_BINARY_DIR}/${_target_lc}_export.h")
endif()
if(_args_BASE_NAME)
string(TOUPPER "${_args_BASE_NAME}" _base_name)
else()
set(_base_name "${_target_uc}")
endif()
get_filename_component(_dir "${_path}" DIRECTORY)
get_filename_component(_file "${_path}" NAME)
if(NOT IS_DIRECTORY "${_dir}")
file(MAKE_DIRECTORY "${_dir}")
endif()
set(_content
"/* Dummy export header generated by CMake. */
#define ${_base_name}_EXPORT\n")
file(WRITE "${_path}" "${_content}")
endfunction()

View file

@ -1,38 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
function(glob variable extension)
set(dirname "${CMAKE_CURRENT_SOURCE_DIR}")
foreach(filename ${ARGN})
unset(filenames)
if((NOT IS_ABSOLUTE "${filename}") AND
(EXISTS "${dirname}/${filename}"))
set(filename "${dirname}/${filename}")
endif()
if(IS_DIRECTORY "${filename}")
file(GLOB_RECURSE filenames "${filename}/*.${extension}")
elseif(EXISTS "${filename}")
if("${filename}" MATCHES "\.${extension}$")
set(filenames "${filename}")
endif()
else()
message(FATAL_ERROR "File ${filename} does not exist")
endif()
list(APPEND files ${filenames})
endforeach()
set(${variable} "${files}" PARENT_SCOPE)
endfunction()

View file

@ -1,170 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if(PACKAGING_INCLUDED)
return()
endif()
set(PACKAGING_INCLUDED true)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(PACKAGING_MODULE_DIR "${PROJECT_SOURCE_DIR}/cmake/modules/Packaging")
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}")
# Generates <Package>Config.cmake.
configure_package_config_file(
"${PACKAGING_MODULE_DIR}/PackageConfig.cmake.in"
"${CMAKE_PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")
# Generates <Package>Version.cmake.
write_basic_package_version_file(
"${CMAKE_PROJECT_NAME}Version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Version.cmake"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)
if((NOT DEFINED BUILD_SHARED_LIBS) OR BUILD_SHARED_LIBS)
# Generates <Package>Targets.cmake file included by <Package>Config.cmake.
# The files are placed in CMakeFiles/Export in the build tree.
install(
EXPORT "${CMAKE_PROJECT_NAME}"
FILE "${CMAKE_PROJECT_NAME}Targets.cmake"
NAMESPACE "${CMAKE_PROJECT_NAME}::"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)
endif()
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(VENDOR_INSTALL_ROOT "ADLINK")
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "ADLINK Technology Inc.")
set(CPACK_PACKAGE_CONTACT "${CMAKE_PROJECT_NAME} core developers <info@adlinktech.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Leading OMG DDS implementation from ADLINK Technology")
set(CPACK_PACKAGE_ICON "${PACKAGING_MODULE_DIR}/vortex.ico")
# WiX requires a .txt file extension for CPACK_RESOURCE_FILE_LICENSE
file(COPY "${PROJECT_SOURCE_DIR}/../LICENSE" DESTINATION "${CMAKE_BINARY_DIR}")
file(RENAME "${CMAKE_BINARY_DIR}/LICENSE" "${CMAKE_BINARY_DIR}/license.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/license.txt")
# Packages could be generated on alien systems. e.g. Debian packages could be
# created on Red Hat Enterprise Linux, but since packages also need to be
# verified on the target platform, please refrain from doing so. Another
# reason for building installer packages on the target platform is to ensure
# the binaries are linked to the libc version shipped with that platform. To
# support "generic" Linux distributions, eventually compressed tarballs will
# be shipped.
#
# NOTE: Settings for different platforms are in separate control branches.
# Although that does not make sense from a technical point-of-view, it
# does help to clearify which settings are required for a platform.
set(CPACK_COMPONENTS_ALL dev lib)
set(CPACK_COMPONENT_LIB_DISPLAY_NAME "${CMAKE_PROJECT_NAME_FULL} library")
set(CPACK_COMPONENT_LIB_DESCRIPTION "Library used to run programs with ${CMAKE_PROJECT_NAME_FULL}")
set(CPACK_COMPONENT_DEV_DISPLAY_NAME "${CMAKE_PROJECT_NAME_FULL} development")
set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for use with ${CMAKE_PROJECT_NAME_FULL}")
if(WIN32 AND NOT UNIX)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(__arch "win64")
else()
set(__arch "win32")
endif()
mark_as_advanced(__arch)
set(CPACK_GENERATOR "WIX;ZIP;${CPACK_GENERATOR}" CACHE STRING "List of package generators")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${VENDOR_INSTALL_ROOT}/${CMAKE_PROJECT_NAME_FULL}")
set(CPACK_WIX_LIGHT_EXTENSIONS "WixUtilExtension")
set(CPACK_WIX_COMPONENT_INSTALL ON)
set(CPACK_WIX_ROOT_FEATURE_TITLE "${CMAKE_PROJECT_NAME_FULL}")
set(CPACK_WIX_PRODUCT_ICON "${PACKAGING_MODULE_DIR}/vortex.ico")
# Bitmap (.bmp) of size 493x58px
set(CPACK_WIX_UI_BANNER "${PACKAGING_MODULE_DIR}/banner.bmp")
# Bitmap (.bmp) of size 493x312px
set(CPACK_WIX_UI_DIALOG "${PACKAGING_MODULE_DIR}/dialog.png")
set(CPACK_WIX_PROGRAM_MENU_FOLDER "${CPACK_PACKAGE_NAME_FULL}")
set(CPACK_WIX_PATCH_FILE "${PACKAGING_MODULE_DIR}/examples.xml")
set(CPACK_WIX_PROPERTY_ARPHELPLINK "http://www.adlinktech.com/support")
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "http://www.adlinktech.com/")
set(CPACK_WIX_PROPERTY_ARPURLUPDATEINFO "http://www.adlinktech.com/")
# A constant GUID allows installers to replace existing installations that use the same GUID.
set(CPACK_WIX_UPGRADE_GUID "1351F59A-972B-4624-A7F1-439381BFA41D")
include(InstallRequiredSystemLibraries)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
# CMake prior to v3.6 messes up the name of the packages. >= v3.6 understands CPACK_RPM/DEBIAN_<component>_FILE_NAME
cmake_minimum_required(VERSION 3.6)
set(CPACK_COMPONENTS_GROUPING "IGNORE")
# FIXME: Requiring lsb_release to be installed may be a viable option.
if(EXISTS "/etc/redhat-release")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(__arch "x86_64")
else()
set(__arch "i686")
endif()
set(CPACK_GENERATOR "RPM;TGZ;${CPACK_GENERATOR}" CACHE STRING "List of package generators")
set(CPACK_RPM_COMPONENT_INSTALL ON)
# FIXME: The package file name must be updated to include the distribution.
# See Fedora and Red Hat packaging guidelines for details.
set(CPACK_RPM_LIB_PACKAGE_NAME "${CMAKE_PROJECT_NAME_DASHED}")
set(CPACK_RPM_LIB_FILE_NAME "${CPACK_RPM_LIB_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}.rpm")
set(CPACK_RPM_DEV_PACKAGE_NAME "${CPACK_RPM_LIB_PACKAGE_NAME}-devel")
set(CPACK_RPM_DEV_FILE_NAME "${CPACK_RPM_DEV_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${__arch}.rpm")
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "${CPACK_RPM_LIB_PACKAGE_NAME} = ${CPACK_PACKAGE_VERSION}")
elseif(EXISTS "/etc/debian_version")
set(CPACK_DEB_COMPONENT_INSTALL ON)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(__arch "amd64")
else()
set(__arch "i386")
endif()
set(CPACK_GENERATOR "DEB;TGZ;${CPACK_GENERATOR}" CACHE STRING "List of package generators")
string(TOLOWER "${CMAKE_PROJECT_NAME_DASHED}" CPACK_DEBIAN_LIB_PACKAGE_NAME)
set(CPACK_DEBIAN_LIB_FILE_NAME "${CPACK_DEBIAN_LIB_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${__arch}.deb")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_NAME} (= ${CPACK_PACKAGE_VERSION}), libc6 (>= 2.23)")
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${CPACK_DEBIAN_LIB_PACKAGE_NAME}-dev")
set(CPACK_DEBIAN_DEV_FILE_NAME "${CPACK_DEBIAN_DEV_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${__arch}.deb")
else()
# Generic tgz package
set(CPACK_GENERATOR "TGZ;${CPACK_GENERATOR}" CACHE STRING "List of package generators")
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "VxWorks")
# FIXME: Support for VxWorks packages must still be implemented (probably
# just a compressed tarball)
message(STATUS "Packaging for VxWorks is unsupported")
endif()
# This must always be last!
include(CPack)

View file

@ -1,16 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/idlc/IdlcGenerate.cmake")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View file

@ -1,228 +0,0 @@
<!--
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-->
<!--
Installing the Hello World! example at the USERPROFILE directory.
-->
<CPackWiXPatch>
<CPackWiXFragment Id="#PRODUCT">
<DirectoryRef Id="TARGETDIR">
<Directory Id="PersonalFolder">
<Directory Id="CYCLONEUSERDIR" Name="Cyclone DDS">
<Directory Id="CM_DP_dev.usr.CycloneDDS.examples" Name="examples">
<Directory Id="CM_DP_dev.usr.CycloneDDS.examples.helloworld" Name="helloworld">
<Directory Id="CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" Name="vs"/>
<Directory Id="CM_DP_dev.usr.CycloneDDS.examples.helloworld.generated" Name="generated"/>
</Directory>
<Directory Id="CM_DP_dev.usr.CycloneDDS.examples.roundtrip" Name="roundtrip" />
<Directory Id="CM_DP_dev.usr.CycloneDDS.examples.throughput" Name="throughput" />
</Directory>
</Directory>
</Directory>
</DirectoryRef>
<Feature Id="UserWritableExampleFeature" Display="expand" Absent="disallow" ConfigurableDirectory="CYCLONEUSERDIR" Title="Cyclone DDS Examples" Description="Example code to getting started with DDS development." Level="1">
<Feature Id="CM_C_usr" Title="Cyclone DDS Development Examples" Description="Example Development files for use with Cyclone DDS. Typically installed in the users 'Document' directory.">
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.Launcher.ApplicationShortcut" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.environment" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.cmake.prefix.path" />
<!-- helloworld -->
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.remove" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.idl" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.sln" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldPublisher.vcxproj" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldSubscriber.vcxproj" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldType.vcxproj" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.h" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.directories.props" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.publisher.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.subscriber.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.CMakeLists.txt" />
<!-- roundtrip -->
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.RoundTrip.idl" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.ping.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.pong.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.CMakeLists.txt" />
<!-- throughput -->
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.Throughput.idl" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.publisher.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.subscriber.c" />
<ComponentRef Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.CMakeLists.txt" />
</Feature>
</Feature>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.remove" Directory="CYCLONEUSERDIR" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="Remove.CM_CP_dev.usr.CycloneDDS.examples" Value="Remove.CM_CP_dev.usr.CycloneDDS.examples" KeyPath="yes" />
<!-- helloworld -->
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" On="uninstall"/>
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS.examples.helloworld.generated" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.generated" On="uninstall"/>
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS.examples.helloworld" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld" On="uninstall"/>
<!-- roundtrip -->
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS.examples.roundtrip" Directory="CM_DP_dev.usr.CycloneDDS.examples.roundtrip" On="uninstall"/>
<!-- throughput -->
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS.examples.throughput" Directory="CM_DP_dev.usr.CycloneDDS.examples.throughput" On="uninstall"/>
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS.examples" Directory="CM_DP_dev.usr.CycloneDDS.examples" On="uninstall"/>
<RemoveFolder Id="Remove.CM_DP_dev.usr.CycloneDDS" Directory="CYCLONEUSERDIR" On="uninstall"/>
</Component>
<!-- Hello World - files -->
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.idl" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldData.idl" Value="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldData.idl" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldData.idl" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/HelloWorldData.idl" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.sln" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorld.sln" Value="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorld.sln" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorld.sln" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/HelloWorld.sln" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldPublisher.vcxproj" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldPublisher.vcxproj" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldPublisher.vcxproj" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldPublisher.vcxproj" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/vs/HelloWorldPublisher.vcxproj" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldSubscriber.vcxproj" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldSubscriber.vcxproj" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldSubscriber.vcxproj" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldSubscriber.vcxproj" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/vs/HelloWorldSubscriber.vcxproj" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldType.vcxproj" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldType.vcxproj" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldType.vcxproj" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldType.vcxproj" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/vs/HelloWorldType.vcxproj" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.directories.props" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.vs" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.directories.props" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.directories.props" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.directories.props" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/vs/directories.props" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.generated" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.c" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldData.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/generated/HelloWorldData.c" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.h" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld.generated" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.h" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.HelloWorldData.h" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.HelloWorldData.h" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/generated/HelloWorldData.h" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.publisher.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.publisher.c" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.publisher.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.publisher.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/publisher.c" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.subscriber.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.subscriber.c" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.subscriber.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.subscriber.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/subscriber.c" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.helloworld.CMakeLists.txt" Directory="CM_DP_dev.usr.CycloneDDS.examples.helloworld" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.helloworld.CMakeLists.txt" Value="CM_CP_dev.usr.CycloneDDS.examples.helloworld.CMakeLists.txt" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.helloworld.CMakeLists.txt" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/helloworld/CMakeLists.txt" KeyPath="no"/>
</Component>
<!-- RoundTrip - files -->
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.CMakeLists.txt" Directory="CM_DP_dev.usr.CycloneDDS.examples.roundtrip" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.CMakeLists.txt" Value="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.CMakeLists.txt" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.roundtrip.CMakeLists.txt" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/roundtrip/CMakeLists.txt" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.RoundTrip.idl" Directory="CM_DP_dev.usr.CycloneDDS.examples.roundtrip" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.RoundTrip.idl" Value="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.RoundTrip.idl" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.roundtrip.RoundTrip.idl" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/roundtrip/RoundTrip.idl" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.ping.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.roundtrip" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.ping.c" Value="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.ping.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.roundtrip.ping.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/roundtrip/ping.c" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.pong.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.roundtrip" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.pong.c" Value="CM_CP_dev.usr.CycloneDDS.examples.roundtrip.pong.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.roundtrip.pong.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/roundtrip/pong.c" KeyPath="no"/>
</Component>
<!-- Throughput - files -->
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.CMakeLists.txt" Directory="CM_DP_dev.usr.CycloneDDS.examples.throughput" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.throughput.CMakeLists.txt" Value="CM_CP_dev.usr.CycloneDDS.examples.throughput.CMakeLists.txt" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.throughput.CMakeLists.txt" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/throughput/CMakeLists.txt" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.Throughput.idl" Directory="CM_DP_dev.usr.CycloneDDS.examples.throughput" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.throughput.Throughput.idl" Value="CM_CP_dev.usr.CycloneDDS.examples.throughput.Throughput.idl" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.throughput.Throughput.idl" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/throughput/Throughput.idl" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.publisher.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.throughput" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.throughput.publisher.c" Value="CM_CP_dev.usr.CycloneDDS.examples.throughput.publisher.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.throughput.publisher.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/throughput/publisher.c" KeyPath="no"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.throughput.subscriber.c" Directory="CM_DP_dev.usr.CycloneDDS.examples.throughput" Guid="">
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.examples.throughput.subscriber.c" Value="CM_CP_dev.usr.CycloneDDS.examples.throughput.subscriber.c" KeyPath="yes" />
<File Id="CM_FP_usr.usr.CycloneDDS.examples.throughput.subscriber.c" Source="$(sys.SOURCEFILEDIR)/$(var.CPACK_PACKAGE_NAME)-$(var.CPACK_PACKAGE_VERSION)-win64/dev/share/CycloneDDS/examples/throughput/subscriber.c" KeyPath="no"/>
</Component>
<!-- Add the location of the ddsc.dll to the system path -->
<Component Id="CM_CP_dev.usr.CycloneDDS.examples.environment" Directory="CYCLONEUSERDIR" Guid="">
<!-- CreateFolder and RegistryValue are needed to keep Wix happy -->
<CreateFolder Directory="CYCLONEUSERDIR"/>
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.environment" Value="CM_CP_dev.usr.CycloneDDS.environment" KeyPath="yes" />
<Environment Action="set" Id="CycloneDDSPath" Name="PATH" Part="last" Permanent="yes" System="yes" Value="[INSTALL_ROOT]bin"/>
</Component>
<Component Id="CM_CP_dev.usr.CycloneDDS.cmake.prefix.path" Directory="CYCLONEUSERDIR" Guid="">
<!-- CreateFolder and RegistryValue are needed to keep Wix happy -->
<CreateFolder Directory="CYCLONEUSERDIR"/>
<RegistryValue Type="string" Root="HKCU" Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)" Name="CM_CP_dev.usr.CycloneDDS.cmake.prefix.path" Value="CM_CP_dev.usr.CycloneDDS.cmake.prefix.path" KeyPath="yes" />
<Environment Action="set" Id="CMakePrefixPath" Name="CMAKE_PREFIX_PATH" Permanent="no" Value="[INSTALL_ROOT]share/CycloneDDS"/>
</Component>
<!-- Offer the user the ability the start the launcher -->
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="After clicking Finish, the Vortex DDS Launcher will start (if indicated below). The Vortex DDS Laucher will help to get started with Cyclone DDS." />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Start the Vortex DDS Launcher" />
<Property Id="WixShellExecTarget" Value="[INSTALL_ROOT]/bin/vortexddslauncher.exe" />
<CustomAction Id="CM_CA_dev.user.CycloneDDS.Launcher.Launch" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<UI>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="CM_CA_dev.user.CycloneDDS.Launcher.Launch">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<!-- Create start-menu -->
<DirectoryRef Id="TARGETDIR">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Cyclone DDS"/>
</Directory>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="CM_CP_dev.usr.CycloneDDS.Launcher.ApplicationShortcut" Guid="C21831A3-FBCE-44D0-A098-A1F21FD4846F">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="CycloneDDS Launcher"
Directory="ApplicationProgramsFolder"
Description="My Application Description"
Target="[INSTALL_ROOT]/bin/vortexddslauncher.exe"
Icon="ShortcutIcon"
IconIndex="0">
<Icon Id="ShortcutIcon" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)" />
</Shortcut>
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\AdLink" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
</CPackWiXFragment>
</CPackWiXPatch>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View file

@ -1,213 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# CMake Platform file for VxWorks
#
# This file will be used as platform file if CMAKE_SYSTEM_NAME is defined
# as VxWorks in the toolchain file.
#
# Most information is resolved by analyzing the absolute location of the
# compiler on the file system, but can be overridden if required.
#
# Setting CMAKE_SYSTEM_PROCESSOR is mandatory. The variable should be set to
# e.g. ARMARCH* if the target architecture is arm.
#
# NOTES:
# * For now support for VxWorks Diab compiler will NOT be implemented.
# * If certain settings are not explicitly defined, this platform file will
# try to deduce it from the installation path. It will, however, not go out
# of it's way to validate and cross-reference settings.
#
# https://cmake.org/Wiki/CMake_Cross_Compiling
#
if((NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles") AND
(NOT "${CMAKE_GENERATOR}" MATCHES "Ninja"))
message(FATAL_ERROR "Cross compilation for VxWorks is not supported for "
"${CMAKE_GENERATOR}")
endif()
set(WIND_PROCESSOR_TYPE_PATTERN ".*(cc|c\\+\\+)(arm|mips|pentium|ppc).*")
set(WIND_HOST_TYPE_PATTERN "^x86-(linux2|win32)$")
set(WIND_PLATFORM_PATTERN "^[0-9\.]+-vxworks-([0-9\.]+)$")
# Try to deduce the system architecture from either CMAKE_C_COMPILER or
# CMAKE_CXX_COMPILER (one of which must be specified).
#
# Path examples:
# <WindRiver>/gnu/4.3.3-vxworks-6.9/x86-linux2/bin
# <WindRiver>/gnu/4.1.2-vxworks-6.8/x86-win32/bin
foreach(COMPILER CMAKE_C_COMPILER CMAKE_CXX_COMPILER)
if("${${COMPILER}}" MATCHES "${WIND_PROCESSOR_TYPE_PATTERN}")
string(
REGEX REPLACE
"${WIND_PROCESSOR_TYPE_PATTERN}" "\\2"
PROCESSOR_TYPE
${${COMPILER}})
if(NOT WIND_PROCESSOR_TYPE)
set(WIND_PROCESSOR_TYPE ${PROCESSOR_TYPE})
endif()
get_filename_component(COMPILER_NAME "${${COMPILER}}" NAME)
if((NOT "${COMPILER_NAME}" STREQUAL "${${COMPILER}}") AND
(NOT "${COMPILER_DIRECTORY}"))
get_filename_component(
COMPILER_PATH "${${COMPILER}}" REALPATH)
get_filename_component(
COMPILER_DIRECTORY "${COMPILER_PATH}" DIRECTORY)
endif()
else()
message(FATAL_ERROR "${COMPILER} did not conform to the expected "
"executable format. i.e. it did not end with "
"arm, mips, pentium, or ppc.")
endif()
endforeach()
get_filename_component(C_COMPILER_NAME "${CMAKE_C_COMPILER}" NAME)
get_filename_component(CXX_COMPILER_NAME "${CMAKE_CXX_COMPILER}" NAME)
# Ideally the location of the compiler should be resolved at this, but invoke
# find_program as a last resort.
if(NOT COMPILER_DIRECTORY)
find_program(
COMPILER_PATH NAMES "${C_COMPILER_NAME}" "${CXX_COMPILER_NAME}")
if(COMPILER_PATH)
get_filename_component(
COMPILER_DIRECTORY "${COMPILER_PATH}" COMPILER_PATH)
else()
# The compiler must be successfully be detected by now.
message(FATAL_ERROR "Could not determine location of compiler path.")
endif()
endif()
get_filename_component(basename "${COMPILER_DIRECTORY}" NAME)
get_filename_component(basedir "${COMPILER_DIRECTORY}" DIRECTORY)
while(basename)
if("${basename}" MATCHES "${WIND_PLATFORM_PATTERN}")
string(
REGEX REPLACE "${WIND_PLATFORM_PATTERN}" "\\1" version ${basename})
if(NOT CMAKE_SYSTEM_VERSION)
set(CMAKE_SYSTEM_VERSION ${version})
endif()
# The current base directory may be the WindRiver directory depending
# on wether a "gnu" directory exists or not, but that is evaluated in
# the next iteration.
set(WIND_HOME "${basedir}")
set(WIND_PLATFORM "${basename}")
elseif(CMAKE_SYSTEM_VERSION AND WIND_HOME AND WIND_HOST_TYPE)
# The "gnu" directory may not be part of the path. If it is, strip it.
if("${basename}" STREQUAL "gnu")
set(WIND_HOME "${basedir}")
endif()
break()
elseif("${basename}" MATCHES "${WIND_HOST_TYPE_PATTERN}")
set(WIND_HOST_TYPE "${basename}")
endif()
get_filename_component(basename ${basedir} NAME)
get_filename_component(basedir ${basedir} DIRECTORY)
endwhile()
# VxWorks commands require the WIND_BASE environment variable, so this script
# will support it too. If the environment variable is not set, the necessary
# path information is deduced from the compiler path.
if(NOT WIND_BASE)
set(WIND_BASE $ENV{WIND_BASE})
endif()
if(NOT WIND_BASE)
set(WIND_BASE "${WIND_HOME}/vxworks-${CMAKE_SYSTEM_VERSION}")
endif()
# Verify the location WIND_BASE references actually exists.
if(NOT EXISTS ${WIND_BASE})
message(FATAL_ERROR "VxWorks base directory ${WIND_BASE} does not exist, "
"please ensure the toolchain information is correct.")
elseif(NOT ENV{WIND_BASE})
# WIND_BASE environment variable must be exported during generation
# otherwise compiler tests will fail.
set(ENV{WIND_BASE} "${WIND_BASE}")
endif()
if(NOT CMAKE_C_COMPILER_VERSION)
execute_process(
COMMAND "${CMAKE_C_COMPILER}" -dumpversion
OUTPUT_VARIABLE CMAKE_C_COMPILER_VERSION)
string(STRIP "${CMAKE_C_COMPILER_VERSION}" CMAKE_C_COMPILER_VERSION)
message(STATUS "VxWorks C compiler version ${CMAKE_C_COMPILER_VERSION}")
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION)
execute_process(
COMMAND "${CMAKE_CXX_COMPILER}" -dumpversion
OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
string(STRIP "${CMAKE_CXX_COMPILER_VERSION}" CMAKE_CXX_COMPILER_VERSION)
message(STATUS "VxWorks CXX compiler version ${CMAKE_C_COMPILER_VERSION}")
endif()
set(CMAKE_C_COMPILER_ID GNU)
set(CMAKE_CXX_COMPILER_ID GNU)
# CMAKE_SOURCE_DIR does not resolve to the actual source directory because
# platform files are processed to early on in the process.
set(ROOT "${CMAKE_MODULE_PATH}/../")
if(WIN32)
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-c.bat")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-cxx.bat")
configure_file(
"${ROOT}/launch-c.bat.in" "${CMAKE_C_COMPILER_LAUNCHER}" @ONLY)
configure_file(
"${ROOT}/launch-cxx.bat.in" "${CMAKE_CXX_COMPILER_LAUNCHER}" @ONLY)
else()
# Check if a directory like lmapi-* exists (VxWorks 6.9) and append it to
# LD_LIBRARY_PATH.
file(GLOB WIND_LMAPI LIST_DIRECTORIES true "${WIND_HOME}/lmapi-*")
if(WIND_LMAPI)
set(WIND_LMAPI "${WIND_LMAPI}/${WIND_HOST_TYPE}/lib")
endif()
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-cxx")
configure_file(
"${ROOT}/launch-c.in" "${CMAKE_C_COMPILER_LAUNCHER}" @ONLY)
configure_file(
"${ROOT}/launch-cxx.in" "${CMAKE_CXX_COMPILER_LAUNCHER}" @ONLY)
execute_process(COMMAND chmod a+rx "${CMAKE_C_COMPILER_LAUNCHER}")
execute_process(COMMAND chmod a+rx "${CMAKE_CXX_COMPILER_LAUNCHER}")
endif()
set(WIND_INCLUDE_DIRECTORY "${WIND_BASE}/target/h")
# Versions before 6.8 have a different path for common libs.
if("${CMAKE_SYSTEM_VERSION}" VERSION_GREATER "6.8")
set(WIND_LIBRARY_DIRECTORY "${WIND_BASE}/target/lib/usr/lib/${WIND_PROCESSOR_TYPE}/${CMAKE_SYSTEM_PROCESSOR}/common")
else()
set(WIND_LIBRARY_DIRECTORY "${WIND_BASE}/target/usr/lib/${WIND_PROCESSOR_TYPE}/${CMAKE_SYSTEM_PROCESSOR}/common")
endif()
if(NOT EXISTS "${WIND_LIBRARY_DIRECTORY}")
message(FATAL_ERROR "${CMAKE_SYSTEM_PROCESSOR} is not part of the "
"${WIND_PROCESSOR_TYPE} processor family.")
endif()
include_directories(BEFORE SYSTEM "${WIND_INCLUDE_DIRECTORY}")
link_directories("${WIND_LIBRARY_DIRECTORY}")

View file

@ -1,134 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# This script will run all tests and generates various coverage reports.
#
# Example usage:
# $ cmake -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoverageConvenience.cmake
# If you start the scripts while in <cham bld> then you don't have to provide the COVERAGE_SETTINGS file.
#
cmake_minimum_required(VERSION 3.5)
# Get Coverage configuration file
if(NOT COVERAGE_SETTINGS)
set(COVERAGE_SETTINGS ${CMAKE_CURRENT_BINARY_DIR}/CoverageSettings.cmake)
endif()
include(${COVERAGE_SETTINGS})
message(STATUS "Config file: ${COVERAGE_SETTINGS}")
message(STATUS "Source directory: ${COVERAGE_SOURCE_DIR}")
message(STATUS "Test directory: ${COVERAGE_RUN_DIR}")
message(STATUS "Output directory: ${COVERAGE_OUTPUT_DIR}")
set(COVERAGE_SCRIPTS_DIR "${COVERAGE_SOURCE_DIR}/cmake/scripts")
###############################################################################
#
# Detect generators
#
###############################################################################
set(GENERATE_COVERAGE TRUE)
if(GENERATE_COVERAGE)
find_program(GCOV_PATH gcov PARENT_SCOPE)
if(NOT GCOV_PATH)
set(GENERATE_COVERAGE FALSE)
message(STATUS "[SKIP] Coverage generators - gcov (could not find gcov)")
endif()
endif()
if(GENERATE_COVERAGE)
message(STATUS "[ OK ] Coverage generators - gcov")
endif()
set(GENERATE_COVERAGE_HTML TRUE)
if(GENERATE_COVERAGE_HTML)
find_program(LCOV_PATH lcov PARENT_SCOPE)
if(NOT LCOV_PATH)
set(GENERATE_COVERAGE_HTML FALSE)
message(STATUS "[SKIP] Coverage generators - HTML (could not find lcov)")
endif()
endif()
if(GENERATE_COVERAGE_HTML)
find_program(GENHTML_PATH genhtml PARENT_SCOPE)
if(NOT GENHTML_PATH)
set(GENERATE_COVERAGE_HTML FALSE)
message(STATUS "[SKIP] Coverage generators - HTML (could not find genhtml)")
endif()
endif()
if(GENERATE_COVERAGE_HTML)
message(STATUS "[ OK ] Coverage generators - HTML (lcov and genhtml)")
endif()
set(GENERATE_COVERAGE_COBERTURA TRUE)
if(GENERATE_COVERAGE_COBERTURA)
find_program(GCOVR_PATH gcovr PARENT_SCOPE)
if(NOT GCOVR_PATH)
set(GENERATE_COVERAGE_COBERTURA FALSE)
message(STATUS "[SKIP] Coverage generators - Cobertura (could not find gcovr)")
endif()
endif()
if(GENERATE_COVERAGE_COBERTURA)
message(STATUS "[ OK ] Coverage generators - Cobertura (gcovr)")
endif()
if(NOT GENERATE_COVERAGE)
message(FATAL_ERROR "Could not find the main coverage generator 'gcov'")
elseif(NOT GENERATE_COVERAGE_HTML AND NOT GENERATE_COVERAGE_COBERTURA)
message(FATAL_ERROR "Could not find either of the two coverage report generators")
endif()
###############################################################################
#
# Setup environment
#
###############################################################################
message(STATUS "Setup environment")
if(GENERATE_COVERAGE_HTML)
execute_process(COMMAND ${CMAKE_COMMAND} -DCOVERAGE_SETTINGS=${COVERAGE_SETTINGS} -P ${COVERAGE_SCRIPTS_DIR}/CoveragePreHtml.cmake
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
endif()
if(GENERATE_COVERAGE_COBERTURA)
execute_process(COMMAND ${CMAKE_COMMAND} -DCOVERAGE_SETTINGS=${COVERAGE_SETTINGS} -P ${COVERAGE_SCRIPTS_DIR}/CoveragePreCobertura.cmake
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
endif()
###############################################################################
#
# Generate coverage results by running all the tests
#
###############################################################################
message(STATUS "Run all test to get coverage")
execute_process(COMMAND ctest ${COVERAGE_QUIET_FLAG} -T test
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
execute_process(COMMAND ctest ${COVERAGE_QUIET_FLAG} -T coverage
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
###############################################################################
#
# Generate coverage reports
#
###############################################################################
if(GENERATE_COVERAGE_HTML)
execute_process(COMMAND ${CMAKE_COMMAND} -DCOVERAGE_SETTINGS=${COVERAGE_SETTINGS} -P ${COVERAGE_SCRIPTS_DIR}/CoveragePostHtml.cmake
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
endif()
if(GENERATE_COVERAGE_COBERTURA)
execute_process(COMMAND ${CMAKE_COMMAND} -DCOVERAGE_SETTINGS=${COVERAGE_SETTINGS} -P ${COVERAGE_SCRIPTS_DIR}/CoveragePostCobertura.cmake
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
endif()

View file

@ -1,52 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# This script assumes that all test have been run and gcov results are available.
# It will generate the Cobertura output from the gcov results.
#
# Example usage:
# $ cmake -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePreCobertura.cmake
# $ ctest -T test
# $ ctest -T coverage
# $ ctest -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePostCobertura.cmake
# If you start the scripts while in <cham bld> then you don't have to provide the COVERAGE_SETTINGS file.
#
cmake_minimum_required(VERSION 3.5)
# Get Coverage configuration file
if(NOT COVERAGE_SETTINGS)
set(COVERAGE_SETTINGS ${CMAKE_CURRENT_BINARY_DIR}/CoverageSettings.cmake)
endif()
include(${COVERAGE_SETTINGS})
# Some debug
#message(STATUS "Config file: ${COVERAGE_SETTINGS}")
#message(STATUS "Source directory: ${COVERAGE_SOURCE_DIR}")
#message(STATUS "Test directory: ${COVERAGE_RUN_DIR}")
#message(STATUS "Output directory: ${COVERAGE_OUTPUT_DIR}")
# Find gcovr to generate Cobertura results
find_program(GCOVR_PATH gcovr PARENT_SCOPE)
if(NOT GCOVR_PATH)
message(FATAL_ERROR "Could not find gcovr to generate Cobertura coverage.")
endif()
# Create location to put the result file.
file(MAKE_DIRECTORY ${COVERAGE_OUTPUT_DIR})
execute_process(COMMAND ${GCOVR_PATH} -x -r ${COVERAGE_SOURCE_DIR} -e ".*/${COVERAGE_EXCLUDE_TESTS}/.*" -e ".*/${COVERAGE_EXCLUDE_EXAMPLES}/.*" -e ".*/${COVERAGE_EXCLUDE_BUILD_SUPPORT}/.*" -o ${COVERAGE_OUTPUT_DIR}/cobertura.xml
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
message(STATUS "The Cobertura report can be found here: ${COVERAGE_OUTPUT_DIR}/cobertura.xml")

View file

@ -1,71 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# This script assumes that all test have been run and gcov results are available.
# It will generate the HTML output from the gcov results.
#
# Example usage:
# $ cmake -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePreHtml.cmake
# $ ctest -T test
# $ ctest -T coverage
# $ ctest -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePostHtml.cmake
# If you start the scripts while in <cham bld> then you don't have to provide the COVERAGE_SETTINGS file.
#
cmake_minimum_required(VERSION 3.5)
# Get Coverage configuration file
if(NOT COVERAGE_SETTINGS)
set(COVERAGE_SETTINGS ${CMAKE_CURRENT_BINARY_DIR}/CoverageSettings.cmake)
endif()
include(${COVERAGE_SETTINGS})
# Some debug
#message(STATUS "Config file: ${COVERAGE_SETTINGS}")
#message(STATUS "Source directory: ${COVERAGE_SOURCE_DIR}")
#message(STATUS "Test directory: ${COVERAGE_RUN_DIR}")
#message(STATUS "Output directory: ${COVERAGE_OUTPUT_DIR}")
# Find tools to generate HTML coverage results
find_program(LCOV_PATH lcov PARENT_SCOPE)
if(NOT LCOV_PATH)
message(FATAL_ERROR "Could not find lcov to generate HTML coverage.")
endif()
find_program(GENHTML_PATH genhtml PARENT_SCOPE)
if(NOT GENHTML_PATH)
message(FATAL_ERROR "Could not find genhtml to generate HTML coverage.")
endif()
# Create location to put the result file.
file(MAKE_DIRECTORY ${COVERAGE_OUTPUT_DIR})
set(COVERAGE_HTML_OUTPUT "${COVERAGE_OUTPUT_DIR}/html")
file(MAKE_DIRECTORY ${COVERAGE_HTML_OUTPUT})
# Setup tmp analysis files
set(COVERAGE_INFO "${COVERAGE_HTML_OUTPUT}/coverage_html.info")
set(COVERAGE_CLEANED "${COVERAGE_INFO}.cleaned")
# Execute lcov and genhtml commands to get HTML results
execute_process(COMMAND ${LCOV_PATH} ${COVERAGE_QUIET_FLAG} --directory . --capture --output-file ${COVERAGE_INFO}
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
execute_process(COMMAND ${LCOV_PATH} ${COVERAGE_QUIET_FLAG} --remove ${COVERAGE_INFO} "${COVERAGE_EXCLUDE_TESTS}/*" "${COVERAGE_EXCLUDE_EXAMPLES}/*" "${COVERAGE_EXCLUDE_BUILD_SUPPORT}/*" "/usr/*" --output-file ${COVERAGE_CLEANED}
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
execute_process(COMMAND ${GENHTML_PATH} ${COVERAGE_QUIET_FLAG} -o ${COVERAGE_HTML_OUTPUT} ${COVERAGE_CLEANED}
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
# Remove tmp analysis files
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${COVERAGE_INFO} ${COVERAGE_CLEANED}
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})
message(STATUS "The HTML coverage report can be found here: ${COVERAGE_HTML_OUTPUT}/index.html")

View file

@ -1,30 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# This script assumes that it is called before all tests are run and gcov results are available.
# It can be used to setup the environment needed to get proper Cobertura coverage results.
#
# Example usage:
# $ cmake -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePreCobertura.cmake
# $ ctest -T test
# $ ctest -T coverage
# $ ctest -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePostCobertura.cmake
# If you start the scripts while in <cham bld> then you don't have to provide the COVERAGE_SETTINGS file.
#
cmake_minimum_required(VERSION 3.5)
#
# Nothing to do really.
# This is just added to provide consistency between Coverage scripts.
#

View file

@ -1,52 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# This script assumes that it is called before all tests are run and gcov results are available.
# It can be used to setup the environment needed to get proper HTML coverage results.
#
# Example usage:
# $ cmake -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePreHtml.cmake
# $ ctest -T test
# $ ctest -T coverage
# $ ctest -DCOVERAGE_SETTINGS=<cham bld>/CoverageSettings.cmake -P <cham src>/cmake/scripts/CoveragePostHtml.cmake
# If you start the scripts while in <cham bld> then you don't have to provide the COVERAGE_SETTINGS file.
#
cmake_minimum_required(VERSION 3.5)
# Get Coverage configuration file
if(NOT COVERAGE_SETTINGS)
set(COVERAGE_SETTINGS ${CMAKE_CURRENT_BINARY_DIR}/CoverageSettings.cmake)
endif()
include(${COVERAGE_SETTINGS})
# Some debug
#message(STATUS "Config file: ${COVERAGE_SETTINGS}")
#message(STATUS "Source directory: ${COVERAGE_SOURCE_DIR}")
#message(STATUS "Test directory: ${COVERAGE_RUN_DIR}")
#message(STATUS "Output directory: ${COVERAGE_OUTPUT_DIR}")
# Find tools to generate HTML coverage results
find_program(LCOV_PATH lcov PARENT_SCOPE)
if(NOT LCOV_PATH)
message(FATAL_ERROR "Could not find lcov to generate HTML coverage.")
endif()
find_program(GENHTML_PATH genhtml PARENT_SCOPE)
if(NOT GENHTML_PATH)
message(FATAL_ERROR "Could not find genhtml to generate HTML coverage.")
endif()
# Reset LCOV environment
execute_process(COMMAND ${LCOV_PATH} ${COVERAGE_QUIET_FLAG} --directory . --zerocounters
WORKING_DIRECTORY ${COVERAGE_RUN_DIR})

View file

@ -1,33 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
set(CMAKE_SYSTEM_NAME VxWorks)
set(CMAKE_SYSTEM_PROCESSOR PENTIUM4)
set(WIND_HOME "/path/to/WindRiver")
set(WIND_PROCESSOR_TYPE "pentium")
# Binaries are named e.g. ccpentium or ccarm
set(CMAKE_C_COMPILER ${WIND_HOME}/gnu/4.3.3-vxworks-6.9/x86-linux2/bin/cc${WIND_PROCESSOR_TYPE})
set(CMAKE_CXX_COMPILER ${WIND_HOME}/gnu/4.3.3-vxworks-6.9/x86-linux2/bin/c++${WIND_PROCESSOR_TYPE})
set(CMAKE_AR ${WIND_HOME}/gnu/4.3.3-vxworks-6.9/x86-linux2/bin/ar${WIND_PROCESSOR_TYPE})
set(WIND_PROGRAM_PATH ${WIND_HOME}/vxworks-6.9/host/x86-linux2/bin;${WIND_BASE}/gnu/4.3.3-vxworks-6.9/x86-linux2/bin)
set(WIND_LIBRARY_PATH ${WIND_HOME}/target/lib/${WIND_PROCESSOR_TYPE}/${CMAKE_SYSTEM_PROCESSOR}/common)
set(WIND_INCLUDE_PATH ${WIND_HOME}/vxworks-6.9/target/h)
set(CMAKE_FIND_ROOT_PATH ${WIND_PROGRAM_PATH};${WIND_LIBRARY_PATH};${WIND_INCLUDE_PATH})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View file

@ -27,8 +27,19 @@ endif()
add_definitions(-DDDSI_INCLUDE_NETWORK_PARTITIONS -DDDSI_INCLUDE_SSM)
option(DDSC_ENABLE_OPENSSL "Enable openssl support" ON)
if(DDSC_ENABLE_OPENSSL)
# OpenSSL is huge, raising the RSS by 1MB or so, and moreover find_package(OpenSSL) causes
# trouble on some older CMake versions that otherwise work fine, so provide an option to avoid
# all OpenSSL related things.
#
# Historically the option was DDSC_ENABLE_OPENSSL so make some allowance for those who are
# currently relying on it.
option(ENABLE_SSL "Enable openssl support" ON)
option(DDSC_ENABLE_OPENSSL "Deprecated: please use ENABLE_SSL instead" ON)
if(NOT DDSC_ENABLE_OPENSSL)
message(ERROR "DDSC_ENABLE_OPENSSL is deprecated, please use ENABLE_SSL instead")
set(ENABLE_SSL OFF)
endif()
if(ENABLE_SSL)
find_package(OpenSSL)
if(OPENSSL_FOUND)
add_definitions(-DDDSI_INCLUDE_SSL)
@ -36,8 +47,9 @@ if(DDSC_ENABLE_OPENSSL)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set_target_properties(ddsc PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
message(STATUS "Building with OpenSSL support")
else()
message(FATAL_ERROR "To build without openssl support, set DDSC_ENABLE_OPENSSL to OFF")
message(STATUS "Building without OpenSSL support")
endif()
endif()
@ -68,4 +80,6 @@ install(
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
)
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/xtests")
if(BUILD_IDLC)
add_subdirectory(xtests)
endif()

View file

@ -11,16 +11,10 @@
#
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS ../../)
endif()
add_compile_options("-I${PROJECT_SOURCE_DIR}/ddsrt/include")
add_compile_options("-I${PROJECT_SOURCE_DIR}/core/ddsc/include")
add_compile_options("-I${PROJECT_SOURCE_DIR}/core/ddsc/src")
add_compile_options("-I${PROJECT_SOURCE_DIR}/core/ddsi/include")
add_compile_options("-I${PROJECT_SOURCE_DIR}/src/ddsrt/include")
add_compile_options("-I${PROJECT_SOURCE_DIR}/src/core/ddsc/include")
add_compile_options("-I${PROJECT_SOURCE_DIR}/src/core/ddsc/src")
add_compile_options("-I${PROJECT_SOURCE_DIR}/src/core/ddsi/include")
add_compile_options("-I$ENV{OSPL_HOME}/src/abstraction/os/include")
add_compile_options("-I$ENV{OSPL_HOME}/src/database/database/include")

View file

@ -1,218 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# TODO depending on requirements we can add/remove options as needed,
# these are examples of generators we'll need as a minimum.
# Perhaps we should also consider options for building subset of all docs.
# When a certain doc is related to a target, no option is needed; you can simply check if the target exists
# (i.e. if a target 'ddsc' exists, build ddsc api docs). And possibly make the target definition dependent on an option.
option(BUILD_DOCS "Build documentation." OFF)
option(DOWNLOAD_DOCS "Download documentation." OFF)
# When BUILD_DOCS is set, missing deps are treated as fatal errors
if (BUILD_DOCS)
set(mode FATAL_ERROR)
else()
set(mode STATUS)
endif()
find_program(SPHINX_EXECUTABLE NAMES sphinx-build DOC "Sphinx documentation builder")
if (NOT SPHINX_EXECUTABLE)
message(${mode} "${CMAKE_PROJECT_NAME} documentation: unable to find sphinx-build executable")
endif()
find_package(Doxygen)
if (NOT Doxygen_FOUND)
message(${mode} "${CMAKE_PROJECT_NAME} documentation: unable to find Doxygen")
endif()
# Creating pdf from latex requires latexmk (which depends on perl, latexpdf et. al)
find_program(LATEXMK_EXECUTABLE NAMES latexmk DOC "LateX PDF Generator")
if (NOT LATEXMK_EXECUTABLE)
message(${mode} "${CMAKE_PROJECT_NAME} documentation: unable to find latexmk")
endif()
if ((NOT DOWNLOAD_DOCS) AND SPHINX_EXECUTABLE AND Doxygen_FOUND AND LATEXMK_EXECUTABLE)
# User requested docs (USE_DOCS=1) and did not explicitely request to download docs (DOWNLOAD_DOCS=0)
# All prerequisites are available to build docs, so force BUILD_DOCS even when the user did not enable it explicitely
set(BUILD_DOCS ON PARENT_SCOPE) # for examples' docs
set(BUILD_DOCS ON)
message(STATUS "${CMAKE_PROJECT_NAME} documentation: Success (build)")
else()
# User requested docs (USE_DOCS=1) and prefers to download instead of build (or prerequisites are not available).
# So force DOWNLOAD_DOCS even when user did not enable it explicitely
set(DOWNLOAD_DOCS ON PARENT_SCOPE) # for examples' docs
set(DOWNLOAD_DOCS ON)
message(STATUS "${CMAKE_PROJECT_NAME} documentation: Success (download)")
endif()
#set(DOCS_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
if (DOWNLOAD_DOCS)
set(JENKINS_BASE_URI "http://jenkins.prismtech.com:8080/")
set(JENKINS_DOCS_JOB_NAME "BuildChameleonLinux64bit")
set(PROJECT_PDF_URI "${JENKINS_BASE_URI}/job/${JENKINS_DOCS_JOB_NAME}/lastSuccessfulBuild/artifact/cham/builds/docs/${CMAKE_PROJECT_NAME}.pdf")
set(PROJECT_HTML_URI "${JENKINS_BASE_URI}/job/${JENKINS_DOCS_JOB_NAME}/lastSuccessfulBuild/artifact/cham/builds/docs/${CMAKE_PROJECT_NAME}HTML.tar.gz")
add_custom_target(docs ALL)
find_program(WGET_EXECUTABLE NAMES wget DOC "wget")
if (WGET_EXECUTABLE)
# prevent wget to create numbered downloads.
add_custom_command(TARGET docs
COMMAND ${CMAKE_COMMAND}
-E remove -f "${CMAKE_PROJECT_NAME}HTML.tar.gz"
VERBATIM)
add_custom_command(TARGET docs
COMMAND ${WGET_EXECUTABLE}
-q ${PROJECT_HTML_URI} ${PROJECT_PDF_URI}
COMMENT "Downloading documentation from target."
VERBATIM)
# To make downloading and packaging easier.
# add_custom_command(TARGET docs
# COMMAND ${CMAKE_COMMAND}
# -E rename ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pdf ${DOCS_OUTPUT_DIR}/${CMAKE_PROJECT_NAME}.pdf
# VERBATIM)
else()
message(STATUS "Unable to find wget. Download docs now.")
# Just try to download the docs straight away.
file(DOWNLOAD ${PROJECT_HTML_URI} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}HTML.tar.gz)
file(DOWNLOAD ${PROJECT_PDF_URI} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pdf)
endif()
add_custom_command(TARGET docs
COMMAND ${CMAKE_COMMAND}
-E tar "zxf" "${CMAKE_PROJECT_NAME}HTML.tar.gz" .
VERBATIM)
# Remove downloaded files when cleaning the build tree
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
html
${CMAKE_PROJECT_NAME}HTML.tar.gz
${CMAKE_PROJECT_NAME}.pdf)
elseif(BUILD_DOCS)
# Generate ddsc API docs in XML format using Doxygen, if the ddsc target is defined.
# The XML will serve as input for sphinx' breathe plugin
if (TARGET ${CMAKE_PROJECT_NAME}::ddsc)
# Process doxygen configuration file, for ddsc
set(doxy_conf_project "${CMAKE_PROJECT_NAME_FULL} C API Documentation")
set(doxy_conf_outputdir "ddsc_api")
set(doxy_conf_input "${PROJECT_SOURCE_DIR}/core/ddsc/include/dds/dds.h ${PROJECT_SOURCE_DIR}/core/ddsc/include/dds")
configure_file(Doxyfile.in Doxyfile @ONLY)
add_custom_target(ddsc_docs
${DOXYGEN_EXECUTABLE} Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running Doxygen for API docs generation"
VERBATIM
)
# Remove generated files when cleaning the build tree
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${doxy_conf_outputdir})
# Add ddsc api docs to sphinx' breathe projects
set(sph_conf_breathe_projs "\"ddsc_api\": \"${doxy_conf_outputdir}/xml\"")
add_custom_command(TARGET ddsc_docs
POST_BUILD
WORKING_DIRECTORY "${doxy_conf_outputdir}"
COMMAND ${CMAKE_COMMAND} -E tar "zcf" "${CMAKE_PROJECT_NAME}_C_HTML.tar.gz" "ddsc")
endif()
# Process sphinx configuration file
set(sph_conf_author "Eclipse Cyclone DDS project")
set(sph_conf_version "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(sph_conf_release "${PROJECT_VERSION}")
configure_file(conf.py.in conf.py @ONLY)
# Define a list of output formats (-b option for sphinx-build)
set(docs_builders "")
list(APPEND docs_builders html)
list(APPEND docs_builders latex)
# Define custom commands for running sphinx-build for different docs builders
set(docs_outputs "")
foreach(builder ${docs_builders})
set(docs_builder_output "docs_${builder}_output")
# Log stdout (not stderr) to a file instead of messing up build output
set(docs_builder_log "sphinx-build-${builder}.log")
add_custom_command(OUTPUT ${docs_builder_output}
COMMAND ${SPHINX_EXECUTABLE}
-b ${builder}
-d ${CMAKE_CURRENT_BINARY_DIR}/cache
-c ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/docs
${CMAKE_CURRENT_BINARY_DIR}/${builder} > ${docs_builder_log}
COMMENT "Running Sphinx for ${builder} output"
VERBATIM)
# FIXME: This is definitely in the wrong location
if(builder STREQUAL html)
add_custom_command(OUTPUT ${docs_builder_output}
COMMAND ${CMAKE_COMMAND}
-E tar "zcf"
"${CMAKE_PROJECT_NAME}HTML.tar.gz"
"html"
APPEND
VERBATIM)
endif()
# Create a pdf from the latex builder output, by appending a latexmk command
# TODO look into rinohtype as an alternative (don't bother with rst2pdf, it's no good)
if(builder STREQUAL latex)
add_custom_command(OUTPUT ${docs_builder_output}
COMMAND ${LATEXMK_EXECUTABLE}
-interaction=nonstopmode
-silent
-output-directory=${builder}
-pdf -dvi- -ps- -cd- ${builder}/${CMAKE_PROJECT_NAME}.tex
APPEND
VERBATIM)
# Move the pdf, so that install rules don't need to differentiate between built and downloaded docs
add_custom_command(OUTPUT ${docs_builder_output}
COMMAND ${CMAKE_COMMAND}
-E rename
"latex/${CMAKE_PROJECT_NAME}.pdf"
"${CMAKE_PROJECT_NAME}.pdf"
APPEND
VERBATIM)
endif()
# OUTPUT is a fake target / symbolic name, not an actual file
set_property(SOURCE ${docs_builder_output} PROPERTY SYMBOLIC 1)
# Remove generated files when cleaning the build tree
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
${builder}
${docs_builder_log})
# Include this builder as a dependency of the general 'docs' target
list(APPEND docs_outputs ${docs_builder_output})
endforeach()
# Remove generated files when cleaning the build tree
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
${CMAKE_PROJECT_NAME}HTML.tar.gz
${CMAKE_PROJECT_NAME}.pdf)
add_custom_target(docs ALL DEPENDS ddsc_docs ${docs_outputs})
endif()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT dev)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pdf
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT dev)

File diff suppressed because it is too large Load diff

View file

@ -1,316 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. _`HelloWorld`:
.. raw:: latex
\newpage
#########################################
Building Eclipse Cyclone DDS applications
#########################################
.. .. contents::
***********************************
Building the *Hello World!* example
***********************************
To test the :ref:`installation <TestYourInstallation>`, a small
*Hello World!* application is used. This application will also be used
as an introduction to DDS.
This chapter explains how to build this example, without details
regarding the source code. The next chapter will explain what has
to be done to code the *Hello World!* example.
The procedure used to build the *Hello World!* example can also be
used for building your own applications.
:Windows: ...
:Linux: It is advised to have copied the Eclipse Cyclone DDS examples to a user-friendly
location as described in :ref:`this <CopyLinuxExamplesToUserFriendlyLocation>`
paragraph when actively building the Eclipse Cyclone DDS examples on Linux.
This chapter refers to the Eclipse Cyclone DDS examples installed
in the user-defined location.
Build Files
===========
Three files are available *Hello World!* root directory to support
building the example. Both
:ref:`Windows native <WindowsNativeBuild>` (HelloWorld.sln) and
:ref:`Linux native <LinuxNativeBuild>` (Makefile) build files
will only be available for this *Hello World!* example. All the
other examples make use of the :ref:`CMake <CMakeIntro>` build
system and thus only have the CMakeLists.txt build related file.
.. _`LinuxNativeBuild`:
Linux Native Build
==================
A Linux native :code:`Makefile` is provided in the
:code:`examples/helloworld` directory within the destination location
entered in the
:ref:`vdds_install_examples script <CopyLinuxExamplesToUserFriendlyLocation>`.
In a terminal, go to that directory and type
::
make
The build process should have access to the include files and
the ddsc library. The Makefile expects them to be present at
system default locations so that it can find them automatically.
If this isn't the case on your machine, then please
update the commented out :code:`CFLAGS` and :code:`LDFLAGS` within the
:code:`Makefile` to point to the proper locations.
This will build the HelloworldSubscriber and HelloworldPublisher
executables in the helloworld source directory (not the bin
directory that contains the pre-build binaries).
The *Hello World!* example can now be executed,
like described in :ref:`Test your installation <TestYourInstallation>`,
using the binaries that were just build. Be sure to use the right directories.
.. _`WindowsNativeBuild`:
Windows Native Build
====================
For the Windows Native Build, a Visual Studio solution file is
available in the :code:`examples/helloworld` directory. Use a
file explorer to navigate to that directory and double click on
the :code:`HelloWorld.sln` file. Visual Studio should now start
with the HelloWorld solution that contains three projects.
+----------------------+-------------------------------------------------+
| Project | Description |
+======================+=================================================+
| HelloWorldPublisher | Information to build the example publisher. |
+----------------------+-------------------------------------------------+
| HelloWorldSubscriber | Information to build the example subcriber. |
+----------------------+-------------------------------------------------+
| HelloWorldType | Information to (re)generate |
| | :ref:`HelloWorldData_Msg <HelloWorldDataFiles>` |
| | data type. |
+----------------------+-------------------------------------------------+
Creating the *Hello World!* example executables is as simple as
selecting the required configuration and building the solution.
:code:`helloworld\vs\directories.props` contains the location of where
the Eclipse Cyclone DDS header files and libraries are be placed. These locations
are based on the default installation directory structure. When Eclipse Cyclone DDS
is installed in a different directory, the following paths in
:code:`helloworld\vs\directories.props` should be changed, like:
.. code-block:: xml
<CycloneDDS_lib_dir>C:/Path/To/CycloneDDS/Installation/lib</CycloneDDS_lib_dir>
<CycloneDDS_inc_dir>C:/Path/To/CycloneDDS/Installation/include</CycloneDDS_inc_dir>
<CycloneDDS_idlc_dir>C:/Path/To/CycloneDDS/Installation/share/CycloneDDS/idlc</CycloneDDS_idlc_dir>
To run the example, Visual Studio should run both the publisher
and subscriber simultaneously. It is capable of doing so, but
it's not its default setting. To change it, open the HelloWorld
solution property page by right clicking the solution and
selecting :code:`Properties`. Then go to :code:`Common Properties`
-> :code:`Startup Project`, select :code:`Multiple startup project`
and set :code:`Action "Start"` for HelloWorldPublisher and
HelloWorldSubscriber. Finish the change by selecting :code:`OK`.
Visual Studio is now ready to actually run the *Hello World!*
example, which can be done by selecting :code:`Debug` ->
:code:`Start without debugging`.
Both the HelloworldSubscriber and the HelloworldPublisher will be
started and the HelloworldPublisher will write a message that is
received by the HelloworldSubscriber.
.. _`BuildingWithCMake`:
*******************
Building With CMake
*******************
In the earlier chapters, building the *Hello World!* example is done
natively. However, the *Hello World!* example can also be build using the
`CMake tool <http://cmake.org>`_. This is what is recommended. In fact,
all the other examples don't provide native makefiles, only CMake files.
.. _`CMakeIntro`:
CMake
=====
`CMake <http://cmake.org>`_ is an open-source, cross-platform
family of tools designed to build, test and package software.
CMake is used to control the software compilation process using
simple platform and compiler independent configuration files,
and generate native makefiles and workspaces that can be used
in the compiler environment of your choice.
In other words, CMake's main strength is build portability.
CMake uses the native tools, and other than requiring itself,
does not require any additional tools to be installed. The same
CMake input files will build with GNU make, Visual studio 6,7,8
IDEs, borland make, nmake, and XCode.
An other advantage of CMake is building out-of-source. It simply
works out-of-the-box. There are two important reasons to choose
this:
1. Easy cleanup (no cluttering the source tree). Simply remove
the build directory if you want to start from scratch.
2. Multiple build targets. It's possible to have up-to-date
Debug and Release targets, without having to recompile the
entire tree. For systems that do cross-platform compilation,
it is easy to have up-to-date builds for the host and target
platform.
There are a few other benefits to CMake, but that is out of the
scope of this document.
.. _`CycloneDdsPackage`:
Hello World! CMake (CycloneDDS Package)
=======================================
After the CMake digression, we're back with the *Hello World!*
example. Apart from the native build files, CMake build files
are provided as well. See
:code:`examples/helloworld/CMakeLists.txt`
.. literalinclude:: ../../examples/helloworld/CMakeLists.export
:linenos:
:language: cmake
It will try to find the :code:`CycloneDDS` CMake package. When it
has found it, every path and dependencies are automatically set.
After that, an application can use it without fuss. CMake will
look in the default locations for the code:`CycloneDDS` package.
.. _`IdlcGenerate`:
The :code:`CycloneDDS` package provides the :code:`ddsc` library
that contains the DDS API that the application needs. But apart
from that, it also contains helper functionality
(:code:`idlc_generate`) to generate library targets from IDL
files. These library targets can be easily used when compiling
an application that depends on a data type described
in an IDL file.
Two applications will be created, :code:`HelloworldPublisher`
and :code:`HelloworldSubscriber`. Both consist only out of one
source file.
Both applications need to be linked to the :code:`ddsc` library
in the :code:`CycloneDDS` package and :code:`HelloWorldData_lib`
that was generated by the call to :code:`idlc_generate`.
.. _`HelloWorldBuilding`:
Hello World! Configuration
==========================
The *Hello World!* example is prepared to be built by CMake
through the use of its :code:`CMakeLists.txt` file. The first
step is letting CMake configure the build environment.
It's good practice to build examples or applications
out-of-source. In order to do that, create a :code:`build`
directory in the :code:`examples/helloworld` directory and go
there, making our location :code:`examples/helloworld/build`.
Here, we can let CMake configure the build environment for
us by typing:
::
cmake ../
.. note::
CMake does a pretty good job at guessing which generator to use, but some
environments require that you supply a specific generator. For example, only
64-bit libraries are shipped for Windows, but CMake will generate a 32-bit
project by default, resulting in linker errors. When generating a
Visual Studio project keep in mind to append **Win64** to the generator.
The example below shows how to generate a Visual Studio 2015 project.
::
cmake -G "Visual Studio 14 2015 Win64" ..
.. note::
CMake generators can also create IDE environments. For instance,
the "Visual Studio 14 2015 Win64" will generate a Visual Studio
solution file. Other IDE's are also possible, like Eclipse.
CMake will use the CMakeLists.txt in the helloworld directory
to create makefiles that fit the native platform.
Since everything is prepared, we can actually build the
applications (HelloworldPublisher and HelloworldSubscriber in
this case).
Hello World! Build
==================
After the configuration step, building the example is as easy
as typing:
::
cmake --build .
.. note::
On Windows, it is likely that you have to supply the config
of Visual Studio:
::
cmake --build . --config "Release"
while being in the build directory created during the
configuration step: :code:`examples/helloworld/build`.
The resulting Publisher and Subscriber applications can be found
in:
:Windows: :code:`examples\helloworld\build\Release`.
:Linux: :code:`examples/helloworld/build`.
The *Hello World!* example can now be executed,
like described in :ref:`Test your installation <TestYourInstallation>`,
using the binaries that were just build. Be sure to use the right directories.
*******
Summary
*******
We've seen that a Eclipse Cyclone DDS application can be build by using a Makefile on Linux
or a Visual Studio Solutions on Windows. Also CMake can be used to build a Eclipse Cyclone DDS
application. In fact, it is the preferred way of building.
In the end, a predefined way of generating and building the source code should
be followed when building Eclipse Cyclone DDS applications. The figure below shows how a
typical Eclipse Cyclone DDS application is build.
.. image:: ../_static/pictures/BuildSchema.png
:scale: 30 %
:align: center
Next chapter will provide an overview of all steps mentioned in the figure above.

View file

@ -1,438 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. _`HelloWorldInDepth`:
.. raw:: latex
\newpage
###########################
Hello World! in more detail
###########################
.. .. contents::
The previous chapter focused on building the *Hello World!* example while
this chapter will focus on the code itself; what has to be done to code
this small example.
.. _`HelloWorldDataType`:
*********************
Hello World! DataType
*********************
Data-Centric Architecture
=========================
By creating a Data-centric architecture, you get a loosely
coupled information-driven system. It emphasizes a data layer
that is common for all distributed applications within the
system. Because there is no direct coupling among the
applications in the DDS model, they can be added and removed
easily in a modular and scalable manner. This makes that the
complexity of a data-centric architecture doesn't really
increase when more and more publishers/subscribers are added.
The *Hello World!* example has a very simple 'data layer' of only
one data type :code:`HelloWorldData_Msg` (please read on).
The subscriber and publisher are not aware of each other.
The former just waits until somebody provides the data it
requires, while the latter just publishes the data without
considering the number of interested parties. In other words,
it doesn't matter for the publisher if there are none or
multiple subscribers (try running the *Hello World!* example
by starting multiple HelloworldSubscribers before starting a
HelloworldPublisher). A publisher just writes the data. The
DDS middleware takes care of delivering the data when needed.
******************
HelloWorldData.idl
******************
To be able to sent data from a writer to a reader, DDS needs to
know the data type. For the *Hello World!* example, this data type
is described using `IDL <http://www.omg.org/gettingstarted/omg_idl.htm>`_
and is located in HelloWorldData.idl. This IDL file will be compiled by
a IDL compiler which in turn generates a C language source and header
file. These generated source and header file will be used by the
HelloworldSubscriber and HelloworldPublisher in order to communicate
the *Hello World!* message between the HelloworldPublisher
and the HelloworldSubscriber.
Hello World! IDL
================
There are a few ways to describe the structures that make up the
data layer. The HelloWorld uses the IDL language to describe the
data type in HelloWorldData.idl:
.. literalinclude:: ../../examples/helloworld/HelloWorldData.idl
:linenos:
:language: idl
An extensive explanation of IDL lies outside the scope of this
example. Nevertheless, a quick overview of this example is given
anyway.
First, there's the :code:`module HelloWorldData`. This is a kind
of namespace or scope or similar.
Within that module, there's the :code:`struct Msg`. This is the
actual data structure that is used for the communication. In
this case, it contains a :code:`userID` and :code:`message`.
The combination of this module and struct translates to the
following when using the c language.
::
typedef struct HelloWorldData_Msg
{
int32_t userID;
char * message;
} HelloWorldData_Msg;
When it is translated to a different language, it will look
different and more tailored towards that language. This is the
advantage of using a data oriented language, like IDL, to
describe the data layer. It can be translated into different
languages after which the resulting applications can communicate
without concerns about the (possible different) programming
languages these application are written in.
.. _`IdlCompiler`:
Generate Sources and Headers
============================
Like already mentioned in the `Hello World! IDL`_ chapter, an IDL
file contains the description of data type(s). This needs to be
translated into programming languages to be useful in the
creation of DDS applications.
To be able to do that, there's a pre-compile step that actually
compiles the IDL file into the desired programming language.
A java application :code:`org.eclipse.cyclonedds.compilers.Idlc`
is supplied to support this pre-compile step. This is available
in :code:`idlc-jar-with-dependencies.jar`
The compilation from IDL into c source code is as simple as
starting that java application with an IDL file. In the case of
the *Hello World!* example, that IDL file is HelloWorldData.idl.
::
java -classpath "<install_dir>/share/CycloneDDS/idlc/idlc-jar-with-dependencies.jar" org.eclipse.cyclonedds.compilers.Idlc HelloWorldData.idl
:Windows: The :code:`HelloWorldType` project within the HelloWorld solution.
:Linux: The :code:`make datatype` command.
This will result in new :code:`generated/HelloWorldData.c` and
:code:`generated/HelloWorldData.h`
files that can be used in the *Hello World!* publisher and
subscriber applications.
The application has to be rebuild when the data type source
files were re-generated.
Again, this is all for the native builds. When using CMake, all
this is done automatically.
.. _`HelloWorldDataFiles`:
HelloWorldData.c & HelloWorldData.h
===================================
As described in the :ref:`Hello World! DataType <HelloWorldDataType>`
paragraph, the IDL compiler will generate this source and header
file. These files contain the data type of the messages that are sent
and received.
While the c source has no interest for the application
developers, HelloWorldData.h contains some information that they
depend on. For example, it contains the actual message structure
that is used when writing or reading data.
::
typedef struct HelloWorldData_Msg
{
int32_t userID;
char * message;
} HelloWorldData_Msg;
It also contains convenience macros to allocate and free memory
space for the specific data types.
::
HelloWorldData_Msg__alloc()
HelloWorldData_Msg_free(d,o)
It contains an extern variable that describes the data type to
the DDS middleware as well.
::
HelloWorldData_Msg_desc
***************************
Hello World! Business Logic
***************************
Apart from the
:ref:`HelloWorldData data type files <HelloWorldDataFiles>` that
the *Hello World!* example uses to send messages, the *Hello World!*
example also contains two (user) source files
(:ref:`subscriber.c <HelloWorldSubscriberSource>` and
:ref:`publisher.c <HelloWorldPublisherSource>`), containing the
business logic.
.. _`HelloWorldSubscriberSource`:
*Hello World!* Subscriber Source Code
=====================================
Subscriber.c contains the source that will wait for a *Hello World!*
message and reads it when it receives one.
.. literalinclude:: ../../examples/helloworld/subscriber.c
:linenos:
:language: c
We will be using the DDS API and the
:ref:`HelloWorldData_Msg <HelloWorldDataFiles>` type
to receive data. For that, we need to include the
appropriate header files.
::
#include "dds/dds.h"
#include "HelloWorldData.h"
The main starts with defining a few variables that will be used for
reading the *Hello World!* message.
The entities are needed to create a reader.
::
dds_entity_t participant;
dds_entity_t topic;
dds_entity_t reader;
Then there are some buffers that are needed to actually read the
data.
::
HelloWorldData_Msg *msg;
void *samples[MAX_SAMPLES];
dds_sample_info_t info[MAX_SAMPLES];
To be able to create a reader, we first need a participant. This
participant is part of a specific communication domain. In the
*Hello World!* example case, it is part of the default domain.
::
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
The another requisite is the topic which basically describes the
data type that is used by the reader. When creating the topic,
the :ref:`data description <HelloWorldDataFiles>` for the DDS
middleware that is present in the
:ref:`HelloWorldData.h <HelloWorldDataFiles>` is used.
The topic also has a name. Topics with the same data type
description, but with different names, are considered
different topics. This means that readers/writers created with a
topic named "A" will not interfere with readers/writers created
with a topic named "B".
::
topic = dds_create_topic (participant, &HelloWorldData_Msg_desc,
"HelloWorldData_Msg", NULL, NULL);
When we have a participant and a topic, we then can create
the reader. Since the order in which the *Hello World!* Publisher and
*Hello World!* Subscriber are started shouldn't matter, we need to create
a so called 'reliable' reader. Without going into details, the reader
will be created like this
::
dds_qos_t *qos = dds_create_qos ();
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS (10));
reader = dds_create_reader (participant, topic, qos, NULL);
dds_delete_qos(qos);
We are almost able to read data. However, the read expects an
array of pointers to valid memory locations. This means the
samples array needs initialization. In this example, we have
an array of only one element: :code:`#define MAX_SAMPLES 1`.
So, we only need to initialize one element.
::
samples[0] = HelloWorldData_Msg__alloc ();
Now everything is ready for reading data. But we don't know if
there is any data. To simplify things, we enter a polling loop
that will exit when data has been read.
Within the polling loop, we do the actual read. We provide the
initialized array of pointers (:code:`samples`), an array that
holds information about the read sample(s) (:code:`info`), the
size of the arrays and the maximum number of samples to read.
Every read sample in the samples array has related information
in the info array at the same index.
::
ret = dds_read (reader, samples, info, MAX_SAMPLES, MAX_SAMPLES);
The :code:`dds_read` function returns the number of samples it
actually read. We can use that to determine if the function actually
read some data. When it has, then it is still possible that the
data part of the sample is not valid. This has some use cases
when there is no real data, but still the state of the related
sample has changed (for instance it was deleted). This will
normally not happen in the *Hello World!* example. But we check
for it anyway.
::
if ((ret > 0) && (info[0].valid_data))
If data has been read, then we can cast the void pointer to the
actual message data type and display the contents. The polling
loop is quit as well in this case.
::
msg = (HelloWorldData_Msg*) samples[0];
printf ("=== [Subscriber] Received : ");
printf ("Message (%d, %s)\n", msg->userID, msg->message);
break;
When data is received and the polling loop is stopped, we need to
clean up.
::
HelloWorldData_Msg_free (samples[0], DDS_FREE_ALL);
dds_delete (participant);
All the entities that are created using the participant are also
deleted. This means that deleting the participant will
automatically delete the topic and reader as well.
.. _`HelloWorldPublisherSource`:
*Hello World!* Publisher Source Code
====================================
Publisher.c contains the source that will write an *Hello World!* message
on which the subscriber is waiting.
.. literalinclude:: ../../examples/helloworld/publisher.c
:linenos:
:language: c
We will be using the DDS API and the
:ref:`HelloWorldData_Msg <HelloWorldDataFiles>` type
to sent data. For that, we need to include the
appropriate header files.
::
#include "dds/dds.h"
#include "HelloWorldData.h"
Just like with the
:ref:`reader in subscriber.c <HelloWorldSubscriberSource>`,
we need a participant and a topic to be able to create a writer.
We use the same topic name as in subscriber.c. Otherwise the
reader and writer are not considered related and data will not
be sent between them.
::
dds_entity_t participant;
dds_entity_t topic;
dds_entity_t writer;
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
topic = dds_create_topic (participant, &HelloWorldData_Msg_desc,
"HelloWorldData_Msg", NULL, NULL);
writer = dds_create_writer (participant, topic, NULL, NULL);
The DDS middleware is a publication/subscription implementation.
This means that it will discover related readers and writers
(i.e. readers and writers sharing the same data type and topic name)
and connect them so that written data can be received by readers
without the application having to worry about it. There is a catch though:
this discovery and coupling takes a small amount of
time. There are various ways to work around this problem. The following
can be done to properly connect readers and writers:
* Wait for the publication/subscription matched events
* The Subscriber should wait for a subscription matched event
* The Publisher should wait for a publication matched event.
The use of these events will be outside the scope of this example
* Poll for the publication/subscription matches statusses
* The Subscriber should poll for a subscription matched status to be set
* The Publisher should poll for a publication matched status to be set
The Publisher in this example uses the polling schema.
* Let the publisher sleep for a second before writing a sample. This
is not recommended since a second may not be enough on several networks
* Accept that the reader miss a few samples at startup. This may be
acceptable in cases where the publishing rate is high enough.
As said, the publisher of this example polls for the publication matched status.
To make this happen, the writer must be instructed to 'listen' for this status.
The following line of code makes sure the writer does so.
::
dds_set_status_mask(writer, DDS_PUBLICATION_MATCHED_STATUS);
Now the polling may start:
::
while(true)
{
uint32_t status;
ret = dds_get_status_changes (writer, &status);
DDS_ERR_CHECK(ret, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
if (status == DDS_PUBLICATION_MATCHED_STATUS) {
break;
}
/* Polling sleep. */
dds_sleepfor (DDS_MSECS (20));
}
After this loop, we are sure that a matching reader has been started.
Now, we commence to writing the data. First the data must be initialized
::
HelloWorldData_Msg msg;
msg.userID = 1;
msg.message = "Hello World";
Then we can actually sent the message to be received by the
subscriber.
::
ret = dds_write (writer, &msg);
After the sample is written, we need to clean up.
::
ret = dds_delete (participant);
All the entities that are created using the participant are also
deleted. This means that deleting the participant will
automatically delete the topic and writer as well.

View file

@ -1,21 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. _`GettingStarted`:
.. toctree::
:maxdepth: 4
installation.rst
helloworld.rst
helloworld_indepth.rst
next_steps.rst
uninstall.rst

View file

@ -1,122 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. _`Installation`:
.. raw:: latex
\newpage
##############################
Installing Eclipse Cyclone DDS
##############################
.. .. contents::
.. _`SystemRequirements`:
*******************
System requirements
*******************
At the time of writing, Eclipse Cyclone DDS is known to run on Linux, macOS and Windows. The build-process is not yet able to generate native packages.
***************
Linux and macOS
***************
.. _`CopyLinuxExamplesToUserFriendlyLocation`:
Post install steps
~~~~~~~~~~~~~~~~~~
The installation package installs examples in system directories. In order to have a better user
experience when building the Eclipse Cyclone DDS examples, it is advised to copy the examples to a
user-defined location. This is to be able to build the examples natively and experiment with the
example source code.
For this, the installation package provides the vdds_install_examples
script, located in /usr/bin.
Create an user writable directory where the examples should go. Navigate
to that directory and execute the script. Answer 'yes' to the questions
and the examples will be installed in the current location.
Type :code:`vdds_install_examples -h` for more information.
.. _`LinuxSetLibPath`:
Paths
=====
To be able to run Eclipse Cyclone DDS executables, the required libraries (like libddsc.so) need to
be available to the executables. Normally, these are installed in system default locations and it
works out-of-the-box. However, if they are not installed in those locations, it is possible that the
library search path has to be changed. This can be achieved by executing the command: ::
export LD_LIBRARY_PATH=<install_dir>/lib:$LD_LIBRARY_PATH
*******
Windows
*******
.. _`WindowsSetLibPath`:
Paths
~~~~~
To be able to run Eclipse Cyclone DDS executables, the required libraries (like ddsc.dll) need to be
available to the executables. Normally, these are installed in system default locations and it
works out-of-the-box. However, if they are not installed on those locations, it is possible that the
library search path has to be changed. This can be achieved by executing the command: ::
set PATH=<install_dir>/bin;%PATH%
.. _`TestYourInstallation`:
**********************
Test your installation
**********************
Eclipse Cyclone DDS includes a simple :ref:`Hello World! <HelloWorld>` application which can be run
in order to test your installation. The *Hello World!* application consists of two executables: a so
called HelloworldPublisher and a HelloworldSubscriber.
To run the example application, please open two console windows and navigate to the appropriate
directory in both console windows. Run the HelloworldSubscriber in one of the console windows by the
typing following command:
:Windows: :code:`HelloworldSubscriber.exe`
:Linux: :code:`./HelloworldSubscriber`
and the HelloworldPublisher in the other console window by typing:
:Windows: :code:`HelloworldPublisher.exe`
:Linux: :code:`./HelloworldPublisher`
The output HelloworldPublisher should look like
.. image:: ../_static/pictures/HelloworldPublisherWindows.png
while the HelloworldSubscriber will be looking like this
.. image:: ../_static/pictures/HelloworldSubscriberWindows.png
For more information on how to build this application your own and the code which has
been used, please have a look at the :ref:`Hello World! <HelloWorld>` chapter.

View file

@ -1,43 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. _`WhatsNext`:
.. raw:: latex
\newpage
############
What's next?
############
Want to know more about DDS? The primary source of information is the
OMG website at http://www.omg.org and specifically the `DDS Getting
Started <http://www.omg.org/gettingstarted/omg_idl.htm>`_ page and the
`DDS specification <http://www.omg.org/spec/DDS/>`_ itself. The
specification is a bit wordy and of course deals with minute details,
but it is surprisingly easy to follow for a specification.
There are also various resources on the web dealing with DDS in general,
as the various vendors have posted tutorials, presentations, general
information and documentation on their products. While the details
between the various implementations do differ, they have much more in
common than what separates them, and so this information is also
applicable to Eclipse Cyclone DDS. The one thing in which
Eclipse Cyclone DDS really differs is in the details of API, but that's
just syntax.
Obviously there are also things specific to Eclipse Cyclone DDS. The
level of documentation of Eclipse is not nearly what it should be, but
that will improve over time.
And last but note least: please always feel welcome to ask questions on
GitHub!

View file

@ -1,22 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. _`Uninstall`:
.. raw:: latex
\newpage
################################
Uninstalling Eclipse Cyclone DDS
################################
TBD.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,178 +0,0 @@
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'breathe']
breathe_projects = { @sph_conf_breathe_projs@ }
# Add any paths that contain templates here, relative to this directory.
#templates_path = ['@CMAKE_CURRENT_SOuRCE_DIR@/_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'@CMAKE_PROJECT_NAME_FULL@'
copyright = u'@sph_conf_copyright@'
author = u'@sph_conf_author@'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y.Z version.
version = u'@sph_conf_version@'
# The full version, including alpha/beta/rc tags.
release = u'@sph_conf_release@'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = u'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = '@CMAKE_PROJECT_NAME_FULL@doc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
'babel': '\\usepackage[english]{babel}'
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, '@CMAKE_PROJECT_NAME@.tex', u'@CMAKE_PROJECT_NAME_FULL@',
u'@sph_conf_author@', 'manual'),
]
latex_logo = u'@sph_logo@'
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
#man_pages = [
# (master_doc, 'cyclonedds', u'Eclipse Cyclone DDS Documentation',
# [author], 1)
#]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, '@CMAKE_PROJECT_NAME_FULL@', u'@CMAKE_PROJECT_NAME_FULL@ Documentation',
author, '@CMAKE_PROJECT_NAME@', 'One line description of project.',
'Miscellaneous'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'https://docs.python.org/': None}

File diff suppressed because it is too large Load diff

View file

@ -1,16 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
Eclipse Cyclone DDS C API Reference
===================================
.. doxygenindex::
:project: ddsc_api

View file

@ -1,30 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
.. Eclipse Cyclone DDS documentation master file
Welcome to Eclipse Cyclone DDS's documentation!
===============================================
.. toctree::
:maxdepth: 3
:caption: Contents
GettingStartedGuide/index
ddsc
config
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View file

@ -1,20 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
configure_file("cmake/default.xml.in" "${CMAKE_PROJECT_NAME_SMALL}.xml" @ONLY)
set(CONFIG_FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME_SMALL}.xml")
install(
FILES ${CONFIG_FILES}
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CMAKE_PROJECT_NAME}"
COMPONENT lib
)

View file

@ -1,29 +0,0 @@
<!--
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-->
<@CMAKE_PROJECT_NAME@>
<Domain>
<Id>any</Id>
</Domain>
<DDSI2E>
<General>
<NetworkInterfaceAddress>auto</NetworkInterfaceAddress>
<AllowMulticast>true</AllowMulticast>
<EnableMulticastLoopback>true</EnableMulticastLoopback>
</General>
<Compatibility>
<StandardsConformance>lax</StandardsConformance>
</Compatibility>
<Tracing>
<Verbosity>warning</Verbosity> <!-- Set to 'finest' for debugging level output -->
</Tracing>
</DDSI2E>
</@CMAKE_PROJECT_NAME@>

View file

@ -1,128 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
set(CMAKE_INSTALL_EXAMPLESDIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/examples")
add_subdirectory(helloworld)
add_subdirectory(roundtrip)
add_subdirectory(throughput)
if (USE_DOCS)
# TODO Move to docs CMakeLists
set(EXAMPLES_HTML_ARCHIVE "${CMAKE_PROJECT_NAME}ExamplesHTML.tar.gz")
if (DOWNLOAD_DOCS)
message(STATUS "${CMAKE_PROJECT_NAME} Examples documentation: Success (download)")
set(EXAMPLES_HTML_URI "http://jenkins.prismtech.com:8080/job/BuildChameleonLinux64bit/lastSuccessfulBuild/artifact/cham/builds/examples/${EXAMPLES_HTML_ARCHIVE}")
file(DOWNLOAD "${EXAMPLES_HTML_URI}" "${CMAKE_CURRENT_BINARY_DIR}/Downloaded${EXAMPLES_HTML_ARCHIVE}"
TIMEOUT 10
STATUS status)
list(GET status 0 status_code)
list(GET status 1 status_string)
if (NOT status_code EQUAL 0)
message(FATAL_ERROR
"Failed to download ${EXAMPLES_HTML_URI} (Code: ${status_code}, ${status_string})")
endif()
add_custom_target(examples_docs ALL)
add_custom_command(TARGET examples_docs
COMMAND ${CMAKE_COMMAND} -E tar "zxf" "Downloaded${EXAMPLES_HTML_ARCHIVE}"
VERBATIM)
elseif (BUILD_DOCS)
message(STATUS "${CMAKE_PROJECT_NAME} Examples documentation: Success (build)")
# Process sphinx configuration file
set(sph_conf_author "ADLINK")
string(TIMESTAMP sph_conf_copyright "%Y, ADLINK")
set(sph_conf_version "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(sph_conf_release "${PROJECT_VERSION}")
configure_file(sphinx-conf.py.in conf.py @ONLY)
set(builder_output "examples_html_output")
set(builder_log "sphinx-examples-html.log")
add_custom_command(OUTPUT ${builder_output}
COMMAND ${SPHINX_EXECUTABLE}
-b html
-d ${CMAKE_CURRENT_BINARY_DIR}/cache
-c ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} > ${builder_log}
COMMENT "Running Sphinx for examples html output"
VERBATIM)
# OUTPUT is a fake target / symbolic name, not an actual file
set_property(SOURCE ${builder_output} PROPERTY SYMBOLIC 1)
add_custom_target(examples_docs ALL DEPENDS ${builder_output})
# Archive the output html files, will become a jenkins artifact for use in other jobs
# TODO this hardcoded list and archiving should be replaced by ExternalData refs
set(html_outputs
"_static"
"search.html"
"searchindex.js"
"genindex.html"
"examples.html"
"helloworld/readme.html"
"roundtrip/readme.html"
"throughput/readme.html")
add_custom_command(OUTPUT ${builder_output}
COMMAND ${CMAKE_COMMAND}
-E tar "zcf"
"${EXAMPLES_HTML_ARCHIVE}"
${html_outputs}
APPEND
VERBATIM)
# Remove generated files when cleaning the build tree
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
"cache"
"${builder_log}"
"objects.inv"
${html_outputs}
"_sources"
"${EXAMPLES_HTML_ARCHIVE}")
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(platform_exclude "examples/helloworld/Makefile")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(platform_exclude "examples/helloworld/vs|examples/helloworld/HelloWorld\.sln")
else()
set(platform_exclude "this_is_a_placeholder")
endif()
# Install example source-files
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/examples/"
DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}"
COMPONENT dev
PATTERN "CMakeLists.export" EXCLUDE
PATTERN "examples/CMakeLists.txt" EXCLUDE
REGEX ${platform_exclude} EXCLUDE
REGEX "\.rst|\.py" EXCLUDE
)
# Install example html docs files
# TODO this should be replaced by install commands that use ExternalData refs (preferably in examples' CMakeLists.txt)
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}"
COMPONENT dev
FILES_MATCHING
PATTERN "CMakeFiles" EXCLUDE
PATTERN "cache" EXCLUDE
PATTERN "_sources" EXCLUDE
PATTERN "*.html"
PATTERN "*.js"
PATTERN "_static/*"
)

View file

@ -1,48 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
Examples
========
.. toctree::
:maxdepth: 1
:caption: Contents:
helloworld/readme
roundtrip/readme
throughput/readme
Configuration
*************
Eclipse Cyclone DDS has various configuration parameters and comes with a default built-in
configuration. To run an example, or any application that uses Eclipse Cyclone DDS for its data
exchange, this default configuration is usually fine and no further action is required.
Configuration parameters for Eclipse CycloneDDS are expressed in XML and grouped together in a
single XML file. To use a custom XML configuration in an application, the ``CYCLONEDDS_URI``
environment variable needs to be set prior to starting the application and pointed to the location
of the configuration file to be used.
| *Example*
| **Windows:** ``set CYCLONEDDS_URI=file://%USERPROFILE%/CycloneDDS/my-config.xml``
| **Linux:** ``export CYCLONEDDS_URI="file://$HOME/CycloneDDS/my-config.xml"``
The Eclipse CycloneDDS installation comes with a configuration file that corresponds to the default
behaviour. You can modify it or add your using any text or XML editor, or using by using the
Eclipse CycloneDDS Configurator tool, which provides context-sensitive help on available
configuration parameters and their applicability.
One very important part of the configuration settings are the "tracing" settings: these allow
letting Eclipse Cyclone DDS trace very detailed information to a file, and this includes the actual
configuration settings in use, including all those that are set at the default. When editing
configuration files by hand, this overview can be very useful. Increasing the Verbosity from
"warning" to, e.g., "config" already suffices for getting this information written to the log.

View file

@ -1,22 +0,0 @@
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS "${CMAKE_SOURCE_DIR}/../../")
endif()
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.
# In short, it takes the idl file, generates the source files with
# the proper data types and compiles them into a library.
idlc_generate(HelloWorldData_lib "HelloWorldData.idl")
# Both executables have only one related source file.
add_executable(HelloworldPublisher publisher.c)
add_executable(HelloworldSubscriber subscriber.c)
# Both executables need to be linked to the idl data type library and
# the ddsc API library.
target_link_libraries(HelloworldPublisher HelloWorldData_lib CycloneDDS::ddsc)
target_link_libraries(HelloworldSubscriber HelloWorldData_lib CycloneDDS::ddsc)

View file

@ -1,58 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS ../../)
endif()
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.
# In short, it takes the idl file, generates the source files with
# the proper data types and compiles them into a library.
idlc_generate(HelloWorldData_lib "HelloWorldData.idl")
# Both executables have only one related source file.
add_executable(HelloworldPublisher publisher.c)
add_executable(HelloworldSubscriber subscriber.c)
# Both executables need to be linked to the idl data type library and
# the ddsc API library.
target_link_libraries(HelloworldPublisher HelloWorldData_lib CycloneDDS::ddsc)
target_link_libraries(HelloworldSubscriber HelloWorldData_lib CycloneDDS::ddsc)
#
# The helloworld example is the only example to have a different CMakeLists.txt
# for building in source and install environments. This is because it has to
# do some specific installations to support the Getting Started Guide.
# The CMakelists.export will be used for the install environments.
#
install(
TARGETS HelloworldSubscriber HelloworldPublisher
DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}/helloworld/bin"
COMPONENT dev)
install(
FILES "CMakeLists.export"
DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}/helloworld"
COMPONENT dev
RENAME "CMakeLists.txt")
get_target_property(GENERATED_FILES HelloWorldData_lib INTERFACE_SOURCES)
install(
FILES ${GENERATED_FILES}
DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}/helloworld/generated"
COMPONENT dev)

View file

@ -1,54 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorldSubscriber", "vs\HelloWorldSubscriber.vcxproj", "{D8B2F285-EB03-4657-A0DC-603172553BEA}"
ProjectSection(ProjectDependencies) = postProject
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D} = {28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorldPublisher", "vs\HelloWorldPublisher.vcxproj", "{D8B2F285-EB03-4657-ACDC-603172553BEA}"
ProjectSection(ProjectDependencies) = postProject
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D} = {28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorldType", "vs\HelloWorldType.vcxproj", "{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Debug|x64.ActiveCfg = Debug|x64
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Debug|x64.Build.0 = Debug|x64
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Debug|x86.ActiveCfg = Debug|Win32
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Debug|x86.Build.0 = Debug|Win32
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Release|x64.ActiveCfg = Release|x64
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Release|x64.Build.0 = Release|x64
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Release|x86.ActiveCfg = Release|Win32
{D8B2F285-EB03-4657-A0DC-603172553BEA}.Release|x86.Build.0 = Release|Win32
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Debug|x64.ActiveCfg = Debug|x64
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Debug|x64.Build.0 = Debug|x64
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Debug|x86.ActiveCfg = Debug|Win32
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Debug|x86.Build.0 = Debug|Win32
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Release|x64.ActiveCfg = Release|x64
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Release|x64.Build.0 = Release|x64
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Release|x86.ActiveCfg = Release|Win32
{D8B2F285-EB03-4657-ACDC-603172553BEA}.Release|x86.Build.0 = Release|Win32
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Debug|x64.ActiveCfg = Debug|x64
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Debug|x64.Build.0 = Debug|x64
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Debug|x86.ActiveCfg = Debug|Win32
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Debug|x86.Build.0 = Debug|Win32
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Release|x64.ActiveCfg = Release|x64
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Release|x64.Build.0 = Release|x64
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Release|x86.ActiveCfg = Release|Win32
{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,9 +0,0 @@
module HelloWorldData
{
struct Msg
{
long userID;
string message;
};
#pragma keylist Msg userID
};

View file

@ -1,54 +0,0 @@
publisher_NAME := HelloworldPublisher
publisher_SRCS := publisher.c generated/HelloWorldData.c
publisher_OBJS := ${publisher_SRCS:.c=.o}
subscriber_NAME := HelloworldSubscriber
subscriber_SRCS := subscriber.c generated/HelloWorldData.c
subscriber_OBJS := ${subscriber_SRCS:.c=.o}
# Make sure that the location where dds.h is installed is known to the
# compiler. If dds.h is not installed in a system default spot, then
# it can be introduced by adding it to the CFLAGS, like:
#CFLAGS += -I../../../../include
# Make sure that the location where libddsc.so is installed is known
# to the compiler. If the lib is not installed in a system default
# location, then it can be introduced by adding it to the LDFLAGS:
#LDFLAGS += -L../../../../lib
CFLAGS += -Igenerated
LDFLAGS += -lddsc
.PHONY: all clean distclean
all: $(publisher_NAME) $(subscriber_NAME)
$(publisher_NAME): $(publisher_OBJS)
gcc $(CFLAGS) $(publisher_OBJS) $(LDFLAGS) -o $(publisher_NAME)
$(subscriber_NAME): $(subscriber_OBJS)
gcc $(CFLAGS) $(subscriber_OBJS) $(LDFLAGS) -o $(subscriber_NAME)
clean:
@- $(RM) $(publisher_NAME)
@- $(RM) $(publisher_OBJS)
@- $(RM) $(subscriber_NAME)
@- $(RM) $(subscriber_OBJS)
distclean: clean
# Make sure that the idlc jar file is available and java can find its
# location. In this example, it is assumed that the jar is located at
# a specific relative directory. Change the classpath variable if
# this is not the case on your system.
classpath:= ../../idlc/idlc-jar-with-dependencies.jar
ifneq ($(CLASSPATH),)
classpath:= $(CLASSPATH):$(classpath)
endif
export CLASSPATH:=$(classpath)
datatype:
java org.eclipse.cyclonedds.compilers.Idlc HelloWorldData.idl

View file

@ -1,68 +0,0 @@
#include "dds/dds.h"
#include "HelloWorldData.h"
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char ** argv)
{
dds_entity_t participant;
dds_entity_t topic;
dds_entity_t writer;
dds_return_t rc;
HelloWorldData_Msg msg;
uint32_t status = 0;
(void)argc;
(void)argv;
/* Create a Participant. */
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
if (participant < 0)
DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant));
/* Create a Topic. */
topic = dds_create_topic (
participant, &HelloWorldData_Msg_desc, "HelloWorldData_Msg", NULL, NULL);
if (topic < 0)
DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));
/* Create a Writer. */
writer = dds_create_writer (participant, topic, NULL, NULL);
if (writer < 0)
DDS_FATAL("dds_create_write: %s\n", dds_strretcode(-writer));
printf("=== [Publisher] Waiting for a reader to be discovered ...\n");
fflush (stdout);
rc = dds_set_status_mask(writer, DDS_PUBLICATION_MATCHED_STATUS);
if (rc != DDS_RETCODE_OK)
DDS_FATAL("dds_set_status_mask: %s\n", dds_strretcode(-rc));
while(!(status & DDS_PUBLICATION_MATCHED_STATUS))
{
rc = dds_get_status_changes (writer, &status);
if (rc != DDS_RETCODE_OK)
DDS_FATAL("dds_get_status_changes: %s\n", dds_strretcode(-rc));
/* Polling sleep. */
dds_sleepfor (DDS_MSECS (20));
}
/* Create a message to write. */
msg.userID = 1;
msg.message = "Hello World";
printf ("=== [Publisher] Writing : ");
printf ("Message (%"PRId32", %s)\n", msg.userID, msg.message);
fflush (stdout);
rc = dds_write (writer, &msg);
if (rc != DDS_RETCODE_OK)
DDS_FATAL("dds_write: %s\n", dds_strretcode(-rc));
/* Deleting the participant will delete all its children recursively as well. */
rc = dds_delete (participant);
if (rc != DDS_RETCODE_OK)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-rc));
return EXIT_SUCCESS;
}

View file

@ -1,46 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
HelloWorld
==========
Description
***********
The basic HelloWorld example is used to illustrate the necessary steps to setup DCPS entities.
Note it is also used in the Getting Started Guide to explain the usage of Eclipse Cyclone DDS.
Design
******
It consists of 2 units:
- HelloworldPublisher: implements the publisher's main
- HelloworldSubscriber: implements the subscriber's main
Scenario
********
The publisher sends a single HelloWorld sample. The sample contains two fields:
- a userID field (long type)
- a message field (string type)
When it receives the sample, the subscriber displays the userID and the message field.
Running the example
*******************
It is recommended that you run the subscriber and publisher in separate terminals to avoid mixing the output.
- Open 2 terminals.
- In the first terminal start the subscriber by running HelloWorldSubscriber
- In the second terminal start the publisher by running HelloWorldPublisher

View file

@ -1,84 +0,0 @@
#include "dds/dds.h"
#include "HelloWorldData.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* An array of one message (aka sample in dds terms) will be used. */
#define MAX_SAMPLES 1
int main (int argc, char ** argv)
{
dds_entity_t participant;
dds_entity_t topic;
dds_entity_t reader;
HelloWorldData_Msg *msg;
void *samples[MAX_SAMPLES];
dds_sample_info_t infos[MAX_SAMPLES];
dds_return_t rc;
dds_qos_t *qos;
(void)argc;
(void)argv;
/* Create a Participant. */
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
if (participant < 0)
DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant));
/* Create a Topic. */
topic = dds_create_topic (
participant, &HelloWorldData_Msg_desc, "HelloWorldData_Msg", NULL, NULL);
if (topic < 0)
DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));
/* Create a reliable Reader. */
qos = dds_create_qos ();
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS (10));
reader = dds_create_reader (participant, topic, qos, NULL);
if (reader < 0)
DDS_FATAL("dds_create_reader: %s\n", dds_strretcode(-reader));
dds_delete_qos(qos);
printf ("\n=== [Subscriber] Waiting for a sample ...\n");
fflush (stdout);
/* Initialize sample buffer, by pointing the void pointer within
* the buffer array to a valid sample memory location. */
samples[0] = HelloWorldData_Msg__alloc ();
/* Poll until data has been read. */
while (true)
{
/* Do the actual read.
* The return value contains the number of read samples. */
rc = dds_read (reader, samples, infos, MAX_SAMPLES, MAX_SAMPLES);
if (rc < 0)
DDS_FATAL("dds_read: %s\n", dds_strretcode(-rc));
/* Check if we read some data and it is valid. */
if ((rc > 0) && (infos[0].valid_data))
{
/* Print Message. */
msg = (HelloWorldData_Msg*) samples[0];
printf ("=== [Subscriber] Received : ");
printf ("Message (%"PRId32", %s)\n", msg->userID, msg->message);
fflush (stdout);
break;
}
else
{
/* Polling sleep. */
dds_sleepfor (DDS_MSECS (20));
}
}
/* Free the data location. */
HelloWorldData_Msg_free (samples[0], DDS_FREE_ALL);
/* Deleting the participant will delete all its children recursively as well. */
rc = dds_delete (participant);
if (rc != DDS_RETCODE_OK)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-rc));
return EXIT_SUCCESS;
}

View file

@ -1,142 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D8B2F285-EB03-4657-ACDC-603172553BEA}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<ProjectName>HelloWorldPublisher</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(Platform)\$(Configuration)\Publisher\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(CycloneDDS_inc_dir);..\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>$(CycloneDDS_lib_dir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>ddsc.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(CycloneDDS_inc_dir);..\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ddsc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CycloneDDS_lib_dir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(CycloneDDS_inc_dir);..\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ddsc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CycloneDDS_lib_dir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\generated\HelloWorldData.c" />
<ClCompile Include="..\publisher.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\generated\HelloWorldData.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
</Project>

View file

@ -1,142 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D8B2F285-EB03-4657-A0DC-603172553BEA}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<ProjectName>HelloWorldSubscriber</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(Platform)\$(Configuration)\Subscriber\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(CycloneDDS_inc_dir);..\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>$(CycloneDDS_lib_dir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>ddsc.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(CycloneDDS_inc_dir);..\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ddsc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CycloneDDS_lib_dir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(CycloneDDS_inc_dir);..\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ddsc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CycloneDDS_lib_dir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\generated\HelloWorldData.c" />
<ClCompile Include="..\subscriber.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\generated\HelloWorldData.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
</Project>

View file

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{28A7A97B-3CEF-4FD7-8DC5-A7586D6DAE1D}</ProjectGuid>
<RootNamespace>HelloWorldType</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="directories.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemGroup>
<CustomBuild Include="..\HelloWorldData.idl">
<Command>java -classpath "$(CycloneDDS_idlc_dir)\idlc-jar-with-dependencies.jar" org.eclipse.cyclonedds.compilers.Idlc -d "$(SolutionDir)generated" "%(FullPath)"</Command>
<Message>Generating source files from IDL into "$(SolutionDir)generated"</Message>
<Outputs>HelloWorldData.h;HelloWorldData.c</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<CycloneDDS_lib_dir>C:/Program Files/ADLINK/Cyclone DDS/lib</CycloneDDS_lib_dir>
<CycloneDDS_inc_dir>C:/Program Files/ADLINK/Cyclone DDS/include</CycloneDDS_inc_dir>
<CycloneDDS_idlc_dir>C:/Program Files/ADLINK/Cyclone DDS/share/CycloneDDS/idlc</CycloneDDS_idlc_dir>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<BuildMacro Include="CycloneDDS_lib_dir">
<Value>$(CycloneDDS_lib_dir)</Value>
</BuildMacro>
<BuildMacro Include="CycloneDDS_inc_dir">
<Value>$(CycloneDDS_inc_dir)</Value>
</BuildMacro>
<BuildMacro Include="CycloneDDS_idlc_dir">
<Value>$(CycloneDDS_idlc_dir)</Value>
</BuildMacro>
</ItemGroup>
<PropertyGroup Label="Configuration">
<!-->
User macros are not expanded when starting the build applications in VS.
The path is extended with a possible Cyclone DLL location when they are not
installed in a system default location.
<-->
<LocalDebuggerEnvironment>PATH=../../../../../bin;%PATH%
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>

View file

@ -1,33 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS "${CMAKE_SOURCE_DIR}/../../")
endif()
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.
# In short, it takes the idl file, generates the source files with
# the proper data types and compiles them into a library.
idlc_generate(RoundTrip_lib RoundTrip.idl)
# Both executables have only one related source file.
add_executable(RoundtripPing ping.c)
add_executable(RoundtripPong pong.c)
# Both executables need to be linked to the idl data type library and
# the ddsc API library.
target_link_libraries(RoundtripPing RoundTrip_lib CycloneDDS::ddsc)
target_link_libraries(RoundtripPong RoundTrip_lib CycloneDDS::ddsc)

View file

@ -1,8 +0,0 @@
module RoundTripModule
{
struct DataType
{
sequence<octet> payload;
};
#pragma keylist DataType
};

View file

@ -1,513 +0,0 @@
#include "dds/dds.h"
#include "RoundTrip.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <inttypes.h>
#define TIME_STATS_SIZE_INCREMENT 50000
#define MAX_SAMPLES 100
#define US_IN_ONE_SEC 1000000LL
/* Forward declaration */
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener);
static void finalize_dds(dds_entity_t participant);
typedef struct ExampleTimeStats
{
dds_time_t * values;
unsigned long valuesSize;
unsigned long valuesMax;
double average;
dds_time_t min;
dds_time_t max;
unsigned long count;
} ExampleTimeStats;
static void exampleInitTimeStats (ExampleTimeStats *stats)
{
stats->values = (dds_time_t*) malloc (TIME_STATS_SIZE_INCREMENT * sizeof (dds_time_t));
stats->valuesSize = 0;
stats->valuesMax = TIME_STATS_SIZE_INCREMENT;
stats->average = 0;
stats->min = 0;
stats->max = 0;
stats->count = 0;
}
static void exampleResetTimeStats (ExampleTimeStats *stats)
{
memset (stats->values, 0, stats->valuesMax * sizeof (dds_time_t));
stats->valuesSize = 0;
stats->average = 0;
stats->min = 0;
stats->max = 0;
stats->count = 0;
}
static void exampleDeleteTimeStats (ExampleTimeStats *stats)
{
free (stats->values);
}
static ExampleTimeStats *exampleAddTimingToTimeStats
(ExampleTimeStats *stats, dds_time_t timing)
{
if (stats->valuesSize > stats->valuesMax)
{
dds_time_t * temp = (dds_time_t*) realloc (stats->values, (stats->valuesMax + TIME_STATS_SIZE_INCREMENT) * sizeof (dds_time_t));
stats->values = temp;
stats->valuesMax += TIME_STATS_SIZE_INCREMENT;
}
if (stats->values != NULL && stats->valuesSize < stats->valuesMax)
{
stats->values[stats->valuesSize++] = timing;
}
stats->average = ((double)stats->count * stats->average + (double)timing) / (double)(stats->count + 1);
stats->min = (stats->count == 0 || timing < stats->min) ? timing : stats->min;
stats->max = (stats->count == 0 || timing > stats->max) ? timing : stats->max;
stats->count++;
return stats;
}
static int exampleCompareul (const void* a, const void* b)
{
dds_time_t ul_a = *((dds_time_t*)a);
dds_time_t ul_b = *((dds_time_t*)b);
if (ul_a < ul_b) return -1;
if (ul_a > ul_b) return 1;
return 0;
}
static double exampleGetMedianFromTimeStats (ExampleTimeStats *stats)
{
double median = 0.0;
qsort (stats->values, stats->valuesSize, sizeof (dds_time_t), exampleCompareul);
if (stats->valuesSize % 2 == 0)
{
median = (double)(stats->values[stats->valuesSize / 2 - 1] + stats->values[stats->valuesSize / 2]) / 2;
}
else
{
median = (double)stats->values[stats->valuesSize / 2];
}
return median;
}
static dds_time_t exampleGet99PercentileFromTimeStats (ExampleTimeStats *stats)
{
qsort (stats->values, stats->valuesSize, sizeof (dds_time_t), exampleCompareul);
return stats->values[stats->valuesSize - stats->valuesSize / 100];
}
static dds_entity_t waitSet;
#ifdef _WIN32
#include <Windows.h>
static bool CtrlHandler (DWORD fdwCtrlType)
{
dds_waitset_set_trigger (waitSet, true);
return true; //Don't let other handlers handle this key
}
#elif !DDSRT_WITH_FREERTOS
static void CtrlHandler (int sig)
{
(void)sig;
dds_waitset_set_trigger (waitSet, true);
}
#endif
static dds_entity_t writer;
static dds_entity_t reader;
static dds_entity_t participant;
static dds_entity_t readCond;
static ExampleTimeStats roundTrip;
static ExampleTimeStats writeAccess;
static ExampleTimeStats readAccess;
static ExampleTimeStats roundTripOverall;
static ExampleTimeStats writeAccessOverall;
static ExampleTimeStats readAccessOverall;
static RoundTripModule_DataType pub_data;
static RoundTripModule_DataType sub_data[MAX_SAMPLES];
static void *samples[MAX_SAMPLES];
static dds_sample_info_t info[MAX_SAMPLES];
static dds_time_t startTime;
static dds_time_t preWriteTime;
static dds_time_t postWriteTime;
static dds_time_t preTakeTime;
static dds_time_t postTakeTime;
static dds_time_t elapsed = 0;
static bool warmUp = true;
static void data_available(dds_entity_t rd, void *arg)
{
dds_time_t difference = 0;
int status;
(void)arg;
/* Take sample and check that it is valid */
preTakeTime = dds_time ();
status = dds_take (rd, samples, info, MAX_SAMPLES, MAX_SAMPLES);
if (status < 0)
DDS_FATAL("dds_take: %s\n", dds_strretcode(-status));
postTakeTime = dds_time ();
/* Update stats */
difference = (postWriteTime - preWriteTime)/DDS_NSECS_IN_USEC;
writeAccess = *exampleAddTimingToTimeStats (&writeAccess, difference);
writeAccessOverall = *exampleAddTimingToTimeStats (&writeAccessOverall, difference);
difference = (postTakeTime - preTakeTime)/DDS_NSECS_IN_USEC;
readAccess = *exampleAddTimingToTimeStats (&readAccess, difference);
readAccessOverall = *exampleAddTimingToTimeStats (&readAccessOverall, difference);
difference = (postTakeTime - info[0].source_timestamp)/DDS_NSECS_IN_USEC;
roundTrip = *exampleAddTimingToTimeStats (&roundTrip, difference);
roundTripOverall = *exampleAddTimingToTimeStats (&roundTripOverall, difference);
if (!warmUp) {
/* Print stats each second */
difference = (postTakeTime - startTime)/DDS_NSECS_IN_USEC;
if (difference > US_IN_ONE_SEC)
{
printf("%9" PRIi64 " %9lu %8.0f %8" PRIi64 " %8" PRIi64 " %8" PRIi64 " %10lu %8.0f %8" PRIi64 " %10lu %8.0f %8" PRIi64 "\n",
elapsed + 1,
roundTrip.count,
exampleGetMedianFromTimeStats (&roundTrip) / 2,
roundTrip.min / 2,
exampleGet99PercentileFromTimeStats (&roundTrip) / 2,
roundTrip.max / 2,
writeAccess.count,
exampleGetMedianFromTimeStats (&writeAccess),
writeAccess.min,
readAccess.count,
exampleGetMedianFromTimeStats (&readAccess),
readAccess.min);
fflush (stdout);
exampleResetTimeStats (&roundTrip);
exampleResetTimeStats (&writeAccess);
exampleResetTimeStats (&readAccess);
startTime = dds_time ();
elapsed++;
}
}
preWriteTime = dds_time();
status = dds_write_ts (writer, &pub_data, preWriteTime);
if (status < 0)
DDS_FATAL("dds_write_ts: %s\n", dds_strretcode(-status));
postWriteTime = dds_time();
}
static void usage(void)
{
printf ("Usage (parameters must be supplied in order):\n"
"./ping [-l] [payloadSize (bytes, 0 - 100M)] [numSamples (0 = infinite)] [timeOut (seconds, 0 = infinite)]\n"
"./ping quit - ping sends a quit signal to pong.\n"
"Defaults:\n"
"./ping 0 0 0\n");
exit(EXIT_FAILURE);
}
int main (int argc, char *argv[])
{
uint32_t payloadSize = 0;
uint64_t numSamples = 0;
bool invalidargs = false;
dds_time_t timeOut = 0;
dds_time_t time;
dds_time_t difference = 0;
dds_attach_t wsresults[1];
size_t wsresultsize = 1U;
dds_time_t waitTimeout = DDS_SECS (1);
unsigned long i;
int status;
dds_listener_t *listener = NULL;
bool use_listener = false;
int argidx = 1;
/* poor man's getopt works even on Windows */
if (argc > argidx && strcmp(argv[argidx], "-l") == 0)
{
argidx++;
use_listener = true;
}
/* Register handler for Ctrl-C */
#ifdef _WIN32
SetConsoleCtrlHandler ((PHANDLER_ROUTINE)CtrlHandler, TRUE);
#elif !DDSRT_WITH_FREERTOS
struct sigaction sat, oldAction;
sat.sa_handler = CtrlHandler;
sigemptyset (&sat.sa_mask);
sat.sa_flags = 0;
sigaction (SIGINT, &sat, &oldAction);
#endif
exampleInitTimeStats (&roundTrip);
exampleInitTimeStats (&writeAccess);
exampleInitTimeStats (&readAccess);
exampleInitTimeStats (&roundTripOverall);
exampleInitTimeStats (&writeAccessOverall);
exampleInitTimeStats (&readAccessOverall);
memset (&sub_data, 0, sizeof (sub_data));
memset (&pub_data, 0, sizeof (pub_data));
for (i = 0; i < MAX_SAMPLES; i++)
{
samples[i] = &sub_data[i];
}
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
if (participant < 0)
DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant));
if (use_listener)
{
listener = dds_create_listener(NULL);
dds_lset_data_available(listener, data_available);
}
prepare_dds(&writer, &reader, &readCond, listener);
if (argc - argidx == 1 && strcmp (argv[argidx], "quit") == 0)
{
printf ("Sending termination request.\n");
fflush (stdout);
/* pong uses a waitset which is triggered by instance disposal, and
quits when it fires. */
dds_sleepfor (DDS_SECS (1));
pub_data.payload._length = 0;
pub_data.payload._buffer = NULL;
pub_data.payload._release = true;
pub_data.payload._maximum = 0;
status = dds_writedispose (writer, &pub_data);
if (status < 0)
DDS_FATAL("dds_writedispose: %s\n", dds_strretcode(-status));
dds_sleepfor (DDS_SECS (1));
goto done;
}
if (argc - argidx == 0)
{
invalidargs = true;
}
if (argc - argidx >= 1)
{
payloadSize = (uint32_t) atol (argv[argidx]);
if (payloadSize > 100 * 1048576)
{
invalidargs = true;
}
}
if (argc - argidx >= 2)
{
numSamples = (uint64_t) atol (argv[argidx+1]);
}
if (argc - argidx >= 3)
{
timeOut = atol (argv[argidx+2]);
}
if (invalidargs || (argc - argidx == 1 && (strcmp (argv[argidx], "-h") == 0 || strcmp (argv[argidx], "--help") == 0)))
usage();
printf ("# payloadSize: %" PRIu32 " | numSamples: %" PRIu64 " | timeOut: %" PRIi64 "\n\n", payloadSize, numSamples, timeOut);
fflush (stdout);
pub_data.payload._length = payloadSize;
pub_data.payload._buffer = payloadSize ? dds_alloc (payloadSize) : NULL;
pub_data.payload._release = true;
pub_data.payload._maximum = 0;
for (i = 0; i < payloadSize; i++)
{
pub_data.payload._buffer[i] = 'a';
}
startTime = dds_time ();
printf ("# Waiting for startup jitter to stabilise\n");
fflush (stdout);
/* Write a sample that pong can send back */
while (!dds_triggered (waitSet) && difference < DDS_SECS(5))
{
status = dds_waitset_wait (waitSet, wsresults, wsresultsize, waitTimeout);
if (status < 0)
DDS_FATAL("dds_waitset_wait: %s\n", dds_strretcode(-status));
if (status > 0 && listener == NULL) /* data */
{
status = dds_take (reader, samples, info, MAX_SAMPLES, MAX_SAMPLES);
if (status < 0)
DDS_FATAL("dds_take: %s\n", dds_strretcode(-status));
}
time = dds_time ();
difference = time - startTime;
}
if (!dds_triggered (waitSet))
{
warmUp = false;
printf("# Warm up complete.\n\n");
printf("# Latency measurements (in us)\n");
printf("# Latency [us] Write-access time [us] Read-access time [us]\n");
printf("# Seconds Count median min 99%% max Count median min Count median min\n");
fflush (stdout);
}
exampleResetTimeStats (&roundTrip);
exampleResetTimeStats (&writeAccess);
exampleResetTimeStats (&readAccess);
startTime = dds_time ();
/* Write a sample that pong can send back */
preWriteTime = dds_time ();
status = dds_write_ts (writer, &pub_data, preWriteTime);
if (status < 0)
DDS_FATAL("dds_write_ts: %s\n", dds_strretcode(-status));
postWriteTime = dds_time ();
for (i = 0; !dds_triggered (waitSet) && (!numSamples || i < numSamples) && !(timeOut && elapsed >= timeOut); i++)
{
status = dds_waitset_wait (waitSet, wsresults, wsresultsize, waitTimeout);
if (status < 0)
DDS_FATAL("dds_waitset_wait: %s\n", dds_strretcode(-status));
if (status != 0 && listener == NULL) {
data_available(reader, NULL);
}
}
if (!warmUp)
{
printf
(
"\n%9s %9lu %8.0f %8" PRIi64 " %8" PRIi64 " %8" PRIi64 " %10lu %8.0f %8" PRIi64 " %10lu %8.0f %8" PRIi64 "\n",
"# Overall",
roundTripOverall.count,
exampleGetMedianFromTimeStats (&roundTripOverall) / 2,
roundTripOverall.min / 2,
exampleGet99PercentileFromTimeStats (&roundTripOverall) / 2,
roundTripOverall.max / 2,
writeAccessOverall.count,
exampleGetMedianFromTimeStats (&writeAccessOverall),
writeAccessOverall.min,
readAccessOverall.count,
exampleGetMedianFromTimeStats (&readAccessOverall),
readAccessOverall.min
);
fflush (stdout);
}
done:
#ifdef _WIN32
SetConsoleCtrlHandler (0, FALSE);
#elif !DDSRT_WITH_FREERTOS
sigaction (SIGINT, &oldAction, 0);
#endif
finalize_dds(participant);
/* Clean up */
exampleDeleteTimeStats (&roundTrip);
exampleDeleteTimeStats (&writeAccess);
exampleDeleteTimeStats (&readAccess);
exampleDeleteTimeStats (&roundTripOverall);
exampleDeleteTimeStats (&writeAccessOverall);
exampleDeleteTimeStats (&readAccessOverall);
for (i = 0; i < MAX_SAMPLES; i++)
{
RoundTripModule_DataType_free (&sub_data[i], DDS_FREE_CONTENTS);
}
RoundTripModule_DataType_free (&pub_data, DDS_FREE_CONTENTS);
return EXIT_SUCCESS;
}
static dds_entity_t prepare_dds(dds_entity_t *wr, dds_entity_t *rd, dds_entity_t *rdcond, dds_listener_t *listener)
{
dds_return_t status;
dds_entity_t topic;
dds_entity_t publisher;
dds_entity_t subscriber;
const char *pubPartitions[] = { "ping" };
const char *subPartitions[] = { "pong" };
dds_qos_t *pubQos;
dds_qos_t *dwQos;
dds_qos_t *drQos;
dds_qos_t *subQos;
/* A DDS_Topic is created for our sample type on the domain participant. */
topic = dds_create_topic (participant, &RoundTripModule_DataType_desc, "RoundTrip", NULL, NULL);
if (topic < 0)
DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));
/* A DDS_Publisher is created on the domain participant. */
pubQos = dds_create_qos ();
dds_qset_partition (pubQos, 1, pubPartitions);
publisher = dds_create_publisher (participant, pubQos, NULL);
if (publisher < 0)
DDS_FATAL("dds_create_publisher: %s\n", dds_strretcode(-publisher));
dds_delete_qos (pubQos);
/* A DDS_DataWriter is created on the Publisher & Topic with a modified Qos. */
dwQos = dds_create_qos ();
dds_qset_reliability (dwQos, DDS_RELIABILITY_RELIABLE, DDS_SECS (10));
dds_qset_writer_data_lifecycle (dwQos, false);
*wr = dds_create_writer (publisher, topic, dwQos, NULL);
if (*wr < 0)
DDS_FATAL("dds_create_writer: %s\n", dds_strretcode(-*wr));
dds_delete_qos (dwQos);
/* A DDS_Subscriber is created on the domain participant. */
subQos = dds_create_qos ();
dds_qset_partition (subQos, 1, subPartitions);
subscriber = dds_create_subscriber (participant, subQos, NULL);
if (subscriber < 0)
DDS_FATAL("dds_create_subscriber: %s\n", dds_strretcode(-subscriber));
dds_delete_qos (subQos);
/* A DDS_DataReader is created on the Subscriber & Topic with a modified QoS. */
drQos = dds_create_qos ();
dds_qset_reliability (drQos, DDS_RELIABILITY_RELIABLE, DDS_SECS(10));
*rd = dds_create_reader (subscriber, topic, drQos, listener);
if (*rd < 0)
DDS_FATAL("dds_create_reader: %s\n", dds_strretcode(-*rd));
dds_delete_qos (drQos);
waitSet = dds_create_waitset (participant);
if (listener == NULL) {
*rdcond = dds_create_readcondition (*rd, DDS_ANY_STATE);
status = dds_waitset_attach (waitSet, *rdcond, *rd);
if (status < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-status));
} else {
*rdcond = 0;
}
status = dds_waitset_attach (waitSet, waitSet, waitSet);
if (status < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-status));
return participant;
}
static void finalize_dds(dds_entity_t ppant)
{
dds_return_t status;
status = dds_delete (ppant);
if (status < 0)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-status));
}

View file

@ -1,227 +0,0 @@
#include "dds/dds.h"
#include "RoundTrip.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
static dds_entity_t waitSet;
#define MAX_SAMPLES 10
/* Forward declarations */
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener);
static void finalize_dds(dds_entity_t participant, RoundTripModule_DataType data[MAX_SAMPLES]);
#ifdef _WIN32
#include <Windows.h>
static bool CtrlHandler (DWORD fdwCtrlType)
{
dds_waitset_set_trigger (waitSet, true);
return true; //Don't let other handlers handle this key
}
#elif !DDSRT_WITH_FREERTOS
static void CtrlHandler (int sig)
{
(void)sig;
dds_waitset_set_trigger (waitSet, true);
}
#endif
static RoundTripModule_DataType data[MAX_SAMPLES];
static void * samples[MAX_SAMPLES];
static dds_sample_info_t info[MAX_SAMPLES];
static dds_entity_t participant;
static dds_entity_t reader;
static dds_entity_t writer;
static dds_entity_t readCond;
static void data_available(dds_entity_t rd, void *arg)
{
int status, samplecount;
(void)arg;
samplecount = dds_take (rd, samples, info, MAX_SAMPLES, MAX_SAMPLES);
if (samplecount < 0)
DDS_FATAL("dds_take: %s\n", dds_strretcode(-samplecount));
for (int j = 0; !dds_triggered (waitSet) && j < samplecount; j++)
{
/* If writer has been disposed terminate pong */
if (info[j].instance_state == DDS_IST_NOT_ALIVE_DISPOSED)
{
printf ("Received termination request. Terminating.\n");
dds_waitset_set_trigger (waitSet, true);
break;
}
else if (info[j].valid_data)
{
/* If sample is valid, send it back to ping */
RoundTripModule_DataType * valid_sample = &data[j];
status = dds_write_ts (writer, valid_sample, info[j].source_timestamp);
if (status < 0)
DDS_FATAL("dds_write_ts: %d\n", -status);
}
}
}
int main (int argc, char *argv[])
{
dds_duration_t waitTimeout = DDS_INFINITY;
unsigned int i;
int status;
dds_attach_t wsresults[1];
size_t wsresultsize = 1U;
dds_listener_t *listener = NULL;
bool use_listener = false;
int argidx = 1;
if (argc > argidx && strcmp(argv[argidx], "-l") == 0)
{
argidx++;
use_listener = true;
}
/* Register handler for Ctrl-C */
#ifdef _WIN32
SetConsoleCtrlHandler ((PHANDLER_ROUTINE)CtrlHandler, TRUE);
#elif !DDSRT_WITH_FREERTOS
struct sigaction sat, oldAction;
sat.sa_handler = CtrlHandler;
sigemptyset (&sat.sa_mask);
sat.sa_flags = 0;
sigaction (SIGINT, &sat, &oldAction);
#endif
/* Initialize sample data */
memset (data, 0, sizeof (data));
for (i = 0; i < MAX_SAMPLES; i++)
{
samples[i] = &data[i];
}
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
if (participant < 0)
DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant));
if (use_listener)
{
listener = dds_create_listener(NULL);
dds_lset_data_available(listener, data_available);
}
(void)prepare_dds(&writer, &reader, &readCond, listener);
while (!dds_triggered (waitSet))
{
/* Wait for a sample from ping */
status = dds_waitset_wait (waitSet, wsresults, wsresultsize, waitTimeout);
if (status < 0)
DDS_FATAL("dds_waitset_wait: %s\n", dds_strretcode(-status));
/* Take samples */
if (listener == NULL) {
data_available (reader, 0);
}
}
#ifdef _WIN32
SetConsoleCtrlHandler (0, FALSE);
#elif !DDSRT_WITH_FREERTOS
sigaction (SIGINT, &oldAction, 0);
#endif
/* Clean up */
finalize_dds(participant, data);
return EXIT_SUCCESS;
}
static void finalize_dds(dds_entity_t pp, RoundTripModule_DataType xs[MAX_SAMPLES])
{
dds_return_t status;
status = dds_delete (pp);
if (status < 0)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-status));
for (unsigned int i = 0; i < MAX_SAMPLES; i++)
{
RoundTripModule_DataType_free (&xs[i], DDS_FREE_CONTENTS);
}
}
static dds_entity_t prepare_dds(dds_entity_t *wr, dds_entity_t *rd, dds_entity_t *rdcond, dds_listener_t *rdlist)
{
const char *pubPartitions[] = { "pong" };
const char *subPartitions[] = { "ping" };
dds_qos_t *qos;
dds_entity_t subscriber;
dds_entity_t publisher;
dds_entity_t topic;
dds_return_t status;
/* A DDS Topic is created for our sample type on the domain participant. */
topic = dds_create_topic (participant, &RoundTripModule_DataType_desc, "RoundTrip", NULL, NULL);
if (topic < 0)
DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));
/* A DDS Publisher is created on the domain participant. */
qos = dds_create_qos ();
dds_qset_partition (qos, 1, pubPartitions);
publisher = dds_create_publisher (participant, qos, NULL);
if (publisher < 0)
DDS_FATAL("dds_create_publisher: %s\n", dds_strretcode(-publisher));
dds_delete_qos (qos);
/* A DDS DataWriter is created on the Publisher & Topic with a modififed Qos. */
qos = dds_create_qos ();
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS(10));
dds_qset_writer_data_lifecycle (qos, false);
*wr = dds_create_writer (publisher, topic, qos, NULL);
if (*wr < 0)
DDS_FATAL("dds_create_writer: %s\n", dds_strretcode(-*wr));
dds_delete_qos (qos);
/* A DDS Subscriber is created on the domain participant. */
qos = dds_create_qos ();
dds_qset_partition (qos, 1, subPartitions);
subscriber = dds_create_subscriber (participant, qos, NULL);
if (subscriber < 0)
DDS_FATAL("dds_create_subscriber: %s\n", dds_strretcode(-subscriber));
dds_delete_qos (qos);
/* A DDS DataReader is created on the Subscriber & Topic with a modified QoS. */
qos = dds_create_qos ();
dds_qset_reliability (qos, DDS_RELIABILITY_RELIABLE, DDS_SECS(10));
*rd = dds_create_reader (subscriber, topic, qos, rdlist);
if (*rd < 0)
DDS_FATAL("dds_create_reader: %s\n", dds_strretcode(-*rd));
dds_delete_qos (qos);
waitSet = dds_create_waitset (participant);
if (rdlist == NULL) {
*rdcond = dds_create_readcondition (*rd, DDS_ANY_STATE);
status = dds_waitset_attach (waitSet, *rdcond, *rd);
if (status < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-status));
} else {
*rdcond = 0;
}
status = dds_waitset_attach (waitSet, waitSet, waitSet);
if (status < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-status));
printf ("Waiting for samples from ping to send back...\n");
fflush (stdout);
return participant;
}

View file

@ -1,83 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
Roundtrip
==========
Description
***********
The Roundtrip example allows the measurement of roundtrip duration when sending and receiving back a single message.
Design
******
It consists of 2 units:
- Pong: waits for messages from ping and sends the same message back.
- Ping: Sends a message to pong and waits for its return.
Scenario
********
A message is sent by the **ping** executable on the "PING" partition, which the **pong** executable is waiting for.
The **pong** executable sends the same message back on the "PONG" partition, which the **ping** executable is waiting for.
This sequence is repeated a configurable number of times.
The **ping** executable measures:
- writeAccess time: time the write() method took.
- readAccess time: time the take() method took.
- roundTrip time: time between the call to the write() method and the return of the take() method.
- **ping** also calculates min/max/average statistics on these values over a configurable number of samples and/or time out period.
Configurable:
- payloadSize: the size of the payload in bytes.
- numSamples: the number of samples to send.
- timeOut: the number of seconds ping should run for.
Running the example
*******************
It is recommended that you run ping and pong in separate terminals to avoid mixing the output.
- Open 2 terminals.
- In the first terminal start Pong by running pong.
pong usage:
``./pong``
- In the second terminal start Ping by running ping.
ping usage (parameters must be supplied in order):
``./ping [payloadSize (bytes, 0 - 655536)] [numSamples (0 = infinite)] [timeOut (seconds, 0 = infinite)]``
``./ping quit - ping sends a quit signal to pong.``
defaults:
``./ping 0 0 0``
- To achieve optimal performance it is recommended to set the CPU affinity so that ping and pong run on separate CPU cores,
and use real-time scheduling. In a Linux environment this can be achieved as follows:
pong usage:
``taskset -c 0 chrt -f 80 ./pong``
ping usage:
``taskset -c 1 chrt -f 80 ./ping [payloadSize (bytes, 0 - 655536)] [numSamples (0 = infinite)] [timeOut (seconds, 0 = infinite)]``
On Windows the CPU affinity and scheduling class can be set as follows:
pong usage:
``START /affinity 1 /high cmd /k "pong.exe"``
ping usage:
``START /affinity 2 /high cmd /k "ping.exe" [payloadSize (bytes, 0 - 655536)] [numSamples (0 = infinite)] [timeOut (seconds, 0 = infinite)]``

View file

@ -1,86 +0,0 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'breathe']
# Add any paths that contain templates here, relative to this directory.
#templates_path = ['@CMAKE_CURRENT_SOuRCE_DIR@/_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'examples'
# General information about the project.
project = u'@CMAKE_PROJECT_NAME@'
copyright = u'@sph_conf_copyright@'
author = u'@sph_conf_author@'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y.Z version.
version = u'@sph_conf_version@'
# The full version, including alpha/beta/rc tags.
release = u'@sph_conf_release@'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_show_sourcelink = False
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = { 'show_powered_by': False }
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['@PROJECT_SOURCE_DIR@/docs/_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}

View file

@ -1,33 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
cmake_minimum_required(VERSION 3.5)
if (NOT TARGET CycloneDDS::ddsc)
# Find the CycloneDDS package. If it is not in a default location, try
# finding it relative to the example where it most likely resides.
find_package(CycloneDDS REQUIRED PATHS "${CMAKE_SOURCE_DIR}/../../")
endif()
# This is a convenience function, provided by the CycloneDDS package,
# that will supply a library target related the the given idl file.
# In short, it takes the idl file, generates the source files with
# the proper data types and compiles them into a library.
idlc_generate(Throughput_lib Throughput.idl)
# Both executables have only one related source file.
add_executable(ThroughputPublisher publisher.c)
add_executable(ThroughputSubscriber subscriber.c)
# Both executables need to be linked to the idl data type library and
# the ddsc API library.
target_link_libraries(ThroughputPublisher Throughput_lib CycloneDDS::ddsc)
target_link_libraries(ThroughputSubscriber Throughput_lib CycloneDDS::ddsc)

View file

@ -1,9 +0,0 @@
module ThroughputModule
{
struct DataType
{
unsigned long long count;
sequence<octet> payload;
};
#pragma keylist DataType
};

View file

@ -1,295 +0,0 @@
#include "dds/dds.h"
#include "Throughput.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
/*
* The Throughput example measures data throughput in bytes per second. The publisher
* allows you to specify a payload size in bytes as well as allowing you to specify
* whether to send data in bursts. The publisher will continue to send data forever
* unless a time out is specified. The subscriber will receive data and output the
* total amount received and the data rate in bytes per second. It will also indicate
* if any samples were received out of order. A maximum number of cycles can be
* specified and once this has been reached the subscriber will terminate and output
* totals and averages.
*/
#define MAX_SAMPLES 100
static bool done = false;
/* Forward declarations */
static dds_return_t wait_for_reader(dds_entity_t writer, dds_entity_t participant);
static void start_writing(dds_entity_t writer, ThroughputModule_DataType *sample,
int burstInterval, uint32_t burstSize, int timeOut);
static int parse_args(int argc, char **argv, uint32_t *payloadSize, int *burstInterval,
uint32_t *burstSize, int *timeOut, char **partitionName);
static dds_entity_t prepare_dds(dds_entity_t *writer, const char *partitionName);
static void finalize_dds(dds_entity_t participant, dds_entity_t writer, ThroughputModule_DataType sample);
static void sigint (int sig)
{
(void)sig;
done = true;
}
int main (int argc, char **argv)
{
uint32_t payloadSize = 8192;
int burstInterval = 0;
uint32_t burstSize = 1;
int timeOut = 0;
char * partitionName = "Throughput example";
dds_entity_t participant;
dds_entity_t writer;
dds_return_t rc;
ThroughputModule_DataType sample;
if (parse_args(argc, argv, &payloadSize, &burstInterval, &burstSize, &timeOut, &partitionName) == EXIT_FAILURE) {
return EXIT_FAILURE;
}
participant = prepare_dds(&writer, partitionName);
/* Wait until have a reader */
if (wait_for_reader(writer, participant) == 0) {
printf ("=== [Publisher] Did not discover a reader.\n");
fflush (stdout);
rc = dds_delete (participant);
if (rc < 0)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-rc));
return EXIT_FAILURE;
}
/* Fill the sample payload with data */
sample.count = 0;
sample.payload._buffer = dds_alloc (payloadSize);
sample.payload._length = payloadSize;
sample.payload._release = true;
for (uint32_t i = 0; i < payloadSize; i++) {
sample.payload._buffer[i] = 'a';
}
/* Register handler for Ctrl-C */
signal (SIGINT, sigint);
/* Register the sample instance and write samples repeatedly or until time out */
start_writing(writer, &sample, burstInterval, burstSize, timeOut);
/* Cleanup */
finalize_dds(participant, writer, sample);
return EXIT_SUCCESS;
}
static int parse_args(
int argc,
char **argv,
uint32_t *payloadSize,
int *burstInterval,
uint32_t *burstSize,
int *timeOut,
char **partitionName)
{
int result = EXIT_SUCCESS;
/*
* Get the program parameters
* Parameters: publisher [payloadSize] [burstInterval] [burstSize] [timeOut] [partitionName]
*/
if (argc == 2 && (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0))
{
printf ("Usage (parameters must be supplied in order):\n");
printf ("./publisher [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]\n");
printf ("Defaults:\n");
printf ("./publisher 8192 0 1 0 \"Throughput example\"\n");
return EXIT_FAILURE;
}
if (argc > 1)
{
*payloadSize = (uint32_t) atoi (argv[1]); /* The size of the payload in bytes */
}
if (argc > 2)
{
*burstInterval = atoi (argv[2]); /* The time interval between each burst in ms */
}
if (argc > 3)
{
*burstSize = (uint32_t) atoi (argv[3]); /* The number of samples to send each burst */
}
if (argc > 4)
{
*timeOut = atoi (argv[4]); /* The number of seconds the publisher should run for (0 = infinite) */
}
if (argc > 5)
{
*partitionName = argv[5]; /* The name of the partition */
}
printf ("payloadSize: %"PRIu32" bytes burstInterval: %u ms burstSize: %"PRId32" timeOut: %u seconds partitionName: %s\n",
*payloadSize, *burstInterval, *burstSize, *timeOut, *partitionName);
fflush (stdout);
return result;
}
static dds_entity_t prepare_dds(dds_entity_t *writer, const char *partitionName)
{
dds_entity_t participant;
dds_entity_t topic;
dds_entity_t publisher;
const char *pubParts[1];
dds_qos_t *pubQos;
dds_qos_t *dwQos;
/* A domain participant is created for the default domain. */
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
if (participant < 0)
DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant));
/* A topic is created for our sample type on the domain participant. */
topic = dds_create_topic (participant, &ThroughputModule_DataType_desc, "Throughput", NULL, NULL);
if (topic < 0)
DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));
/* A publisher is created on the domain participant. */
pubQos = dds_create_qos ();
pubParts[0] = partitionName;
dds_qset_partition (pubQos, 1, pubParts);
publisher = dds_create_publisher (participant, pubQos, NULL);
if (publisher < 0)
DDS_FATAL("dds_create_publisher: %s\n", dds_strretcode(-publisher));
dds_delete_qos (pubQos);
/* A DataWriter is created on the publisher. */
dwQos = dds_create_qos ();
dds_qset_reliability (dwQos, DDS_RELIABILITY_RELIABLE, DDS_SECS (10));
dds_qset_history (dwQos, DDS_HISTORY_KEEP_ALL, 0);
dds_qset_resource_limits (dwQos, MAX_SAMPLES, DDS_LENGTH_UNLIMITED, DDS_LENGTH_UNLIMITED);
*writer = dds_create_writer (publisher, topic, dwQos, NULL);
if (*writer < 0)
DDS_FATAL("dds_create_writer: %s\n", dds_strretcode(-*writer));
dds_delete_qos (dwQos);
/* Enable write batching */
dds_write_set_batch (true);
return participant;
}
static dds_return_t wait_for_reader(dds_entity_t writer, dds_entity_t participant)
{
printf ("\n=== [Publisher] Waiting for a reader ...\n");
fflush (stdout);
dds_return_t rc;
dds_entity_t waitset;
rc = dds_set_status_mask(writer, DDS_PUBLICATION_MATCHED_STATUS);
if (rc < 0)
DDS_FATAL("dds_set_status_mask: %s\n", dds_strretcode(-rc));
waitset = dds_create_waitset(participant);
if (waitset < 0)
DDS_FATAL("dds_create_waitset: %s\n", dds_strretcode(-waitset));
rc = dds_waitset_attach(waitset, writer, (dds_attach_t)NULL);
if (rc < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-rc));
rc = dds_waitset_wait(waitset, NULL, 0, DDS_SECS(30));
if (rc < 0)
DDS_FATAL("dds_waitset_wait: %s\n", dds_strretcode(-rc));
return rc;
}
static void start_writing(
dds_entity_t writer,
ThroughputModule_DataType *sample,
int burstInterval,
uint32_t burstSize,
int timeOut)
{
bool timedOut = false;
dds_time_t pubStart = dds_time ();
dds_time_t now;
dds_time_t deltaTv;
dds_return_t status;
if (!done)
{
dds_time_t burstStart = pubStart;
unsigned int burstCount = 0;
printf ("=== [Publisher] Writing samples...\n");
fflush (stdout);
while (!done && !timedOut)
{
/* Write data until burst size has been reached */
if (burstCount < burstSize)
{
status = dds_write (writer, sample);
if (status == DDS_RETCODE_TIMEOUT)
{
timedOut = true;
}
else if (status < 0)
{
DDS_FATAL("dds_write: %s\n", dds_strretcode(-status));
}
else
{
sample->count++;
burstCount++;
}
}
else if (burstInterval)
{
/* Sleep until burst interval has passed */
dds_time_t time = dds_time ();
deltaTv = time - burstStart;
if (deltaTv < DDS_MSECS (burstInterval))
{
dds_write_flush (writer);
dds_sleepfor (DDS_MSECS (burstInterval) - deltaTv);
}
burstStart = dds_time ();
burstCount = 0;
}
else
{
burstCount = 0;
}
if (timeOut)
{
now = dds_time ();
deltaTv = now - pubStart;
if ((deltaTv) > DDS_SECS (timeOut))
{
timedOut = true;
}
}
}
dds_write_flush (writer);
printf ("=== [Publisher] %s, %llu samples written.\n", done ? "Terminated" : "Timed out", (unsigned long long) sample->count);
fflush (stdout);
}
}
static void finalize_dds(dds_entity_t participant, dds_entity_t writer, ThroughputModule_DataType sample)
{
dds_return_t status = dds_dispose (writer, &sample);
if (status != DDS_RETCODE_TIMEOUT && status < 0)
DDS_FATAL("dds_dispose: %s\n", dds_strretcode(-status));
dds_free (sample.payload._buffer);
status = dds_delete (participant);
if (status < 0)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-status));
}

View file

@ -1,99 +0,0 @@
..
Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
v. 1.0 which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
Throughput
==========
Description
***********
The Throughput example allows the measurement of data throughput when receiving samples from a publisher.
Design
******
It consists of 2 units:
- Publisher: sends samples at a specified size and rate.
- Subscriber: Receives samples and outputs statistics about throughput
Scenario
********
The **publisher** sends samples and allows you to specify a payload size in bytes as well as allowing you to specify whether
to send data in bursts. The **publisher** will continue to send data forever unless a time-out is specified.
Configurable:
- payloadSize: the size of the payload in bytes
- burstInterval: the time interval between each burst in ms
- burstSize: the number of samples to send each burst
- timeOut: the number of seconds the publisher should run for (0=infinite)
- partitionName: the name of the partition
The **subscriber** will receive data and output the total amount received and the data-rate in bytes-per-second. It will
also indicate if any samples were received out-of-order. A maximum number of cycles can be specified and once this has
been reached the subscriber will terminate and output totals and averages.
The **subscriber** executable measures:
- transferred: the total amount of data transferred in bytes.
- outOfOrder: the number of samples that were received out of order.
- transfer rate: the data transfer rate in bytes per second.
- subscriber also calculates statistics on these values over a configurable number of cycles.
Configurable:
- maxCycles: the number of times to output statistics before terminating
- pollingDelay
- partitionName: the name of the partition
Running the example
*******************
It is recommended that you run ping and pong in separate terminals to avoid mixing the output.
- Open 2 terminals.
- In the first terminal start Publisher by running publisher
publisher usage (parameters must be supplied in order):
``./publisher [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]``
defaults:
``./publisher 8192 0 1 0 "Throughput example"``
- In the second terminal start Ping by running subscriber
subscriber usage (parameters must be supplied in order):
``./subscriber [maxCycles (0=infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]``
defaults:
``./subscriber 0 0 "Throughput example"``
- To achieve optimal performance it is recommended to set the CPU affinity so that ping and pong run on separate CPU cores,
and use real-time scheduling. In a Linux environment this can be achieved as follows:
publisher usage:
``taskset -c 0 chrt -f 80 ./publisher [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]``
subscriber usage:
``taskset -c 1 chrt -f 80 ./subscriber [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]``
On Windows the CPU affinity and prioritized scheduling class can be set as follows:
publisher usage:
``START /affinity 1 /high cmd /k "publisher.exe" [payloadSize (bytes)] [burstInterval (ms)] [burstSize (samples)] [timeOut (seconds)] [partitionName]``
subscriber usage:
``START /affinity 2 /high cmd /k "subscriber.exe" [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = event based)] [partitionName]``

View file

@ -1,400 +0,0 @@
#include "dds/dds.h"
#include "Throughput.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <assert.h>
/*
* The Throughput example measures data throughput in bytes per second. The publisher
* allows you to specify a payload size in bytes as well as allowing you to specify
* whether to send data in bursts. The publisher will continue to send data forever
* unless a time out is specified. The subscriber will receive data and output the
* total amount received and the data rate in bytes per second. It will also indicate
* if any samples were received out of order. A maximum number of cycles can be
* specified and once this has been reached the subscriber will terminate and output
* totals and averages.
*/
#define BYTES_PER_SEC_TO_MEGABITS_PER_SEC 125000
#define MAX_SAMPLES 1000
typedef struct HandleEntry
{
dds_instance_handle_t handle;
unsigned long long count;
struct HandleEntry * next;
} HandleEntry;
typedef struct HandleMap
{
HandleEntry *entries;
} HandleMap;
static long pollingDelay = -1; /* i.e. use a listener */
static HandleMap * imap;
static unsigned long long outOfOrder = 0;
static unsigned long long total_bytes = 0;
static unsigned long long total_samples = 0;
static dds_time_t startTime = 0;
static unsigned long payloadSize = 0;
static ThroughputModule_DataType data [MAX_SAMPLES];
static void * samples[MAX_SAMPLES];
static dds_entity_t waitSet;
static volatile sig_atomic_t done = false;
/* Forward declarations */
static HandleMap * HandleMap__alloc (void);
static void HandleMap__free (HandleMap *map);
static HandleEntry * store_handle (HandleMap *map, dds_instance_handle_t key);
static HandleEntry * retrieve_handle (HandleMap *map, dds_instance_handle_t key);
static void data_available_handler (dds_entity_t reader, void *arg);
static int parse_args(int argc, char **argv, unsigned long long *maxCycles, char **partitionName);
static void process_samples(dds_entity_t reader, unsigned long long maxCycles);
static dds_entity_t prepare_dds(dds_entity_t *reader, const char *partitionName);
static void finalize_dds(dds_entity_t participant);
static void sigint (int sig)
{
(void) sig;
done = true;
}
int main (int argc, char **argv)
{
unsigned long long maxCycles = 0;
char *partitionName = "Throughput example";
dds_entity_t participant;
dds_entity_t reader;
if (parse_args(argc, argv, &maxCycles, &partitionName) == EXIT_FAILURE)
{
return EXIT_FAILURE;
}
printf ("Cycles: %llu | PollingDelay: %ld | Partition: %s\n", maxCycles, pollingDelay, partitionName);
fflush (stdout);
participant = prepare_dds(&reader, partitionName);
printf ("=== [Subscriber] Waiting for samples...\n");
fflush (stdout);
/* Process samples until Ctrl-C is pressed or until maxCycles */
/* has been reached (0 = infinite) */
signal (SIGINT, sigint);
process_samples(reader, maxCycles);
dds_set_status_mask (reader, 0);
HandleMap__free (imap);
finalize_dds (participant);
return EXIT_SUCCESS;
}
/*
* This struct contains all of the entities used in the publisher and subscriber.
*/
static HandleMap * HandleMap__alloc (void)
{
HandleMap * map = malloc (sizeof (*map));
assert(map);
memset (map, 0, sizeof (*map));
return map;
}
static void HandleMap__free (HandleMap *map)
{
HandleEntry * entry;
while (map->entries)
{
entry = map->entries;
map->entries = entry->next;
free (entry);
}
free (map);
}
static HandleEntry * store_handle (HandleMap *map, dds_instance_handle_t key)
{
HandleEntry * entry = malloc (sizeof (*entry));
assert(entry);
memset (entry, 0, sizeof (*entry));
entry->handle = key;
entry->next = map->entries;
map->entries = entry;
return entry;
}
static HandleEntry * retrieve_handle (HandleMap *map, dds_instance_handle_t key)
{
HandleEntry * entry = map->entries;
while (entry)
{
if (entry->handle == key)
{
break;
}
entry = entry->next;
}
return entry;
}
static int do_take (dds_entity_t reader)
{
int samples_received;
dds_sample_info_t info [MAX_SAMPLES];
dds_instance_handle_t ph = 0;
HandleEntry * current = NULL;
if (startTime == 0)
{
startTime = dds_time ();
}
/* Take samples and iterate through them */
samples_received = dds_take (reader, samples, info, MAX_SAMPLES, MAX_SAMPLES);
if (samples_received < 0)
DDS_FATAL("dds_take: %s\n", dds_strretcode(-samples_received));
for (int i = 0; !done && i < samples_received; i++)
{
if (info[i].valid_data)
{
ph = info[i].publication_handle;
current = retrieve_handle (imap, ph);
ThroughputModule_DataType * this_sample = &data[i];
if (current == NULL)
{
current = store_handle (imap, ph);
current->count = this_sample->count;
}
if (this_sample->count != current->count)
{
outOfOrder++;
}
current->count = this_sample->count + 1;
/* Add the sample payload size to the total received */
payloadSize = this_sample->payload._length;
total_bytes += payloadSize + 8;
total_samples++;
}
}
return samples_received;
}
static void data_available_handler (dds_entity_t reader, void *arg)
{
(void)arg;
do_take (reader);
}
static int parse_args(int argc, char **argv, unsigned long long *maxCycles, char **partitionName)
{
/*
* Get the program parameters
* Parameters: subscriber [maxCycles] [pollingDelay] [partitionName]
*/
if (argc == 2 && (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0))
{
printf ("Usage (parameters must be supplied in order):\n");
printf ("./subscriber [maxCycles (0 = infinite)] [pollingDelay (ms, 0 = waitset, -1 = listener)] [partitionName]\n");
printf ("Defaults:\n");
printf ("./subscriber 0 0 \"Throughput example\"\n");
return EXIT_FAILURE;
}
if (argc > 1)
{
*maxCycles = (unsigned long long) atoi (argv[1]); /* The number of times to output statistics before terminating */
}
if (argc > 2)
{
pollingDelay = atoi (argv[2]); /* The number of ms to wait between reads (0 = waitset, -1 = listener) */
}
if (argc > 3)
{
*partitionName = argv[3]; /* The name of the partition */
}
return EXIT_SUCCESS;
}
static void process_samples(dds_entity_t reader, unsigned long long maxCycles)
{
dds_return_t status;
unsigned long long prev_bytes = 0;
unsigned long long prev_samples = 0;
dds_attach_t wsresults[2];
dds_time_t deltaTv;
bool first_batch = true;
unsigned long cycles = 0;
double deltaTime = 0;
dds_time_t prev_time = 0;
dds_time_t time_now = 0;
while (!done && (maxCycles == 0 || cycles < maxCycles))
{
if (pollingDelay > 0)
dds_sleepfor (DDS_MSECS (pollingDelay));
else
{
status = dds_waitset_wait (waitSet, wsresults, sizeof(wsresults)/sizeof(wsresults[0]), DDS_MSECS(100));
if (status < 0)
DDS_FATAL("dds_waitset_wait: %s\n", dds_strretcode(-status));
}
if (pollingDelay >= 0)
{
while (do_take (reader))
;
}
time_now = dds_time();
if (!first_batch)
{
deltaTv = time_now - prev_time;
deltaTime = (double) deltaTv / DDS_NSECS_IN_SEC;
if (deltaTime >= 1.0 && total_samples != prev_samples)
{
printf ("=== [Subscriber] %5.3f Payload size: %lu | Total received: %llu samples, %llu bytes | Out of order: %llu samples "
"Transfer rate: %.2lf samples/s, %.2lf Mbit/s\n",
deltaTime, payloadSize, total_samples, total_bytes, outOfOrder,
(deltaTime != 0.0) ? ((double)(total_samples - prev_samples) / deltaTime) : 0,
(deltaTime != 0.0) ? ((double)((total_bytes - prev_bytes) / BYTES_PER_SEC_TO_MEGABITS_PER_SEC) / deltaTime) : 0);
fflush (stdout);
cycles++;
prev_time = time_now;
prev_bytes = total_bytes;
prev_samples = total_samples;
}
}
else
{
prev_time = time_now;
first_batch = false;
}
}
/* Output totals and averages */
deltaTv = time_now - startTime;
deltaTime = (double) (deltaTv / DDS_NSECS_IN_SEC);
printf ("\nTotal received: %llu samples, %llu bytes\n", total_samples, total_bytes);
printf ("Out of order: %llu samples\n", outOfOrder);
printf ("Average transfer rate: %.2lf samples/s, ", (double)total_samples / deltaTime);
printf ("%.2lf Mbit/s\n", (double)(total_bytes / BYTES_PER_SEC_TO_MEGABITS_PER_SEC) / deltaTime);
fflush (stdout);
}
static dds_entity_t prepare_dds(dds_entity_t *reader, const char *partitionName)
{
dds_return_t status;
dds_entity_t topic;
dds_entity_t subscriber;
dds_listener_t *rd_listener;
dds_entity_t participant;
int32_t maxSamples = 4000;
const char *subParts[1];
dds_qos_t *subQos = dds_create_qos ();
dds_qos_t *drQos = dds_create_qos ();
/* A Participant is created for the default domain. */
participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
if (participant < 0)
DDS_FATAL("dds_create_particpant: %s\n", dds_strretcode(-participant));
/* A Topic is created for our sample type on the domain participant. */
topic = dds_create_topic (participant, &ThroughputModule_DataType_desc, "Throughput", NULL, NULL);
if (topic < 0)
DDS_FATAL("dds_create_topic: %s\n", dds_strretcode(-topic));
/* A Subscriber is created on the domain participant. */
subParts[0] = partitionName;
dds_qset_partition (subQos, 1, subParts);
subscriber = dds_create_subscriber (participant, subQos, NULL);
if (subscriber < 0)
DDS_FATAL("dds_create_subscriber: %s\n", dds_strretcode(-subscriber));
dds_delete_qos (subQos);
/* A Reader is created on the Subscriber & Topic with a modified Qos. */
dds_qset_reliability (drQos, DDS_RELIABILITY_RELIABLE, DDS_SECS (10));
dds_qset_history (drQos, DDS_HISTORY_KEEP_ALL, 0);
dds_qset_resource_limits (drQos, maxSamples, DDS_LENGTH_UNLIMITED, DDS_LENGTH_UNLIMITED);
rd_listener = dds_create_listener(NULL);
dds_lset_data_available(rd_listener, data_available_handler);
/* A Read Condition is created which is triggered when data is available to read */
waitSet = dds_create_waitset (participant);
if (waitSet < 0)
DDS_FATAL("dds_create_waitset: %s\n", dds_strretcode(-waitSet));
status = dds_waitset_attach (waitSet, waitSet, waitSet);
if (status < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-status));
imap = HandleMap__alloc ();
memset (data, 0, sizeof (data));
for (unsigned int i = 0; i < MAX_SAMPLES; i++)
{
samples[i] = &data[i];
}
*reader = dds_create_reader (subscriber, topic, drQos, pollingDelay < 0 ? rd_listener : NULL);
if (*reader < 0)
DDS_FATAL("dds_create_reader: %s\n", dds_strretcode(-*reader));
if (pollingDelay == 0)
{
status = dds_waitset_attach (waitSet, *reader, *reader);
if (status < 0)
DDS_FATAL("dds_waitset_attach: %s\n", dds_strretcode(-status));
}
dds_delete_qos (drQos);
dds_delete_listener(rd_listener);
return participant;
}
static void finalize_dds(dds_entity_t participant)
{
dds_return_t status;
for (unsigned int i = 0; i < MAX_SAMPLES; i++)
{
ThroughputModule_DataType_free (&data[i], DDS_FREE_CONTENTS);
}
status = dds_waitset_detach (waitSet, waitSet);
if (status < 0)
DDS_FATAL("dds_waitset_detach: %s\n", dds_strretcode(-status));
status = dds_delete (waitSet);
if (status < 0)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-status));
status = dds_delete (participant);
if (status < 0)
DDS_FATAL("dds_delete: %s\n", dds_strretcode(-status));
}

View file

@ -14,7 +14,6 @@ banner (file, date, version) ::= <<
Generated by Eclipse Cyclone DDS IDL to C Translator
File name: <file>.c
Source: <file>.idl
<if(date)> Generated: <date><endif>
Cyclone DDS: V<version>
*****************************************************************/

View file

@ -14,7 +14,6 @@ banner (file, date, version) ::= <<
Generated by Eclipse Cyclone DDS IDL to C Translator
File name: <file>.h
Source: <file>.idl
<if(date)> Generated: <date><endif>
Cyclone DDS: V<version>
*****************************************************************/

View file

@ -11,7 +11,7 @@
#
include(${MPT_CMAKE})
add_compile_options("-I${PROJECT_SOURCE_DIR}/core/ddsi/include")
add_compile_options("-I${PROJECT_SOURCE_DIR}/src/core/ddsi/include")
idlc_generate(mpt_rwdata_lib "procs/rwdata.idl")

View file

@ -1,21 +0,0 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
configure_file(
"cmake/vdds_install_examples.in" "vdds_install_examples" @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vdds_install_examples
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT dev)
endif()

View file

@ -1,199 +0,0 @@
#!/bin/sh
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
OUTPUT_DIR=
SCRIPT_DIR=
EXAMPLES_DIR=
EXPLICIT_YES=false
HELP_SHOWN=false
show_help() {
# Show help only once.
if [ $HELP_SHOWN = false ]; then
cat << EOF
Usage: ${0##*/} [-h] [-y] [-d OUTDIR]
The @CMAKE_PROJECT_NAME@ examples are probably installed in a read-only location.
By executing this script, the examples can be (re)installed to a writable
location. That could be helpful when trying to experiment with the examples.
-d|--dir OUTDIR Install the examples in OUTDIR.
This directory should not be a sub-directory of the
examples location.
If not set, an output dir will be asked for. When asking
for an output dir, the current directory is used as
suggestion.
-h|--help This text.
-y|--yes Use 'yes' for every question.
EOF
HELP_SHOWN=true
fi
}
#
# Parse command line arguments.
#
if [ -z "$1" ]; then
show_help
printf '\n'
else
while :; do
case $1 in
-h|-\?|--help)
show_help
exit
;;
-d|--dir)
if [ "$2" ]; then
OUTPUT_DIR=$2
shift
else
show_help
printf '\nERROR: "-d|--dir" requires a non-empty option argument.\n' "$1" >&2
exit 1
fi
;;
-y|--yes)
EXPLICIT_YES=true
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*)
break
esac
shift
done
fi
#
# Get the location of the script.
#
SCRIPT=`readlink -f "$0"`
SCRIPT_DIR=`dirname "$SCRIPT"`
#
# Try a few locations where the examples probably are.
#
EXAMPLES_DIR_DEFAULT="/usr/share/@CMAKE_PROJECT_NAME@/examples"
EXAMPLES_DIR_RELATIVE="$SCRIPT_DIR/../share/@CMAKE_PROJECT_NAME@/examples"
EXAMPLES_DIR_CURRENT=`pwd`
if [ -d "$EXAMPLES_DIR_DEFAULT" ]; then
EXAMPLES_DIR="$EXAMPLES_DIR_DEFAULT"
elif [ -d "$EXAMPLES_DIR_RELATIVE" ]; then
EXAMPLES_DIR="$EXAMPLES_DIR_RELATIVE"
elif [ -d "$EXAMPLES_DIR_CURRENT" ]; then
case "$EXAMPLES_DIR_CURRENT" in
*@CMAKE_PROJECT_NAME@/examples) EXAMPLES_DIR="$EXAMPLES_DIR_CURRENT"
esac
fi
if [ -z "$EXAMPLES_DIR" ]; then
show_help
printf '\nERROR: Could not find the @CMAKE_PROJECT_NAME@ examples at any of these locations:\n' >&2
printf ' - [Default ] - %s\n' "$EXAMPLES_DIR_DEFAULT" >&2
printf ' - [Relative] - %s\n' "$EXAMPLES_DIR_RELATIVE" >&2
printf ' - [Current ] - %s\n' "$EXAMPLES_DIR_CURRENT" >&2
exit 1
fi
#
# Only get the output dir ourselves when it wasn't already set by the
# command line arguments.
#
if [ -z "$OUTPUT_DIR" ]; then
# Assume the examples should be installed in the current directory.
OUTPUT_DIR=`pwd`
# When explicit 'yes' is provided as a command line argument, then
# don't ask if the assumption is correct.
if [ $EXPLICIT_YES = false ]; then
# Keep pestering the user until we have a proper answer.
while true; do
YNC=
if [ "$OUTPUT_DIR" = "$EXAMPLES_DIR" ]; then
YNC="N"
elif [ ! -w "$OUTPUT_DIR" ]; then
YNC="N"
else
read -p "Do you wish to install the @CMAKE_PROJECT_NAME@ examples in \"$OUTPUT_DIR\"? [Yes|No|Cancel] " YNC
fi
case $YNC in
[Yy]* ) break;;
[Nn]* ) read -p "New examples install directory> " OUTPUT_DIR; break;;
[Cc]* ) exit;;
* ) echo "Please answer yes, no or cancel.";;
esac
done
elif [ "$OUTPUT_DIR" = "$EXAMPLES_DIR" ]; then
show_help
printf '\nERROR: Destination is same as source.\n'
exit 1
fi
fi
#
# Check if the output dir is valid.
#
if [ ! -d "$OUTPUT_DIR" ]; then
# Only ask for permission if an explicit yes wasn't part of
# the command line arguments.
if [ $EXPLICIT_YES = false ]; then
while true; do
read -p "Do you wish to create directory \"$OUTPUT_DIR\"? [Yes|No] " YN
case $YN in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
fi
mkdir -p "$OUTPUT_DIR"
if [ $? -ne 0 ]; then
printf 'ERROR: Could not create directory "%s"\n' "$OUTPUT_DIR"
exit 1
fi
fi
# If the directory still doesn't exist, exit.
if [ ! -d "$OUTPUT_DIR" ]; then
show_help
printf '\nERROR: Directory "%s" does not exist.\n' "$OUTPUT_DIR" >&2
exit 1
fi
# If the directory isn't writable, exit.
if [ ! -w "$OUTPUT_DIR" ]; then
show_help
printf '\nERROR: Directory "%s" does not have write permission.\n' "$OUTPUT_DIR" >&2
exit 1
fi
#
# Copy the examples.
#
cp -Rf "$EXAMPLES_DIR" "$OUTPUT_DIR"
if [ $? -ne 0 ]; then
printf 'ERROR: Could not install examples\n'
exit 1
else
printf 'Installed @CMAKE_PROJECT_NAME@ examples into "%s"\n' "$OUTPUT_DIR"
fi

View file

@ -1,5 +1,5 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
# Copyright(c) 2006 to 2019 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
@ -11,15 +11,10 @@
#
set(CMAKE_INSTALL_TOOLSDIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/tools")
add_subdirectory(pubsub)
add_subdirectory(config)
if(BUILD_CONFTOOL)
add_subdirectory(config)
endif()
add_subdirectory(ddsls)
add_subdirectory(ddsperf)
# VxWorks build machines use OpenJDK 8, which lack jfxrt.jar. Do not build launcher on that platform.
#
# TODO Instead of making inclusion dependent on platform name, the condition should instead be on the
# jdk vendor (Oracle JDK, not OpenJDK). Find a way to make CMake aware of jdk vendor.
#option(BUILD_LAUNCHER "Enable building of launcher." ON)
#if(NOT CMAKE_SYSTEM_NAME STREQUAL "VxWorks" AND BUILD_LAUNCHER)
# add_subdirectory(launcher)
#endif()
if(BUILD_IDLC)
add_subdirectory(ddsperf)
endif()

View file

@ -9,9 +9,11 @@
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
idlc_generate(ddsperf_types ddsperf_types.idl)
add_executable(ddsperf ddsperf.c)
target_link_libraries(ddsperf ddsperf_types ddsc)
if(WIN32)
target_compile_definitions(ddsperf PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()