Skip to content

Commit e165c92

Browse files
committed
cmake: Apply .cmake-format.py
Run: ``` cmake-format -c .cmake-format.py -i $(git ls-files | grep CMakeLists.txt) $(git ls-files cmake/ | grep .cmake) ``` This applies the cmake formatting as defined in all files. In order to install `cmake-format`, you might want to run `pip install cmakelang` Or use another package manager of your choice. Signed-off-by: Johannes Demel <[email protected]>
1 parent 7739ee4 commit e165c92

25 files changed

+1049
-906
lines changed

CMakeLists.txt

Lines changed: 140 additions & 131 deletions
Large diffs are not rendered by default.

apps/CMakeLists.txt

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,24 @@ if(HAVE_POSIX_MEMALIGN)
1717
endif(HAVE_POSIX_MEMALIGN)
1818

1919
# MAKE volk_profile
20-
add_executable(volk_profile
21-
${CMAKE_CURRENT_SOURCE_DIR}/volk_profile.cc
22-
${PROJECT_SOURCE_DIR}/lib/qa_utils.cc
23-
${CMAKE_CURRENT_SOURCE_DIR}/volk_option_helpers.cc
24-
)
20+
add_executable(
21+
volk_profile
22+
${CMAKE_CURRENT_SOURCE_DIR}/volk_profile.cc ${PROJECT_SOURCE_DIR}/lib/qa_utils.cc
23+
${CMAKE_CURRENT_SOURCE_DIR}/volk_option_helpers.cc)
2524

2625
if(MSVC)
27-
target_include_directories(volk_profile
28-
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/cmake/msvc>
29-
)
26+
target_include_directories(
27+
volk_profile PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/cmake/msvc>)
3028
endif(MSVC)
3129

32-
target_include_directories(volk_profile
30+
target_include_directories(
31+
volk_profile
3332
PRIVATE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
3433
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
3534
PRIVATE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/lib>
3635
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib>
3736
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
38-
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
39-
)
37+
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
4038

4139
add_definitions(-DHAS_STD_FILESYSTEM=1)
4240
if(${find_experimental})
@@ -54,12 +52,11 @@ endif()
5452
install(
5553
TARGETS volk_profile
5654
DESTINATION bin
57-
COMPONENT "volk"
58-
)
55+
COMPONENT "volk")
5956

6057
# MAKE volk-config-info
61-
add_executable(volk-config-info volk-config-info.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_option_helpers.cc
62-
)
58+
add_executable(volk-config-info volk-config-info.cc
59+
${CMAKE_CURRENT_SOURCE_DIR}/volk_option_helpers.cc)
6360

6461
if(ENABLE_STATIC_LIBS)
6562
target_link_libraries(volk-config-info volk_static)
@@ -71,21 +68,20 @@ endif()
7168
install(
7269
TARGETS volk-config-info
7370
DESTINATION bin
74-
COMPONENT "volk"
75-
)
71+
COMPONENT "volk")
7672

7773
# Launch volk_profile if requested to do so
7874
if(ENABLE_PROFILING)
79-
if(DEFINED VOLK_CONFIGPATH)
80-
set( VOLK_CONFIG_ARG "-p${VOLK_CONFIGPATH}" )
81-
set( VOLK_CONFIG "${VOLK_CONFIGPATH}/volk_config" )
82-
endif()
75+
if(DEFINED VOLK_CONFIGPATH)
76+
set(VOLK_CONFIG_ARG "-p${VOLK_CONFIGPATH}")
77+
set(VOLK_CONFIG "${VOLK_CONFIGPATH}/volk_config")
78+
endif()
8379

84-
add_custom_command(OUTPUT ${VOLK_CONFIG}
80+
add_custom_command(
81+
OUTPUT ${VOLK_CONFIG}
8582
COMMAND volk_profile "${VOLK_CONFIG_ARG}"
8683
DEPENDS volk_profile
87-
COMMENT "Launching profiler, this may take a few minutes..."
88-
)
84+
COMMENT "Launching profiler, this may take a few minutes...")
8985
add_custom_target(volk-profile-run ALL DEPENDS ${VOLK_CONFIG})
9086

9187
endif()

cmake/Modules/CMakeParseArgumentsCopy.cmake

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -80,66 +80,77 @@
8080
# (To distribute this file outside of CMake, substitute the full
8181
# License text for the above reference.)
8282

