Skip to content

Commit

Permalink
cmake: use BLAKE3's cmake
Browse files Browse the repository at this point in the history
Added EXCLUDE_FROM_ALL to prevent gristing files in
the subdir.

Signed-off-by: Casey Bodley <[email protected]>
Signed-off-by: Matt Benjamin <[email protected]>
  • Loading branch information
cbodley authored and mattbenjamin committed Jul 3, 2024
1 parent 77f6997 commit 18ab9f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.
7 changes: 3 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,16 @@ if(HAS_GLIBCXX_ASSERTIONS AND CMAKE_BUILD_TYPE STREQUAL Debug)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D_GLIBCXX_ASSERTIONS>)
endif()

# add BLAKE3 before we clobber CMAKE_ASM_COMPILER
add_subdirectory(BLAKE3/c EXCLUDE_FROM_ALL)

include(SIMDExt)
if(HAVE_INTEL)
if(APPLE)
set(object_format "macho64")
else()
set(object_format "elf64")
endif()

set(SAVE_CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS})
set(SAVE_CMAKE_ASM_COMPILER ${CMAKE_ASM_COMPILER})

set(CMAKE_ASM_FLAGS "-f ${object_format}")
set(CMAKE_ASM_COMPILER ${PROJECT_SOURCE_DIR}/src/nasm-wrapper)
if(NOT WIN32)
Expand Down
31 changes: 2 additions & 29 deletions src/rgw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,6 @@ endfunction()

find_package(ICU 52.0 COMPONENTS uc REQUIRED)

set(blake3_srcs
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3.c
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_dispatch.c
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_portable.c)

if (HAVE_INTEL)
# restore compiler detected assembler, following use gas syntax
set(CMAKE_ASM_FLAGS ${SAVE_CMAKE_ASM_FLAGS})
set(CMAKE_ASM_COMPILER ${SAVE_CMAKE_ASM_COMPILER})
if(WIN32)
list(APPEND blake3_srcs
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_sse2_x86-64_windows_gnu.S
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_sse41_x86-64_windows_gnu.S
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_avx2_x86-64_windows_gnu.S
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_avx512_x86-64_windows_gnu.S)
else()
list(APPEND blake3_srcs
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3.c
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_dispatch.c
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_portable.c
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_sse2_x86-64_unix.S
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_sse41_x86-64_unix.S
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_avx2_x86-64_unix.S
${CMAKE_SOURCE_DIR}/src/BLAKE3/c/blake3_avx512_x86-64_unix.S)
endif()
endif()

set(librgw_common_srcs
services/svc_finisher.cc
services/svc_bi_rados.cc
Expand Down Expand Up @@ -84,7 +57,6 @@ set(librgw_common_srcs
services/svc_user_rados.cc
services/svc_zone.cc
services/svc_zone_utils.cc
${blake3_srcs}
rgw_account.cc
rgw_acl.cc
rgw_acl_s3.cc
Expand Down Expand Up @@ -333,7 +305,8 @@ target_link_libraries(rgw_common
RapidJSON::RapidJSON
Boost::context
${FMT_LIB}
OpenSSL::SSL)
OpenSSL::SSL
BLAKE3::blake3)
target_include_directories(rgw_common
PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw/services"
PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw"
Expand Down

0 comments on commit 18ab9f5

Please sign in to comment.