Skip to content

Commit c9e7154

Browse files
committed
Release v3.4
2 parents 4263ad5 + 9ada8f2 commit c9e7154

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+731
-201
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ install:
4141
build_script:
4242
- mkdir build.%PLATFORM%.%CONFIGURATION%.%TOOLCHAIN%
4343
- cd build.%PLATFORM%.%CONFIGURATION%.%TOOLCHAIN%
44-
- cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "NMake Makefiles" -DCC_QT_DIR=%QTDIR% -DCMAKE_CXX_STANDARD=%CPP_STD% -DCMAKE_INSTALL_PREFIX=%cd%/install -DCC_ENABLE_DEMO_PROTOCOL=ON
44+
- cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "NMake Makefiles" -DCC_QT_DIR=%QTDIR% -DCMAKE_CXX_STANDARD=%CPP_STD% -DCMAKE_INSTALL_PREFIX=%cd%/install -DCC_BUILD_DEMO_PROTOCOL=ON
4545
- nmake install
4646
- IF "%CONFIGURATION%"=="Release" ( nmake deploy_qt )
4747
test_script:

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ on:
1717
pull_request:
1818
# The branches below must be a subset of the branches above
1919
branches: [ master, develop ]
20-
schedule:
21-
- cron: '28 20 * * 5'
2220

2321
jobs:
2422
analyze:
@@ -57,7 +55,7 @@ jobs:
5755
- run: |
5856
cmake -E make_directory ${{runner.workspace}}/build
5957
cd ${{runner.workspace}}/build
60-
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install -DCC_COMMS_LIB_ONLY=ON
58+
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install -DCC_BUILD_TOOLS_LIBRARY=OFF
6159
cmake --build . --target install
6260
6361
- name: Perform CodeQL Analysis

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ matrix:
1414
apt:
1515
packages:
1616
- g++-4.8
17-
env: _CC=gcc-4.8 _CXX=g++-4.8 _BUILD="-DCC_COMMS_LIB_ONLY=ON"
17+
env: _CC=gcc-4.8 _CXX=g++-4.8 _BUILD="-DCC_BUILD_TOOLS_LIBRARY=OFF"
1818
- os: linux
1919
addons:
2020
apt:
@@ -315,21 +315,21 @@ script:
315315
- echo "------------------ Debug build ------------------"
316316
- mkdir build.debug
317317
- cd build.debug
318-
- CC=${_CC} CXX=${_CXX} cmake .. ${_BUILD} -DCMAKE_INSTALL_PREFIX=./install -DCC_ENABLE_DEMO_PROTOCOL=ON
318+
- CC=${_CC} CXX=${_CXX} cmake .. ${_BUILD} -DCMAKE_INSTALL_PREFIX=./install -DCC_BUILD_DEMO_PROTOCOL=ON
319319
- make install
320320
- ctest
321321
- cd ..
322322
- echo "------------------ Release build ------------------"
323323
- mkdir build.release
324324
- cd build.release
325-
- CC=${_CC} CXX=${_CXX} cmake .. ${_BUILD} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install -DCC_ENABLE_DEMO_PROTOCOL=ON
325+
- CC=${_CC} CXX=${_CXX} cmake .. ${_BUILD} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install -DCC_BUILD_DEMO_PROTOCOL=ON
326326
- make install
327327
- ctest
328328
- cd ..
329329
- echo "------------------ MinSize Release build ------------------"
330330
- mkdir build.min_size
331331
- cd build.min_size
332-
- CC=${_CC} CXX=${_CXX} cmake .. ${_BUILD} -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=./install -DCC_ENABLE_DEMO_PROTOCOL=ON
332+
- CC=${_CC} CXX=${_CXX} cmake .. ${_BUILD} -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=./install -DCC_BUILD_DEMO_PROTOCOL=ON
333333
- make install
334334
- ctest
335335
- cd ..

CMakeLists.txt

Lines changed: 77 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,40 @@ cmake_minimum_required (VERSION 3.1)
22
project ("comms_champion")
33