83-
8483
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
85-
return()
84+
return()
8685
endif()
8786
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
8887

89-
9088
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
91-
# first set all result variables to empty/FALSE
92-
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
93-
set(${prefix}_${arg_name})
94-
endforeach(arg_name)
89+
# first set all result variables to empty/FALSE
90+
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
91+
set(${prefix}_${arg_name})
92+
endforeach(arg_name)
9593

96-
foreach(option ${_optionNames})
97-
set(${prefix}_${option} FALSE)
98-
endforeach(option)
94+
foreach(option ${_optionNames})
95+
set(${prefix}_${option} FALSE)
96+
endforeach(option)
9997

100-
set(${prefix}_UNPARSED_ARGUMENTS)
98+
set(${prefix}_UNPARSED_ARGUMENTS)
10199

102-
set(insideValues FALSE)
103-
set(currentArgName)
100+
set(insideValues FALSE)
101+
set(currentArgName)
104102

105-
# now iterate over all arguments and fill the result variables
106-
foreach(currentArg ${ARGN})
107-
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
108-
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
109-
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
103+
# now iterate over all arguments and fill the result variables
104+
foreach(currentArg ${ARGN})
105+
list(FIND _optionNames "${currentArg}" optionIndex
106+
)# ... then this marks the end of the arguments belonging to this keyword
107+
list(FIND _singleArgNames "${currentArg}" singleArgIndex
108+
)# ... then this marks the end of the arguments belonging to this keyword
109+
list(FIND _multiArgNames "${currentArg}" multiArgIndex
110+
)# ... then this marks the end of the arguments belonging to this keyword
110111

111-
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
112-
if(insideValues)
113-
if("${insideValues}" STREQUAL "SINGLE")
114-
set(${prefix}_${currentArgName} ${currentArg})
115-
set(insideValues FALSE)
116-
elseif("${insideValues}" STREQUAL "MULTI")
117-
list(APPEND ${prefix}_${currentArgName} ${currentArg})
112+
if(${optionIndex} EQUAL -1
113+
AND ${singleArgIndex} EQUAL -1
114+
AND ${multiArgIndex} EQUAL -1)
115+
if(insideValues)
116+
if("${insideValues}" STREQUAL "SINGLE")
117+
set(${prefix}_${currentArgName} ${currentArg})
118+
set(insideValues FALSE)
119+
elseif("${insideValues}" STREQUAL "MULTI")
120+
list(APPEND ${prefix}_${currentArgName} ${currentArg})
121+
endif()
122+
else(insideValues)
123+
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
124+
endif(insideValues)
125+
else()
126+
if(NOT ${optionIndex} EQUAL -1)
127+
set(${prefix}_${currentArg} TRUE)
128+
set(insideValues FALSE)
129+
elseif(NOT ${singleArgIndex} EQUAL -1)
130+
set(currentArgName ${currentArg})
131+
set(${prefix}_${currentArgName})
132+
set(insideValues "SINGLE")
133+
elseif(NOT ${multiArgIndex} EQUAL -1)
134+
set(currentArgName ${currentArg})
135+
set(${prefix}_${currentArgName})
136+
set(insideValues "MULTI")
137+
endif()
118138
endif()
119-
else(insideValues)
120-
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
121-
endif(insideValues)
122-
else()
123-
if(NOT ${optionIndex} EQUAL -1)
124-
set(${prefix}_${currentArg} TRUE)
125-
set(insideValues FALSE)
126-
elseif(NOT ${singleArgIndex} EQUAL -1)
127-
set(currentArgName ${currentArg})
128-
set(${prefix}_${currentArgName})
129-
set(insideValues "SINGLE")
130-
elseif(NOT ${multiArgIndex} EQUAL -1)
131-
set(currentArgName ${currentArg})
132-
set(${prefix}_${currentArgName})
133-
set(insideValues "MULTI")
134-
endif()
135-
endif()
136139

137-
endforeach(currentArg)
140+
endforeach(currentArg)
138141

139-
# propagate the result variables to the caller:
140-
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
141-
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
142-
endforeach(arg_name)
143-
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
142+
# propagate the result variables to the caller:
143+
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
144+
set(${prefix}_${arg_name}
145+
${${prefix}_${arg_name}}
146+
PARENT_SCOPE)
147+
endforeach(arg_name)
148+
set(${prefix}_UNPARSED_ARGUMENTS
149+
${${prefix}_UNPARSED_ARGUMENTS}
150+
PARENT_SCOPE)
144151

