Skip to content

Commit af78fad

Browse files
committed
cmake: reformatted
cmake-format -c .cmake-format.py \ -i cmake/cmake_uninstall.cmake.in cmake/Modules/* \ cmake/Toolchains/arm_cortex_a8_native.cmake \ cmake/Toolchains/oe-sdk_cross.cmake \ $(git ls-files | grep -x mako CMakeLists.txt ) Signed-off-by: Josh Morman <[email protected]>
1 parent 5cae465 commit af78fad

File tree

209 files changed

+5260
-6193
lines changed

Some content is hidden

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

209 files changed

+5260
-6193
lines changed

CMakeLists.txt

+135-158
Large diffs are not rendered by default.

cmake/Modules/CMakeOverloads.cmake

+26-26
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
########################################################################
1313

1414
if(DEFINED __INCLUDED_CMAKE_OVERLOADS)
15-
return()
15+
return()
1616
endif()
1717
set(__INCLUDED_CMAKE_OVERLOADS TRUE)
1818

@@ -26,32 +26,32 @@ set(__INCLUDED_CMAKE_OVERLOADS TRUE)
2626
# situation seems like it's unlikely, so we ignore it here.
2727

2828
macro(INCLUDE_DIRECTORIES)
29-
# for each provided include directory ...
30-
foreach(inc_dir ${ARGN})
29+
# for each provided include directory ...
30+
foreach(inc_dir ${ARGN})
3131

32-
# is this dir the literal string "BEFORE" or "AFTER"?
33-
string(FIND ${inc_dir} BEFORE IS_BEFORE)
34-
string(FIND ${inc_dir} AFTER IS_AFTER)
35-
if(NOT ${IS_BEFORE} EQUAL 0 AND NOT ${IS_AFTER} EQUAL 0)
32+
# is this dir the literal string "BEFORE" or "AFTER"?
33+
string(FIND ${inc_dir} BEFORE IS_BEFORE)
34+
string(FIND ${inc_dir} AFTER IS_AFTER)
35+
if(NOT ${IS_BEFORE} EQUAL 0 AND NOT ${IS_AFTER} EQUAL 0)
3636

37-
# not "BEFORE" or "AFTER"; a real directory.
38-
# get absolute path of this include directory
39-
get_filename_component(inc_dir_abs ${inc_dir} ABSOLUTE)
37+
# not "BEFORE" or "AFTER"; a real directory.
38+
# get absolute path of this include directory
39+
get_filename_component(inc_dir_abs ${inc_dir} ABSOLUTE)
4040

41-
# is this include directory located within the SOURCE or BUILD?
42-
string(FIND ${inc_dir_abs} ${PROJECT_SOURCE_DIR} IS_IN_SOURCE)
43-
string(FIND ${inc_dir_abs} ${PROJECT_BINARY_DIR} IS_IN_BINARY)
44-
if(${IS_IN_SOURCE} EQUAL 0 OR ${IS_IN_BINARY} EQUAL 0)
45-
# yes: local SOURCE or BINARY; internal.
46-
# call the overloaded INCLUDE_DIRECTORIES,
47-
# prepending this internal directory.
48-
_include_directories(BEFORE ${inc_dir_abs})
49-
else()
50-
# no: not SOURCE or BUILD; must be external.
51-
# call the overloaded INCLUDE_DIRECTORIES,
52-
# appending this external directory.
53-
_include_directories(AFTER ${inc_dir_abs})
54-
endif()
55-
endif()
56-
endforeach()
41+
# is this include directory located within the SOURCE or BUILD?
42+
string(FIND ${inc_dir_abs} ${PROJECT_SOURCE_DIR} IS_IN_SOURCE)
43+
string(FIND ${inc_dir_abs} ${PROJECT_BINARY_DIR} IS_IN_BINARY)
44+
if(${IS_IN_SOURCE} EQUAL 0 OR ${IS_IN_BINARY} EQUAL 0)
45+
# yes: local SOURCE or BINARY; internal.
46+
# call the overloaded INCLUDE_DIRECTORIES,
47+
# prepending this internal directory.
48+
_include_directories(BEFORE ${inc_dir_abs})
49+
else()
50+
# no: not SOURCE or BUILD; must be external.
51+
# call the overloaded INCLUDE_DIRECTORIES,
52+
# appending this external directory.
53+
_include_directories(AFTER ${inc_dir_abs})
54+
endif()
55+
endif()
56+
endforeach()
5757
endmacro(INCLUDE_DIRECTORIES)

cmake/Modules/CMakeParseArgumentsCopy.cmake

+60-49
Original file line numberDiff line numberDiff line change
@@ -73,66 +73,77 @@
7373
# (To distribute this file outside of CMake, substitute the full
7474
# License text for the above reference.)
7575

76-
7776
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
78-
return()
77+
return()
7978
endif()
8079
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
8180

82-
8381
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
84-
# first set all result variables to empty/FALSE
85-
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
86-
set(${prefix}_${arg_name})
87-
endforeach(arg_name)
82+
# first set all result variables to empty/FALSE
83+
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
84+
set(${prefix}_${arg_name})
85+
endforeach(arg_name)
8886

89-
foreach(option ${_optionNames})
90-
set(${prefix}_${option} FALSE)
91-
endforeach(option)
87+
foreach(option ${_optionNames})
88+
set(${prefix}_${option} FALSE)
89+
endforeach(option)
9290

93-
set(${prefix}_UNPARSED_ARGUMENTS)
91+
set(${prefix}_UNPARSED_ARGUMENTS)
9492

95-
set(insideValues FALSE)
96-
set(currentArgName)
93+
set(insideValues FALSE)
94+
set(currentArgName)
9795

98-
# now iterate over all arguments and fill the result variables
99-
foreach(currentArg ${ARGN})
100-
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
101-
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
102-
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
96+
# now iterate over all arguments and fill the result variables
97+
foreach(currentArg ${ARGN})
98+
list(FIND _optionNames "${currentArg}" optionIndex
99+
)# ... then this marks the end of the arguments belonging to this keyword
100+
list(FIND _singleArgNames "${currentArg}" singleArgIndex
101+
)# ... then this marks the end of the arguments belonging to this keyword
102+
list(FIND _multiArgNames "${currentArg}" multiArgIndex
103+
)# ... then this marks the end of the arguments belonging to this keyword
103104

104-
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
105-
if(insideValues)
106-
if("${insideValues}" STREQUAL "SINGLE")
107-
set(${prefix}_${currentArgName} ${currentArg})
108-
set(insideValues FALSE)
109-
elseif("${insideValues}" STREQUAL "MULTI")
110-
list(APPEND ${prefix}_${currentArgName} ${currentArg})
105+
if(${optionIndex} EQUAL -1
106+
AND ${singleArgIndex} EQUAL -1
107+
AND ${multiArgIndex} EQUAL -1)
108+
if(insideValues)
109+
if("${insideValues}" STREQUAL "SINGLE")
110+
set(${prefix}_${currentArgName} ${currentArg})
111+
set(insideValues FALSE)
112+
elseif("${insideValues}" STREQUAL "MULTI")
113+
list(APPEND ${prefix}_${currentArgName} ${currentArg})
114+
endif()
115+
else(insideValues)
116+
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
117+
endif(insideValues)
118+
else()
119+
if(NOT ${optionIndex} EQUAL -1)
120+
set(${prefix}_${currentArg} TRUE)
121+
set(insideValues FALSE)
122+
elseif(NOT ${singleArgIndex} EQUAL -1)
123+
set(currentArgName ${currentArg})
124+
set(${prefix}_${currentArgName})
125+
set(insideValues "SINGLE")
126+
elseif(NOT ${multiArgIndex} EQUAL -1)
127+
set(currentArgName ${currentArg})
128+
set(${prefix}_${currentArgName})
129+
set(insideValues "MULTI")
130+
endif()
111131
endif()
112-
else(insideValues)
113-
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
114-
endif(insideValues)
115-
else()
116-
if(NOT ${optionIndex} EQUAL -1)
117-
set(${prefix}_${currentArg} TRUE)
118-
set(insideValues FALSE)
119-
elseif(NOT ${singleArgIndex} EQUAL -1)
120-
set(currentArgName ${currentArg})
121-
set(${prefix}_${currentArgName})
122-
set(insideValues "SINGLE")
123-
elseif(NOT ${multiArgIndex} EQUAL -1)
124-
set(currentArgName ${currentArg})
125-
set(${prefix}_${currentArgName})
126-
set(insideValues "MULTI")
127-
endif()
128-
endif()
129132

130-
endforeach(currentArg)
133+
endforeach(currentArg)
131134

132-
# propagate the result variables to the caller:
133-
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
134-
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
135-
endforeach(arg_name)
136-
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
135+
# propagate the result variables to the caller:
136+
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
137+
set(${prefix}_${arg_name}
138+
${${prefix}_${arg_name}}
139+
PARENT_SCOPE)
140+
endforeach(arg_name)
141+
set(${prefix}_UNPARSED_ARGUMENTS
142+
${${prefix}_UNPARSED_ARGUMENTS}
143+
PARENT_SCOPE)
137144

138-
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
145+
endfunction(
146+
CMAKE_PARSE_ARGUMENTS
147+
_options
148+
_singleArgs
149+
_multiArgs)

cmake/Modules/CodeCoverage.cmake

+95-90
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,30 @@
6868
#
6969

7070
# Check prereqs
71-
FIND_PROGRAM( GCOV_PATH gcov )
72-
FIND_PROGRAM( LCOV_PATH lcov )
73-
FIND_PROGRAM( GENHTML_PATH genhtml )
74-
FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${PROJECT_SOURCE_DIR}/tests)
75-
76-
IF(NOT GCOV_PATH)
77-
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
78-
ENDIF() # NOT GCOV_PATH
79-
80-
IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
81-
IF("${CMAKE_CXX_COMPILER_VERSION}" CLANG_MIN_VERSION )
82-
MESSAGE(FATAL_ERROR "Clang version must be ${CLANG_MIN_VERSION} or greater! Aborting...")
83-
ENDIF()
84-
ELSEIF(NOT CMAKE_COMPILER_IS_GNUCXX)
85-
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
86-
ENDIF() # CHECK VALID COMPILER
87-
88-
IF ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage"))
89-
MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" )
90-
ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
91-
71+
find_program(GCOV_PATH gcov)
72+
find_program(LCOV_PATH lcov)
73+
find_program(GENHTML_PATH genhtml)
74+
find_program(GCOVR_PATH gcovr PATHS ${PROJECT_SOURCE_DIR}/tests)
75+
76+
if(NOT GCOV_PATH)
77+
message(FATAL_ERROR "gcov not found! Aborting...")
78+
endif() # NOT GCOV_PATH
79+
80+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
81+
if("${CMAKE_CXX_COMPILER_VERSION}" CLANG_MIN_VERSION)
82+
message(
83+
FATAL_ERROR
84+
"Clang version must be ${CLANG_MIN_VERSION} or greater! Aborting...")
85+
endif()
86+
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
87+
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
88+
endif() # CHECK VALID COMPILER
89+
90+
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage"))
91+
message(
92+
WARNING
93+
"Code coverage results with an optimized (non-Debug) build may be misleading")
94+
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
9295

9396
# Param _targetname The name of new the custom make target
9497
# Param _testrunner The name of the target which runs the tests.
@@ -98,78 +101,80 @@ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
98101
# HTML report is generated in _outputname/index.html
99102
# Optional fourth parameter is passed as arguments to _testrunner
100103
# Pass them in list form, e.g.: "-j;2" for -j 2
101-
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
102-
103-
IF(NOT LCOV_PATH)
104-
MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
105-
ENDIF() # NOT LCOV_PATH
106-
107-
IF(NOT GENHTML_PATH)
108-
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
109-
ENDIF() # NOT GENHTML_PATH
110-
111-
SET(coverage_info "${PROJECT_BINARY_DIR}/${_outputname}.info")
112-
SET(coverage_cleaned "${coverage_info}.cleaned")
113-
114-
SEPARATE_ARGUMENTS(test_command UNIX_COMMAND "${_testrunner}")
115-
116-
# Setup target
117-
ADD_CUSTOM_TARGET(${_targetname}
118-
119-
# Cleanup lcov
120-
${LCOV_PATH} --directory . --zerocounters
121-
122-
# Run tests
123-
COMMAND ${test_command} ${ARGV3}
124-
125-
# Capturing lcov counters and generating report
126-
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${coverage_info}
127-
COMMAND ${LCOV_PATH} --remove ${coverage_info} 'tests/*' '/usr/*' '*/qa_*' --output-file ${coverage_cleaned}
128-
COMMAND ${GENHTML_PATH} -o ${_outputname} ${coverage_cleaned}
129-
# Don't remove fragments so CI can upload them to codecov
130-
131-
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
132-
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
133-
)
134-
135-
# Show info where to find the report
136-
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
137-
COMMAND ;
138-
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
139-
)
140-
141-
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
104+
function(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
105+
106+
if(NOT LCOV_PATH)
107+
message(FATAL_ERROR "lcov not found! Aborting...")
108+
endif() # NOT LCOV_PATH
109+
110+
if(NOT GENHTML_PATH)
111+
message(FATAL_ERROR "genhtml not found! Aborting...")
112+
endif() # NOT GENHTML_PATH
113+
114+
set(coverage_info "${PROJECT_BINARY_DIR}/${_outputname}.info")
115+
set(coverage_cleaned "${coverage_info}.cleaned")
116+
117+
separate_arguments(test_command UNIX_COMMAND "${_testrunner}")
118+
119+
# Setup target
120+
add_custom_target(
121+
${_targetname}
122+
# Cleanup lcov
123+
${LCOV_PATH} --directory . --zerocounters
124+
# Run tests
125+
COMMAND ${test_command} ${ARGV3}
126+
# Capturing lcov counters and generating report
127+
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${coverage_info}
128+
COMMAND ${LCOV_PATH} --remove ${coverage_info} 'tests/*' '/usr/*' '*/qa_*'
129+
--output-file ${coverage_cleaned}
130+
COMMAND ${GENHTML_PATH} -o ${_outputname} ${coverage_cleaned}
131+
# Don't remove fragments so CI can upload them to codecov
132+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
133+
COMMENT
134+
"Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
135+
)
136+
137+
# Show info where to find the report
138+
add_custom_command(
139+
TARGET ${_targetname}
140+
POST_BUILD
141+
COMMAND ;
142+
COMMENT
143+
"Open ./${_outputname}/index.html in your browser to view the coverage report."
144+
)
145+
146+
endfunction() # SETUP_TARGET_FOR_COVERAGE
142147

143148
# Param _targetname The name of new the custom make target
144149
# Param _testrunner The name of the target which runs the tests
145150
# Param _outputname cobertura output is generated as _outputname.xml
146151
# Optional fourth parameter is passed as arguments to _testrunner
147152
# Pass them in list form, e.g.: "-j;2" for -j 2
148-
FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
149-
150-
IF(NOT PYTHON_EXECUTABLE)
151-
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
152-
ENDIF() # NOT PYTHON_EXECUTABLE
153-
154-
IF(NOT GCOVR_PATH)
155-
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
156-
ENDIF() # NOT GCOVR_PATH
157-
158-
ADD_CUSTOM_TARGET(${_targetname}
159-
160-
# Run tests
161-
${_testrunner} ${ARGV3}
162-
163-
# Running gcovr
164-
COMMAND ${GCOVR_PATH} -x -r ${PROJECT_SOURCE_DIR} -e '${PROJECT_SOURCE_DIR}/tests/' -o ${_outputname}.xml
165-
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
166-
COMMENT "Running gcovr to produce Cobertura code coverage report."
167-
)
168-
169-
# Show info where to find the report
170-
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
171-
COMMAND ;
172-
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
173-
)
174-
175-
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
153+
function(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
154+
155+
if(NOT PYTHON_EXECUTABLE)
156+
message(FATAL_ERROR "Python not found! Aborting...")
157+
endif() # NOT PYTHON_EXECUTABLE
158+
159+
if(NOT GCOVR_PATH)
160+
message(FATAL_ERROR "gcovr not found! Aborting...")
161+
endif() # NOT GCOVR_PATH
162+
163+
add_custom_target(
164+
${_targetname}
165+
# Run tests
166+
${_testrunner} ${ARGV3}
167+
# Running gcovr
168+
COMMAND ${GCOVR_PATH} -x -r ${PROJECT_SOURCE_DIR} -e
169+
'${PROJECT_SOURCE_DIR}/tests/' -o ${_outputname}.xml
170+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
171+
COMMENT "Running gcovr to produce Cobertura code coverage report.")
172+
173+
# Show info where to find the report
174+
add_custom_command(
175+
TARGET ${_targetname}
176+
POST_BUILD
177+
COMMAND ;
178+
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml.")
179+
180+
endfunction() # SETUP_TARGET_FOR_COVERAGE_COBERTURA

0 commit comments

Comments
 (0)