Skip to content

Commit 5003d1e

Browse files
committed
Format code
1 parent 4e00207 commit 5003d1e

22 files changed

+246
-154
lines changed

CMakeLists.txt

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ else ()
160160
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
161161
set(X86 TRUE)
162162
endif ()
163-
if (CMAKE_CXX_COMPILER_TARGET MATCHES "^([Aa][Rr][Mm]|[Aa][Aa][Rr][Cc][Hh]|[Rr][Vv][Vv])")
163+
if (CMAKE_CXX_COMPILER_TARGET MATCHES
164+
"^([Aa][Rr][Mm]|[Aa][Aa][Rr][Cc][Hh]|[Rr][Vv][Vv])")
164165
set(X86 FALSE)
165166
endif ()
166167
if (CMAKE_ANDROID_ARCH_ABI MATCHES "x86")
@@ -205,7 +206,7 @@ endif ()
205206

206207
if (X86)
207208
option(KFR_ENABLE_MULTIARCH
208-
"Multiple architectures will be built with runtime dispatch" ON)
209+
"Multiple architectures will be built with runtime dispatch" ON)
209210
endif ()
210211

211212
option(ENABLE_TESTS "Enable KFR tests" OFF)
@@ -227,8 +228,12 @@ option(KFR_INSTALL_LIBRARIES "Include libraries in installation" ON)
227228
option(KFR_MANAGED_ALLOCATION
228229
"Use KFR managed memory (copy-free aligned reallocation, ref counting)"
229230
OFF)
230-
option(KFR_USE_BOOST_MATH "Use Boost.Math (standalone) to support Elliptic filters" ON)
231-
option(KFR_USE_BOOST "Use Boost to support Elliptic filters. Enable this only if you're already using Boost" OFF)
231+
option(KFR_USE_BOOST_MATH
232+
"Use Boost.Math (standalone) to support Elliptic filters" ON)
233+
option(
234+
KFR_USE_BOOST
235+
"Use Boost to support Elliptic filters. Enable this only if you're already using Boost"
236+
OFF)
232237
option(KFR_USE_STD_FILESYSTEM "Use std::filesystem for path arguments" OFF)
233238
mark_as_advanced(KFR_ENABLE_ASMTEST)
234239
mark_as_advanced(KFR_REGENERATE_TESTS)
@@ -273,7 +278,10 @@ endif ()
273278

274279
if (NOT X86)
275280
if (KFR_ARCH IN_LIST DETECT_NAMES)
276-
message(STATUS "Cpu detection is disabled on non-x86, setting neon (KFR_ARCH=${KFR_ARCH})")
281+
message(
282+
STATUS
283+
"Cpu detection is disabled on non-x86, setting neon (KFR_ARCH=${KFR_ARCH})"
284+
)
277285
if (BITNESS64)
278286
set(KFR_ARCH neon64)
279287
else ()
@@ -291,8 +299,7 @@ if (KFR_ARCH IN_LIST DETECT_NAMES AND NOT CMAKE_CROSSCOMPILING)
291299
${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect_cpu.cpp
292300
CMAKE_FLAGS
293301
"-DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR}/include"
294-
-DCMAKE_CXX_STANDARD=20
295-
-DCMAKE_CXX_STANDARD_REQUIRED=ON
302+
-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON
296303
"-DCOMPILE_DEFINITIONS=-DCPU_${KFR_ARCH}=1"
297304
COMPILE_OUTPUT_VARIABLE COMPILE_OUT
298305
RUN_OUTPUT_VARIABLE RUN_OUT)
@@ -400,7 +407,8 @@ else ()
400407
target_link_libraries(kfr INTERFACE ${STD_LIB} ${PTHREAD_LIB} m)
401408
endif ()
402409
if (KFR_DISABLE_CLANG_EXTENSIONS)
403-
target_compile_definitions(kfr INTERFACE $<BUILD_INTERFACE:KFR_DISABLE_CLANG_EXT>)
410+
target_compile_definitions(
411+
kfr INTERFACE $<BUILD_INTERFACE:KFR_DISABLE_CLANG_EXT>)
404412
endif ()
405413
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
406414
add_compile_options(-Wno-ignored-qualifiers -Wno-psabi)
@@ -419,11 +427,13 @@ if (NOT KFR_ENABLE_DFT)
419427
target_compile_definitions(kfr INTERFACE $<BUILD_INTERFACE:KFR_NO_DFT>)
420428
endif ()
421429
if (KFR_EXTENDED_TESTS)
422-
target_compile_definitions(kfr INTERFACE $<BUILD_INTERFACE:KFR_EXTENDED_TESTS>)
430+
target_compile_definitions(kfr
431+
INTERFACE $<BUILD_INTERFACE:KFR_EXTENDED_TESTS>)
423432
endif ()
424433