44
# Available options
5-
option (CC_COMMS_LIB_ONLY "Install only COMMS library, no other apps will be built." OFF)
6-
option (CC_LIBS_ONLY "Build and install COMMS and CommsChampion libraries, no other apps will be built." OFF)
7-
option (CC_STATIC_RUNTIME "Enable/Disable static runtime" OFF)
8-
option (CC_NO_UNIT_TESTS "Disable unittests." OFF)
9-
option (CC_NO_WARN_AS_ERR "Do NOT treat warning as error" OFF)
10-
option (CC_ENABLE_DEMO_PROTOCOL "Enable demo protocol" OFF)
11-
option (CC_NO_CXX_STANDARD_FORCING "Disable forcing C++ standard to C++11 when no CMAKE_CXX_STANDARD is defined" OFF)
12-
option (CC_NO_CCACHE "Disable use of ccache on UNIX systems")
5+
6+
option (CC_INSTALL_COMMS_LIB "Install comms library headers." ON)
7+
option (CC_BUILD_UNIT_TESTS "Build unittests." ${CC_INSTALL_COMMS_LIB})
138
option (CC_UNIT_TESTS_USE_SANITIZERS "Use sanitizers during unittests. Applicable when unittest are enabled." ON)
9+
option (CC_BUILD_TOOLS_LIBRARY "Build tools library." ON)
10+
option (CC_INSTALL_TOOLS_LIBRARY "Install tools library." ${CC_BUILD_TOOLS_LIBRARY})
11+
option (CC_BUILD_TOOLS "Build tools binaries." ${CC_BUILD_TOOLS_LIBRARY})
12+
option (CC_INSTALL_TOOLS "Install tools binaries." ${CC_BUILD_TOOLS})
13+
option (CC_BUILD_DEMO_PROTOCOL "Build demo protocol plugin." OFF)
14+
option (CC_INSTALL_DEMO_PROTOCOL "Install demo protocol plugin." ${CC_BUILD_DEMO_PROTOCOL})
15+
option (CC_WARN_AS_ERR "Treat warning as error" ON)
16+
option (CC_USE_CCACHE "Use ccache on UNIX systems if it's available" ON)
17+
option (CC_SKIP_CXX_STANDARD_FORCING "Use ccache on UNIX systems if it's available" ON)
18+
option (CC_STATIC_RUNTIME "Enable/Disable static runtime" OFF)
1419

1520
# Extra variables
1621
# CC_QT_DIR=dir - Directory of QT5 installation. Can be used to provide path to QT5 if
1722
# differs from system default installation path.
1823
# CC_EXTERNALS_DIR - Directory where pull externals, defaults to
1924
# ${PROJECT_SOURCE_DIR}/externals
2025

26+
# Deprecated options for backward compatibility, use the ones above for new builds.
27+
# option (CC_COMMS_LIB_ONLY "Install only COMMS library, no other apps will be built." OFF)
28+
# option (CC_LIBS_ONLY "Build and install COMMS and CommsChampion libraries, no other apps will be built." OFF)
29+
# option (CC_NO_UNIT_TESTS "Disable unittests." OFF)
30+
# option (CC_NO_WARN_AS_ERR "Do NOT treat warning as error" OFF)
31+
# option (CC_ENABLE_DEMO_PROTOCOL "Enable demo protocol" OFF)
32+
# option (CC_NO_CXX_STANDARD_FORCING "Disable forcing C++ standard to C++11 when no CMAKE_CXX_STANDARD is defined" OFF)
33+
# option (CC_NO_CCACHE "Disable use of ccache on UNIX systems" OFF)
34+
2135
if (CMAKE_TOOLCHAIN_FILE AND EXISTS ${CMAKE_TOOLCHAIN_FILE})
2236
message(STATUS "Loading toolchain from ${CMAKE_TOOLCHAIN_FILE}")
2337
endif()
2438

