| 1 |
cmake_minimum_required(VERSION 3.9...3.18 FATAL_ERROR) |
| 2 |
|
| 3 |
# respect C_EXTENSIONS OFF without explicitly setting C_STANDARD |
| 4 |
if (POLICY CMP0128) |
| 5 |
cmake_policy(SET CMP0128 NEW) |
| 6 |
endif() |
| 7 |
# mark_as_advanced does not implicitly create UNINITIALIZED cache entries |
| 8 |
if (POLICY CMP0102) |
| 9 |
cmake_policy(SET CMP0102 NEW) |
| 10 |
endif() |
| 11 |
|
| 12 |
project(libblake3 |
| 13 |
VERSION 1.8.7 |
| 14 |
DESCRIPTION "BLAKE3 C implementation" |
| 15 |
LANGUAGES C CXX ASM |
| 16 |
) |
| 17 |
|
| 18 |
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") |
| 19 |
|
| 20 |
option(BLAKE3_USE_TBB "Enable oneTBB parallelism" OFF) |
| 21 |
option(BLAKE3_FETCH_TBB "Allow fetching oneTBB from GitHub if not found on system" OFF) |
| 22 |
|
| 23 |
include(CTest) |
| 24 |
include(FeatureSummary) |
| 25 |
include(GNUInstallDirs) |
| 26 |
include(BLAKE3/Utils) |
| 27 |
|
| 28 |
add_subdirectory(dependencies) |
| 29 |
|
| 30 |
# architecture lists for which to enable assembly / SIMD sources |
| 31 |
set(BLAKE3_AMD64_NAMES amd64 AMD64 x86_64) |
| 32 |
set(BLAKE3_X86_NAMES i686 x86 X86) |
| 33 |
set(BLAKE3_ARMv8_NAMES aarch64 AArch64 arm64 ARM64 armv8 armv8a) |
| 34 |
# default SIMD compiler flag configuration (can be overridden by toolchains or CLI) |
| 35 |
if(MSVC) |
| 36 |
if (CMAKE_C_COMPILER_ID STREQUAL "Clang") |
| 37 |
set(BLAKE3_CFLAGS_SSE2 "-msse2" CACHE STRING "the compiler flags to enable SSE2") |
| 38 |
set(BLAKE3_CFLAGS_SSE4.1 "-msse4.1" CACHE STRING "the compiler flags to enable SSE4.1") |
| 39 |
set(BLAKE3_CFLAGS_AVX2 "-mavx2" CACHE STRING "the compiler flags to enable AVX2") |
| 40 |
set(BLAKE3_CFLAGS_AVX512 "-mavx512f -mavx512vl" CACHE STRING "the compiler flags to enable AVX512") |
| 41 |
else() |
| 42 |
set(BLAKE3_CFLAGS_SSE2 "/arch:SSE2" CACHE STRING "the compiler flags to enable SSE2") |
| 43 |
# MSVC has no dedicated sse4.1 flag (see https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170) |
| 44 |
set(BLAKE3_CFLAGS_SSE4.1 "/arch:AVX" CACHE STRING "the compiler flags to enable SSE4.1") |
| 45 |
set(BLAKE3_CFLAGS_AVX2 "/arch:AVX2" CACHE STRING "the compiler flags to enable AVX2") |
| 46 |
set(BLAKE3_CFLAGS_AVX512 "/arch:AVX512" CACHE STRING "the compiler flags to enable AVX512") |
| 47 |
endif() |
| 48 |
|
| 49 |
set(BLAKE3_AMD64_ASM_SOURCES |
| 50 |
blake3_avx2_x86-64_windows_msvc.asm |
| 51 |
blake3_avx512_x86-64_windows_msvc.asm |
| 52 |
blake3_sse2_x86-64_windows_msvc.asm |
| 53 |
blake3_sse41_x86-64_windows_msvc.asm |
| 54 |
) |
| 55 |
|
| 56 |
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" |
| 57 |
OR CMAKE_C_COMPILER_ID STREQUAL "Clang" |
| 58 |
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang") |
| 59 |
set(BLAKE3_CFLAGS_SSE2 "-msse2" CACHE STRING "the compiler flags to enable SSE2") |
| 60 |
set(BLAKE3_CFLAGS_SSE4.1 "-msse4.1" CACHE STRING "the compiler flags to enable SSE4.1") |
| 61 |
set(BLAKE3_CFLAGS_AVX2 "-mavx2" CACHE STRING "the compiler flags to enable AVX2") |
| 62 |
set(BLAKE3_CFLAGS_AVX512 "-mavx512f -mavx512vl" CACHE STRING "the compiler flags to enable AVX512") |
| 63 |
|
| 64 |
if (WIN32 OR CYGWIN) |
| 65 |
set(BLAKE3_AMD64_ASM_SOURCES |
| 66 |
blake3_avx2_x86-64_windows_gnu.S |
| 67 |
blake3_avx512_x86-64_windows_gnu.S |
| 68 |
blake3_sse2_x86-64_windows_gnu.S |
| 69 |
blake3_sse41_x86-64_windows_gnu.S |
| 70 |
) |
| 71 |
|
| 72 |
elseif(UNIX) |
| 73 |
set(BLAKE3_AMD64_ASM_SOURCES |
| 74 |
blake3_avx2_x86-64_unix.S |
| 75 |
blake3_avx512_x86-64_unix.S |
| 76 |
blake3_sse2_x86-64_unix.S |
| 77 |
blake3_sse41_x86-64_unix.S |
| 78 |
) |
| 79 |
endif() |
| 80 |
|
| 81 |
if (CMAKE_SYSTEM_PROCESSOR IN_LIST BLAKE3_ARMv8_NAMES |
| 82 |
AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) |
| 83 |
# 32-bit ARMv8 needs NEON to be enabled explicitly |
| 84 |
set(BLAKE3_CFLAGS_NEON "-mfpu=neon" CACHE STRING "the compiler flags to enable NEON") |
| 85 |
endif() |
| 86 |
endif() |
| 87 |
|
| 88 |
mark_as_advanced(BLAKE3_CFLAGS_SSE2 BLAKE3_CFLAGS_SSE4.1 BLAKE3_CFLAGS_AVX2 BLAKE3_CFLAGS_AVX512 BLAKE3_CFLAGS_NEON) |
| 89 |
mark_as_advanced(BLAKE3_AMD64_ASM_SOURCES) |
| 90 |
|
| 91 |
message(STATUS "BLAKE3 SIMD configuration: ${CMAKE_C_COMPILER_ARCHITECTURE_ID}") |
| 92 |
if(MSVC AND DEFINED CMAKE_C_COMPILER_ARCHITECTURE_ID) |
| 93 |
if(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "[Xx]86") |
| 94 |
set(BLAKE3_SIMD_TYPE "x86-intrinsics" CACHE STRING "the SIMD acceleration type to use") |
| 95 |
|
| 96 |
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "[Xx]64") |
| 97 |
set(BLAKE3_SIMD_TYPE "amd64-asm" CACHE STRING "the SIMD acceleration type to use") |
| 98 |
|
| 99 |
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "[Aa][Rr][Mm]64") |
| 100 |
set(BLAKE3_SIMD_TYPE "neon-intrinsics" CACHE STRING "the SIMD acceleration type to use") |
| 101 |
|
| 102 |
else() |
| 103 |
set(BLAKE3_SIMD_TYPE "none" CACHE STRING "the SIMD acceleration type to use") |
| 104 |
endif() |
| 105 |
|
| 106 |
elseif(CMAKE_SYSTEM_PROCESSOR IN_LIST BLAKE3_AMD64_NAMES) |
| 107 |
set(BLAKE3_SIMD_TYPE "amd64-asm" CACHE STRING "the SIMD acceleration type to use") |
| 108 |
|
| 109 |
elseif(CMAKE_SYSTEM_PROCESSOR IN_LIST BLAKE3_X86_NAMES |
| 110 |
AND DEFINED BLAKE3_CFLAGS_SSE2 |
| 111 |
AND DEFINED BLAKE3_CFLAGS_SSE4.1 |
| 112 |
AND DEFINED BLAKE3_CFLAGS_AVX2 |
| 113 |
AND DEFINED BLAKE3_CFLAGS_AVX512) |
| 114 |
set(BLAKE3_SIMD_TYPE "x86-intrinsics" CACHE STRING "the SIMD acceleration type to use") |
| 115 |
|
| 116 |
elseif((CMAKE_SYSTEM_PROCESSOR IN_LIST BLAKE3_ARMv8_NAMES |
| 117 |
OR ANDROID_ABI STREQUAL "armeabi-v7a" |
| 118 |
OR BLAKE3_USE_NEON_INTRINSICS) |
| 119 |
AND (DEFINED BLAKE3_CFLAGS_NEON |
| 120 |
OR CMAKE_SIZEOF_VOID_P EQUAL 8)) |
| 121 |
set(BLAKE3_SIMD_TYPE "neon-intrinsics" CACHE STRING "the SIMD acceleration type to use") |
| 122 |
|
| 123 |
else() |
| 124 |
set(BLAKE3_SIMD_TYPE "none" CACHE STRING "the SIMD acceleration type to use") |
| 125 |
endif() |
| 126 |
|
| 127 |
mark_as_advanced(BLAKE3_SIMD_TYPE) |
| 128 |
|
| 129 |
# library target |
| 130 |
add_library(blake3 |
| 131 |
blake3.c |
| 132 |
blake3_dispatch.c |
| 133 |
blake3_portable.c |
| 134 |
) |
| 135 |
add_library(BLAKE3::blake3 ALIAS blake3) |
| 136 |
|
| 137 |
# library configuration |
| 138 |
set(PKG_CONFIG_CFLAGS) |
| 139 |
if (BUILD_SHARED_LIBS) |
| 140 |
target_compile_definitions(blake3 |
| 141 |
PUBLIC BLAKE3_DLL |
| 142 |
PRIVATE BLAKE3_DLL_EXPORTS |
| 143 |
) |
| 144 |
list(APPEND PKG_CONFIG_CFLAGS -DBLAKE3_DLL) |
| 145 |
endif() |
| 146 |
target_include_directories(blake3 PUBLIC |
| 147 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> |
| 148 |
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
| 149 |
) |
| 150 |
set_target_properties(blake3 PROPERTIES |
| 151 |
VERSION ${PROJECT_VERSION} |
| 152 |
SOVERSION 0 |
| 153 |
C_VISIBILITY_PRESET hidden |
| 154 |
C_EXTENSIONS OFF |
| 155 |
) |
| 156 |
target_compile_features(blake3 PUBLIC c_std_99) |
| 157 |
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) |
| 158 |
target_compile_features(blake3 PUBLIC cxx_std_20) |
| 159 |
# else: add it further below through `BLAKE3_CMAKE_CXXFLAGS_*` |
| 160 |
endif() |
| 161 |
|
| 162 |
# ensure C_EXTENSIONS OFF is respected without overriding CMAKE_C_STANDARD |
| 163 |
# which may be set by the user or toolchain file |
| 164 |
if (NOT POLICY CMP0128 AND NOT DEFINED CMAKE_C_STANDARD) |
| 165 |
set_target_properties(blake3 PROPERTIES C_STANDARD 99) |
| 166 |
endif() |
| 167 |
|
| 168 |
# optional SIMD sources |
| 169 |
if(BLAKE3_SIMD_TYPE STREQUAL "amd64-asm") |
| 170 |
if (NOT DEFINED BLAKE3_AMD64_ASM_SOURCES) |
| 171 |
message(FATAL_ERROR "BLAKE3_SIMD_TYPE is set to 'amd64-asm' but no assembly sources are available for the target architecture.") |
| 172 |
endif() |
| 173 |
set(BLAKE3_SIMD_AMD64_ASM ON) |
| 174 |
|
| 175 |
if(MSVC) |
| 176 |
enable_language(ASM_MASM) |
| 177 |
endif() |
| 178 |
|
| 179 |
target_sources(blake3 PRIVATE ${BLAKE3_AMD64_ASM_SOURCES}) |
| 180 |
|
| 181 |
elseif(BLAKE3_SIMD_TYPE STREQUAL "x86-intrinsics") |
| 182 |
if (NOT DEFINED BLAKE3_CFLAGS_SSE2 |
| 183 |
OR NOT DEFINED BLAKE3_CFLAGS_SSE4.1 |
| 184 |
OR NOT DEFINED BLAKE3_CFLAGS_AVX2 |
| 185 |
OR NOT DEFINED BLAKE3_CFLAGS_AVX512) |
| 186 |
message(FATAL_ERROR "BLAKE3_SIMD_TYPE is set to 'x86-intrinsics' but no compiler flags are available for the target architecture.") |
| 187 |
endif() |
| 188 |
set(BLAKE3_SIMD_X86_INTRINSICS ON) |
| 189 |
|
| 190 |
target_sources(blake3 PRIVATE |
| 191 |
blake3_avx2.c |
| 192 |
blake3_avx512.c |
| 193 |
blake3_sse2.c |
| 194 |
blake3_sse41.c |
| 195 |
) |
| 196 |
set_source_files_properties(blake3_avx2.c PROPERTIES COMPILE_FLAGS "${BLAKE3_CFLAGS_AVX2}") |
| 197 |
set_source_files_properties(blake3_avx512.c PROPERTIES COMPILE_FLAGS "${BLAKE3_CFLAGS_AVX512}") |
| 198 |
set_source_files_properties(blake3_sse2.c PROPERTIES COMPILE_FLAGS "${BLAKE3_CFLAGS_SSE2}") |
| 199 |
set_source_files_properties(blake3_sse41.c PROPERTIES COMPILE_FLAGS "${BLAKE3_CFLAGS_SSE4.1}") |
| 200 |
|
| 201 |
elseif(BLAKE3_SIMD_TYPE STREQUAL "neon-intrinsics") |
| 202 |
set(BLAKE3_SIMD_NEON_INTRINSICS ON) |
| 203 |
|
| 204 |
target_sources(blake3 PRIVATE |
| 205 |
blake3_neon.c |
| 206 |
) |
| 207 |
target_compile_definitions(blake3 PRIVATE |
| 208 |
BLAKE3_USE_NEON=1 |
| 209 |
) |
| 210 |
|
| 211 |
if (DEFINED BLAKE3_CFLAGS_NEON) |
| 212 |
set_source_files_properties(blake3_neon.c PROPERTIES COMPILE_FLAGS "${BLAKE3_CFLAGS_NEON}") |
| 213 |
endif() |
| 214 |
|
| 215 |
elseif(BLAKE3_SIMD_TYPE STREQUAL "none") |
| 216 |
target_compile_definitions(blake3 PRIVATE |
| 217 |
BLAKE3_USE_NEON=0 |
| 218 |
BLAKE3_NO_SSE2 |
| 219 |
BLAKE3_NO_SSE41 |
| 220 |
BLAKE3_NO_AVX2 |
| 221 |
BLAKE3_NO_AVX512 |
| 222 |
) |
| 223 |
|
| 224 |
else() |
| 225 |
message(FATAL_ERROR "BLAKE3_SIMD_TYPE is set to an unknown value: '${BLAKE3_SIMD_TYPE}'") |
| 226 |
endif() |
| 227 |
|
| 228 |
if(BLAKE3_USE_TBB) |
| 229 |
find_package(TBB 2021.11.0 QUIET) |
| 230 |
if(NOT TBB_FOUND AND NOT TARGET TBB::tbb) |
| 231 |
message(WARNING |
| 232 |
"oneTBB not found; disabling BLAKE3_USE_TBB\n" |
| 233 |
"Enable BLAKE3_FETCH_TBB to automatically fetch and build oneTBB" |
| 234 |
) |
| 235 |
set(BLAKE3_USE_TBB OFF) |
| 236 |
else() |
| 237 |
target_sources(blake3 |
| 238 |
PRIVATE |
| 239 |
blake3_tbb.cpp) |
| 240 |
target_link_libraries(blake3 |
| 241 |
PUBLIC |
| 242 |
# Make shared TBB a transitive dependency. The consuming program is technically not required |
| 243 |
# to link TBB in order for libblake3 to function but we do this in order to prevent the |
| 244 |
# possibility of multiple separate TBB runtimes being linked into a final program in case |
| 245 |
# the consuming program also happens to already use TBB. |
| 246 |
TBB::tbb) |
| 247 |
target_compile_definitions(blake3 |
| 248 |
PUBLIC |
| 249 |
BLAKE3_USE_TBB) |
| 250 |
endif() |
| 251 |
if (CMAKE_SIZEOF_VOID_P EQUAL 8) |
| 252 |
set(TBB_PC_NAME tbb) |
| 253 |
else() |
| 254 |
set(TBB_PC_NAME tbb32) |
| 255 |
endif() |
| 256 |
list(APPEND PKG_CONFIG_REQUIRES "${TBB_PC_NAME} >= ${TBB_VERSION}") |
| 257 |
list(APPEND PKG_CONFIG_CFLAGS -DBLAKE3_USE_TBB) |
| 258 |
include(CheckCXXSymbolExists) |
| 259 |
check_cxx_symbol_exists(_LIBCPP_VERSION "version" BLAKE3_HAVE_LIBCPP) |
| 260 |
check_cxx_symbol_exists(__GLIBCXX__ "version" BLAKE3_HAVE_GLIBCXX) |
| 261 |
if(BLAKE3_HAVE_GLIBCXX) |
| 262 |
list(APPEND PKG_CONFIG_LIBS -lstdc++) |
| 263 |
elseif(BLAKE3_HAVE_LIBCPP) |
| 264 |
list(APPEND PKG_CONFIG_LIBS -lc++) |
| 265 |
endif() |
| 266 |
endif() |
| 267 |
|
| 268 |
if(BLAKE3_USE_TBB) |
| 269 |
# Define some scratch variables for building appropriate flags per compiler |
| 270 |
if(CMAKE_VERSION VERSION_LESS 3.12) |
| 271 |
set(APPEND BLAKE3_CXX_STANDARD_FLAGS_GNU -std=c++20) |
| 272 |
set(APPEND BLAKE3_CXX_STANDARD_FLAGS_MSVC /std:c++20) |
| 273 |
endif() |
| 274 |
|
| 275 |
set(BLAKE3_CXXFLAGS_GNU "-fno-exceptions;-fno-rtti;${BLAKE3_CXX_STANDARD_FLAGS_GNU}" CACHE STRING "C++ flags used for compiling private BLAKE3 library components with GNU-like compiler frontends.") |
| 276 |
set(BLAKE3_CXXFLAGS_MSVC "/EHs-c-;/GR-;${BLAKE3_CXX_STANDARD_FLAGS_MSVC}" CACHE STRING "C++ flags used for compiling private BLAKE3 library components with MSVC-like compiler frontends.") |
| 277 |
|
| 278 |
if(BLAKE3_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") |
| 279 |
target_compile_options(blake3 PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${BLAKE3_CXXFLAGS_GNU}>) |
| 280 |
elseif(BLAKE3_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") |
| 281 |
target_compile_options(blake3 PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${BLAKE3_CXXFLAGS_MSVC}>) |
| 282 |
endif() |
| 283 |
|
| 284 |
# Undefine scratch variables |
| 285 |
unset(BLAKE3_CXX_STANDARD_FLAGS_GNU) |
| 286 |
unset(BLAKE3_CXX_STANDARD_FLAGS_MSVC) |
| 287 |
unset(BLAKE3_CXXFLAGS_GNU) |
| 288 |
unset(BLAKE3_CXXFLAGS_MSVC) |
| 289 |
endif() |
| 290 |
|
| 291 |
# cmake install support |
| 292 |
install(FILES blake3.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") |
| 293 |
install(TARGETS blake3 EXPORT blake3-targets |
| 294 |
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 295 |
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 296 |
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 297 |
) |
| 298 |
install(EXPORT blake3-targets |
| 299 |
NAMESPACE BLAKE3:: |
| 300 |
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/blake3" |
| 301 |
) |
| 302 |
|
| 303 |
include(CMakePackageConfigHelpers) |
| 304 |
configure_package_config_file(blake3-config.cmake.in |
| 305 |
"${CMAKE_CURRENT_BINARY_DIR}/blake3-config.cmake" |
| 306 |
|
| 307 |
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/blake3" |
| 308 |
) |
| 309 |
write_basic_package_version_file( |
| 310 |
"${CMAKE_CURRENT_BINARY_DIR}/blake3-config-version.cmake" |
| 311 |
VERSION ${libblake3_VERSION} |
| 312 |
COMPATIBILITY SameMajorVersion |
| 313 |
) |
| 314 |
install(FILES |
| 315 |
"${CMAKE_CURRENT_BINARY_DIR}/blake3-config.cmake" |
| 316 |
"${CMAKE_CURRENT_BINARY_DIR}/blake3-config-version.cmake" |
| 317 |
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/blake3" |
| 318 |
) |
| 319 |
|
| 320 |
# Function for joining paths known from most languages |
| 321 |
# |
| 322 |
# SPDX-License-Identifier: (MIT OR CC0-1.0) |
| 323 |
# Copyright 2020 Jan Tojnar |
| 324 |
# https://github.com/jtojnar/cmake-snips |
| 325 |
# |
| 326 |
# Modelled after Python’s os.path.join |
| 327 |
# https://docs.python.org/3.7/library/os.path.html#os.path.join |
| 328 |
# Windows not supported |
| 329 |
function(join_paths joined_path first_path_segment) |
| 330 |
set(temp_path "${first_path_segment}") |
| 331 |
foreach(current_segment IN LISTS ARGN) |
| 332 |
if(NOT ("${current_segment}" STREQUAL "")) |
| 333 |
if(IS_ABSOLUTE "${current_segment}") |
| 334 |
set(temp_path "${current_segment}") |
| 335 |
else() |
| 336 |
set(temp_path "${temp_path}/${current_segment}") |
| 337 |
endif() |
| 338 |
endif() |
| 339 |
endforeach() |
| 340 |
set(${joined_path} "${temp_path}" PARENT_SCOPE) |
| 341 |
endfunction() |
| 342 |
|
| 343 |
# In-place rewrite a string and join by `sep`. |
| 344 |
# |
| 345 |
# TODO: Replace function with list(JOIN) when updating to CMake 3.12 |
| 346 |
function(join_pkg_config_field sep requires) |
| 347 |
set(_requires "${${requires}}") # avoid shadowing issues, e.g. "${requires}"=len |
| 348 |
list(LENGTH "${requires}" len) |
| 349 |
set(idx 1) |
| 350 |
foreach(req IN LISTS _requires) |
| 351 |
string(APPEND acc "${req}") |
| 352 |
if(idx LESS len) |
| 353 |
string(APPEND acc "${sep}") |
| 354 |
endif() |
| 355 |
math(EXPR idx "${idx} + 1") |
| 356 |
endforeach() |
| 357 |
set("${requires}" "${acc}" PARENT_SCOPE) |
| 358 |
endfunction() |
| 359 |
|
| 360 |
# pkg-config support |
| 361 |
join_pkg_config_field(", " PKG_CONFIG_REQUIRES) |
| 362 |
join_pkg_config_field(" " PKG_CONFIG_LIBS) |
| 363 |
join_pkg_config_field(" " PKG_CONFIG_CFLAGS) |
| 364 |
join_paths(PKG_CONFIG_INSTALL_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") |
| 365 |
join_paths(PKG_CONFIG_INSTALL_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") |
| 366 |
configure_file(libblake3.pc.in libblake3.pc @ONLY) |
| 367 |
install(FILES "${CMAKE_BINARY_DIR}/libblake3.pc" |
| 368 |
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") |
| 369 |
|
| 370 |
# print feature summary |
| 371 |
# add_feature_info cannot directly use the BLAKE3_SIMD_TYPE :( |
| 372 |
add_feature_info("AMD64 assembly" BLAKE3_SIMD_AMD64_ASM "The library uses hand written amd64 SIMD assembly.") |
| 373 |
add_feature_info("x86 SIMD intrinsics" BLAKE3_SIMD_X86_INTRINSICS "The library uses x86 SIMD intrinsics.") |
| 374 |
add_feature_info("NEON SIMD intrinsics" BLAKE3_SIMD_NEON_INTRINSICS "The library uses NEON SIMD intrinsics.") |
| 375 |
add_feature_info("oneTBB parallelism" BLAKE3_USE_TBB "The library uses oneTBB parallelism.") |
| 376 |
feature_summary(WHAT ENABLED_FEATURES) |
| 377 |
|
| 378 |
if(BLAKE3_EXAMPLES) |
| 379 |
include(BLAKE3/Examples) |
| 380 |
endif() |
| 381 |
if(BLAKE3_TESTING) |
| 382 |
include(BLAKE3/Testing) |
| 383 |
endif() |