425434
if (KFR_MANAGED_ALLOCATION)
426-
target_compile_definitions(kfr INTERFACE $<BUILD_INTERFACE:KFR_MANAGED_ALLOCATION=1>)
435+
target_compile_definitions(
436+
kfr INTERFACE $<BUILD_INTERFACE:KFR_MANAGED_ALLOCATION=1>)
427437
endif ()
428438

429439
set(KFR_DEBUG_INSTALL_SUFFIX
@@ -513,9 +523,8 @@ set(KFR_INSTALL_CMAKEDIR
513523
"${CMAKE_INSTALL_LIBDIR}/cmake/kfr"
514524
CACHE STRING "Path to KFR CMake files")
515525

516-
install(FILES
517-
${CMAKE_CURRENT_BINARY_DIR}/KFRConfigVersion.cmake
518-
DESTINATION ${KFR_INSTALL_CMAKEDIR})
526+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KFRConfigVersion.cmake
527+
DESTINATION ${KFR_INSTALL_CMAKEDIR})
519528

520529
configure_package_config_file(
521530
${CMAKE_CURRENT_LIST_DIR}/cmake/config.cmake.in
@@ -524,7 +533,8 @@ configure_package_config_file(
524533

525534
install(TARGETS kfr EXPORT KFRTargets)
526535

527-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KFRConfig.cmake DESTINATION "${KFR_INSTALL_CMAKEDIR}")
536+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KFRConfig.cmake
537+
DESTINATION "${KFR_INSTALL_CMAKEDIR}")
528538

529539
install(
530540
EXPORT KFRTargets

cmake/aarch64.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ set(CMAKE_SYSTEM_NAME Linux)
33
set(CMAKE_SYSTEM_PROCESSOR aarch64)
44

55
set(EMULATOR qemu-aarch64)
6-
set(QEMU_LD_PREFIX "/usr/aarch64-linux-gnu/" CACHE INTERNAL "")
6+
set(QEMU_LD_PREFIX
7+
"/usr/aarch64-linux-gnu/"
8+
CACHE INTERNAL "")
79
list(APPEND EMULATOR "-L")
810
list(APPEND EMULATOR ${QEMU_LD_PREFIX})
911

@@ -18,8 +20,12 @@ set(CMAKE_OBJDUMP llvm-objdump)
1820
set(CMAKE_RANLIB llvm-ranlib)
1921

2022
# Set compiler flags for AArch64
21-
set(CMAKE_C_FLAGS "--target=aarch64-linux-gnu -mcpu=cortex-a72" CACHE STRING "C flags")
22-
set(CMAKE_CXX_FLAGS "--target=aarch64-linux-gnu -mcpu=cortex-a72" CACHE STRING "C++ flags")
23+
set(CMAKE_C_FLAGS
24+
"--target=aarch64-linux-gnu -mcpu=cortex-a72"
25+
CACHE STRING "C flags")
26+
set(CMAKE_CXX_FLAGS
27+
"--target=aarch64-linux-gnu -mcpu=cortex-a72"
28+
CACHE STRING "C++ flags")
2329

2430
# Set the target environment path
2531
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)

cmake/add_kfr_library.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,20 @@ function (add_kfr_library)
2626
target_link_libraries(${LIB_NAME} INTERFACE ${LIB_NAME}_${ARCH})
2727
target_set_arch(${LIB_NAME}_${ARCH} PRIVATE ${ARCH})
2828
if (NOT ARCH STREQUAL BASE_ARCH)
29-
target_compile_definitions(${LIB_NAME}_${ARCH} PRIVATE KFR_SKIP_IF_NON_X86=1)
29+
target_compile_definitions(${LIB_NAME}_${ARCH}
30+
PRIVATE KFR_SKIP_IF_NON_X86=1)
3031
endif ()
3132
endforeach ()
3233
target_compile_definitions(${LIB_NAME}_${BASE_ARCH}
3334
PRIVATE KFR_BASE_ARCH=1)
34-
set_target_properties(${LIB_NAME}_${BASE_ARCH} PROPERTIES OUTPUT_NAME ${LIB_NAME})
35+
set_target_properties(${LIB_NAME}_${BASE_ARCH} PROPERTIES OUTPUT_NAME
36+
${LIB_NAME})
3537

3638
link_as_whole(${LIB_NAME} INTERFACE ${LIB_NAME}_${BASE_ARCH})
3739