25-
if ((NOT CMAKE_CXX_STANDARD) AND (NOT CC_NO_CXX_STANDARD_FORCING))
26-
set (CMAKE_CXX_STANDARD 11)
27-
endif()
28-
2939
if (NOT CC_EXTERNALS_DIR)
3040
set (CC_EXTERNALS_DIR "${PROJECT_SOURCE_DIR}/externals")
3141
endif ()
@@ -34,8 +44,60 @@ set (CMAKE_SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/cmake")
3444

3545
################################################
3646

47+
# Check usage of deprecated options and ovewrite the default values of proper ones
48+
if ((DEFINED CC_COMMS_LIB_ONLY) AND (${CC_COMMS_LIB_ONLY}))
49+
set (CC_INSTALL_COMMS_LIB ON)
50+
set (CC_BUILD_TOOLS_LIBRARY OFF)
51+
set (CC_INSTALL_TOOLS_LIBRARY OFF)
52+
set (CC_BUILD_TOOLS OFF)
53+
set (CC_INSTALL_TOOLS OFF)
54+
set (CC_BUILD_DEMO_PROTOCOL OFF)
55+
set (CC_INSTALL_DEMO_PROTOCOL OFF)
56+
endif ()
57+
58+
if ((DEFINED CC_LIBS_ONLY) AND (${CC_LIBS_ONLY}))
59+
set (CC_INSTALL_COMMS_LIB ON)
60+
set (CC_BUILD_TOOLS_LIBRARY ON)
61+
set (CC_INSTALL_TOOLS_LIBRARY ON)
62+
set (CC_BUILD_TOOLS OFF)
63+
set (CC_INSTALL_TOOLS OFF)
64+
set (CC_BUILD_DEMO_PROTOCOL OFF)
65+
set (CC_INSTALL_DEMO_PROTOCOL OFF)
66+
endif ()
67+
68+
macro (cc_negate_option old_name new_name)
69+
if (DEFINED ${old_name})
70+
if (${old_name})
71+
set (${new_name} OFF)
72+
else ()
73+
set (${new_name} ON)
74+
endif ()
75+
endif ()
76+
endmacro ()
77+
78+
cc_negate_option(CC_NO_UNIT_TESTS CC_BUILD_UNIT_TESTS)
79+
cc_negate_option(CC_NO_WARN_AS_ERR CC_WARN_AS_ERR)
80+
cc_negate_option(CC_NO_CCACHE CC_USE_CCACHE)
81+
82+
if (DEFINED CC_NO_CXX_STANDARD_FORCING)
83+
set (CC_SKIP_CXX_STANDARD_FORCING ${CC_NO_CXX_STANDARD_FORCING})
84+
endif ()
85+
86+
if ((DEFINED CC_ENABLE_DEMO_PROTOCOL) AND (${CC_ENABLE_DEMO_PROTOCOL}))
87+
set (CC_BUILD_TOOLS_LIBRARY ON)
88+
set (CC_INSTALL_TOOLS_LIBRARY ON)
89+
set (CC_BUILD_DEMO_PROTOCOL ON)
90+
set (CC_INSTALL_DEMO_PROTOCOL ON)
91+
endif ()
92+
93+
################################################
94+
95+
if ((NOT CMAKE_CXX_STANDARD) AND (NOT CC_SKIP_CXX_STANDARD_FORCING))
96+
set (CMAKE_CXX_STANDARD 11)
97+
endif()
98+
3799
while (TRUE)
38-
if (CC_NO_UNIT_TESTS)
100+
if (NOT CC_BUILD_UNIT_TESTS)
39101
message (STATUS "Unittests are disabled")
40102
break()
41103
endif ()
@@ -53,7 +115,7 @@ endwhile ()
53115
################################################
54116
# Compiler options
55117
set (warn_opt)
56-
if (NOT CC_NO_WARN_AS_ERR)
118+
if (CC_WARN_AS_ERR)
57119
set (warn_opt WARN_AS_ERR)
58120
endif ()
59121

@@ -63,7 +125,7 @@ if (CC_STATIC_RUNTIME)
63125
endif ()
64126

65127
set (ccache_opt)
66-
if ((UNIX) AND (NOT CC_NO_CCACHE))
128+
if ((UNIX) AND (CC_USE_CCACHE))
67129
set (ccache_opt USE_CCACHE)
68130
endif ()
69131

@@ -135,31 +197,9 @@ set (COMMS_CHAMPION_CMAKE_FILES
135197
${PROJECT_SOURCE_DIR}/cmake/CommsChampionConfig.cmake
136198
)
137199

138-
install (
139-
FILES ${LIB_COMMS_CMAKE_FILES}
140-
DESTINATION ${LIB_INSTALL_DIR}/LibComms/cmake/
141-
)
142-
143-
if (NOT CC_COMMS_LIB_ONLY)
144-
install (
145-
FILES ${COMMS_CHAMPION_CMAKE_FILES}
146-
DESTINATION ${LIB_INSTALL_DIR}/CommsChampion/cmake/
147-
)
148-
endif ()
149-
150-
151200
add_subdirectory (comms)
152-
153-
if (CC_COMMS_LIB_ONLY)
154-
return ()
155-
endif ()
156-
157201
add_subdirectory (comms_champion)
158202

159-
if (CC_LIBS_ONLY)
160-
return ()
161-
endif ()
162-
163203
add_subdirectory (demo)
164204

165205
if (WIN32 AND CC_QT_DIR)

cmake/CC_External.cmake

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,32 @@
4545
# ******************************************************
4646
# - Build comms_champion as external project during normal build process.
4747
# cc_build_as_external_project(
48+
# TGT <target_name>
4849
# SRC_DIR <src_dir>
4950
# [BUILD_DIR <build_dir>]
5051
# [INSTALL_DIR] <install_dir>]
5152
# [TAG <tag>]
5253
# [REPO <repo>]
5354
# [CMAKE_ARGS <arg1> <arg2> ...]
5455
# [QT_DIR <path_to_qt>]
56+
# [NO_REPO]
5557
# [NO_TOOLS]
5658
# [UPDATE_DISCONNECTED]
5759
# [NO_DEFAULT_CMAKE_ARGS]
5860
# )
61+
# - TGT - Name of CMake target that can be used to establish dependencies.
5962
# - SRC_DIR - A directory where comms_champion sources will end up.
6063
# - BUILD_DIR - A directory where comms_champion will be build.
6164
# - INSTALL_DIR - A directory where comms_champion will be installed, also passed as
6265
# CMAKE_INSTALL_PREFIX in addition to provided CMAKE_ARGS.
63-
# - TAG - Override the default tag to checkout.
64-
# - REPO - Override the default repository of the comms_champion.
66+
# - TAG - Override the default tag to checkout (unless NO_REPO param is used).
67+
# - REPO - Override the default repository of the comms_champion (unless NO_REPO param is used).
6568
# - CMAKE_ARGS - Extra cmake arguments to be passed to the comms_champion project.
6669
# - QT_DIR - Path to external Qt5 libraries, will be passed to the comms_champion
6770
# build process using CC_QT_DIR variable.
71+
# - NO_REPO - Don't checkout sources, SRC_DIR must contain checkout out sources, suitable for this repo being a submodule.
6872
# - NO_TOOLS - Will disable build of the CommsChampion Tools, will result in
69-
# having CC_COMMS_LIB_ONLY=ON option being passed to the build process.
73+
# having CC_BUILD_TOOLS_LIBRARY=OFF option being passed to the build process.
7074
# - NO_DEPLOY_QT - Don't generate "deploy_qt" build target when applicable.
7175
# - UPDATE_DISCONNECTED - Pass "UPDATE_DISCONNECTED 1" to ExternalProject_Add()
7276
# - NO_DEFAULT_CMAKE_ARGS - Exclude passing the extra cmake arguments that copy the
@@ -223,10 +227,11 @@ macro (cc_define_external_project_targets inst_dir)
223227
set (CC_COMMS_FOUND TRUE)
224228
set (CC_INCLUDE_DIRS "${inst_dir}/include")
225229

226-
add_library(comms INTERFACE)
227-
add_library(cc::comms ALIAS comms)
228-
229-
target_include_directories(comms INTERFACE ${CC_INCLUDE_DIRS})
230+
add_library(cc::comms INTERFACE IMPORTED GLOBAL)
231+
execute_process(
232+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CC_INCLUDE_DIRS}
233+
)
234+
target_include_directories(cc::comms INTERFACE ${CC_INCLUDE_DIRS})
230235

