From db04cb83a83af5895607c9ec7afaeb2869987156 Mon Sep 17 00:00:00 2001 From: Ralph Urlus Date: Thu, 17 Oct 2024 16:44:53 +0200 Subject: [PATCH] STY: Format CMake files --- .../cmake/ConfigureTarget.cmake | 66 +++++++++---------- src/sparse_dot_topn_core/cmake/FindAvx.cmake | 2 +- src/sparse_dot_topn_core/cmake/FindSse.cmake | 2 +- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/sparse_dot_topn_core/cmake/ConfigureTarget.cmake b/src/sparse_dot_topn_core/cmake/ConfigureTarget.cmake index 8313f63..580710a 100644 --- a/src/sparse_dot_topn_core/cmake/ConfigureTarget.cmake +++ b/src/sparse_dot_topn_core/cmake/ConfigureTarget.cmake @@ -1,7 +1,7 @@ target_include_directories(_sparse_dot_topn_core PUBLIC ${SDTN_INCLUDE_DIR}) if(OpenMP_CXX_FOUND) - target_link_libraries(_sparse_dot_topn_core PUBLIC OpenMP::OpenMP_CXX) - target_compile_definitions(_sparse_dot_topn_core PRIVATE SDTN_OMP_ENABLED=TRUE) + target_link_libraries(_sparse_dot_topn_core PUBLIC OpenMP::OpenMP_CXX) + target_compile_definitions(_sparse_dot_topn_core PRIVATE SDTN_OMP_ENABLED=TRUE) if(APPLE) # store path to libomp found at build time in a variable get_target_property( @@ -78,7 +78,7 @@ target_compile_definitions(_sparse_dot_topn_core PRIVATE VERSION_INFO=${SKBUILD_ # -- Optional if(SDTN_ENABLE_DEVMODE) - target_compile_options(_sparse_dot_topn_core PRIVATE ${SDTN_DEVMODE_OPTIONS}) + target_compile_options(_sparse_dot_topn_core PRIVATE ${SDTN_DEVMODE_OPTIONS}) endif() # -- Options & Properties @@ -89,41 +89,41 @@ set_property(TARGET _sparse_dot_topn_core PROPERTY POSITION_INDEPENDENT_CODE ON) include(CheckCXXCompilerFlag) function(check_cxx_support FLAG DEST) - string(SUBSTRING ${FLAG} 1 -1 STRIPPED_FLAG) - string(REGEX REPLACE "=" "_" STRIPPED_FLAG ${STRIPPED_FLAG}) - string(TOUPPER ${STRIPPED_FLAG} STRIPPED_FLAG) - set(RES_VAR "${STRIPPED_FLAG}_SUPPORTED") - check_cxx_compiler_flag("${FLAG}" ${RES_VAR}) - if(${RES_VAR}) - set(${DEST} "${${DEST}} ${FLAG}" PARENT_SCOPE) - endif() + string(SUBSTRING ${FLAG} 1 -1 STRIPPED_FLAG) + string(REGEX REPLACE "=" "_" STRIPPED_FLAG ${STRIPPED_FLAG}) + string(TOUPPER ${STRIPPED_FLAG} STRIPPED_FLAG) + set(RES_VAR "${STRIPPED_FLAG}_SUPPORTED") + check_cxx_compiler_flag("${FLAG}" ${RES_VAR}) + if(${RES_VAR}) + set(${DEST} "${${DEST}} ${FLAG}" PARENT_SCOPE) + endif() endfunction() # -- Compiler Flags if (SDTN_ENABLE_ARCH_FLAGS AND "${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - set(SDTN_ARCHITECTURE_FLAGS "") - if (APPLE AND (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")) - # see https://github.com/google/highway/issues/745 - check_cxx_support("-march=native" SDTN_ARCHITECTURE_FLAGS) - else() - include(FindSse) - include(FindAvx) - SDTN_CHECK_FOR_SSE() - add_definitions(${SSE_DEFINITIONS}) - SDTN_CHECK_FOR_AVX() - string(APPEND SDTN_ARCHITECTURE_FLAGS "${SSE_FLAGS} ${AVX_FLAGS}") - endif() + set(SDTN_ARCHITECTURE_FLAGS "") + if (APPLE AND (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")) + # see https://github.com/google/highway/issues/745 + check_cxx_support("-march=native" SDTN_ARCHITECTURE_FLAGS) + else() + include(FindSse) + include(FindAvx) + SDTN_CHECK_FOR_SSE() + add_definitions(${SSE_DEFINITIONS}) + SDTN_CHECK_FOR_AVX() + string(APPEND SDTN_ARCHITECTURE_FLAGS "${SSE_FLAGS} ${AVX_FLAGS}") + endif() - if (NOT ${SDTN_ARCHITECTURE_FLAGS} STREQUAL "") - string(STRIP ${SDTN_ARCHITECTURE_FLAGS} SDTN_ARCHITECTURE_FLAGS) - message(STATUS "sparse-dot-topn | Enabled arch flags: ${SDTN_ARCHITECTURE_FLAGS}") - if (MSVC) - separate_arguments(SDTN_ARCHITECTURE_FLAGS WINDOWS_COMMAND "${SDTN_ARCHITECTURE_FLAGS}") - else() - separate_arguments(SDTN_ARCHITECTURE_FLAGS UNIX_COMMAND "${SDTN_ARCHITECTURE_FLAGS}") - endif() - target_compile_options(_sparse_dot_topn_core PRIVATE $<$:${SDTN_ARCHITECTURE_FLAGS}>) + if (NOT ${SDTN_ARCHITECTURE_FLAGS} STREQUAL "") + string(STRIP ${SDTN_ARCHITECTURE_FLAGS} SDTN_ARCHITECTURE_FLAGS) + message(STATUS "sparse-dot-topn | Enabled arch flags: ${SDTN_ARCHITECTURE_FLAGS}") + if (MSVC) + separate_arguments(SDTN_ARCHITECTURE_FLAGS WINDOWS_COMMAND "${SDTN_ARCHITECTURE_FLAGS}") else() - message(STATUS "sparse-dot-topn | Architecture flags enabled but no valid flags were found") + separate_arguments(SDTN_ARCHITECTURE_FLAGS UNIX_COMMAND "${SDTN_ARCHITECTURE_FLAGS}") endif() + target_compile_options(_sparse_dot_topn_core PRIVATE $<$:${SDTN_ARCHITECTURE_FLAGS}>) + else() + message(STATUS "sparse-dot-topn | Architecture flags enabled but no valid flags were found") + endif() endif() diff --git a/src/sparse_dot_topn_core/cmake/FindAvx.cmake b/src/sparse_dot_topn_core/cmake/FindAvx.cmake index 6cebabb..c122d83 100644 --- a/src/sparse_dot_topn_core/cmake/FindAvx.cmake +++ b/src/sparse_dot_topn_core/cmake/FindAvx.cmake @@ -1,4 +1,4 @@ -############################################################################### +# ############################################################################## # Check for the presence of AVX and figure out the flags to use for it. # This routine is a modified version of `PCL_CHECK_FOR_AVX` # Reference: https://github.com/PointCloudLibrary/pcl/blob/master/cmake/pcl_find_avx.cmake diff --git a/src/sparse_dot_topn_core/cmake/FindSse.cmake b/src/sparse_dot_topn_core/cmake/FindSse.cmake index 0832aa4..2ebed97 100644 --- a/src/sparse_dot_topn_core/cmake/FindSse.cmake +++ b/src/sparse_dot_topn_core/cmake/FindSse.cmake @@ -1,4 +1,4 @@ -############################################################################### +# ############################################################################## # Check for the presence of SSE and figure out the flags to use for it. # This routine is a modified version of `PCL_CHECK_FOR_SSE` # https://github.com/PointCloudLibrary/pcl/blob/master/cmake/pcl_find_sse.cmake