Initial contribution
This commit is contained in:
parent
7b5cc4fa59
commit
11d9ce37aa
580 changed files with 155133 additions and 162 deletions
31
src/cmake/CoverageSettings.cmake.in
Normal file
31
src/cmake/CoverageSettings.cmake.in
Normal file
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# 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")
|
||||
|
26
src/cmake/launch-c.bat.in
Normal file
26
src/cmake/launch-c.bat.in
Normal file
|
@ -0,0 +1,26 @@
|
|||
@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@" %*
|
40
src/cmake/launch-c.in
Normal file
40
src/cmake/launch-c.in
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/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@" "$@"
|
||||
|
26
src/cmake/launch-cxx.bat.in
Normal file
26
src/cmake/launch-cxx.bat.in
Normal file
|
@ -0,0 +1,26 @@
|
|||
@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@" %*
|
40
src/cmake/launch-cxx.in
Normal file
40
src/cmake/launch-cxx.in
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/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@" "$@"
|
||||
|
65
src/cmake/modules/AnalyzeBuild.cmake
Normal file
65
src/cmake/modules/AnalyzeBuild.cmake
Normal file
|
@ -0,0 +1,65 @@
|
|||
#
|
||||
# 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()
|
||||
|
128
src/cmake/modules/CUnit.cmake
Normal file
128
src/cmake/modules/CUnit.cmake
Normal file
|
@ -0,0 +1,128 @@
|
|||
#
|
||||
# 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)
|
||||
|
||||
include(Glob)
|
||||
|
||||
set(CUNIT_DIR "${CMAKE_CURRENT_LIST_DIR}/CUnit")
|
||||
|
||||
function(add_cunit_executable target)
|
||||
# Generate semi-random filename to store the generated code in to avoid
|
||||
# possible naming conflicts.
|
||||
string(RANDOM random)
|
||||
set(runner "${target}_${random}")
|
||||
|
||||
set(s "[ \t\r\n]") # space
|
||||
set(w "[0-9a-zA-Z_]") # word
|
||||
set(param "${s}*(${w}+)${s}*")
|
||||
set(pattern "CUnit_${w}+${s}*\\(${param}(,${param}(,${param})?)?\\)")
|
||||
|
||||
glob(filenames "c" ${ARGN})
|
||||
|
||||
foreach(filename ${filenames})
|
||||
file(READ "${filename}" contents)
|
||||
string(REGEX MATCHALL "${pattern}" captures "${contents}")
|
||||
|
||||
list(APPEND sources "${filename}")
|
||||
list(LENGTH captures length)
|
||||
if(length)
|
||||
foreach(capture ${captures})
|
||||
string(REGEX REPLACE "${pattern}" "\\1" suite "${capture}")
|
||||
|
||||
if("${capture}" MATCHES "CUnit_Suite_Initialize")
|
||||
list(APPEND suites ${suite})
|
||||
list(APPEND suites_w_init ${suite})
|
||||
elseif("${capture}" MATCHES "CUnit_Suite_Cleanup")
|
||||
list(APPEND suites ${suite})
|
||||
list(APPEND suites_w_deinit ${suite})
|
||||
elseif("${capture}" MATCHES "CUnit_Test")
|
||||
list(APPEND suites ${suite})
|
||||
|
||||
# Specifying a test name is mandatory
|
||||
if("${capture}" MATCHES ",")
|
||||
string(REGEX REPLACE "${pattern}" "\\3" test "${capture}")
|
||||
else()
|
||||
message(FATAL_ERROR "Bad CUnit_Test signature in ${filename}")
|
||||
endif()
|
||||
|
||||
# Specifying if a test is enabled is optional
|
||||
set(enable "true")
|
||||
if("${capture}" MATCHES ",${param},")
|
||||
string(REGEX REPLACE "${pattern}" "\\5" enable "${capture}")
|
||||
endif()
|
||||
|
||||
if((NOT "${enable}" STREQUAL "true") AND
|
||||
(NOT "${enable}" STREQUAL "false"))
|
||||
message(FATAL_ERROR "Bad CUnit_Test signature in ${filename}")
|
||||
endif()
|
||||
|
||||
list(APPEND tests "${suite}:${test}:${enable}")
|
||||
else()
|
||||
message(FATAL_ERROR "Bad CUnit signature in ${filename}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Test suite signatures can be decided on only after everything is parsed.
|
||||
set(lf "\n")
|
||||
set(declf "")
|
||||
set(deflf "")
|
||||
|
||||
list(REMOVE_DUPLICATES suites)
|
||||
list(SORT suites)
|
||||
foreach(suite ${suites})
|
||||
set(init "NULL")
|
||||
set(deinit "NULL")
|
||||
if(${suite} IN_LIST suites_w_init)
|
||||
set(init "CUnit_Suite_Initialize__(${suite})")
|
||||
set(decls "${decls}${declf}CUnit_Suite_Initialize_Decl__(${suite});")
|
||||
set(declf "${lf}")
|
||||
endif()
|
||||
if(${suite} IN_LIST suites_w_deinit)
|
||||
set(deinit "CUnit_Suite_Cleanup__(${suite})")
|
||||
set(decls "${decls}${declf}CUnit_Suite_Cleanup_Decl__(${suite});")
|
||||
set(declf "${lf}")
|
||||
endif()
|
||||
|
||||
set(defs "${defs}${deflf}CUnit_Suite__(${suite}, ${init}, ${deinit});")
|
||||
set(deflf "${lf}")
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES tests)
|
||||
list(SORT tests)
|
||||
foreach(entry ${tests})
|
||||
string(REPLACE ":" ";" entry ${entry})
|
||||
list(GET entry 0 suite)
|
||||
list(GET entry 1 test)
|
||||
list(GET entry 2 enable)
|
||||
|
||||
set(decls "${decls}${declf}CUnit_Test_Decl__(${suite}, ${test});")
|
||||
set(declf "${lf}")
|
||||
set(defs "${defs}${deflf}CUnit_Test__(${suite}, ${test}, ${enable});")
|
||||
set(deflf "${lf}")
|
||||
|
||||
add_test(
|
||||
NAME "CUnit_${suite}_${test}"
|
||||
COMMAND ${target} -a -r "${suite}-${test}" -s ${suite} -t ${test})
|
||||
endforeach()
|
||||
|
||||
set(root "${CUNIT_DIR}")
|
||||
set(CUnit_Decls "${decls}")
|
||||
set(CUnit_Defs "${defs}")
|
||||
|
||||
configure_file("${root}/src/main.c.in" "${runner}.c" @ONLY)
|
||||
add_executable(${target} "${runner}.c" "${root}/src/runner.c" ${sources})
|
||||
target_link_libraries(${target} CUnit)
|
||||
target_include_directories(${target} PRIVATE "${root}/include")
|
||||
endfunction()
|
||||
|
83
src/cmake/modules/CUnit/include/CUnit/Runner.h
Normal file
83
src/cmake/modules/CUnit/include/CUnit/Runner.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef CUNIT_RUNNER_H
|
||||
#define CUNIT_RUNNER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <CUnit/CUnit.h>
|
||||
#include <CUnit/CUError.h>
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CUnit_Suite_Initialize_Name__(s) \
|
||||
s ## _Initialize
|
||||
#define CUnit_Suite_Initialize(s) \
|
||||
int CUnit_Suite_Initialize_Name__(s)(void)
|
||||
#define CUnit_Suite_Initialize_Decl__(s) \
|
||||
extern CUnit_Suite_Initialize(s)
|
||||
#define CUnit_Suite_Initialize__(s) \
|
||||
CUnit_Suite_Initialize_Name__(s)
|
||||
|
||||
#define CUnit_Suite_Cleanup_Name__(s) \
|
||||
s ## _Cleanup
|
||||
#define CUnit_Suite_Cleanup(s) \
|
||||
int CUnit_Suite_Cleanup_Name__(s)(void)
|
||||
#define CUnit_Suite_Cleanup_Decl__(s) \
|
||||
extern CUnit_Suite_Cleanup(s)
|
||||
#define CUnit_Suite_Cleanup__(s) \
|
||||
CUnit_Suite_Cleanup_Name__(s)
|
||||
|
||||
#define CUnit_Test_Name__(s, t) \
|
||||
s ## _ ## t
|
||||
#define CUnit_Test(s, t, ...) \
|
||||
void CUnit_Test_Name__(s, t)(void)
|
||||
#define CUnit_Test_Decl__(s, t) \
|
||||
extern CUnit_Test(s, t)
|
||||
|
||||
#define CUnit_Suite__(s, c, d) \
|
||||
cu_runner_add_suite(#s, c, d)
|
||||
#define CUnit_Test__(s, t, e) \
|
||||
cu_runner_add_test(#s, #t, CUnit_Test_Name__(s, t), e)
|
||||
|
||||
CU_ErrorCode
|
||||
cu_runner_init(
|
||||
int argc,
|
||||
char *argv[]);
|
||||
|
||||
void
|
||||
cu_runner_fini(
|
||||
void);
|
||||
|
||||
void
|
||||
cu_runner_add_suite(
|
||||
const char *suite,
|
||||
CU_InitializeFunc pInitFunc,
|
||||
CU_CleanupFunc pCleanFunc);
|
||||
|
||||
void
|
||||
cu_runner_add_test(
|
||||
const char *suite,
|
||||
const char *test,
|
||||
CU_TestFunc pTestFunc,
|
||||
bool enable);
|
||||
|
||||
CU_ErrorCode
|
||||
cu_runner_run(
|
||||
void);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CUNIT_RUNNER_H */
|
31
src/cmake/modules/CUnit/src/main.c.in
Normal file
31
src/cmake/modules/CUnit/src/main.c.in
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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 "CUnit/Runner.h"
|
||||
|
||||
@CUnit_Decls@
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
CU_ErrorCode err;
|
||||
|
||||
if ((err = cu_runner_init(argc, argv))) {
|
||||
goto err_init;
|
||||
}
|
||||
|
||||
@CUnit_Defs@
|
||||
|
||||
err = cu_runner_run();
|
||||
cu_runner_fini();
|
||||
err_init:
|
||||
return err;
|
||||
}
|
||||
|
213
src/cmake/modules/CUnit/src/runner.c
Normal file
213
src/cmake/modules/CUnit/src/runner.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* 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 <CUnit/Basic.h>
|
||||
#include <CUnit/Automated.h>
|
||||
|
||||
#include "CUnit/Runner.h"
|
||||
|
||||
static struct cunit_runner {
|
||||
bool automated;
|
||||
bool junit;
|
||||
const char * results;
|
||||
CU_BasicRunMode mode;
|
||||
CU_ErrorAction error_action;
|
||||
const char *suite;
|
||||
const char *test;
|
||||
} runner;
|
||||
|
||||
static void
|
||||
usage(
|
||||
const char * name)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [flags]\n", name);
|
||||
fprintf(stderr, "Supported flags:\n");
|
||||
fprintf(stderr, " -a run in automated mode\n");
|
||||
fprintf(stderr, " -r <file_name> results file for automated run\n");
|
||||
fprintf(stderr, " -j junit format results \n");
|
||||
fprintf(stderr, " -f fail fast \n");
|
||||
fprintf(stderr, " -s suite\n");
|
||||
fprintf(stderr, " -t test\n");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
CU_ErrorCode
|
||||
cu_runner_init(
|
||||
int argc,
|
||||
char* argv[])
|
||||
{
|
||||
int c, i;
|
||||
CU_ErrorCode e = CUE_SUCCESS;
|
||||
|
||||
runner.automated = false;
|
||||
runner.junit = false;
|
||||
runner.results = NULL;
|
||||
runner.mode = CU_BRM_NORMAL;
|
||||
runner.error_action = CUEA_IGNORE;
|
||||
runner.suite = "*";
|
||||
runner.test = "*";
|
||||
|
||||
for (i = 1; e == CUE_SUCCESS && i < argc; i++) {
|
||||
c = (argv[i][0] == '-') ? argv[i][1] : -1;
|
||||
switch (argv[i][1]) {
|
||||
case 'a':
|
||||
runner.automated = true;
|
||||
break;
|
||||
case 'f':
|
||||
runner.error_action = CUEA_FAIL;
|
||||
break;
|
||||
case 'j':
|
||||
runner.junit = true;
|
||||
break;
|
||||
case 'r':
|
||||
if((i+1) < argc){
|
||||
runner.results = argv[++i];
|
||||
break;
|
||||
}
|
||||
/* no break */
|
||||
case 's':
|
||||
if ((i+1) < argc) {
|
||||
runner.suite = argv[++i];
|
||||
break;
|
||||
}
|
||||
/* no break */
|
||||
case 't':
|
||||
if ((i+1) < argc) {
|
||||
runner.test = argv[++i];
|
||||
break;
|
||||
}
|
||||
/* no break */
|
||||
default:
|
||||
e = (CU_ErrorCode)256;
|
||||
CU_set_error(e); /* Will print as "Undefined Errpr" */
|
||||
usage(argv[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (e == CUE_SUCCESS) {
|
||||
if ((e = CU_initialize_registry()) != CUE_SUCCESS) {
|
||||
fprintf(
|
||||
stderr, "Test registry initialization failed: %s\n", CU_get_error_msg());
|
||||
}
|
||||
}
|
||||
|
||||
CU_set_error_action (runner.error_action);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
void
|
||||
cu_runner_fini(
|
||||
void)
|
||||
{
|
||||
CU_cleanup_registry();
|
||||
}
|
||||
|
||||
void
|
||||
cu_runner_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);
|
||||
//assert(pSuite != NULL);
|
||||
CU_set_suite_active(pSuite, patmatch(runner.suite, suite));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cu_runner_add_test(
|
||||
const char *suite,
|
||||
const char *test,
|
||||
CU_TestFunc pTestFunc,
|
||||
bool enable)
|
||||
{
|
||||
CU_pSuite pSuite;
|
||||
CU_pTest pTest;
|
||||
|
||||
pSuite = CU_get_suite(suite);
|
||||
//assert(pSuite != NULL);
|
||||
pTest = CU_add_test(pSuite, test, pTestFunc);
|
||||
//assert(pTest != NULL);
|
||||
CU_set_test_active(pTest, enable && patmatch(runner.test, test));
|
||||
}
|
||||
|
||||
CU_ErrorCode
|
||||
cu_runner_run(
|
||||
void)
|
||||
{
|
||||
if (runner.automated) {
|
||||
/* Generate CUnit or JUnit format results */
|
||||
if (runner.results != NULL) {
|
||||
CU_set_output_filename(runner.results);
|
||||
}
|
||||
|
||||
if (runner.junit) {
|
||||
CU_automated_enable_junit_xml(CU_TRUE);
|
||||
} else {
|
||||
CU_list_tests_to_file();
|
||||
}
|
||||
CU_automated_run_tests();
|
||||
} else {
|
||||
CU_basic_set_mode(runner.mode);
|
||||
CU_basic_run_tests();
|
||||
}
|
||||
|
||||
if (CU_get_error() == 0) {
|
||||
return (CU_get_number_of_failures() != 0);
|
||||
}
|
||||
|
||||
return CU_get_error();
|
||||
}
|
50
src/cmake/modules/Coverage.cmake
Normal file
50
src/cmake/modules/Coverage.cmake
Normal file
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# 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()
|
||||
|
78
src/cmake/modules/Criterion.cmake
Normal file
78
src/cmake/modules/Criterion.cmake
Normal file
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# 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(Criterion REQUIRED)
|
||||
|
||||
include(Glob)
|
||||
|
||||
set(_criterion_dir "${CMAKE_CURRENT_LIST_DIR}/Criterion")
|
||||
|
||||
function(add_criterion_executable _target)
|
||||
set(s "[ \t\r\n]") # space
|
||||
set(w "[0-9a-zA-Z_]") # word
|
||||
set(b "[^0-9a-zA-Z_]") # boundary
|
||||
set(arg "${s}*(${w}+)${s}*")
|
||||
set(test "(^|${b})Test${s}*\\(${arg},${arg}(,[^\\)]+)?\\)") # Test
|
||||
set(params "${s}*\\([^\\)]*\\)${s}*")
|
||||
set(theory "(^|${b})Theory${s}*\\(${params},${arg},${arg}(,[^\\)]+)?\\)") # Theory
|
||||
set(paramtest "(^|${b})ParameterizedTest${s}*\\([^,]+,${arg},${arg}(,[^\\)]+)?\\)") # ParameterizedTest
|
||||
|
||||
glob(_files "c" ${ARGN})
|
||||
|
||||
foreach(_file ${_files})
|
||||
file(READ "${_file}" _contents)
|
||||
string(REGEX MATCHALL "${test}" _matches "${_contents}")
|
||||
|
||||
list(APPEND _sources "${_file}")
|
||||
list(LENGTH _matches _length)
|
||||
if(_length)
|
||||
foreach(_match ${_matches})
|
||||
string(REGEX REPLACE "${test}" "\\2" _suite "${_match}")
|
||||
string(REGEX REPLACE "${test}" "\\3" _name "${_match}")
|
||||
list(APPEND _tests "${_suite}:${_name}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
string(REGEX MATCHALL "${theory}" _matches "${_contents}")
|
||||
list(LENGTH _matches _length)
|
||||
if(_length)
|
||||
foreach(_match ${_matches})
|
||||
string(REGEX REPLACE "${theory}" "\\2" _suite "${_match}")
|
||||
string(REGEX REPLACE "${theory}" "\\3" _name "${_match}")
|
||||
list(APPEND _tests "${_suite}:${_name}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
string(REGEX MATCHALL "${paramtest}" _matches "${_contents}")
|
||||
list(LENGTH _matches _length)
|
||||
if(_length)
|
||||
foreach(_match ${_matches})
|
||||
string(REGEX REPLACE "${paramtest}" "\\2" _suite "${_match}")
|
||||
string(REGEX REPLACE "${paramtest}" "\\3" _name "${_match}")
|
||||
list(APPEND _tests "${_suite}:${_name}")
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_executable(${_target} "${_criterion_dir}/src/runner.c" ${_sources})
|
||||
target_link_libraries(${_target} Criterion)
|
||||
|
||||
foreach(_entry ${_tests})
|
||||
string(REPLACE ":" ";" _entry ${_entry})
|
||||
list(GET _entry 0 _suite)
|
||||
list(GET _entry 1 _name)
|
||||
|
||||
add_test(
|
||||
NAME "Criterion_${_suite}_${_name}"
|
||||
COMMAND ${_target} --suite ${_suite} --test ${_name} --cunit=${_suite}-${_name} --quiet)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
474
src/cmake/modules/Criterion/src/runner.c
Normal file
474
src/cmake/modules/Criterion/src/runner.c
Normal file
|
@ -0,0 +1,474 @@
|
|||
/*
|
||||
* 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 <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <criterion/criterion.h>
|
||||
#include <criterion/hooks.h>
|
||||
#include <criterion/internal/ordered-set.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdlib.h>
|
||||
#define LF "\r\n"
|
||||
#define NAME_MAX _MAX_FNAME
|
||||
#else
|
||||
#define LF "\n"
|
||||
#endif
|
||||
|
||||
static const char *suitepat = "*";
|
||||
static const char *testpat = "*";
|
||||
static char runfn[NAME_MAX + 1] = { 0 };
|
||||
static char listfn[NAME_MAX + 1] = { 0 };
|
||||
static char stamp[64] = { 0 };
|
||||
|
||||
static const char
|
||||
run_hdr[] =
|
||||
"<?xml version=\"1.0\" ?>" LF
|
||||
"<?xml-stylesheet type=\"text/xsl\" href=\"CUnit-Run.xsl\" ?>" LF
|
||||
"<!DOCTYPE CUNIT_TEST_RUN_REPORT SYSTEM \"CUnit-Run.dtd\">" LF
|
||||
"<CUNIT_TEST_RUN_REPORT>" LF
|
||||
" <CUNIT_HEADER/>" LF;
|
||||
|
||||
/* TODO: Criterion version number is not available in any of the header files,
|
||||
but print_version() is. The function prints a message along the lines
|
||||
of: Tests compiled with Criterion v2.3.2. The version number therefore
|
||||
can be retrieved by temporarily swapping out stdout for a FILE handle
|
||||
opened by open_memstream. However, I don't consider the version number
|
||||
important enough to go through all that trouble. */
|
||||
static const char
|
||||
run_ftr[] =
|
||||
" <CUNIT_FOOTER> File Generated By Criterion - %s </CUNIT_FOOTER>" LF
|
||||
"</CUNIT_TEST_RUN_REPORT>";
|
||||
|
||||
static const char
|
||||
run_result_hdr[] =
|
||||
" <CUNIT_RESULT_LISTING>" LF;
|
||||
|
||||
static const char
|
||||
run_result_ftr[] =
|
||||
" </CUNIT_RESULT_LISTING>" LF;
|
||||
|
||||
static const char
|
||||
run_suite_hdr[] =
|
||||
" <CUNIT_RUN_SUITE>" LF
|
||||
" <CUNIT_RUN_SUITE_SUCCESS>" LF
|
||||
" <SUITE_NAME> %s </SUITE_NAME>" LF;
|
||||
|
||||
static const char
|
||||
run_suite_ftr[] =
|
||||
" </CUNIT_RUN_SUITE_SUCCESS>" LF
|
||||
" </CUNIT_RUN_SUITE>" LF;
|
||||
|
||||
static const char
|
||||
run_test_hdr[] =
|
||||
" <CUNIT_RUN_TEST_RECORD>" LF;
|
||||
|
||||
static const char
|
||||
run_test_ftr[] =
|
||||
" </CUNIT_RUN_TEST_RECORD>" LF;
|
||||
|
||||
static const char
|
||||
run_test_ok[] =
|
||||
" <CUNIT_RUN_TEST_SUCCESS>" LF
|
||||
" <TEST_NAME> %s </TEST_NAME>" LF
|
||||
" </CUNIT_RUN_TEST_SUCCESS>" LF;
|
||||
|
||||
static const char
|
||||
run_test_nok[] =
|
||||
" <CUNIT_RUN_TEST_FAILURE>" LF
|
||||
" <TEST_NAME> %s </TEST_NAME>" LF
|
||||
" <FILE_NAME> %s </FILE_NAME>" LF
|
||||
" <LINE_NUMBER> %u </LINE_NUMBER>" LF
|
||||
" <CONDITION> %s </CONDITION>" LF
|
||||
" </CUNIT_RUN_TEST_FAILURE>" LF;
|
||||
|
||||
static const char
|
||||
run_stats[] =
|
||||
" <CUNIT_RUN_SUMMARY>" LF
|
||||
" <CUNIT_RUN_SUMMARY_RECORD>" LF
|
||||
" <TYPE> Suites </TYPE>" LF
|
||||
" <TOTAL> %zu </TOTAL>" LF
|
||||
" <RUN> %zu </RUN>" LF
|
||||
" <SUCCEEDED> - NA - </SUCCEEDED>" LF
|
||||
" <FAILED> %zu </FAILED>" LF
|
||||
" <INACTIVE> %zu </INACTIVE>" LF
|
||||
" </CUNIT_RUN_SUMMARY_RECORD>" LF
|
||||
" <CUNIT_RUN_SUMMARY_RECORD>" LF
|
||||
" <TYPE> Test Cases </TYPE>" LF
|
||||
" <TOTAL> %zu </TOTAL>" LF
|
||||
" <RUN> %zu </RUN>" LF
|
||||
" <SUCCEEDED> %zu </SUCCEEDED>" LF
|
||||
" <FAILED> %zu </FAILED>" LF
|
||||
" <INACTIVE> %zu </INACTIVE>" LF
|
||||
" </CUNIT_RUN_SUMMARY_RECORD>" LF
|
||||
" <CUNIT_RUN_SUMMARY_RECORD>" LF
|
||||
" <TYPE> Assertions </TYPE>" LF
|
||||
" <TOTAL> %zu </TOTAL>" LF
|
||||
" <RUN> %zu </RUN>" LF
|
||||
" <SUCCEEDED> %zu </SUCCEEDED>" LF
|
||||
" <FAILED> %zu </FAILED>" LF
|
||||
" <INACTIVE> n/a </INACTIVE>" LF
|
||||
" </CUNIT_RUN_SUMMARY_RECORD>" LF
|
||||
" </CUNIT_RUN_SUMMARY>" LF;
|
||||
|
||||
static const char
|
||||
list_hdr[] =
|
||||
"<?xml version=\"1.0\" ?>" LF
|
||||
"<?xml-stylesheet type=\"text/xsl\" href=\"CUnit-List.xsl\" ?>" LF
|
||||
"<!DOCTYPE CUNIT_TEST_LIST_REPORT SYSTEM \"CUnit-List.dtd\">" LF
|
||||
"<CUNIT_TEST_LIST_REPORT>" LF
|
||||
" <CUNIT_HEADER/>" LF;
|
||||
|
||||
/* TODO: Criterion version number not available. See previous comment. */
|
||||
static const char
|
||||
list_ftr[] =
|
||||
" <CUNIT_FOOTER> File Generated By Criterion - %s </CUNIT_FOOTER>" LF
|
||||
"</CUNIT_TEST_LIST_REPORT>";
|
||||
|
||||
static const char
|
||||
list_stats[] =
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY>" LF
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY_RECORD>" LF
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY_RECORD_TEXT> Total Number of Suites </CUNIT_LIST_TOTAL_SUMMARY_RECORD_TEXT>" LF
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY_RECORD_VALUE> %zu </CUNIT_LIST_TOTAL_SUMMARY_RECORD_VALUE>" LF
|
||||
" </CUNIT_LIST_TOTAL_SUMMARY_RECORD>" LF
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY_RECORD>" LF
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY_RECORD_TEXT> Total Number of Test Cases </CUNIT_LIST_TOTAL_SUMMARY_RECORD_TEXT>" LF
|
||||
" <CUNIT_LIST_TOTAL_SUMMARY_RECORD_VALUE> %zu </CUNIT_LIST_TOTAL_SUMMARY_RECORD_VALUE>" LF
|
||||
" </CUNIT_LIST_TOTAL_SUMMARY_RECORD>" LF
|
||||
" </CUNIT_LIST_TOTAL_SUMMARY>" LF;
|
||||
|
||||
static const char
|
||||
list_suites_hdr[] =
|
||||
" <CUNIT_ALL_TEST_LISTING_SUITE>" LF;
|
||||
|
||||
static const char
|
||||
list_suites_ftr[] =
|
||||
" </CUNIT_ALL_TEST_LISTING_SUITE>" LF;
|
||||
|
||||
static const char
|
||||
list_suite_hdr[] =
|
||||
" <CUNIT_ALL_TEST_LISTING_SUITE>" LF
|
||||
" <CUNIT_ALL_TEST_LISTING_SUITE_DEFINITION>" LF
|
||||
" <SUITE_NAME> %s </SUITE_NAME>" LF
|
||||
" <INITIALIZE_VALUE> %s </INITIALIZE_VALUE>" LF
|
||||
" <CLEANUP_VALUE> %s </CLEANUP_VALUE>" LF
|
||||
" <ACTIVE_VALUE> %s </ACTIVE_VALUE>" LF
|
||||
" <TEST_COUNT_VALUE> %zu </TEST_COUNT_VALUE>" LF
|
||||
" </CUNIT_ALL_TEST_LISTING_SUITE_DEFINITION>" LF
|
||||
" <CUNIT_ALL_TEST_LISTING_SUITE_TESTS>" LF;
|
||||
|
||||
static const char
|
||||
list_suite_ftr[] =
|
||||
" </CUNIT_ALL_TEST_LISTING_SUITE_TESTS>" LF
|
||||
" </CUNIT_ALL_TEST_LISTING_SUITE>" LF;
|
||||
|
||||
static const char
|
||||
list_test[] =
|
||||
" <TEST_CASE_DEFINITION>" LF
|
||||
" <TEST_CASE_NAME> %s </TEST_CASE_NAME>" LF
|
||||
" <TEST_ACTIVE_VALUE> %s </TEST_ACTIVE_VALUE>" LF
|
||||
" </TEST_CASE_DEFINITION>" LF;
|
||||
|
||||
static void
|
||||
print_run_test_stats(FILE *file, struct criterion_test_stats *stats)
|
||||
{
|
||||
struct criterion_assert_stats *itr;
|
||||
|
||||
(void)fprintf(file, run_test_hdr);
|
||||
if (stats->test_status == CR_STATUS_PASSED) {
|
||||
(void)fprintf(file, run_test_ok, stats->test->name);
|
||||
} else if (stats->test_status == CR_STATUS_FAILED) {
|
||||
for (itr = stats->asserts; itr != NULL; itr = itr->next) {
|
||||
if (!itr->passed) {
|
||||
(void)fprintf(
|
||||
file,
|
||||
run_test_nok,
|
||||
stats->test->name,
|
||||
itr->file,
|
||||
itr->line,
|
||||
itr->message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)fprintf(file, run_test_ftr);
|
||||
}
|
||||
|
||||
static void
|
||||
print_run_suite_stats(FILE *file, struct criterion_suite_stats *stats)
|
||||
{
|
||||
struct criterion_test_stats *itr;
|
||||
|
||||
(void)fprintf(file, run_suite_hdr, stats->suite->name);
|
||||
for (itr = stats->tests; itr != NULL; itr = itr->next) {
|
||||
if (itr->test_status != CR_STATUS_SKIPPED) {
|
||||
print_run_test_stats(file, itr);
|
||||
}
|
||||
}
|
||||
(void)fprintf(file, run_suite_ftr);
|
||||
}
|
||||
|
||||
static void
|
||||
print_run_stats(FILE *file, struct criterion_global_stats *stats)
|
||||
{
|
||||
size_t suites_failed = 0;
|
||||
size_t suites_passed = 0;
|
||||
struct criterion_suite_stats *itr;
|
||||
|
||||
(void)fprintf(file, run_hdr);
|
||||
(void)fprintf(file, run_result_hdr);
|
||||
for (itr = stats->suites; itr != NULL; itr = itr->next) {
|
||||
if (itr->tests_skipped != itr->nb_tests) {
|
||||
print_run_suite_stats(file, itr);
|
||||
if (itr->tests_failed == itr->nb_tests) {
|
||||
suites_failed++;
|
||||
} else {
|
||||
suites_passed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)fprintf(file, run_result_ftr);
|
||||
(void)fprintf(
|
||||
file,
|
||||
run_stats,
|
||||
stats->nb_suites,
|
||||
suites_passed,
|
||||
suites_failed,
|
||||
(stats->nb_suites - (suites_passed - suites_failed)),
|
||||
stats->nb_tests,
|
||||
(stats->tests_passed + stats->tests_failed + stats->tests_crashed),
|
||||
stats->tests_passed,
|
||||
(stats->tests_failed + stats->tests_crashed),
|
||||
stats->tests_skipped,
|
||||
stats->nb_asserts,
|
||||
(stats->asserts_passed + stats->asserts_failed),
|
||||
stats->asserts_passed,
|
||||
stats->asserts_failed);
|
||||
(void)fprintf(file, run_ftr, stamp);
|
||||
}
|
||||
|
||||
static void
|
||||
print_list_test_stats(FILE *file, struct criterion_test_stats *stats)
|
||||
{
|
||||
(void)fprintf(
|
||||
file,
|
||||
list_test,
|
||||
stats->test->name,
|
||||
(stats->test_status == CR_STATUS_SKIPPED ? "No" : "Yes"));
|
||||
}
|
||||
|
||||
static void
|
||||
print_list_suite_stats(FILE *file, struct criterion_suite_stats *stats)
|
||||
{
|
||||
struct criterion_test_stats *itr;
|
||||
|
||||
(void)fprintf(
|
||||
file,
|
||||
list_suite_hdr,
|
||||
stats->suite->name,
|
||||
"No", // <INITIALIZE_VALUE />
|
||||
"No", // <CLEANUP_VALUE />
|
||||
(stats->nb_tests == stats->tests_skipped ? "No" : "Yes"),
|
||||
stats->nb_tests);
|
||||
for (itr = stats->tests; itr != NULL; itr = itr->next) {
|
||||
print_list_test_stats(file, itr);
|
||||
}
|
||||
(void)fprintf(file, list_suite_ftr);
|
||||
}
|
||||
|
||||
static void
|
||||
print_list_stats(FILE *file, struct criterion_global_stats *stats)
|
||||
{
|
||||
struct criterion_suite_stats *itr;
|
||||
|
||||
(void)fprintf(file, list_hdr);
|
||||
(void)fprintf(file, list_stats, stats->nb_suites, stats->nb_tests);
|
||||
(void)fprintf(file, list_suites_hdr);
|
||||
|
||||
for (itr = stats->suites; itr != NULL; itr = itr->next) {
|
||||
print_list_suite_stats(file, itr);
|
||||
}
|
||||
|
||||
(void)fprintf(file, list_suites_ftr);
|
||||
(void)fprintf(file, list_ftr, stamp);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* Criterion actually prescribes */
|
||||
ReportHook(POST_ALL)(struct criterion_global_stats *stats)
|
||||
{
|
||||
FILE *runfh, *listfh;
|
||||
|
||||
if (listfn[0] != '\0' && runfn[0] != '\0') {
|
||||
runfh = NULL;
|
||||
listfh = NULL;
|
||||
|
||||
if ((runfh = fopen(runfn, "w")) != NULL &&
|
||||
(listfh = fopen(listfn, "w")) != NULL)
|
||||
{
|
||||
print_run_stats(runfh, stats);
|
||||
print_list_stats(listfh, stats);
|
||||
} else {
|
||||
(void)fprintf(stderr, "Cannot write results in CUnit format\n");
|
||||
}
|
||||
|
||||
if (runfh != NULL) {
|
||||
(void)fclose(runfh);
|
||||
}
|
||||
if (listfh != NULL) {
|
||||
(void)fclose(listfh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int result = 0;
|
||||
int argno, cr_argc, sz;
|
||||
char *pfx, **cr_argv;
|
||||
const char runfmt[] = "%s-Results.xml";
|
||||
const char listfmt[] = "%s-Listing.xml";
|
||||
const char stampfmt[] = "%a %b %e %H:%M:%S %Y";
|
||||
time_t now;
|
||||
|
||||
/* Before handing over argc and argv over to criterion, go over the list to
|
||||
extract the custom options. Note that these are meant to be "hidden" */
|
||||
cr_argc = 0;
|
||||
if ((cr_argv = calloc(argc, sizeof(*cr_argv))) == NULL) {
|
||||
result = 1;
|
||||
} else {
|
||||
for (argno = 0; argno < argc; argno++) {
|
||||
/* FIXME:
|
||||
Eventually CUnit output format should be supported through an
|
||||
actual logger implementation, but it will do for now.
|
||||
See: http://criterion.readthedocs.io/en/master/output.html */
|
||||
if (strncmp(argv[argno], "--cunit", 7) == 0) {
|
||||
if ((pfx = strchr(argv[argno], '=')) != NULL) {
|
||||
pfx++;
|
||||
} else {
|
||||
pfx = "CriterionAutomated";
|
||||
}
|
||||
|
||||
sz = snprintf(runfn, sizeof(runfn), runfmt, pfx);
|
||||
assert(sz > 0 && sz < sizeof(runfn));
|
||||
sz = snprintf(listfn, sizeof(listfn), listfmt, pfx);
|
||||
assert(sz > 0 && sz < sizeof(listfn));
|
||||
now = time(NULL);
|
||||
sz = (int)strftime(
|
||||
stamp, sizeof(stamp), stampfmt, localtime(&now));
|
||||
assert(sz != 0);
|
||||
} else if (strncmp(argv[argno], "--suite", 7) == 0) {
|
||||
if ((argno + 1) == argc) {
|
||||
fprintf(stderr, "--suite requires an argument\n");
|
||||
result = 1;
|
||||
goto bail;
|
||||
}
|
||||
suitepat = (const char *)argv[++argno];
|
||||
} else if (strncmp(argv[argno], "--test", 6) == 0) {
|
||||
if ((argno + 1) == argc) {
|
||||
fprintf(stderr, "--test requires an argument\n");
|
||||
result = 1;
|
||||
goto bail;
|
||||
}
|
||||
testpat = (const char *)argv[++argno];
|
||||
} else {
|
||||
cr_argv[cr_argc++] = argv[argno];
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Depending on internal knowledge is not very pretty, but it is
|
||||
the only way to provide a filter that will work on both *nix
|
||||
and non-*nix platforms. */
|
||||
struct criterion_test_set *tests = criterion_initialize();
|
||||
struct criterion_ordered_set_node *suite_itr, *test_itr;
|
||||
struct criterion_suite_set *suite;
|
||||
struct criterion_test *test;
|
||||
|
||||
for (suite_itr = tests->suites->first;
|
||||
suite_itr != NULL;
|
||||
suite_itr = suite_itr->next)
|
||||
{
|
||||
suite = (struct criterion_suite_set *)(suite_itr + 1);
|
||||
for (test_itr = suite->tests->first;
|
||||
test_itr != NULL;
|
||||
test_itr = test_itr->next)
|
||||
{
|
||||
test = (struct criterion_test *)(test_itr + 1);
|
||||
if (!patmatch(suitepat, test->category) ||
|
||||
!patmatch(testpat, test->name))
|
||||
{
|
||||
test->data->disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (criterion_handle_args(cr_argc, cr_argv, true)) {
|
||||
result = !criterion_run_all_tests(tests);
|
||||
}
|
||||
|
||||
criterion_finalize(tests);
|
||||
|
||||
bail:
|
||||
free(cr_argv);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
146
src/cmake/modules/FileIDs.cmake
Normal file
146
src/cmake/modules/FileIDs.cmake
Normal file
|
@ -0,0 +1,146 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# To uniquely identify the origin of every error all source files must be
|
||||
# assigned a pseudo unique identifier (or module). Because only 32 bits are
|
||||
# available in the return code (for now) to store the sign bit (1), return
|
||||
# code (4), line number (8) and file identifier, using a deterministic hash
|
||||
# will likely lead to collisions. To work around this issue a static map is
|
||||
# applied, which also ensures that file identifiers are persisted accross
|
||||
# versions/branches. Of course one could choose to specify the module manually
|
||||
# with every return, but that is tedious and error prone.
|
||||
|
||||
if(FILE_IDS_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(FILE_IDS_INCLUDED true)
|
||||
|
||||
|
||||
# Verify syntax for all .fileids files and ensure no source file id is used
|
||||
# more than once.
|
||||
file(GLOB_RECURSE fils__ LIST_DIRECTORIES false "${CMAKE_SOURCE_DIR}/.fileids")
|
||||
|
||||
set(ids__)
|
||||
foreach(fil__ ${fils__})
|
||||
file(READ "${fil__}" lines__)
|
||||
string(REGEX REPLACE "\n" ";" lines__ ${lines__})
|
||||
foreach(line__ ${lines__})
|
||||
if("${line__}" MATCHES "^[ \t]*([0-9]+)[ \t]+.*$")
|
||||
set(id__ "${CMAKE_MATCH_1}")
|
||||
if(${id__} IN_LIST ids__)
|
||||
set(dup__ true)
|
||||
message(STATUS "Id ${id__} used more than once")
|
||||
else()
|
||||
list(APPEND ids__ ${id__})
|
||||
endif()
|
||||
elseif(NOT "${line__}" MATCHES "^[ \t]*#")
|
||||
message(FATAL_ERROR "Syntax error in ${fil__}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if(dup__)
|
||||
message(FATAL_ERROR "Duplicate ids")
|
||||
endif()
|
||||
|
||||
function(JOIN lst glue var)
|
||||
string(REPLACE ";" "${glue}" tmp "${${lst}}")
|
||||
set(${var} "${tmp}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(FILE_ID src var) # private
|
||||
# .fileids files may reside in subdirectories to keep them together with the
|
||||
# files they assign an identifier to, much like .gitignore files
|
||||
set(dir "${CMAKE_SOURCE_DIR}")
|
||||
set(parts "${src}")
|
||||
string(REGEX REPLACE "[/\\]+" ";" parts "${parts}")
|
||||
while(parts)
|
||||
set(map "${dir}/.fileids")
|
||||
join(parts "/" fil)
|
||||
list(APPEND maps "${map}^${fil}")
|
||||
list(GET parts 0 part)
|
||||
list(REMOVE_AT parts 0)
|
||||
set(dir "${dir}/${part}")
|
||||
endwhile()
|
||||
|
||||
set(id)
|
||||
foreach(entry ${maps})
|
||||
string(REPLACE "^" ";" entry "${entry}")
|
||||
list(GET entry 0 map)
|
||||
list(GET entry 1 fil)
|
||||
if(EXISTS "${map}")
|
||||
file(READ "${map}" contents)
|
||||
string(REGEX REPLACE "\n" ";" lines "${contents}")
|
||||
|
||||
foreach(line ${lines})
|
||||
if("${line}" MATCHES "^[ \t]*([0-9]+)[ \t]+(.*)$")
|
||||
set(id "${CMAKE_MATCH_1}")
|
||||
string(STRIP "${CMAKE_MATCH_2}" expr)
|
||||
if("${fil}" STREQUAL "${expr}")
|
||||
set(${var} ${id} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
elseif(NOT "${line}" MATCHES "^[ \t]*#")
|
||||
message(FATAL_ERROR "Syntax error in ${map}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Source file properties are visible only to targets added in the same
|
||||
# directory (CMakeLists.txt).
|
||||
# https://cmake.org/cmake/help/latest/command/set_source_files_properties.html
|
||||
function(SET_TARGET_FILE_IDS tgt)
|
||||
get_target_property(external ${tgt} IMPORTED)
|
||||
get_target_property(alias ${tgt} ALIASED_TARGET)
|
||||
string(LENGTH "${CMAKE_SOURCE_DIR}" len)
|
||||
math(EXPR len "${len} + 1") # strip slash following source dir too
|
||||
|
||||
if((NOT external) AND (NOT alias))
|
||||
get_target_property(srcs ${tgt} SOURCES)
|
||||
get_target_property(src_dir ${tgt} SOURCE_DIR)
|
||||
foreach(src ${srcs})
|
||||
set(id)
|
||||
if(IS_ABSOLUTE "${src}")
|
||||
set(fil "${src}")
|
||||
else()
|
||||
set(fil "${src_dir}/${src}")
|
||||
endif()
|
||||
|
||||
get_filename_component(fil "${fil}" ABSOLUTE)
|
||||
|
||||
string(FIND "${fil}" "${CMAKE_SOURCE_DIR}" pos)
|
||||
if(${pos} EQUAL 0)
|
||||
string(SUBSTRING "${fil}" ${len} -1 rel)
|
||||
file_id("${rel}" id)
|
||||
endif()
|
||||
|
||||
if(id)
|
||||
if(("${source_file_id_${id}}" STREQUAL "") OR
|
||||
("${source_file_id_${id}}" STREQUAL "${rel}"))
|
||||
set("source_file_id_${id}" "${rel}" CACHE INTERNAL "")
|
||||
set_source_files_properties(
|
||||
"${src}" PROPERTIES COMPILE_DEFINITIONS __FILE_ID__=${id})
|
||||
else()
|
||||
message(FATAL_ERROR "Same file id for ${rel} and ${source_file_id_${id}}")
|
||||
endif()
|
||||
else()
|
||||
get_filename_component(ext "${rel}" EXT)
|
||||
if (NOT "${ext}" MATCHES "\.h*")
|
||||
message(FATAL_ERROR "No source file id for ${rel}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
42
src/cmake/modules/FindAbstraction.cmake
Normal file
42
src/cmake/modules/FindAbstraction.cmake
Normal file
|
@ -0,0 +1,42 @@
|
|||
#
|
||||
# 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 (NOT TARGET Abstraction)
|
||||
add_library(Abstraction INTERFACE)
|
||||
endif()
|
||||
|
||||
# Link with the platform-specific threads library that find_package provides us
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(Abstraction INTERFACE Threads::Threads)
|
||||
|
||||
if(WIN32)
|
||||
# Link with WIN32 core-libraries
|
||||
target_link_libraries(Abstraction INTERFACE wsock32 ws2_32 iphlpapi)
|
||||
|
||||
# Many of the secure versions provided by Microsoft have failure modes
|
||||
# which are not supported by our abstraction layer, so efforts trying
|
||||
# to use the _s versions aren't typically the proper solution and C11
|
||||
# (which contains most of the secure versions) is 'too new'. So we rely
|
||||
# on static detection of misuse instead of runtime detection, so all
|
||||
# these warnings can be disabled on Windows.
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) #Disabled warnings for deprecated Winsock 2 API calls in general
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) #Disabled warnings for deprecated POSIX names
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
|
||||
# Shared libs will have this by default. Static libs need it too on x86_64.
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
find_package(GetTime REQUIRED)
|
||||
target_link_libraries(Abstraction INTERFACE GetTime)
|
||||
endif()
|
23
src/cmake/modules/FindCUnit.cmake
Normal file
23
src/cmake/modules/FindCUnit.cmake
Normal file
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# 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_path(CUNIT_INC CUnit/CUnit.h)
|
||||
find_library(CUNIT_LIB cunit)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CUnit DEFAULT_MSG CUNIT_LIB CUNIT_INC)
|
||||
|
||||
if(CUNIT_FOUND AND NOT TARGET CUnit)
|
||||
add_library(CUnit INTERFACE IMPORTED)
|
||||
|
||||
set_property(TARGET CUnit PROPERTY INTERFACE_LINK_LIBRARIES "${CUNIT_LIB}")
|
||||
set_property(TARGET CUnit PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CUNIT_INC}")
|
||||
endif()
|
24
src/cmake/modules/FindCriterion.cmake
Normal file
24
src/cmake/modules/FindCriterion.cmake
Normal file
|
@ -0,0 +1,24 @@
|
|||
#
|
||||
# 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_path(CRITERION_INC criterion/criterion.h PATH_SUFFIXES criterion)
|
||||
find_library(CRITERION_LIB criterion)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Criterion DEFAULT_MSG CRITERION_LIB CRITERION_INC)
|
||||
|
||||
if (CRITERION_FOUND AND NOT TARGET Criterion)
|
||||
add_library(Criterion INTERFACE IMPORTED)
|
||||
|
||||
set_property(TARGET Criterion PROPERTY INTERFACE_LINK_LIBRARIES "${CRITERION_LIB}")
|
||||
set_property(TARGET Criterion PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CRITERION_INC}")
|
||||
endif()
|
||||
|
28
src/cmake/modules/FindGetTime.cmake
Normal file
28
src/cmake/modules/FindGetTime.cmake
Normal file
|
@ -0,0 +1,28 @@
|
|||
#
|
||||
# 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 (NOT TARGET GetTime)
|
||||
add_library(GetTime INTERFACE)
|
||||
endif()
|
||||
|
||||
include(CheckLibraryExists)
|
||||
|
||||
# First check whether libc has clock_gettime
|
||||
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME_IN_C)
|
||||
|
||||
if(NOT HAVE_CLOCK_GETTIME_IN_C)
|
||||
# Before glibc 2.17, clock_gettime was in librt
|
||||
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_IN_RT)
|
||||
if (HAVE_CLOCK_GETTIME_IN_RT)
|
||||
target_link_libraries(GetTime INTERFACE rt)
|
||||
endif()
|
||||
endif()
|
||||
|
74
src/cmake/modules/FindMaven.cmake
Normal file
74
src/cmake/modules/FindMaven.cmake
Normal file
|
@ -0,0 +1,74 @@
|
|||
#
|
||||
# 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()
|
||||
|
||||
# Maven documentation mentions intalling maven under C:\Program Files on
|
||||
# Windows and under /opt on *NIX platforms
|
||||
if(WIN32)
|
||||
set(_program_files_env "ProgramFiles")
|
||||
set(_program_files $ENV{${_program_files_env}})
|
||||
set(_program_files_x86_env "ProgramFiles(x86)")
|
||||
set(_program_files_x86 $ENV{${_program_files_x86_env}})
|
||||
|
||||
if(_program_files)
|
||||
list(APPEND _dirs "${_program_files}")
|
||||
endif()
|
||||
|
||||
if(_program_files_x86)
|
||||
list(APPEND _dirs "${_program_files_x86}")
|
||||
endif()
|
||||
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()
|
||||
|
||||
find_program(Maven_EXECUTABLE
|
||||
NAMES mvn
|
||||
HINTS ${_mvn_hints}
|
||||
PATHS ${_mvn_paths})
|
||||
|
||||
if(Maven_EXECUTABLE)
|
||||
execute_process(COMMAND ${Maven_EXECUTABLE} -version
|
||||
RESULT_VARIABLE result
|
||||
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
|
||||
REQUIRED_VARS Maven_EXECUTABLE
|
||||
VERSION_VAR Maven_VERSION)
|
||||
|
||||
mark_as_advanced(Maven_FOUND Maven_EXECUTABLE Maven_VERSION)
|
||||
|
38
src/cmake/modules/Glob.cmake
Normal file
38
src/cmake/modules/Glob.cmake
Normal file
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# 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()
|
||||
|
170
src/cmake/modules/Packaging.cmake
Normal file
170
src/cmake/modules/Packaging.cmake
Normal file
|
@ -0,0 +1,170 @@
|
|||
#
|
||||
# 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(DDSC_SHARED AND ((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)
|
||||
|
16
src/cmake/modules/Packaging/PackageConfig.cmake.in
Normal file
16
src/cmake/modules/Packaging/PackageConfig.cmake.in
Normal file
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# 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")
|
||||
|
BIN
src/cmake/modules/Packaging/banner.bmp
Normal file
BIN
src/cmake/modules/Packaging/banner.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
BIN
src/cmake/modules/Packaging/dialog.png
Normal file
BIN
src/cmake/modules/Packaging/dialog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
228
src/cmake/modules/Packaging/examples.xml
Normal file
228
src/cmake/modules/Packaging/examples.xml
Normal file
|
@ -0,0 +1,228 @@
|
|||
<!--
|
||||
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>
|
BIN
src/cmake/modules/Packaging/vortex.ico
Normal file
BIN
src/cmake/modules/Packaging/vortex.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
213
src/cmake/modules/Platform/VxWorks6.cmake
Normal file
213
src/cmake/modules/Platform/VxWorks6.cmake
Normal file
|
@ -0,0 +1,213 @@
|
|||
#
|
||||
# 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}")
|
||||
|
134
src/cmake/scripts/CoverageConvenience.cmake
Normal file
134
src/cmake/scripts/CoverageConvenience.cmake
Normal file
|
@ -0,0 +1,134 @@
|
|||
#
|
||||
# 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()
|
||||
|
52
src/cmake/scripts/CoveragePostCobertura.cmake
Normal file
52
src/cmake/scripts/CoveragePostCobertura.cmake
Normal file
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# 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")
|
||||
|
71
src/cmake/scripts/CoveragePostHtml.cmake
Normal file
71
src/cmake/scripts/CoveragePostHtml.cmake
Normal file
|
@ -0,0 +1,71 @@
|
|||
#
|
||||
# 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")
|
||||
|
30
src/cmake/scripts/CoveragePreCobertura.cmake
Normal file
30
src/cmake/scripts/CoveragePreCobertura.cmake
Normal file
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
52
src/cmake/scripts/CoveragePreHtml.cmake
Normal file
52
src/cmake/scripts/CoveragePreHtml.cmake
Normal file
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# 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})
|
||||
|
||||
|
33
src/cmake/vxworks.example.cmake
Normal file
33
src/cmake/vxworks.example.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# 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)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue