Ensure that OpenSSL is linked against needed Windows libraries.

GitOrigin-RevId: d2928c94ebe6565e155f81db8ccc24c4c5d69a54
This commit is contained in:
levlam 2020-07-28 01:34:35 +03:00
parent c1dd9ec1ba
commit ab5d35371b
5 changed files with 37 additions and 13 deletions

View File

@ -792,6 +792,13 @@ add_library(tdcore STATIC ${TDLIB_SOURCE})
target_include_directories(tdcore PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${TL_TD_AUTO_INCLUDE_DIR}>)
target_include_directories(tdcore SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
target_link_libraries(tdcore PUBLIC tdapi tdactor tdutils tdnet tddb PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
if (WIN32)
if (MINGW)
target_link_libraries(tdcore PRIVATE ws2_32 mswsock)
else()
target_link_libraries(tdcore PRIVATE ws2_32 Mswsock)
endif()
endif()
if (NOT CMAKE_CROSSCOMPILING)
add_dependencies(tdcore tl_generate_common)

View File

@ -8,6 +8,13 @@ endif()
#TODO: all benchmarks in one file
add_executable(bench_crypto bench_crypto.cpp)
target_link_libraries(bench_crypto PRIVATE tdutils ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
if (WIN32)
if (MINGW)
target_link_libraries(bench_crypto PRIVATE ws2_32 mswsock)
else()
target_link_libraries(bench_crypto PRIVATE ws2_32 Mswsock)
endif()
endif()
target_include_directories(bench_crypto SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
add_executable(bench_actor bench_actor.cpp)

View File

@ -21,6 +21,14 @@ add_library(tdsqlite STATIC ${SQLITE_SOURCE})
target_include_directories(tdsqlite PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_include_directories(tdsqlite SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
target_link_libraries(tdsqlite PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
if (WIN32)
if (MINGW)
target_link_libraries(tdsqlite PRIVATE ws2_32 mswsock)
else()
target_link_libraries(tdsqlite PRIVATE ws2_32 Mswsock)
endif()
endif()
target_compile_definitions(tdsqlite PRIVATE
-DSQLITE_DEFAULT_MEMSTATUS=0
-DSQLITE_OMIT_LOAD_EXTENSION

View File

@ -60,9 +60,9 @@ target_link_libraries(tdnet PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
if (WIN32)
if (MINGW)
target_link_libraries(tdnet PRIVATE crypt32)
target_link_libraries(tdnet PRIVATE ws2_32 mswsock crypt32)
else()
target_link_libraries(tdnet PRIVATE Crypt32)
target_link_libraries(tdnet PRIVATE ws2_32 Mswsock Crypt32)
endif()
endif()

View File

@ -300,17 +300,7 @@ set(TDUTILS_TEST_SOURCE
#RULES
#LIBRARIES
add_library(tdutils STATIC ${TDUTILS_SOURCE})
if (WIN32)
# find_library for system libraries doesn't work for UWP builds
# find_library(WS2_32_LIBRARY ws2_32)
# find_library(MSWSOCK_LIBRARY Mswsock)
# target_link_libraries(tdutils PRIVATE ${WS2_32_LIBRARY} ${MSWSOCK_LIBRARY})
if (MINGW)
target_link_libraries(tdutils PRIVATE ws2_32 mswsock normaliz psapi)
else()
target_link_libraries(tdutils PRIVATE ws2_32 Mswsock Normaliz psapi)
endif()
endif()
if (NOT CMAKE_CROSSCOMPILING AND TDUTILS_MIME_TYPE)
add_dependencies(tdutils tdmime_auto)
endif()
@ -337,6 +327,18 @@ if (ABSL_FOUND)
target_link_libraries(tdutils SYSTEM PUBLIC absl::flat_hash_map absl::flat_hash_set absl::hash)
endif()
if (WIN32)
# find_library for system libraries doesn't work for UWP builds
# find_library(WS2_32_LIBRARY ws2_32)
# find_library(MSWSOCK_LIBRARY Mswsock)
# target_link_libraries(tdutils PRIVATE ${WS2_32_LIBRARY} ${MSWSOCK_LIBRARY})
if (MINGW)
target_link_libraries(tdutils PRIVATE ws2_32 mswsock normaliz psapi)
else()
target_link_libraries(tdutils PRIVATE ws2_32 Mswsock Normaliz psapi)
endif()
endif()
if (ANDROID)
target_link_libraries(tdutils PRIVATE log)
endif()