2018-09-16 03:06:54 +03:00
|
|
|
if (WITH_TLS)
|
|
|
|
set(OPENSSL_ROOT_DIR ${XMRIG_DEPS})
|
2018-09-22 16:01:27 +03:00
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
|
|
|
set(OPENSSL_MSVC_STATIC_RT TRUE)
|
|
|
|
|
2020-05-13 21:00:52 +08:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} crypt32)
|
2019-11-16 18:56:34 +07:00
|
|
|
elseif (APPLE)
|
|
|
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
2018-09-22 16:01:27 +03:00
|
|
|
endif()
|
2018-09-16 03:06:54 +03:00
|
|
|
|
2020-04-09 09:09:21 +03:00
|
|
|
if (BUILD_STATIC)
|
|
|
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2018-09-16 03:06:54 +03:00
|
|
|
find_package(OpenSSL)
|
|
|
|
|
|
|
|
if (OPENSSL_FOUND)
|
2020-03-18 20:09:11 +07:00
|
|
|
set(TLS_SOURCES
|
|
|
|
src/base/net/stratum/Tls.cpp
|
|
|
|
src/base/net/stratum/Tls.h
|
|
|
|
src/base/net/tls/ServerTls.cpp
|
|
|
|
src/base/net/tls/ServerTls.h
|
|
|
|
src/base/net/tls/TlsConfig.cpp
|
|
|
|
src/base/net/tls/TlsConfig.h
|
|
|
|
src/base/net/tls/TlsContext.cpp
|
|
|
|
src/base/net/tls/TlsContext.h
|
|
|
|
src/base/net/tls/TlsGen.cpp
|
|
|
|
src/base/net/tls/TlsGen.h
|
|
|
|
)
|
|
|
|
|
2018-09-16 03:06:54 +03:00
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
2019-04-09 14:06:56 +07:00
|
|
|
|
|
|
|
if (WITH_HTTP)
|
2020-03-18 20:09:11 +07:00
|
|
|
set(TLS_SOURCES ${TLS_SOURCES}
|
|
|
|
src/base/net/https/HttpsClient.cpp
|
|
|
|
src/base/net/https/HttpsClient.h
|
|
|
|
src/base/net/https/HttpsContext.cpp
|
|
|
|
src/base/net/https/HttpsContext.h
|
|
|
|
src/base/net/https/HttpsServer.cpp
|
|
|
|
src/base/net/https/HttpsServer.h
|
|
|
|
)
|
2019-04-09 14:06:56 +07:00
|
|
|
endif()
|
2018-09-16 03:06:54 +03:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "OpenSSL NOT found: use `-DWITH_TLS=OFF` to build without TLS support")
|
|
|
|
endif()
|
2019-03-16 02:07:26 +07:00
|
|
|
|
|
|
|
add_definitions(/DXMRIG_FEATURE_TLS)
|
2018-09-16 03:06:54 +03:00
|
|
|
else()
|
|
|
|
set(TLS_SOURCES "")
|
|
|
|
set(OPENSSL_LIBRARIES "")
|
2019-03-16 02:07:26 +07:00
|
|
|
remove_definitions(/DXMRIG_FEATURE_TLS)
|
2018-11-11 03:18:56 +07:00
|
|
|
|
2020-03-18 20:09:11 +07:00
|
|
|
if (WITH_HTTP)
|
|
|
|
set(TLS_SOURCES ${TLS_SOURCES}
|
|
|
|
src/base/net/http/HttpServer.cpp
|
|
|
|
src/base/net/http/HttpServer.h
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2018-11-11 03:18:56 +07:00
|
|
|
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
|
2018-09-16 03:06:54 +03:00
|
|
|
endif()
|