2018-12-31 20:04:05 +01:00
|
|
|
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
|
|
|
|
2020-06-26 01:24:13 +02:00
|
|
|
option(TDUTILS_MIME_TYPE "Generate mime types conversion; requires gperf" ON)
|
2020-06-24 13:47:36 +02: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 ZLIB_FOUND)
|
|
|
|
find_package(ZLIB)
|
|
|
|
endif()
|
|
|
|
if (ZLIB_FOUND)
|
|
|
|
set(TD_HAVE_ZLIB 1)
|
|
|
|
message(STATUS "Found ZLIB: ${ZLIB_INCLUDE_DIR} ${ZLIB_LIBRARIES}")
|
2018-02-17 22:24:34 +01:00
|
|
|
|
|
|
|
# OpenSSL internally depends on zlib
|
|
|
|
if (NOT OPENSSL_FOUND)
|
|
|
|
find_package(OpenSSL)
|
|
|
|
endif()
|
|
|
|
if (OPENSSL_FOUND)
|
|
|
|
set(TD_HAVE_OPENSSL 1)
|
|
|
|
endif()
|
2018-12-31 20:04:05 +01:00
|
|
|
endif()
|
|
|
|
|
2018-12-19 15:48:39 +01:00
|
|
|
if (CRC32C_FOUND)
|
|
|
|
set(TD_HAVE_CRC32C 1)
|
|
|
|
endif()
|
|
|
|
|
2019-07-06 13:29:15 +02:00
|
|
|
if (ABSL_FOUND)
|
|
|
|
set(TD_HAVE_ABSL 1)
|
|
|
|
endif()
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
configure_file(td/utils/config.h.in td/utils/config.h @ONLY)
|
|
|
|
|
|
|
|
add_subdirectory(generate)
|
|
|
|
|
|
|
|
# TDUTILS
|
|
|
|
set_source_files_properties(${TDMIME_AUTO} PROPERTIES GENERATED TRUE)
|
|
|
|
if (CLANG OR GCC)
|
|
|
|
set_property(SOURCE ${TDMIME_AUTO} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-conversion")
|
|
|
|
elseif (MSVC)
|
|
|
|
set_property(SOURCE ${TDMIME_AUTO} APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4267")
|
|
|
|
endif()
|
|
|
|
if (CLANG)
|
|
|
|
set_property(SOURCE ${TDMIME_AUTO} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-deprecated-register")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TDUTILS_SOURCE
|
2018-02-12 09:40:52 +01:00
|
|
|
td/utils/port/Clocks.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/FileFd.cpp
|
|
|
|
td/utils/port/IPAddress.cpp
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/port/MemoryMapping.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/path.cpp
|
2021-04-30 00:24:42 +02:00
|
|
|
td/utils/port/platform.cpp
|
2018-09-10 01:37:05 +02:00
|
|
|
td/utils/port/PollFlags.cpp
|
2020-06-15 00:50:03 +02:00
|
|
|
td/utils/port/rlimit.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/ServerSocketFd.cpp
|
|
|
|
td/utils/port/signals.cpp
|
|
|
|
td/utils/port/sleep.cpp
|
|
|
|
td/utils/port/SocketFd.cpp
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/port/stacktrace.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/Stat.cpp
|
2018-08-17 15:41:51 +02:00
|
|
|
td/utils/port/StdStreams.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/thread_local.cpp
|
2018-09-07 02:41:21 +02:00
|
|
|
td/utils/port/UdpSocketFd.cpp
|
2020-06-19 02:08:42 +02:00
|
|
|
td/utils/port/uname.cpp
|
2020-06-15 02:14:08 +02:00
|
|
|
td/utils/port/user.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/wstring_convert.cpp
|
|
|
|
|
|
|
|
td/utils/port/detail/Epoll.cpp
|
|
|
|
td/utils/port/detail/EventFdBsd.cpp
|
|
|
|
td/utils/port/detail/EventFdLinux.cpp
|
|
|
|
td/utils/port/detail/EventFdWindows.cpp
|
2018-09-11 16:43:43 +02:00
|
|
|
td/utils/port/detail/Iocp.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/KQueue.cpp
|
2018-09-07 02:41:21 +02:00
|
|
|
td/utils/port/detail/NativeFd.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/Poll.cpp
|
|
|
|
td/utils/port/detail/Select.cpp
|
|
|
|
td/utils/port/detail/ThreadIdGuard.cpp
|
2019-08-26 14:35:08 +02:00
|
|
|
td/utils/port/detail/ThreadPthread.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/WineventPoll.cpp
|
|
|
|
|
|
|
|
${TDMIME_AUTO}
|
|
|
|
|
|
|
|
td/utils/base64.cpp
|
|
|
|
td/utils/BigNum.cpp
|
|
|
|
td/utils/buffer.cpp
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/BufferedUdp.cpp
|
2019-02-12 16:45:14 +01:00
|
|
|
td/utils/check.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/crypto.cpp
|
2020-10-10 21:37:36 +02:00
|
|
|
td/utils/ExitGuard.cpp
|
2018-08-16 15:56:16 +02:00
|
|
|
td/utils/FileLog.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/filesystem.cpp
|
|
|
|
td/utils/find_boundary.cpp
|
|
|
|
td/utils/Gzip.cpp
|
|
|
|
td/utils/GzipByteFlow.cpp
|
|
|
|
td/utils/Hints.cpp
|
|
|
|
td/utils/HttpUrl.cpp
|
|
|
|
td/utils/JsonBuilder.cpp
|
|
|
|
td/utils/logging.cpp
|
2018-02-03 17:49:39 +01:00
|
|
|
td/utils/misc.cpp
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/MpmcQueue.cpp
|
2020-06-17 02:04:36 +02:00
|
|
|
td/utils/OptionParser.cpp
|
2019-11-26 19:13:38 +01:00
|
|
|
td/utils/PathView.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Random.cpp
|
2019-08-12 13:45:57 +02:00
|
|
|
td/utils/SharedSlice.cpp
|
2019-08-13 22:52:54 +02:00
|
|
|
td/utils/Slice.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/StackAllocator.cpp
|
|
|
|
td/utils/Status.cpp
|
2018-02-03 17:49:39 +01:00
|
|
|
td/utils/StringBuilder.cpp
|
2020-06-26 01:24:13 +02:00
|
|
|
td/utils/tests.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Time.cpp
|
|
|
|
td/utils/Timer.cpp
|
2020-06-24 13:47:36 +02:00
|
|
|
td/utils/TsFileLog.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/tl_parsers.cpp
|
2018-07-31 01:49:42 +02:00
|
|
|
td/utils/translit.cpp
|
2021-05-18 16:24:32 +02:00
|
|
|
td/utils/TsCerr.cpp
|
2019-08-13 22:52:54 +02:00
|
|
|
td/utils/TsFileLog.cpp
|
2021-05-18 16:40:37 +02:00
|
|
|
td/utils/TsLog.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/unicode.cpp
|
|
|
|
td/utils/utf8.cpp
|
|
|
|
|
|
|
|
td/utils/port/Clocks.h
|
|
|
|
td/utils/port/config.h
|
|
|
|
td/utils/port/CxCli.h
|
|
|
|
td/utils/port/EventFd.h
|
|
|
|
td/utils/port/EventFdBase.h
|
|
|
|
td/utils/port/FileFd.h
|
2020-12-23 09:25:27 +01:00
|
|
|
td/utils/port/FromApp.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/IPAddress.h
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/port/IoSlice.h
|
|
|
|
td/utils/port/MemoryMapping.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/path.h
|
|
|
|
td/utils/port/platform.h
|
|
|
|
td/utils/port/Poll.h
|
|
|
|
td/utils/port/PollBase.h
|
2018-09-10 01:37:05 +02:00
|
|
|
td/utils/port/PollFlags.h
|
2020-06-15 00:50:03 +02:00
|
|
|
td/utils/port/rlimit.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/RwMutex.h
|
|
|
|
td/utils/port/ServerSocketFd.h
|
|
|
|
td/utils/port/signals.h
|
|
|
|
td/utils/port/sleep.h
|
|
|
|
td/utils/port/SocketFd.h
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/port/stacktrace.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/Stat.h
|
2018-08-17 15:41:51 +02:00
|
|
|
td/utils/port/StdStreams.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/thread.h
|
|
|
|
td/utils/port/thread_local.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/port/UdpSocketFd.h
|
2020-06-19 02:08:42 +02:00
|
|
|
td/utils/port/uname.h
|
2020-06-15 02:14:08 +02:00
|
|
|
td/utils/port/user.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/wstring_convert.h
|
|
|
|
|
|
|
|
td/utils/port/detail/Epoll.h
|
|
|
|
td/utils/port/detail/EventFdBsd.h
|
|
|
|
td/utils/port/detail/EventFdLinux.h
|
|
|
|
td/utils/port/detail/EventFdWindows.h
|
2018-09-11 16:43:43 +02:00
|
|
|
td/utils/port/detail/Iocp.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/KQueue.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/port/detail/NativeFd.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/Poll.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/port/detail/PollableFd.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/Select.h
|
2020-06-15 02:50:38 +02:00
|
|
|
td/utils/port/detail/skip_eintr.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/port/detail/ThreadIdGuard.h
|
|
|
|
td/utils/port/detail/ThreadPthread.h
|
|
|
|
td/utils/port/detail/ThreadStl.h
|
|
|
|
td/utils/port/detail/WineventPoll.h
|
|
|
|
|
|
|
|
td/utils/AesCtrByteFlow.h
|
2021-01-01 13:59:53 +01:00
|
|
|
td/utils/algorithm.h
|
2018-12-19 22:57:56 +01:00
|
|
|
td/utils/as.h
|
2020-06-26 01:24:13 +02:00
|
|
|
td/utils/AtomicRead.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/base64.h
|
|
|
|
td/utils/benchmark.h
|
|
|
|
td/utils/BigNum.h
|
2018-12-19 15:48:39 +01:00
|
|
|
td/utils/bits.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/buffer.h
|
|
|
|
td/utils/BufferedFd.h
|
|
|
|
td/utils/BufferedReader.h
|
2018-09-07 02:41:21 +02:00
|
|
|
td/utils/BufferedUdp.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/ByteFlow.h
|
2019-05-01 15:13:48 +02:00
|
|
|
td/utils/CancellationToken.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/ChangesProcessor.h
|
2019-02-12 16:45:14 +01:00
|
|
|
td/utils/check.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Closure.h
|
2021-05-17 15:53:35 +02:00
|
|
|
td/utils/CombinedLog.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/common.h
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/ConcurrentHashTable.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Container.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/Context.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/crypto.h
|
2018-09-07 02:41:21 +02:00
|
|
|
td/utils/DecTree.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/Destructor.h
|
2018-09-07 02:41:21 +02:00
|
|
|
td/utils/Enumerator.h
|
2019-07-06 13:29:15 +02:00
|
|
|
td/utils/EpochBasedMemoryReclamation.h
|
2020-10-10 21:37:36 +02:00
|
|
|
td/utils/ExitGuard.h
|
2018-08-16 15:56:16 +02:00
|
|
|
td/utils/FileLog.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/filesystem.h
|
|
|
|
td/utils/find_boundary.h
|
|
|
|
td/utils/FloodControlFast.h
|
|
|
|
td/utils/FloodControlStrict.h
|
|
|
|
td/utils/format.h
|
|
|
|
td/utils/Gzip.h
|
|
|
|
td/utils/GzipByteFlow.h
|
2019-07-07 02:05:30 +02:00
|
|
|
td/utils/Hash.h
|
|
|
|
td/utils/HashMap.h
|
|
|
|
td/utils/HashSet.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/HazardPointers.h
|
|
|
|
td/utils/Heap.h
|
|
|
|
td/utils/Hints.h
|
|
|
|
td/utils/HttpUrl.h
|
|
|
|
td/utils/int_types.h
|
|
|
|
td/utils/invoke.h
|
|
|
|
td/utils/JsonBuilder.h
|
|
|
|
td/utils/List.h
|
|
|
|
td/utils/logging.h
|
|
|
|
td/utils/MemoryLog.h
|
|
|
|
td/utils/misc.h
|
|
|
|
td/utils/MovableValue.h
|
|
|
|
td/utils/MpmcQueue.h
|
|
|
|
td/utils/MpmcWaiter.h
|
|
|
|
td/utils/MpscPollableQueue.h
|
|
|
|
td/utils/MpscLinkQueue.h
|
|
|
|
td/utils/Named.h
|
2021-05-18 16:06:22 +02:00
|
|
|
td/utils/NullLog.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/ObjectPool.h
|
|
|
|
td/utils/Observer.h
|
|
|
|
td/utils/optional.h
|
2020-06-17 02:04:36 +02:00
|
|
|
td/utils/OptionParser.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/OrderedEventsProcessor.h
|
|
|
|
td/utils/overloaded.h
|
|
|
|
td/utils/Parser.h
|
|
|
|
td/utils/PathView.h
|
|
|
|
td/utils/queue.h
|
|
|
|
td/utils/Random.h
|
|
|
|
td/utils/ScopeGuard.h
|
2018-02-03 17:49:39 +01:00
|
|
|
td/utils/SharedObjectPool.h
|
2019-08-13 22:52:54 +02:00
|
|
|
td/utils/SharedSlice.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Slice-decl.h
|
|
|
|
td/utils/Slice.h
|
2021-05-17 02:24:54 +02:00
|
|
|
td/utils/SliceBuilder.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/Span.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/SpinLock.h
|
|
|
|
td/utils/StackAllocator.h
|
|
|
|
td/utils/Status.h
|
2020-06-24 13:47:36 +02:00
|
|
|
td/utils/StealingQueue.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Storer.h
|
|
|
|
td/utils/StorerBase.h
|
|
|
|
td/utils/StringBuilder.h
|
|
|
|
td/utils/tests.h
|
2019-08-13 22:52:54 +02:00
|
|
|
td/utils/ThreadLocalStorage.h
|
2019-07-21 20:07:07 +02:00
|
|
|
td/utils/ThreadSafeCounter.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/Time.h
|
|
|
|
td/utils/TimedStat.h
|
|
|
|
td/utils/Timer.h
|
2020-06-24 13:47:36 +02:00
|
|
|
td/utils/TsFileLog.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/tl_helpers.h
|
|
|
|
td/utils/tl_parsers.h
|
|
|
|
td/utils/tl_storers.h
|
2018-07-31 01:49:42 +02:00
|
|
|
td/utils/translit.h
|
2021-05-18 16:24:32 +02:00
|
|
|
td/utils/TsCerr.h
|
2019-08-13 22:52:54 +02:00
|
|
|
td/utils/TsFileLog.h
|
2020-06-09 17:40:36 +02:00
|
|
|
td/utils/TsList.h
|
2021-05-18 16:40:37 +02:00
|
|
|
td/utils/TsLog.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/type_traits.h
|
2018-12-19 22:18:53 +01:00
|
|
|
td/utils/UInt.h
|
2019-07-21 20:07:07 +02:00
|
|
|
td/utils/uint128.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/unicode.h
|
2018-09-27 16:40:04 +02:00
|
|
|
td/utils/unique_ptr.h
|
2018-12-31 20:04:05 +01:00
|
|
|
td/utils/utf8.h
|
|
|
|
td/utils/Variant.h
|
2018-08-13 19:15:09 +02:00
|
|
|
td/utils/VectorQueue.h
|
2018-12-31 20:04:05 +01:00
|
|
|
)
|
|
|
|
|
2020-06-24 13:47:36 +02:00
|
|
|
if (TDUTILS_MIME_TYPE)
|
|
|
|
set(TDUTILS_SOURCE
|
|
|
|
${TDUTILS_SOURCE}
|
|
|
|
td/utils/MimeType.cpp
|
|
|
|
td/utils/MimeType.h
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
set(TDUTILS_TEST_SOURCE
|
2020-10-09 16:35:53 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/bitmask.cpp
|
2018-08-13 19:15:09 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/buffer.cpp
|
2019-07-06 13:29:15 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/ConcurrentHashMap.cpp
|
2019-07-21 20:07:07 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/crypto.cpp
|
2018-03-06 14:25:36 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/Enumerator.cpp
|
2020-06-26 01:24:13 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/EpochBasedMemoryReclamation.cpp
|
2018-09-07 02:41:21 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/filesystem.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/gzip.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/HazardPointers.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/heap.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/json.cpp
|
2020-06-09 17:40:36 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/List.cpp
|
2019-08-12 13:45:57 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/log.cpp
|
2018-09-07 02:41:21 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/misc.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/MpmcQueue.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/MpmcWaiter.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/MpscLinkQueue.cpp
|
2020-06-17 02:04:36 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/OptionParser.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/OrderedEventsProcessor.cpp
|
2018-08-13 19:15:09 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/port.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/pq.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/SharedObjectPool.cpp
|
2019-08-12 13:45:57 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/SharedSlice.cpp
|
2020-06-24 13:47:36 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/StealingQueue.cpp
|
2018-12-31 20:04:05 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/variant.cpp
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
|
|
|
#RULES
|
|
|
|
#LIBRARIES
|
|
|
|
add_library(tdutils STATIC ${TDUTILS_SOURCE})
|
2020-07-28 00:34:35 +02:00
|
|
|
|
2020-06-24 13:47:36 +02:00
|
|
|
if (NOT CMAKE_CROSSCOMPILING AND TDUTILS_MIME_TYPE)
|
2018-12-31 20:04:05 +01:00
|
|
|
add_dependencies(tdutils tdmime_auto)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (DEFINED CMAKE_THREAD_LIBS_INIT)
|
|
|
|
target_link_libraries(tdutils PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
endif()
|
|
|
|
target_include_directories(tdutils PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
|
|
|
|
|
|
|
|
if (OPENSSL_FOUND)
|
2018-02-17 22:24:34 +01:00
|
|
|
target_link_libraries(tdutils PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
|
2018-12-31 20:04:05 +01:00
|
|
|
target_include_directories(tdutils SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
|
2020-10-11 22:48:17 +02:00
|
|
|
|
2020-10-12 16:20:54 +02:00
|
|
|
if (WIN32)
|
|
|
|
if (MINGW)
|
|
|
|
target_link_libraries(tdutils PRIVATE ws2_32 mswsock crypt32)
|
|
|
|
else()
|
|
|
|
target_link_libraries(tdutils PRIVATE ws2_32 Mswsock Crypt32)
|
|
|
|
endif()
|
2020-10-11 22:48:17 +02:00
|
|
|
endif()
|
2018-12-31 20:04:05 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (ZLIB_FOUND)
|
|
|
|
target_link_libraries(tdutils PRIVATE ${ZLIB_LIBRARIES})
|
|
|
|
target_include_directories(tdutils SYSTEM PRIVATE ${ZLIB_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
|
2018-12-19 15:48:39 +01:00
|
|
|
if (CRC32C_FOUND)
|
|
|
|
target_link_libraries(tdutils PRIVATE crc32c)
|
|
|
|
endif()
|
2019-07-06 13:29:15 +02:00
|
|
|
if (ABSL_FOUND)
|
2020-06-26 01:24:13 +02:00
|
|
|
target_link_libraries(tdutils SYSTEM PUBLIC absl::flat_hash_map absl::flat_hash_set absl::hash)
|
2019-07-06 13:29:15 +02:00
|
|
|
endif()
|
|
|
|
|
2020-07-28 00:34:35 +02:00
|
|
|
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()
|
2020-09-14 22:32:13 +02:00
|
|
|
if (NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
2020-10-11 02:37:45 +02:00
|
|
|
target_link_libraries(tdutils PRIVATE shell32 crypt32)
|
2020-09-14 22:32:13 +02:00
|
|
|
endif()
|
2020-07-28 00:34:35 +02:00
|
|
|
endif()
|
|
|
|
|
2019-07-06 13:29:15 +02:00
|
|
|
if (ANDROID)
|
|
|
|
target_link_libraries(tdutils PRIVATE log)
|
|
|
|
endif()
|
2018-12-19 15:48:39 +01:00
|
|
|
|
2021-04-30 00:48:01 +02:00
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
2019-08-02 18:06:53 +02:00
|
|
|
target_link_libraries(tdutils PUBLIC /usr/pkg/gcc5/i486--netbsdelf/lib/libatomic.so)
|
|
|
|
endif()
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
install(TARGETS tdutils 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
|
|
|
)
|