2021-04-02 10:57:46 +00:00
|
|
|
if(ARCH_AMD64)
|
2020-08-14 23:22:46 +00:00
|
|
|
option (ENABLE_CPUID "Enable libcpuid library (only internal)" ${ENABLE_LIBRARIES})
|
2021-04-02 10:57:46 +00:00
|
|
|
elseif(ENABLE_CPUID)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "libcpuid is only supported on x86_64")
|
2020-05-08 14:11:19 +00:00
|
|
|
set (ENABLE_CPUID 0)
|
2021-04-02 10:57:46 +00:00
|
|
|
endif()
|
2020-05-08 14:11:19 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
if (NOT ENABLE_CPUID)
|
2022-06-01 08:10:06 +00:00
|
|
|
message(STATUS "Not using cpuid")
|
2020-08-14 15:44:04 +00:00
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/libcpuid")
|
|
|
|
|
|
|
|
set (SRCS
|
2020-08-14 23:22:46 +00:00
|
|
|
"${LIBRARY_DIR}/libcpuid/asm-bits.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/cpuid_main.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/libcpuid_util.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/msrdriver.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/rdmsr.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/rdtsc.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/recog_amd.c"
|
|
|
|
"${LIBRARY_DIR}/libcpuid/recog_intel.c"
|
2020-08-14 15:44:04 +00:00
|
|
|
)
|
|
|
|
|
2022-01-20 14:19:47 +00:00
|
|
|
add_library (_cpuid ${SRCS})
|
2020-08-14 15:44:04 +00:00
|
|
|
|
2022-01-20 14:19:47 +00:00
|
|
|
target_include_directories (_cpuid SYSTEM PUBLIC "${LIBRARY_DIR}")
|
|
|
|
target_compile_definitions (_cpuid PRIVATE VERSION="v0.4.1")
|
2020-08-14 15:44:04 +00:00
|
|
|
|
2022-01-20 14:19:47 +00:00
|
|
|
add_library(ch_contrib::cpuid ALIAS _cpuid)
|