2021-06-13 22:38:48 +02:00
|
|
|
if ((CMAKE_MAJOR_VERSION LESS 3) OR (CMAKE_VERSION VERSION_LESS "3.0.2"))
|
|
|
|
message(FATAL_ERROR "CMake >= 3.0.2 is required")
|
|
|
|
endif()
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-01-24 01:03:18 +01:00
|
|
|
if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
|
|
|
set(CMAKE_INSTALL_LIBDIR "lib")
|
|
|
|
endif()
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
if (NOT OPENSSL_FOUND)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
2018-02-17 22:24:34 +01:00
|
|
|
find_package(ZLIB REQUIRED)
|
2018-12-31 20:04:05 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#SOURCE SETS
|
|
|
|
set(TDNET_SOURCE
|
|
|
|
td/net/GetHostByNameActor.cpp
|
|
|
|
td/net/HttpChunkedByteFlow.cpp
|
|
|
|
td/net/HttpConnectionBase.cpp
|
|
|
|
td/net/HttpContentLengthByteFlow.cpp
|
|
|
|
td/net/HttpFile.cpp
|
|
|
|
td/net/HttpInboundConnection.cpp
|
|
|
|
td/net/HttpOutboundConnection.cpp
|
2018-07-26 15:49:18 +02:00
|
|
|
td/net/HttpProxy.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/net/HttpQuery.cpp
|
|
|
|
td/net/HttpReader.cpp
|
|
|
|
td/net/Socks5.cpp
|
2018-08-15 14:41:42 +02:00
|
|
|
td/net/SslStream.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/net/TcpListener.cpp
|
2018-07-26 02:28:02 +02:00
|
|
|
td/net/TransparentProxy.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/net/Wget.cpp
|
|
|
|
|
|
|
|
td/net/GetHostByNameActor.h
|
|
|
|
td/net/HttpChunkedByteFlow.h
|
|
|
|
td/net/HttpConnectionBase.h
|
|
|
|
td/net/HttpContentLengthByteFlow.h
|
|
|
|
td/net/HttpFile.h
|
|
|
|
td/net/HttpHeaderCreator.h
|
|
|
|
td/net/HttpInboundConnection.h
|
|
|
|
td/net/HttpOutboundConnection.h
|
2018-07-26 15:49:18 +02:00
|
|
|
td/net/HttpProxy.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/net/HttpQuery.h
|
|
|
|
td/net/HttpReader.h
|
|
|
|
td/net/NetStats.h
|
|
|
|
td/net/Socks5.h
|
2018-08-15 14:41:42 +02:00
|
|
|
td/net/SslStream.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/net/TcpListener.h
|
2018-07-26 02:28:02 +02:00
|
|
|
td/net/TransparentProxy.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/net/Wget.h
|
|
|
|
)
|
|
|
|
|
2021-09-24 12:41:22 +02:00
|
|
|
if (APPLE_WATCH)
|
2021-03-27 03:19:22 +01:00
|
|
|
set(TDNET_SOURCE
|
2021-03-26 16:52:45 +01:00
|
|
|
${TDNET_SOURCE}
|
|
|
|
td/net/DarwinHttp.mm
|
|
|
|
td/net/DarwinHttp.h
|
|
|
|
)
|
|
|
|
set_source_files_properties(td/net/DarwinHttp.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
|
2021-03-26 16:04:01 +01:00
|
|
|
endif()
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
#RULES
|
|
|
|
#LIBRARIES
|
|
|
|
|
|
|
|
add_library(tdnet STATIC ${TDNET_SOURCE})
|
|
|
|
target_include_directories(tdnet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
2018-10-15 10:23:51 +02:00
|
|
|
target_include_directories(tdnet SYSTEM PRIVATE $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
|
2020-10-13 00:30:50 +02:00
|
|
|
target_link_libraries(tdnet PUBLIC tdutils tdactor)
|
2019-06-28 13:03:06 +02:00
|
|
|
if (NOT EMSCRIPTEN)
|
2019-07-22 06:01:51 +02:00
|
|
|
target_link_libraries(tdnet PRIVATE ${OPENSSL_SSL_LIBRARY})
|
2019-06-28 13:03:06 +02:00
|
|
|
endif()
|
2020-10-13 00:30:50 +02:00
|
|
|
target_link_libraries(tdnet PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-08-15 22:05:06 +02:00
|
|
|
if (WIN32)
|
2020-07-26 15:49:09 +02:00
|
|
|
if (MINGW)
|
2020-07-28 00:34:35 +02:00
|
|
|
target_link_libraries(tdnet PRIVATE ws2_32 mswsock crypt32)
|
2020-07-26 15:49:09 +02:00
|
|
|
else()
|
2020-07-28 00:34:35 +02:00
|
|
|
target_link_libraries(tdnet PRIVATE ws2_32 Mswsock Crypt32)
|
2020-07-26 15:49:09 +02:00
|
|
|
endif()
|
2018-08-15 22:05:06 +02:00
|
|
|
endif()
|
|
|
|
|
2021-09-24 12:41:22 +02:00
|
|
|
if (APPLE_WATCH)
|
2021-03-26 16:52:45 +01:00
|
|
|
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
|
|
|
|
target_link_libraries(tdnet PRIVATE ${FOUNDATION_LIBRARY})
|
|
|
|
endif()
|
2021-03-26 16:04:01 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
install(TARGETS tdnet EXPORT TdTargets
|
2020-01-24 00:01:07 +01:00
|
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
2018-12-31 20:04:05 +01:00
|
|
|
)
|