231236
while (TRUE)
232237
if (CC_EXT_TGT_NO_COMMS_CHAMPION OR CC_EXT_TGT_NO_TOOLS)
@@ -266,7 +271,7 @@ macro (cc_define_external_project_targets inst_dir)
266271
set (cc_lib_name lib${CC_PLUGIN_LIBRARIES}.so)
267272
endif ()
268273

269-
add_library(cc::comms_champion UNKNOWN IMPORTED)
274+
add_library(cc::comms_champion UNKNOWN IMPORTED GLOBAL)
270275
file (MAKE_DIRECTORY ${CC_INCLUDE_DIRS})
271276
set (interface_link_libs cc::comms)
272277

@@ -297,7 +302,7 @@ endmacro ()
297302

298303
function (cc_build_as_external_project)
299304
set (_prefix CC_EXTERNAL_PROJ)
300-
set (_options NO_TOOLS NO_DEPLOY_QT UPDATE_DISCONNECTED NO_DEFAULT_CMAKE_ARGS)
305+
set (_options NO_TOOLS NO_DEPLOY_QT UPDATE_DISCONNECTED NO_DEFAULT_CMAKE_ARGS NO_REPO)
301306
set (_oneValueArgs SRC_DIR BUILD_DIR INSTALL_DIR REPO TAG QT_DIR TGT)
302307
set (_mutiValueArgs CMAKE_ARGS)
303308
cmake_parse_arguments(${_prefix} "${_options}" "${_oneValueArgs}" "${_mutiValueArgs}" ${ARGN})
@@ -314,13 +319,21 @@ function (cc_build_as_external_project)
314319
set (CC_EXTERNAL_PROJ_INSTALL_DIR ${CC_EXTERNAL_PROJ_BUILD_DIR}/install)
315320
endif ()
316321