145-
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
152+
endfunction(
153+
CMAKE_PARSE_ARGUMENTS
154+
_options
155+
_singleArgs
156+
_multiArgs)

cmake/Modules/FindFILESYSTEM.cmake

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ Using `find_package(FILESYSTEM)` with no component arguments:
104104
105105
#]=======================================================================]
106106

107-
108107
if(TARGET std::filesystem)
109108
# This module has already been processed. Don't do it again.
110109
return()
@@ -121,16 +120,19 @@ set(CMAKE_REQUIRED_QUIET ${FILESYSTEM_FIND_QUIETLY})
121120
# All of our tests require C++17 or later
122121
set(OLD_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
123122
set(CMAKE_CXX_STANDARD 17)
124-
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "8.0.0"))
123+
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER
124+
"8.0.0"))
125125
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99")
126126
set(UNDEFINED_BEHAVIOR_WITHOUT_LINKING TRUE)
127127
endif()
128128
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
129129
endif()
130-
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99"))
130+
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION
131+
VERSION_LESS "8.99"))
131132
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
132133
endif()
133-
if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11"))
134+
if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND NOT (CMAKE_CXX_COMPILER_VERSION
135+
VERSION_LESS "11"))
134136
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
135137
endif()
136138
if(MSVC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "18"))
@@ -173,7 +175,8 @@ else()
173175
endif()
174176