3840
list(APPEND ${LIB_NAME}_TARGETS ${LIB_NAME})
39-
target_compile_definitions(${LIB_NAME} INTERFACE $<BUILD_INTERFACE:${LIB_PUBLIC_DEFINITIONS}>)
41+
target_compile_definitions(
42+
${LIB_NAME} INTERFACE $<BUILD_INTERFACE:${LIB_PUBLIC_DEFINITIONS}>)
4043
else ()
4144
add_library(${LIB_NAME} STATIC ${LIB_SOURCES})
4245
list(APPEND ${LIB_NAME}_LIBS ${LIB_NAME})
@@ -49,11 +52,11 @@ function (add_kfr_library)
4952
target_link_libraries(${LIB} PRIVATE ${LIB_LIBRARIES})
5053
target_link_libraries(${LIB} PUBLIC ${LIB_PUBLIC_LIBRARIES})
5154
target_compile_definitions(${LIB} PRIVATE ${LIB_DEFINITIONS})
52-
target_compile_definitions(${LIB} PUBLIC $<BUILD_INTERFACE:${LIB_PUBLIC_DEFINITIONS}>)
55+
target_compile_definitions(
56+
${LIB} PUBLIC $<BUILD_INTERFACE:${LIB_PUBLIC_DEFINITIONS}>)
5357
target_compile_options(${LIB} PRIVATE ${LIB_OPTIONS})
5458
target_include_directories(${LIB} PRIVATE ${LIB_INCLUDE_DIRECTORIES})
5559
endforeach ()
56-
5760

5861
set(${LIB_NAME}_LIBS
5962
${${LIB_NAME}_LIBS}

cmake/arm.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ set(CMAKE_SYSTEM_NAME Linux)
33
set(CMAKE_SYSTEM_PROCESSOR arm)
44

55
set(EMULATOR qemu-arm)
6-
set(QEMU_LD_PREFIX "/usr/arm-linux-gnueabihf/" CACHE INTERNAL "")
6+
set(QEMU_LD_PREFIX
7+
"/usr/arm-linux-gnueabihf/"
8+
CACHE INTERNAL "")
79
list(APPEND EMULATOR "-L")
810
list(APPEND EMULATOR ${QEMU_LD_PREFIX})
911

@@ -18,8 +20,12 @@ set(CMAKE_OBJDUMP llvm-objdump)
1820
set(CMAKE_RANLIB llvm-ranlib)
1921

2022
# Set compiler flags for ARM
21-
set(CMAKE_C_FLAGS "--target=arm-linux-gnueabihf -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard" CACHE STRING "C flags")
22-
set(CMAKE_CXX_FLAGS "--target=arm-linux-gnueabihf -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard" CACHE STRING "C++ flags")
23+
set(CMAKE_C_FLAGS
24+
"--target=arm-linux-gnueabihf -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard"
25+
CACHE STRING "C flags")
26+
set(CMAKE_CXX_FLAGS
27+
"--target=arm-linux-gnueabihf -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard"
28+
CACHE STRING "C++ flags")
2329

2430
# Set the target environment path
2531
set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf)

cmake/link_as_whole.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
21
function (link_as_whole TARGET TYPE LIBRARY)
32
if (APPLE)
4-
target_link_options(${TARGET} ${TYPE} "LINKER:-force_load,$<TARGET_FILE:${LIBRARY}>")
3+
target_link_options(${TARGET} ${TYPE}
4+
"LINKER:-force_load,$<TARGET_FILE:${LIBRARY}>")
55
elseif (MSVC)
66
target_link_options(${TARGET} ${TYPE}
77
/WHOLEARCHIVE:$<TARGET_FILE:${LIBRARY}>)
88
else ()
9-
target_link_options(${TARGET} ${TYPE} "LINKER:--push-state,--whole-archive,$<TARGET_FILE:${LIBRARY}>,--pop-state")
9+
target_link_options(
10+
${TARGET}
11+
${TYPE}
12+
"LINKER:--push-state,--whole-archive,$<TARGET_FILE:${LIBRARY}>,--pop-state"
13+
)
1014
endif ()
1115
endfunction ()

cmake/macos-merge-binaries.cmake

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ endfunction ()
6363