317-
if (NOT CC_EXTERNAL_PROJ_REPO)
318-
set (CC_EXTERNAL_PROJ_REPO ${CC_EXTERNAL_DEFAULT_REPO})
319-
endif ()
322+
set (repo_param)
323+
set (repo_tag_param)
324+
if (NOT CC_EXTERNAL_PROJ_NO_REPO)
325+
if (NOT CC_EXTERNAL_PROJ_REPO)
326+
set (CC_EXTERNAL_PROJ_REPO ${CC_EXTERNAL_DEFAULT_REPO})
327+
endif ()
328+
329+
if (NOT CC_EXTERNAL_PROJ_TAG)
330+
set (CC_EXTERNAL_PROJ_TAG ${CC_EXTERNAL_DEFAULT_TAG})
331+
endif ()
320332

321-
if (NOT CC_EXTERNAL_PROJ_TAG)
322-
set (CC_EXTERNAL_PROJ_TAG ${CC_EXTERNAL_DEFAULT_TAG})
323-
endif ()
333+
334+
set (repo_param GIT_REPOSITORY "${CC_EXTERNAL_PROJ_REPO}")
335+
set (repo_tag_param GIT_TAG "${CC_EXTERNAL_PROJ_TAG}")
336+
endif ()
324337

325338
set (exteral_proj_qt_dir_param)
326339
if (CC_EXTERNAL_PROJ_QT_DIR)
@@ -329,7 +342,7 @@ function (cc_build_as_external_project)
329342

330343
set (comms_lib_only_param)
331344
if (CC_EXTERNAL_PROJ_NO_TOOLS)
332-
set (comms_lib_only_param "-DCC_COMMS_LIB_ONLY=ON")
345+
set (comms_lib_only_param "-DCC_BUILD_TOOLS_LIBRARY=OFF")
333346
endif ()
334347

335348
if (NOT CC_EXTERNAL_PROJ_TGT)
@@ -357,8 +370,8 @@ function (cc_build_as_external_project)
357370
ExternalProject_Add(
358371
"${CC_EXTERNAL_PROJ_TGT}"
359372
PREFIX "${CC_EXTERNAL_PROJ_BUILD_DIR}"
360-
GIT_REPOSITORY "${CC_EXTERNAL_PROJ_REPO}"
361-
GIT_TAG "${CC_EXTERNAL_PROJ_TAG}"
373+
${repo_param}
374+
${repo_tag_param}
362375
SOURCE_DIR "${CC_EXTERNAL_PROJ_SRC_DIR}"
363376
BINARY_DIR "${CC_EXTERNAL_PROJ_BUILD_DIR}"
364377
INSTALL_DIR "${CC_EXTERNAL_PROJ_INSTALL_DIR}"
@@ -386,12 +399,12 @@ function (cc_build_as_external_project)
386399
${define_targets_no_tools_param}
387400
)
388401

389-
if (TARGET comms)
390-
add_dependencies(comms ${CC_EXTERNAL_PROJ_TGT})
402+
if (TARGET cc::comms)
403+
add_dependencies(cc::comms ${CC_EXTERNAL_PROJ_TGT})
391404
endif ()
392405

393-
if (TARGET comms_champion)
394-
add_dependencies(comms_champion ${CC_EXTERNAL_PROJ_TGT})
406+
if (TARGET cc::comms_champion)
407+
add_dependencies(cc::comms_champion ${CC_EXTERNAL_PROJ_TGT})
395408
endif ()
396409

397410
if ((NOT CC_EXTERNAL_PROJ_NO_DEPLOY_QT) AND WIN32 AND (NOT "${CC_EXTERNAL_PROJ_QT_DIR}" STREQUAL ""))

comms/CMakeLists.txt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,22 @@ target_include_directories(comms INTERFACE
2727
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
2828
)
2929

30-
install(TARGETS comms EXPORT commsExport)
31-
install(EXPORT commsExport NAMESPACE cc::
32-
DESTINATION ${LIB_INSTALL_DIR}/LibComms/cmake
33-
)
34-
35-
install (
36-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/comms
37-
DESTINATION ${INC_INSTALL_DIR}
38-
)
30+
if (CC_INSTALL_COMMS_LIB)
31+
install (
32+
FILES ${LIB_COMMS_CMAKE_FILES}
33+
DESTINATION ${LIB_INSTALL_DIR}/LibComms/cmake/
34+
)
35+
36+
install(TARGETS comms EXPORT commsExport)
37+
install(EXPORT commsExport NAMESPACE cc::
38+
DESTINATION ${LIB_INSTALL_DIR}/LibComms/cmake
39+
)
40+
41+
install (
42+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/comms
43+
DESTINATION ${INC_INSTALL_DIR}
44+
)
45+
endif ()
3946

4047
add_subdirectory (test)
4148

0 commit comments

Comments
 (0)