175177
if(find_experimental)
176-
check_include_file_cxx("experimental/filesystem" _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
178+
check_include_file_cxx("experimental/filesystem"
179+
_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
177180
mark_as_advanced(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
178181
else()
179182
set(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER FALSE)
@@ -191,22 +194,32 @@ else()
191194
set(_have_fs FALSE)
192195
endif()
193196

194-
set(CXX_FILESYSTEM_HAVE_FS ${_have_fs} CACHE BOOL "TRUE if we have the C++ filesystem headers")
195-
set(CXX_FILESYSTEM_HEADER ${_fs_header} CACHE STRING "The header that should be included to obtain the filesystem APIs")
196-
set(CXX_FILESYSTEM_NAMESPACE ${_fs_namespace} CACHE STRING "The C++ namespace that contains the filesystem APIs")
197+
set(CXX_FILESYSTEM_HAVE_FS
198+
${_have_fs}
199+
CACHE BOOL "TRUE if we have the C++ filesystem headers")
200+
set(CXX_FILESYSTEM_HEADER
201+
${_fs_header}
202+
CACHE STRING "The header that should be included to obtain the filesystem APIs")
203+
set(CXX_FILESYSTEM_NAMESPACE
204+
${_fs_namespace}
205+
CACHE STRING "The C++ namespace that contains the filesystem APIs")
197206

198207
set(_found FALSE)
199208

200209
if(CXX_FILESYSTEM_HAVE_FS)
201210
# We have some filesystem library available. Do link checks
202-
string(CONFIGURE [[
211+
string(
212+
CONFIGURE
213+
[[
203214
#include <@CXX_FILESYSTEM_HEADER@>
204215
205216
int main() {
206217
auto cwd = @CXX_FILESYSTEM_NAMESPACE@::current_path();
207218
return static_cast<int>(cwd.string().size());
208219
}
209-
]] code @ONLY)
220+
]]
221+
code
222+
@ONLY)
210223

211224
# Try to compile a simple filesystem program without any linker flags
212225
if(NOT UNDEFINED_BEHAVIOR_WITHOUT_LINKING)
@@ -254,7 +267,9 @@ endif()
254267

255268
cmake_pop_check_state()
256269

257-
set(FILESYSTEM_FOUND ${_found} CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE)
270+
set(FILESYSTEM_FOUND
271+
${_found}
272+
CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE)
258273

259274
if(FILESYSTEM_FIND_REQUIRED AND NOT FILESYSTEM_FOUND)
260275
message(FATAL_ERROR "Cannot compile a simple program using std::filesystem")

cmake/Modules/FindORC.cmake

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,51 @@
55
# SPDX-License-Identifier: LGPL-3.0-or-later
66
#
77

8-
FIND_PACKAGE(PkgConfig)
9-
PKG_CHECK_MODULES(PC_ORC "orc-0.4 > 0.4.11")
10-
11-
INCLUDE(GNUInstallDirs)
12-
13-
14-
FIND_PROGRAM(ORCC_EXECUTABLE orcc
15-
HINTS ${PC_ORC_TOOLSDIR}
16-
PATHS ${ORC_ROOT}/bin ${CMAKE_INSTALL_PREFIX}/bin)
17-
18-
FIND_PATH(ORC_INCLUDE_DIR NAMES orc/orc.h
19-
HINTS ${PC_ORC_INCLUDEDIR}
20-
PATHS ${ORC_ROOT}/include ${CMAKE_INSTALL_PREFIX}/include
21-
PATH_SUFFIXES orc-0.4)
22-
23-
24-
FIND_PATH(ORC_LIBRARY_DIR NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
25-
HINTS ${PC_ORC_LIBDIR}
26-
PATHS ${ORC_ROOT}/${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
27-
28-
FIND_LIBRARY(ORC_LIB orc-0.4
29-
HINTS ${PC_ORC_LIBRARY_DIRS}
30-
PATHS ${ORC_ROOT}/${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
31-
32-
FIND_LIBRARY(ORC_LIBRARY_STATIC liborc-0.4.a
33-
HINTS ${PC_ORC_LIBRARY_DIRS}
34-
PATHS ${ORC_ROOT}/${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
35-
36-
LIST(APPEND ORC_LIBRARY
37-
${ORC_LIB}
38-
)
39-
40-
41-
SET(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
42-
SET(ORC_LIBRARIES ${ORC_LIBRARY})
43-
SET(ORC_LIBRARY_DIRS ${ORC_LIBRARY_DIR})
44-
SET(ORC_LIBRARIES_STATIC ${ORC_LIBRARY_STATIC})
45-
46-
INCLUDE(FindPackageHandleStandardArgs)
47-
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR ORCC_EXECUTABLE)
8+
find_package(PkgConfig)
9+
pkg_check_modules(PC_ORC "orc-0.4 > 0.4.11")
10+
11+
include(GNUInstallDirs)
12+
13+
find_program(
14+
ORCC_EXECUTABLE orcc
15+
HINTS ${PC_ORC_TOOLSDIR}
16+
PATHS ${ORC_ROOT}/bin ${CMAKE_INSTALL_PREFIX}/bin)
17+
18+
find_path(
19+
ORC_INCLUDE_DIR
20+
NAMES orc/orc.h
21+
HINTS ${PC_ORC_INCLUDEDIR}
22+
PATHS ${ORC_ROOT}/include ${CMAKE_INSTALL_PREFIX}/include
23+
PATH_SUFFIXES orc-0.4)
24+
25+
find_path(
26+
ORC_LIBRARY_DIR
27+
NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
28+
HINTS ${PC_ORC_LIBDIR}
29+
PATHS ${ORC_ROOT}/${CMAKE_INSTALL_LIBDIR}
30+
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
31+
32+
find_library(
33+
ORC_LIB orc-0.4
34+
HINTS ${PC_ORC_LIBRARY_DIRS}
35+
PATHS ${ORC_ROOT}/${CMAKE_INSTALL_LIBDIR}
36+
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
37+
38+
find_library(
39+
ORC_LIBRARY_STATIC liborc-0.4.a
40+
HINTS ${PC_ORC_LIBRARY_DIRS}
41+
PATHS ${ORC_ROOT}/${CMAKE_INSTALL_LIBDIR}
42+
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
43+
44+
list(APPEND ORC_LIBRARY ${ORC_LIB})
45+
46+
set(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
47+
set(ORC_LIBRARIES ${ORC_LIBRARY})
48+
set(ORC_LIBRARY_DIRS ${ORC_LIBRARY_DIR})
49+
set(ORC_LIBRARIES_STATIC ${ORC_LIBRARY_STATIC})
50+
51+
include(FindPackageHandleStandardArgs)
52+
find_package_handle_standard_args(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR
53+
ORCC_EXECUTABLE)
4854

4955
mark_as_advanced(ORC_INCLUDE_DIR ORC_LIBRARY ORCC_EXECUTABLE)

0 commit comments

Comments
 (0)