6464
# Function to compare two files for equality
6565
function (compare_files file1 file2 are_equal_var)
66-
execute_process(COMMAND cmp -s "${file1}" "${file2}" RESULT_VARIABLE cmp_result)
66+
execute_process(COMMAND cmp -s "${file1}" "${file2}"
67+
RESULT_VARIABLE cmp_result)
6768
if (cmp_result EQUAL 0)
6869
set(${are_equal_var}
6970
TRUE
@@ -114,43 +115,66 @@ function (merge_file arm64_file x64_file output_file)
114115

115116
# Ensure both files are either Mach-O/static lib or neither
116117
if (is_arm64_macho AND NOT is_x64_macho)
117-
message(FATAL_ERROR "File type mismatch: ${arm64_file} is Mach-O/static lib, but ${x64_file} is not")
118+
message(
119+
FATAL_ERROR
120+
"File type mismatch: ${arm64_file} is Mach-O/static lib, but ${x64_file} is not"
121+
)
118122
endif ()
119123
if (NOT is_arm64_macho AND is_x64_macho)
120-
message(FATAL_ERROR "File type mismatch: ${x64_file} is Mach-O/static lib, but ${arm64_file} is not")
124+
message(
125+
FATAL_ERROR
126+
"File type mismatch: ${x64_file} is Mach-O/static lib, but ${arm64_file} is not"
127+
)
121128
endif ()
122129

123130
if (is_arm64_macho AND is_x64_macho)
124131
# Run lipo to create fat binary
125-
execute_process(COMMAND "${LIPO}" -create "${arm64_file}" "${x64_file}" -output "${output_file}"
126-
RESULT_VARIABLE lipo_result)
132+
execute_process(
133+
COMMAND "${LIPO}" -create "${arm64_file}" "${x64_file}" -output
134+
"${output_file}" RESULT_VARIABLE lipo_result)
127135
if (NOT lipo_result EQUAL 0)
128-
message(FATAL_ERROR "Failed to merge ${arm64_file} and ${x64_file} with lipo")
136+
message(
137+
FATAL_ERROR
138+
"Failed to merge ${arm64_file} and ${x64_file} with lipo")
129139
endif ()
130-
message(STATUS "Merged ${arm64_file} and ${x64_file} into ${output_file}")
140+
message(
141+
STATUS "Merged ${arm64_file} and ${x64_file} into ${output_file}")
131142
else ()
132143
# Check for preference lists
133144
file_matches_preference("${arm64_file}" "${PREFER_X64}" prefer_x64)
134145
file_matches_preference("${arm64_file}" "${PREFER_ARM64}" prefer_arm64)
135146

136147
if (prefer_x64 AND prefer_arm64)
137-
message(FATAL_ERROR "File ${arm64_file} matches both PREFER_X64 and PREFER_ARM64 lists")
148+
message(
149+
FATAL_ERROR
150+
"File ${arm64_file} matches both PREFER_X64 and PREFER_ARM64 lists"
151+
)
138152
elseif (prefer_x64)
139153
file(COPY_FILE "${x64_file}" "${output_file}")
140-
message(STATUS "Copied ${x64_file} to ${output_file} (PREFER_X64 match)")
154+
message(
155+
STATUS "Copied ${x64_file} to ${output_file} (PREFER_X64 match)"
156+
)
141157
elseif (prefer_arm64)
142158
file(COPY_FILE "${arm64_file}" "${output_file}")
143-
message(STATUS "Copied ${arm64_file} to ${output_file} (PREFER_ARM64 match)")
159+
message(
160+
STATUS
161+
"Copied ${arm64_file} to ${output_file} (PREFER_ARM64 match)"
162+
)
144163
else ()
145164
# Compare files if not Mach-O or static library and no preference
146165
compare_files("${arm64_file}" "${x64_file}" files_equal)
147166
if (NOT files_equal)
148167
message(
149-
FATAL_ERROR "Non-Mach-O files differ: ${arm64_file} and ${x64_file}\nDiff output:\n${DIFF_OUTPUT}")
168+
FATAL_ERROR
169+
"Non-Mach-O files differ: ${arm64_file} and ${x64_file}\nDiff output:\n${DIFF_OUTPUT}"
170+
)
150171
endif ()
151172
# Copy x64 file
152173
file(COPY_FILE "${x64_file}" "${output_file}")
153-
message(STATUS "Copied ${x64_file} to ${output_file} (non-Mach-O or non-static library)")
174+
message(
175+
STATUS
176+
"Copied ${x64_file} to ${output_file} (non-Mach-O or non-static library)"
177+
)
154178
endif ()
155179
endif ()
156180
endfunction ()
@@ -198,7 +222,10 @@ function (process_directory arm64_base x64_base output_base)
198222
# Clean up temporary files
199223
file(REMOVE "${temp_arm64_list}" "${temp_x64_list}")
200224

201-
message(FATAL_ERROR "Directories have different sets of files. Diff output:\n${diff_output}")
225+
message(
226+
FATAL_ERROR
227+
"Directories have different sets of files. Diff output:\n${diff_output}"
228+
)
202229
endif ()
203230

204231
foreach (item ${arm64_items})

0 commit comments

Comments
 (0)