Add optional libcpuid support to cmake.
This commit is contained in:
parent
1678dc1d6d
commit
0a6d70c499
2 changed files with 29 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(xmrig C)
|
project(xmrig C)
|
||||||
|
|
||||||
|
option(WITH_LIBCPUID "Use Libcpuid library" ON)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
compat.h
|
compat.h
|
||||||
algo/cryptonight/cryptonight.h
|
algo/cryptonight/cryptonight.h
|
||||||
|
@ -94,18 +96,27 @@ endif()
|
||||||
include_directories(compat/jansson)
|
include_directories(compat/jansson)
|
||||||
add_subdirectory(compat/jansson)
|
add_subdirectory(compat/jansson)
|
||||||
|
|
||||||
find_package(CURL REQUIRED)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
if (CURL_FOUND)
|
find_package(CURL REQUIRED)
|
||||||
include_directories(${CURL_INCLUDE_DIRS})
|
include_directories(${CURL_INCLUDE_DIRS})
|
||||||
add_definitions(/DCURL_STATICLIB)
|
add_definitions(/DCURL_STATICLIB)
|
||||||
link_directories(${CURL_LIBRARIES})
|
link_directories(${CURL_LIBRARIES})
|
||||||
|
|
||||||
|
if (WITH_LIBCPUID)
|
||||||
|
find_package(CPUID REQUIRED)
|
||||||
|
include_directories(${CPUID_INCLUDE_DIRS})
|
||||||
|
link_directories(${CPUID_LIBRARIES})
|
||||||
|
|
||||||
|
set(CPUID_LIB cpuid)
|
||||||
|
else()
|
||||||
|
add_definitions(/DXMRIG_NO_LIBCPUID)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
add_subdirectory(algo/cryptonight/bmi2)
|
add_subdirectory(algo/cryptonight/bmi2)
|
||||||
add_executable(xmrig ${HEADERS} ${HEADERS_CRYPTO} ${SOURCES} ${SOURCES_CRYPTO} ${HEADERS_UTILS} ${SOURCES_UTILS} ${HEADERS_COMPAT} ${SOURCES_COMPAT} ${SOURCES_OS})
|
add_executable(xmrig ${HEADERS} ${HEADERS_CRYPTO} ${SOURCES} ${SOURCES_CRYPTO} ${HEADERS_UTILS} ${SOURCES_UTILS} ${HEADERS_COMPAT} ${SOURCES_COMPAT} ${SOURCES_OS})
|
||||||
target_link_libraries(xmrig jansson curl cryptonight_av3_aesni_bmi2 ${EXTRA_LIBS})
|
target_link_libraries(xmrig jansson curl cryptonight_av3_aesni_bmi2 ${CPUID_LIB} ${EXTRA_LIBS})
|
||||||
else()
|
else()
|
||||||
set(CRYPTONIGHT32
|
set(CRYPTONIGHT32
|
||||||
algo/cryptonight/i686/cryptonight_av1_aesni.c
|
algo/cryptonight/i686/cryptonight_av1_aesni.c
|
||||||
|
|
12
cmake/FindCPUID.cmake
Normal file
12
cmake/FindCPUID.cmake
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
find_path(CPUID_INCLUDE_DIR NAMES libcpuid.h)
|
||||||
|
find_library(CPUID_LIBRARY NAMES cpuid)
|
||||||
|
|
||||||
|
mark_as_advanced(CPUID_INCLUDE_DIR CPUID_LIBRARY)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPUID DEFAULT_MSG CPUID_LIBRARY CPUID_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(CURL_FOUND)
|
||||||
|
set(CPUID_LIBRARIES ${CPUID_LIBRARY})
|
||||||
|
set(CPUID_INCLUDE_DIRS ${CPUID_INCLUDE_DIR})
|
||||||
|
endif()
|
Loading…
Reference in a new issue