2016-05-02 20:38:12 +02:00
|
|
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
|
|
|
|
2008-09-28 02:18:03 +02:00
|
|
|
project(libtorrent)
|
2016-09-15 05:22:57 +02:00
|
|
|
set (SOVERSION "10")
|
2016-07-20 20:29:24 +02:00
|
|
|
set (VERSION "1.2.0")
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2016-05-29 18:58:16 +02:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${libtorrent_SOURCE_DIR}/cmake/Modules)
|
|
|
|
|
2008-09-28 02:18:03 +02:00
|
|
|
set(sources
|
2010-10-10 20:43:58 +02:00
|
|
|
web_connection_base
|
2008-09-28 02:18:03 +02:00
|
|
|
alert
|
2013-04-09 04:38:11 +02:00
|
|
|
alert_manager
|
2009-01-15 18:09:36 +01:00
|
|
|
allocator
|
2015-09-18 06:23:45 +02:00
|
|
|
announce_entry
|
2008-09-28 02:18:03 +02:00
|
|
|
assert
|
2009-09-16 06:41:35 +02:00
|
|
|
bandwidth_limit
|
|
|
|
bandwidth_manager
|
|
|
|
bandwidth_queue_entry
|
2015-03-12 06:20:12 +01:00
|
|
|
bdecode
|
2016-04-20 13:50:57 +02:00
|
|
|
bitfield
|
2014-07-06 21:18:00 +02:00
|
|
|
block_cache
|
2010-12-24 02:31:41 +01:00
|
|
|
bloom_filter
|
2011-08-14 01:01:38 +02:00
|
|
|
chained_buffer
|
2014-10-23 00:06:56 +02:00
|
|
|
choker
|
2015-02-28 20:51:15 +01:00
|
|
|
close_reason
|
2015-04-26 20:46:45 +02:00
|
|
|
cpuid
|
2014-10-15 05:01:39 +02:00
|
|
|
crc32c
|
2008-09-28 02:18:03 +02:00
|
|
|
create_torrent
|
|
|
|
disk_buffer_holder
|
|
|
|
entry
|
|
|
|
error_code
|
|
|
|
file_storage
|
2015-07-16 03:53:03 +02:00
|
|
|
file_progress
|
2008-09-28 02:18:03 +02:00
|
|
|
lazy_bdecode
|
|
|
|
escape_string
|
2012-08-26 17:26:17 +02:00
|
|
|
string_util
|
2008-09-28 02:18:03 +02:00
|
|
|
file
|
2017-04-11 06:52:46 +02:00
|
|
|
path
|
2016-10-25 14:03:26 +02:00
|
|
|
fingerprint
|
2008-09-28 02:18:03 +02:00
|
|
|
gzip
|
2013-05-08 09:57:16 +02:00
|
|
|
hasher
|
2015-04-21 02:23:00 +02:00
|
|
|
hex
|
2008-09-28 02:18:03 +02:00
|
|
|
http_connection
|
|
|
|
http_stream
|
|
|
|
http_parser
|
2009-08-20 05:19:12 +02:00
|
|
|
i2p_stream
|
2008-09-28 02:18:03 +02:00
|
|
|
identify_client
|
|
|
|
ip_filter
|
2016-11-07 13:40:09 +01:00
|
|
|
ip_notifier
|
2013-01-02 00:12:16 +01:00
|
|
|
ip_voter
|
2017-07-21 05:19:28 +02:00
|
|
|
listen_socket_handle
|
2014-07-06 21:18:00 +02:00
|
|
|
performance_counters
|
|
|
|
peer_class
|
|
|
|
peer_class_set
|
2008-09-28 02:18:03 +02:00
|
|
|
peer_connection
|
|
|
|
bt_peer_connection
|
|
|
|
web_peer_connection
|
2008-12-30 04:54:07 +01:00
|
|
|
http_seed_connection
|
2015-07-02 06:13:26 +02:00
|
|
|
peer_connection_handle
|
2008-09-28 02:18:03 +02:00
|
|
|
instantiate_connection
|
2015-04-24 08:06:41 +02:00
|
|
|
merkle
|
2008-09-28 02:18:03 +02:00
|
|
|
natpmp
|
2014-07-06 21:18:00 +02:00
|
|
|
part_file
|
2010-11-29 02:33:05 +01:00
|
|
|
packet_buffer
|
2008-09-28 02:18:03 +02:00
|
|
|
piece_picker
|
2014-07-06 21:18:00 +02:00
|
|
|
platform_util
|
|
|
|
proxy_base
|
2014-10-26 08:34:31 +01:00
|
|
|
peer_list
|
2010-03-16 07:14:22 +01:00
|
|
|
puff
|
2011-02-26 08:55:51 +01:00
|
|
|
random
|
2014-11-23 07:14:47 +01:00
|
|
|
receive_buffer
|
2016-03-12 23:57:56 +01:00
|
|
|
read_resume_data
|
2017-03-05 15:31:28 +01:00
|
|
|
write_resume_data
|
2014-07-06 21:18:00 +02:00
|
|
|
request_blocks
|
2015-03-21 01:12:40 +01:00
|
|
|
resolve_links
|
2014-10-15 05:01:39 +02:00
|
|
|
resolver
|
2008-09-28 02:18:03 +02:00
|
|
|
session
|
2014-08-26 06:51:09 +02:00
|
|
|
session_call
|
2015-06-28 23:12:27 +02:00
|
|
|
session_handle
|
2008-09-28 02:18:03 +02:00
|
|
|
session_impl
|
2015-01-06 09:08:49 +01:00
|
|
|
session_settings
|
2017-04-26 05:00:41 +02:00
|
|
|
session_udp_sockets
|
2015-08-25 04:18:10 +02:00
|
|
|
proxy_settings
|
2014-07-06 21:18:00 +02:00
|
|
|
session_stats
|
|
|
|
settings_pack
|
2016-05-03 14:29:27 +02:00
|
|
|
sha1_hash
|
2009-09-16 05:46:36 +02:00
|
|
|
socket_io
|
2015-08-25 04:18:10 +02:00
|
|
|
socket_type
|
2008-09-28 02:18:03 +02:00
|
|
|
socks5_stream
|
|
|
|
stat
|
2014-07-06 21:18:00 +02:00
|
|
|
stat_cache
|
2008-09-28 02:18:03 +02:00
|
|
|
storage
|
2017-01-22 08:38:52 +01:00
|
|
|
storage_piece_set
|
2017-01-11 06:42:10 +01:00
|
|
|
storage_utils
|
2009-11-25 07:55:34 +01:00
|
|
|
time
|
2012-05-16 06:34:18 +02:00
|
|
|
timestamp_history
|
2008-09-28 02:18:03 +02:00
|
|
|
torrent
|
|
|
|
torrent_handle
|
|
|
|
torrent_info
|
2014-07-06 21:18:00 +02:00
|
|
|
torrent_peer
|
|
|
|
torrent_peer_allocator
|
2016-04-08 03:44:24 +02:00
|
|
|
torrent_status
|
2008-09-28 02:18:03 +02:00
|
|
|
tracker_manager
|
|
|
|
http_tracker_connection
|
2012-03-20 04:53:07 +01:00
|
|
|
utf8
|
2008-09-28 02:18:03 +02:00
|
|
|
udp_tracker_connection
|
|
|
|
udp_socket
|
|
|
|
upnp
|
2012-05-16 06:34:18 +02:00
|
|
|
utp_socket_manager
|
2012-05-16 06:23:47 +02:00
|
|
|
utp_stream
|
2008-09-28 02:18:03 +02:00
|
|
|
file_pool
|
|
|
|
lsd
|
2014-07-06 21:18:00 +02:00
|
|
|
disk_io_job
|
2017-01-22 00:36:51 +01:00
|
|
|
disk_job_fence
|
2014-07-06 21:18:00 +02:00
|
|
|
disk_job_pool
|
2011-07-31 04:24:36 +02:00
|
|
|
disk_buffer_pool
|
2008-09-28 02:18:03 +02:00
|
|
|
disk_io_thread
|
2016-06-16 02:49:28 +02:00
|
|
|
disk_io_thread_pool
|
2008-09-28 02:18:03 +02:00
|
|
|
enum_net
|
|
|
|
broadcast_socket
|
|
|
|
magnet_uri
|
|
|
|
parse_url
|
2008-11-14 06:25:56 +01:00
|
|
|
ConvertUTF
|
2014-05-03 23:10:44 +02:00
|
|
|
xml_parse
|
2015-11-20 03:56:51 +01:00
|
|
|
version
|
2016-08-05 21:51:37 +02:00
|
|
|
ffs
|
2017-06-07 16:41:28 +02:00
|
|
|
add_torrent_params
|
2017-07-16 20:26:00 +02:00
|
|
|
peer_info
|
2017-07-23 17:13:07 +02:00
|
|
|
stack_allocator
|
2008-09-28 02:18:03 +02:00
|
|
|
|
|
|
|
# -- extensions --
|
|
|
|
ut_pex
|
|
|
|
ut_metadata
|
|
|
|
smart_ban
|
|
|
|
)
|
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
# -- kademlia --
|
2008-09-28 02:18:03 +02:00
|
|
|
set(kademlia_sources
|
2016-09-17 15:42:04 +02:00
|
|
|
dht_state
|
2015-09-08 22:12:54 +02:00
|
|
|
dht_storage
|
2014-10-15 05:01:39 +02:00
|
|
|
dos_blocker
|
2008-09-28 02:18:03 +02:00
|
|
|
dht_tracker
|
2015-12-06 02:27:01 +01:00
|
|
|
msg
|
2008-09-28 02:18:03 +02:00
|
|
|
node
|
2015-03-16 05:38:28 +01:00
|
|
|
node_entry
|
2008-09-28 02:18:03 +02:00
|
|
|
refresh
|
|
|
|
rpc_manager
|
|
|
|
find_data
|
2015-09-22 20:10:57 +02:00
|
|
|
put_data
|
2008-09-28 02:18:03 +02:00
|
|
|
node_id
|
|
|
|
routing_table
|
|
|
|
traversal_algorithm
|
2014-05-10 09:10:17 +02:00
|
|
|
item
|
|
|
|
get_peers
|
|
|
|
get_item
|
2016-08-30 02:28:42 +02:00
|
|
|
ed25519
|
2017-06-12 11:54:11 +02:00
|
|
|
sample_infohashes
|
2008-09-28 02:18:03 +02:00
|
|
|
)
|
|
|
|
|
2013-08-18 18:01:20 +02:00
|
|
|
# -- ed25519 --
|
|
|
|
set(ed25519_sources
|
|
|
|
add_scalar
|
|
|
|
fe
|
|
|
|
ge
|
|
|
|
key_exchange
|
|
|
|
keypair
|
|
|
|
sc
|
|
|
|
sign
|
|
|
|
verify
|
|
|
|
)
|
|
|
|
|
2014-05-10 09:10:17 +02:00
|
|
|
set(includes include ed25519/src)
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
option(shared "build libtorrent as a shared library" ON)
|
2014-05-10 09:10:17 +02:00
|
|
|
option(static_runtime "build libtorrent with static runtime" OFF)
|
2008-09-29 01:10:17 +02:00
|
|
|
option(encryption "link against openssl and enable encryption" ON)
|
|
|
|
option(dht "enable support for Mainline DHT" ON)
|
|
|
|
option(deprecated-functions "enable deprecated functions for backwards compatibility" ON)
|
2009-02-13 08:10:27 +01:00
|
|
|
option(exceptions "build with exception support" ON)
|
2016-05-29 18:58:16 +02:00
|
|
|
option(libiconv "enable linking against system libiconv" OFF)
|
2016-05-02 20:38:12 +02:00
|
|
|
option(logging "build with logging" ON)
|
2009-07-07 23:55:50 +02:00
|
|
|
option(build_tests "build tests" OFF)
|
2017-08-25 23:32:14 +02:00
|
|
|
option(build_examples "build examples" OFF)
|
2008-09-29 01:10:17 +02:00
|
|
|
|
2015-07-16 04:08:36 +02:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2014-11-17 04:41:01 +01:00
|
|
|
include_directories(${includes})
|
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
if (encryption)
|
2016-05-30 20:33:24 +02:00
|
|
|
list(APPEND sources pe_crypto)
|
2014-07-12 08:20:16 +02:00
|
|
|
else()
|
2016-08-26 01:07:16 +02:00
|
|
|
if (NOT WIN32 AND NOT APPLE)
|
|
|
|
list(APPEND sources sha1)
|
|
|
|
endif()
|
2008-09-29 01:10:17 +02:00
|
|
|
endif (encryption)
|
2008-09-28 02:18:03 +02:00
|
|
|
|
|
|
|
foreach(s ${sources})
|
|
|
|
list(APPEND sources2 src/${s})
|
|
|
|
endforeach(s)
|
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
if (dht)
|
2008-09-28 02:18:03 +02:00
|
|
|
foreach(s ${kademlia_sources})
|
|
|
|
list(APPEND sources2 src/kademlia/${s})
|
|
|
|
endforeach(s)
|
2013-08-18 18:01:20 +02:00
|
|
|
foreach(s ${ed25519_sources})
|
|
|
|
list(APPEND sources2 ed25519/src/${s})
|
|
|
|
endforeach(s)
|
2016-08-26 01:07:16 +02:00
|
|
|
list(APPEND sources2 src/hasher512)
|
|
|
|
if (NOT encryption AND NOT WIN32 AND NOT APPLE)
|
|
|
|
list(APPEND sources2 src/sha512)
|
|
|
|
endif()
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
if (shared)
|
2010-03-16 07:14:22 +01:00
|
|
|
add_library(torrent-rasterbar SHARED ${sources2})
|
2017-07-08 21:21:06 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PRIVATE TORRENT_BUILDING_SHARED)
|
2015-07-15 23:52:06 +02:00
|
|
|
if(NOT MSVC)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
|
|
|
|
endif()
|
|
|
|
else()
|
2014-05-10 09:10:17 +02:00
|
|
|
if(static_runtime)
|
|
|
|
# fix /MT flag:
|
|
|
|
set(CompilerFlags
|
|
|
|
CMAKE_CXX_FLAGS
|
|
|
|
CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_CXX_FLAGS_RELEASE
|
|
|
|
CMAKE_C_FLAGS
|
|
|
|
CMAKE_C_FLAGS_DEBUG
|
|
|
|
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_C_FLAGS_RELEASE
|
|
|
|
)
|
|
|
|
foreach(CompilerFlag ${CompilerFlags})
|
|
|
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
|
|
|
endforeach()
|
2015-12-02 18:59:51 +01:00
|
|
|
set(Boost_USE_MULTITHREADED ON)
|
|
|
|
|
|
|
|
set(Boost_USE_STATIC_RUNTIME ON)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2015-12-02 18:59:51 +01:00
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
2010-03-16 07:14:22 +01:00
|
|
|
add_library(torrent-rasterbar STATIC ${sources2})
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
|
|
|
|
2017-07-08 22:23:19 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC $<$<CONFIG:Debug>:TORRENT_DEBUG>)
|
|
|
|
|
2017-07-08 21:21:06 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PRIVATE TORRENT_BUILDING_LIBRARY)
|
|
|
|
|
|
|
|
if (build_tests)
|
|
|
|
# this will make some internal functions available in the
|
|
|
|
# DLL interface, for the tests to access
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_EXPORT_EXTRA)
|
|
|
|
endif (build_tests)
|
|
|
|
|
|
|
|
if (libiconv)
|
|
|
|
find_package(Iconv REQUIRED)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ICONV)
|
|
|
|
target_include_directories(torrent-rasterbar SYSTEM PUBLIC ${ICONV_INCLUDE_DIR})
|
|
|
|
endif (libiconv)
|
|
|
|
|
|
|
|
if (encryption)
|
|
|
|
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
|
|
|
|
FIND_PACKAGE(OpenSSL REQUIRED)
|
|
|
|
endif()
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_OPENSSL TORRENT_USE_LIBCRYPTO)
|
|
|
|
target_include_directories(torrent-rasterbar PUBLIC ${OPENSSL_INCLUDE_DIR})
|
|
|
|
else()
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_DISABLE_ENCRYPTION)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT logging)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_DISABLE_LOGGING)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT dht)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_DISABLE_DHT)
|
|
|
|
endif()
|
|
|
|
|
2014-05-10 09:10:17 +02:00
|
|
|
# Boost
|
2014-05-10 19:26:24 +02:00
|
|
|
if(NOT DEFINED Boost_INCLUDE_DIR OR NOT DEFINED Boost_LIBRARIES)
|
2016-05-01 02:09:02 +02:00
|
|
|
FIND_PACKAGE(Boost REQUIRED COMPONENTS system)
|
2014-05-10 19:26:24 +02:00
|
|
|
endif()
|
2015-12-02 18:59:51 +01:00
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
2015-07-16 04:08:36 +02:00
|
|
|
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
2008-09-28 02:18:03 +02:00
|
|
|
|
|
|
|
if (WIN32)
|
2015-12-02 18:59:51 +01:00
|
|
|
target_link_libraries(torrent-rasterbar wsock32 ws2_32 Iphlpapi)
|
2017-07-08 21:21:06 +02:00
|
|
|
# target Windows Vista or later
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC _WIN32_WINNT=0x0600)
|
2015-04-26 03:25:45 +02:00
|
|
|
# prevent winsock1 to be included
|
2017-07-08 21:21:06 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC WIN32_LEAN_AND_MEAN)
|
2014-11-27 04:05:06 +01:00
|
|
|
if (MSVC)
|
2017-07-08 21:21:06 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC BOOST_ALL_NO_LIB)
|
2014-11-27 04:05:06 +01:00
|
|
|
endif()
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2017-04-07 23:53:12 +02:00
|
|
|
if(APPLE)
|
|
|
|
# for ip_notifier
|
|
|
|
target_link_libraries(torrent-rasterbar "-framework CoreFoundation" "-framework SystemConfiguration")
|
|
|
|
endif (APPLE)
|
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
if (encryption)
|
2012-06-17 01:19:36 +02:00
|
|
|
target_link_libraries(torrent-rasterbar ${OPENSSL_LIBRARIES})
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2016-05-29 18:58:16 +02:00
|
|
|
if (libiconv)
|
|
|
|
target_link_libraries(torrent-rasterbar ${ICONV_LIBRARIES})
|
|
|
|
endif (libiconv)
|
|
|
|
|
2008-09-29 01:10:17 +02:00
|
|
|
if (NOT deprecated-functions)
|
2017-07-08 21:21:06 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_NO_DEPRECATE)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2009-02-13 08:10:27 +01:00
|
|
|
if (exceptions)
|
2012-06-17 01:19:36 +02:00
|
|
|
if (MSVC)
|
2017-07-08 22:47:23 +02:00
|
|
|
target_compile_options(torrent-rasterbar PUBLIC /EHsc)
|
2012-06-17 01:19:36 +02:00
|
|
|
else (MSVC)
|
2017-07-08 22:47:23 +02:00
|
|
|
target_compile_options(torrent-rasterbar PUBLIC -fexceptions)
|
2012-06-17 01:19:36 +02:00
|
|
|
endif (MSVC)
|
2014-05-10 09:10:17 +02:00
|
|
|
else()
|
|
|
|
if (MSVC)
|
2017-07-08 22:47:23 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC _HAS_EXCEPTIONS=0)
|
2014-05-10 09:10:17 +02:00
|
|
|
else (MSVC)
|
2017-07-08 22:47:23 +02:00
|
|
|
target_compile_options(torrent-rasterbar PUBLIC -fno-exceptions)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif (MSVC)
|
|
|
|
endif()
|
2009-02-13 08:10:27 +01:00
|
|
|
|
2008-09-28 02:18:03 +02:00
|
|
|
if (MSVC)
|
2017-07-08 22:48:16 +02:00
|
|
|
# disable bogus deprecation warnings on msvc8
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC _SCL_SECURE_NO_DEPRECATE _CRT_SECURE_NO_DEPRECATE)
|
|
|
|
# these compiler settings just make the compiler standard conforming
|
|
|
|
target_compile_options(torrent-rasterbar PUBLIC /Zc:wchar_t /Zc:forScope)
|
|
|
|
# for multi-core compilation
|
|
|
|
target_compile_options(torrent-rasterbar PUBLIC /MP)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2017-07-08 21:21:06 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC _FILE_OFFSET_BITS=64)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC BOOST_EXCEPTION_DISABLE)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC BOOST_ASIO_ENABLE_CANCELIO)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC BOOST_ASIO_HAS_STD_CHRONO)
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2008-12-25 02:24:48 +01:00
|
|
|
set_target_properties(torrent-rasterbar PROPERTIES
|
2014-09-13 21:47:51 +02:00
|
|
|
SOVERSION ${SOVERSION})
|
2008-12-28 21:06:40 +01:00
|
|
|
|
2016-05-02 20:38:12 +02:00
|
|
|
# libtorrent requires at least C++11
|
|
|
|
set_property(TARGET torrent-rasterbar PROPERTY CXX_STANDARD 11)
|
|
|
|
set_property(TARGET torrent-rasterbar PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2008-12-28 21:06:40 +01:00
|
|
|
get_property (COMPILETIME_OPTIONS_LIST
|
|
|
|
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIRECTORY}
|
|
|
|
PROPERTY COMPILE_DEFINITIONS
|
|
|
|
)
|
|
|
|
foreach (s ${COMPILETIME_OPTIONS_LIST})
|
|
|
|
set (COMPILETIME_OPTIONS "${COMPILETIME_OPTIONS} -D${s}")
|
|
|
|
endforeach (s)
|
|
|
|
|
2014-11-17 04:41:01 +01:00
|
|
|
configure_file(libtorrent-rasterbar-cmake.pc.in libtorrent-rasterbar.pc)
|
2008-12-28 21:06:40 +01:00
|
|
|
|
2012-03-19 00:31:04 +01:00
|
|
|
string (COMPARE EQUAL "${CMAKE_SIZEOF_VOID_P}" "8" IS64BITS)
|
2009-06-22 17:46:00 +02:00
|
|
|
|
|
|
|
if (IS64BITS AND RESPECTLIB64)
|
|
|
|
set (LIBDIR "lib64")
|
2014-05-10 09:10:17 +02:00
|
|
|
else()
|
2009-06-22 17:46:00 +02:00
|
|
|
set (LIBDIR "lib")
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2009-06-22 17:46:00 +02:00
|
|
|
|
2017-07-08 23:11:22 +02:00
|
|
|
install(TARGETS torrent-rasterbar EXPORT torrent-rasterbarTargets
|
|
|
|
DESTINATION ${LIBDIR} INCLUDES DESTINATION include)
|
|
|
|
install(DIRECTORY include/libtorrent DESTINATION include)
|
2009-06-22 20:42:20 +02:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar.pc DESTINATION ${LIBDIR}/pkgconfig)
|
2008-09-28 02:26:49 +02:00
|
|
|
|
2017-07-08 23:11:22 +02:00
|
|
|
# === generate a CMake Config File ===
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfigVersion.cmake"
|
|
|
|
VERSION ${VERSION}
|
|
|
|
COMPATIBILITY ExactVersion
|
|
|
|
)
|
|
|
|
|
|
|
|
export(EXPORT torrent-rasterbarTargets
|
|
|
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarTargets.cmake"
|
|
|
|
NAMESPACE Libtorrent::
|
|
|
|
)
|
|
|
|
|
|
|
|
configure_file(libtorrent-rasterbarConfig.cmake
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfig.cmake"
|
|
|
|
COPYONLY
|
|
|
|
)
|
|
|
|
|
|
|
|
set(ConfigPackageLocation lib/cmake/libtorrent-rasterbar)
|
|
|
|
install(EXPORT torrent-rasterbarTargets
|
|
|
|
FILE
|
|
|
|
libtorrent-rasterbarTargets.cmake
|
|
|
|
NAMESPACE
|
|
|
|
Libtorrent::
|
|
|
|
DESTINATION
|
|
|
|
${ConfigPackageLocation}
|
|
|
|
)
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
libtorrent-rasterbarConfig.cmake
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar/libtorrent-rasterbarConfigVersion.cmake"
|
|
|
|
DESTINATION
|
|
|
|
${ConfigPackageLocation}
|
|
|
|
)
|
|
|
|
|
2017-08-25 23:32:14 +02:00
|
|
|
# === build examples ===
|
|
|
|
if (build_examples)
|
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
2014-05-10 09:10:17 +02:00
|
|
|
|
2008-10-12 21:55:37 +02:00
|
|
|
# === build tests ===
|
2008-12-25 02:24:48 +01:00
|
|
|
if(build_tests)
|
2015-07-16 07:44:27 +02:00
|
|
|
file(GLOB tests RELATIVE "${PROJECT_SOURCE_DIR}" "test/test_*.cpp")
|
|
|
|
list(REMOVE_ITEM tests "test/test_natpmp.cpp") # doesn't build at time of writing
|
|
|
|
list(REMOVE_ITEM tests "test/test_utils.cpp") # helper file, not a test
|
|
|
|
|
|
|
|
add_library(test_common OBJECT test/main.cpp test/test.cpp
|
|
|
|
test/setup_transfer.cpp test/dht_server.cpp test/udp_tracker.cpp
|
|
|
|
test/peer_server.cpp test/web_seed_suite.cpp test/swarm_suite.cpp
|
2016-05-29 18:58:16 +02:00
|
|
|
test/test_utils.cpp test/make_torrent.hpp test/make_torrent.cpp
|
|
|
|
test/settings.hpp test/settings.cpp)
|
|
|
|
set_target_properties(test_common PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
|
2008-12-25 02:24:48 +01:00
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
foreach(s ${tests})
|
2014-05-10 09:10:17 +02:00
|
|
|
get_filename_component (sn ${s} NAME_WE)
|
2015-07-16 07:44:27 +02:00
|
|
|
add_executable(${sn} ${s} $<TARGET_OBJECTS:test_common>)
|
|
|
|
target_link_libraries(${sn} torrent-rasterbar)
|
2016-05-29 18:58:16 +02:00
|
|
|
set_target_properties(${sn} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
|
2014-05-10 09:10:17 +02:00
|
|
|
add_test(${sn} ${s})
|
2008-12-25 02:24:48 +01:00
|
|
|
endforeach(s)
|
2008-10-12 21:55:37 +02:00
|
|
|
|
2015-07-16 07:44:27 +02:00
|
|
|
add_executable(bdecode_benchmark test/bdecode_benchmark.cpp)
|
|
|
|
target_link_libraries(bdecode_benchmark torrent-rasterbar)
|
2016-05-29 18:58:16 +02:00
|
|
|
set_target_properties(bdecode_benchmark PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|