2018-10-20 15:27:09 +02:00
|
|
|
cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
|
2016-05-02 20:38:12 +02:00
|
|
|
|
2018-11-15 18:20:02 +01:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
|
|
|
|
include(LibtorrentMacros)
|
|
|
|
|
|
|
|
read_version("${CMAKE_CURRENT_SOURCE_DIR}/include/libtorrent/version.hpp" VER_MAJOR VER_MINOR VER_TINY)
|
|
|
|
|
2018-04-12 22:35:42 +02:00
|
|
|
project(libtorrent
|
|
|
|
DESCRIPTION "Bittorrent library"
|
2018-11-15 18:20:02 +01:00
|
|
|
VERSION ${VER_MAJOR}.${VER_MINOR}.${VER_TINY}
|
2018-04-12 22:35:42 +02:00
|
|
|
)
|
2016-09-15 05:22:57 +02:00
|
|
|
set (SOVERSION "10")
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2018-04-12 22:35:42 +02:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
include(GeneratePkgConfig)
|
2016-05-29 18:58:16 +02:00
|
|
|
|
2018-02-04 02:03:40 +01:00
|
|
|
set(libtorrent_include_files
|
|
|
|
add_torrent_params
|
|
|
|
address
|
|
|
|
alert
|
|
|
|
alert_manager
|
|
|
|
alert_types
|
|
|
|
announce_entry
|
|
|
|
assert
|
|
|
|
bandwidth_limit
|
|
|
|
bandwidth_manager
|
|
|
|
bandwidth_queue_entry
|
|
|
|
bandwidth_socket
|
|
|
|
bdecode
|
|
|
|
bencode
|
|
|
|
bitfield
|
|
|
|
block_cache
|
|
|
|
bloom_filter
|
|
|
|
broadcast_socket
|
|
|
|
bt_peer_connection
|
|
|
|
buffer
|
|
|
|
chained_buffer
|
|
|
|
choker
|
|
|
|
close_reason
|
|
|
|
config
|
|
|
|
ConvertUTF
|
|
|
|
copy_ptr
|
|
|
|
crc32c
|
|
|
|
create_torrent
|
|
|
|
deadline_timer
|
|
|
|
debug
|
|
|
|
disk_buffer_holder
|
|
|
|
disk_buffer_pool
|
|
|
|
disk_interface
|
|
|
|
disk_io_job
|
|
|
|
disk_io_thread
|
|
|
|
disk_io_thread_pool
|
|
|
|
disk_job_pool
|
|
|
|
disk_observer
|
|
|
|
download_priority
|
|
|
|
ed25519
|
|
|
|
entry
|
|
|
|
enum_net
|
|
|
|
error
|
|
|
|
error_code
|
|
|
|
extensions
|
|
|
|
file
|
|
|
|
file_pool
|
|
|
|
file_storage
|
|
|
|
fingerprint
|
|
|
|
flags
|
|
|
|
fwd
|
|
|
|
gzip
|
|
|
|
hasher
|
|
|
|
hasher512
|
|
|
|
heterogeneous_queue
|
|
|
|
hex
|
|
|
|
http_connection
|
|
|
|
http_parser
|
|
|
|
http_seed_connection
|
|
|
|
http_stream
|
|
|
|
http_tracker_connection
|
|
|
|
i2p_stream
|
|
|
|
identify_client
|
2018-06-02 19:29:40 +02:00
|
|
|
index_range
|
2018-02-04 02:03:40 +01:00
|
|
|
invariant_check
|
|
|
|
io
|
|
|
|
io_service
|
|
|
|
io_service_fwd
|
|
|
|
ip_filter
|
|
|
|
ip_voter
|
|
|
|
lazy_entry
|
|
|
|
link
|
|
|
|
linked_list
|
|
|
|
lsd
|
|
|
|
magnet_uri
|
|
|
|
natpmp
|
|
|
|
netlink
|
|
|
|
operations
|
|
|
|
optional
|
|
|
|
packet_buffer
|
|
|
|
packet_pool
|
|
|
|
parse_url
|
|
|
|
part_file
|
|
|
|
pe_crypto
|
|
|
|
peer
|
|
|
|
peer_class
|
|
|
|
peer_class_set
|
|
|
|
peer_class_type_filter
|
|
|
|
peer_connection
|
|
|
|
peer_connection_handle
|
|
|
|
peer_connection_interface
|
|
|
|
peer_id
|
|
|
|
peer_info
|
|
|
|
peer_list
|
|
|
|
peer_request
|
|
|
|
performance_counters
|
|
|
|
pex_flags
|
|
|
|
piece_block
|
|
|
|
piece_block_progress
|
|
|
|
piece_picker
|
|
|
|
platform_util
|
|
|
|
portmap
|
|
|
|
proxy_base
|
|
|
|
puff
|
|
|
|
random
|
|
|
|
read_resume_data
|
|
|
|
receive_buffer
|
|
|
|
request_blocks
|
|
|
|
resolve_links
|
|
|
|
resolver
|
|
|
|
resolver_interface
|
|
|
|
session
|
|
|
|
session_handle
|
|
|
|
session_settings
|
|
|
|
session_stats
|
|
|
|
session_status
|
|
|
|
session_types
|
|
|
|
settings_pack
|
|
|
|
sha1
|
|
|
|
sha1_hash
|
|
|
|
sha512
|
|
|
|
sliding_average
|
|
|
|
socket
|
|
|
|
socket_io
|
|
|
|
socks5_stream
|
|
|
|
span
|
|
|
|
ssl_stream
|
|
|
|
stack_allocator
|
|
|
|
stat
|
|
|
|
stat_cache
|
|
|
|
storage
|
|
|
|
storage_defs
|
|
|
|
string_util
|
|
|
|
string_view
|
|
|
|
tailqueue
|
|
|
|
time
|
|
|
|
timestamp_history
|
|
|
|
torrent
|
|
|
|
torrent_flags
|
|
|
|
torrent_handle
|
|
|
|
torrent_info
|
|
|
|
torrent_peer
|
|
|
|
torrent_peer_allocator
|
|
|
|
torrent_status
|
|
|
|
tracker_manager
|
|
|
|
udp_socket
|
|
|
|
udp_tracker_connection
|
|
|
|
union_endpoint
|
|
|
|
units
|
|
|
|
upnp
|
|
|
|
utf8
|
|
|
|
utp_socket_manager
|
|
|
|
utp_stream
|
|
|
|
vector_utils
|
|
|
|
version
|
|
|
|
web_connection_base
|
|
|
|
web_peer_connection
|
|
|
|
write_resume_data
|
|
|
|
xml_parse)
|
|
|
|
|
|
|
|
set(libtorrent_kademlia_include_files
|
2018-07-15 18:56:14 +02:00
|
|
|
announce_flags
|
2018-02-04 02:03:40 +01:00
|
|
|
dht_observer
|
|
|
|
dht_settings
|
|
|
|
dht_state
|
|
|
|
dht_storage
|
|
|
|
dht_tracker
|
|
|
|
direct_request
|
|
|
|
dos_blocker
|
|
|
|
ed25519
|
|
|
|
find_data
|
|
|
|
get_item
|
|
|
|
get_peers
|
|
|
|
io
|
|
|
|
item
|
|
|
|
msg
|
|
|
|
node
|
|
|
|
node_entry
|
|
|
|
node_id
|
|
|
|
observer
|
|
|
|
put_data
|
|
|
|
refresh
|
|
|
|
routing_table
|
|
|
|
rpc_manager
|
|
|
|
sample_infohashes
|
|
|
|
traversal_algorithm
|
|
|
|
types)
|
|
|
|
|
|
|
|
set(libtorrent_extensions_include_files
|
|
|
|
smart_ban
|
|
|
|
ut_metadata
|
|
|
|
ut_pex)
|
|
|
|
|
|
|
|
set(libtorrent_aux_include_files
|
|
|
|
aligned_storage
|
|
|
|
aligned_union
|
|
|
|
alloca
|
|
|
|
allocating_handler
|
|
|
|
array
|
|
|
|
bind_to_device
|
2020-01-29 15:58:31 +01:00
|
|
|
keepalive
|
2018-02-04 02:03:40 +01:00
|
|
|
block_cache_reference
|
|
|
|
byteswap
|
|
|
|
cppint_import_export
|
|
|
|
cpuid
|
|
|
|
deferred_handler
|
2019-11-20 12:32:23 +01:00
|
|
|
deprecated
|
2018-02-04 02:03:40 +01:00
|
|
|
deque
|
|
|
|
dev_random
|
|
|
|
disable_warnings_pop
|
|
|
|
disable_warnings_push
|
|
|
|
disk_job_fence
|
|
|
|
escape_string
|
2018-05-13 21:59:50 +02:00
|
|
|
export
|
2018-02-04 02:03:40 +01:00
|
|
|
ffs
|
|
|
|
file_progress
|
|
|
|
has_block
|
2018-05-28 22:57:55 +02:00
|
|
|
instantiate_connection
|
2018-02-04 02:03:40 +01:00
|
|
|
io
|
|
|
|
ip_notifier
|
|
|
|
listen_socket_handle
|
|
|
|
lsd
|
|
|
|
merkle
|
|
|
|
noexcept_movable
|
|
|
|
numeric_cast
|
|
|
|
openssl
|
|
|
|
path
|
|
|
|
portmap
|
|
|
|
proxy_settings
|
|
|
|
range
|
|
|
|
route
|
|
|
|
scope_end
|
|
|
|
session_call
|
|
|
|
session_impl
|
|
|
|
session_interface
|
|
|
|
session_settings
|
|
|
|
session_udp_sockets
|
|
|
|
set_socket_buffer
|
|
|
|
socket_type
|
|
|
|
storage_piece_set
|
|
|
|
storage_utils
|
|
|
|
string_ptr
|
|
|
|
suggest_piece
|
|
|
|
throw
|
|
|
|
time
|
|
|
|
torrent_impl
|
|
|
|
unique_ptr
|
|
|
|
vector
|
|
|
|
win_crypto_provider
|
|
|
|
win_util)
|
|
|
|
|
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
|
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
|
2018-07-23 09:56:09 +02:00
|
|
|
generate_peer_id
|
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
|
2019-02-12 11:26:05 +01:00
|
|
|
sha1
|
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
|
2020-03-13 12:15:39 +01:00
|
|
|
openssl
|
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
|
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
|
2017-09-02 23:58:10 +02:00
|
|
|
dht_settings
|
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
|
|
|
|
)
|
|
|
|
|
2018-10-20 15:27:09 +02:00
|
|
|
list(TRANSFORM sources PREPEND "src/")
|
|
|
|
list(TRANSFORM kademlia_sources PREPEND "src/kademlia/")
|
|
|
|
list(TRANSFORM ed25519_sources PREPEND "ed25519/src/")
|
|
|
|
list(TRANSFORM libtorrent_include_files PREPEND "include/libtorrent/")
|
|
|
|
list(TRANSFORM libtorrent_extensions_include_files PREPEND "include/libtorrent/extensions/")
|
|
|
|
list(TRANSFORM libtorrent_aux_include_files PREPEND "include/libtorrent/aux_/")
|
|
|
|
list(TRANSFORM libtorrent_kademlia_include_files PREPEND "include/libtorrent/kademlia/")
|
2018-04-27 16:27:51 +02:00
|
|
|
|
|
|
|
# these options control target creation and thus have to be declared before the add_library() call
|
|
|
|
feature_option(BUILD_SHARED_LIBS "build libtorrent as a shared library" ON)
|
|
|
|
feature_option(static_runtime "build libtorrent with static runtime" OFF)
|
|
|
|
|
|
|
|
find_public_dependency(Threads REQUIRED)
|
2018-02-04 02:03:40 +01:00
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
|
|
|
add_compile_options(
|
|
|
|
-Weverything
|
|
|
|
-Wno-documentation
|
|
|
|
-Wno-c++98-compat-pedantic
|
|
|
|
-Wno-padded
|
|
|
|
-Wno-global-constructors
|
|
|
|
-Wno-exit-time-destructors
|
|
|
|
-Wno-weak-vtables)
|
2018-02-04 06:04:23 +01:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
2018-02-04 02:03:40 +01:00
|
|
|
add_compile_options(
|
|
|
|
-Wall
|
|
|
|
-Wextra
|
|
|
|
-Wpedantic
|
|
|
|
-Wparentheses
|
|
|
|
-Wvla
|
|
|
|
-Wc++11-compat
|
|
|
|
-Wno-format-zero-length
|
|
|
|
-ftemplate-depth=512)
|
2018-02-04 06:04:23 +01:00
|
|
|
elseif(MSVC)
|
|
|
|
add_compile_options(
|
|
|
|
/W4
|
|
|
|
# C4251: 'identifier' : class 'type' needs to have dll-interface to be
|
|
|
|
# used by clients of class 'type2'
|
|
|
|
/wd4251
|
|
|
|
# C4275: non DLL-interface classkey 'identifier' used as base for
|
|
|
|
# DLL-interface classkey 'identifier'
|
|
|
|
/wd4275
|
|
|
|
# C4373: virtual function overrides, previous versions of the compiler
|
|
|
|
# did not override when parameters only differed by const/volatile qualifiers
|
|
|
|
/wd4373
|
|
|
|
# C4268: 'identifier' : 'const' static/global data initialized
|
|
|
|
# with compiler generated default constructor fills the object with zeros
|
|
|
|
/wd4268
|
|
|
|
# C4503: 'identifier': decorated name length exceeded, name was truncated
|
|
|
|
/wd4503)
|
2018-02-04 02:03:40 +01:00
|
|
|
endif()
|
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
if(static_runtime)
|
|
|
|
include(ucm_flags)
|
|
|
|
ucm_set_runtime(STATIC)
|
|
|
|
set(Boost_USE_MULTITHREADED ON)
|
|
|
|
set(Boost_USE_STATIC_RUNTIME ON)
|
|
|
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
|
|
|
set(OPENSSL_MSVC_STATIC_RT TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT BUILD_SHARED_LIBS)
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(torrent-rasterbar
|
2018-10-20 15:27:09 +02:00
|
|
|
${sources}
|
|
|
|
${libtorrent_include_files}
|
|
|
|
${libtorrent_extensions_include_files}
|
|
|
|
${libtorrent_aux_include_files}
|
2018-04-27 16:27:51 +02:00
|
|
|
)
|
|
|
|
|
2018-10-20 15:27:09 +02:00
|
|
|
select_cxx_standard(torrent-rasterbar 11)
|
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
if (BUILD_SHARED_LIBS)
|
2018-02-18 21:49:13 +01:00
|
|
|
target_compile_definitions(torrent-rasterbar
|
|
|
|
PRIVATE TORRENT_BUILDING_SHARED
|
|
|
|
INTERFACE TORRENT_LINKING_SHARED
|
|
|
|
)
|
2018-04-27 16:27:51 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(torrent-rasterbar
|
|
|
|
PROPERTIES
|
|
|
|
CXX_VISIBILITY_PRESET "hidden"
|
|
|
|
VISIBILITY_INLINES_HIDDEN "true"
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${SOVERSION}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(torrent-rasterbar PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
|
)
|
|
|
|
|
2018-04-12 22:35:42 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar
|
|
|
|
PUBLIC
|
|
|
|
$<$<CONFIG:Debug>:TORRENT_USE_ASSERTS>
|
2019-03-22 12:39:06 +01:00
|
|
|
BOOST_ASIO_ENABLE_CANCELIO
|
2018-04-12 22:35:42 +02:00
|
|
|
PRIVATE
|
|
|
|
TORRENT_BUILDING_LIBRARY
|
2018-04-27 16:27:51 +02:00
|
|
|
_FILE_OFFSET_BITS=64
|
|
|
|
BOOST_EXCEPTION_DISABLE
|
|
|
|
BOOST_ASIO_HAS_STD_CHRONO
|
2018-04-12 22:35:42 +02:00
|
|
|
)
|
2018-04-27 16:27:51 +02:00
|
|
|
|
2018-04-12 22:35:42 +02:00
|
|
|
target_link_libraries(torrent-rasterbar
|
|
|
|
PUBLIC
|
|
|
|
Threads::Threads
|
|
|
|
)
|
2017-07-08 21:21:06 +02:00
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
# Unconditional platform-specific settings
|
2008-09-28 02:18:03 +02:00
|
|
|
if (WIN32)
|
2018-04-12 22:35:42 +02:00
|
|
|
target_link_libraries(torrent-rasterbar
|
|
|
|
PRIVATE
|
|
|
|
wsock32 ws2_32 Iphlpapi
|
|
|
|
debug dbghelp
|
|
|
|
)
|
|
|
|
|
2018-10-20 15:27:09 +02:00
|
|
|
add_definitions(-D_WIN32_WINNT=0x0600) # target Windows Vista or later
|
|
|
|
|
2018-04-12 22:35:42 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar
|
2018-10-12 08:15:08 +02:00
|
|
|
PUBLIC WIN32_LEAN_AND_MEAN # prevent winsock1 to be included
|
2018-04-12 22:35:42 +02:00
|
|
|
)
|
2018-04-27 16:27:51 +02:00
|
|
|
|
2014-11-27 04:05:06 +01:00
|
|
|
if (MSVC)
|
2018-04-27 16:27:51 +02:00
|
|
|
target_compile_definitions(torrent-rasterbar
|
|
|
|
PUBLIC
|
|
|
|
BOOST_ALL_NO_LIB
|
|
|
|
_SCL_SECURE_NO_DEPRECATE _CRT_SECURE_NO_DEPRECATE # disable bogus deprecation warnings on msvc8
|
|
|
|
)
|
|
|
|
target_compile_options(torrent-rasterbar
|
|
|
|
PRIVATE
|
|
|
|
/Zc:wchar_t /Zc:forScope # these compiler settings just make the compiler standard conforming
|
|
|
|
/MP # for multi-core compilation
|
|
|
|
/bigobj # increase the number of sections for obj files
|
|
|
|
)
|
|
|
|
set_target_properties(torrent-rasterbar PROPERTIES LINK_FLAGS_RELEASE "/OPT:ICF=5 /OPT:REF")
|
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
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
if (ANDROID)
|
|
|
|
target_link_libraries(torrent-rasterbar PRIVATE ${CMAKE_DL_LIBS})
|
2018-03-08 17:43:34 +01:00
|
|
|
endif()
|
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
if (APPLE)
|
2017-04-07 23:53:12 +02:00
|
|
|
# for ip_notifier
|
2018-04-12 22:35:42 +02:00
|
|
|
target_link_libraries(torrent-rasterbar PRIVATE "-framework CoreFoundation" "-framework SystemConfiguration")
|
2018-04-27 16:27:51 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
feature_option(build_tests "build tests" OFF)
|
|
|
|
feature_option(build_examples "build examples" OFF)
|
|
|
|
feature_option(build_tools "build tools" OFF)
|
|
|
|
feature_option(python-bindings "build python bindings" OFF)
|
|
|
|
|
|
|
|
# these options require existing target
|
|
|
|
feature_option(dht "enable support for Mainline DHT" ON)
|
|
|
|
if(NOT build_tests) # tests require deprecated symbols
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME deprecated-functions DEFAULT ON
|
|
|
|
DESCRIPTION "enable deprecated functions for backwards compatibility" DISABLED TORRENT_NO_DEPRECATE)
|
|
|
|
endif()
|
|
|
|
feature_option(encryption "Enables encryption in libtorrent" ON)
|
|
|
|
feature_option(exceptions "build with exception support" ON)
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME extensions DEFAULT ON
|
|
|
|
DESCRIPTION "Enables protocol extensions" DISABLED TORRENT_DISABLE_EXTENSIONS)
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME i2p DEFAULT ON
|
|
|
|
DESCRIPTION "build with I2P support" DISABLED TORRENT_USE_I2P=0)
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME logging DEFAULT ON
|
|
|
|
DESCRIPTION "build with logging" DISABLED TORRENT_DISABLE_LOGGING)
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME mutable-torrents DEFAULT ON
|
|
|
|
DESCRIPTION "Enables mutable torrent support" DISABLED TORRENT_DISABLE_MUTABLE_TORRENTS)
|
2020-03-14 20:32:14 +01:00
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME streaming DEFAULT ON
|
|
|
|
DESCRIPTION "Enables support for piece deadline" DISABLED TORRENT_DISABLE_STREAMING)
|
2018-04-27 16:27:51 +02:00
|
|
|
|
|
|
|
find_public_dependency(Iconv)
|
|
|
|
if(MSVC)
|
|
|
|
set(iconv_package_type OPTIONAL)
|
|
|
|
else()
|
|
|
|
set(iconv_package_type RECOMMENDED)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_package_properties(Iconv
|
|
|
|
PROPERTIES
|
|
|
|
URL "https://www.gnu.org/software/libiconv/"
|
|
|
|
DESCRIPTION "GNU encoding conversion library"
|
|
|
|
TYPE ${iconv_package_type}
|
|
|
|
PURPOSE "Convert strings between various encodings"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(Iconv_FOUND)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ICONV)
|
|
|
|
target_link_libraries(torrent-rasterbar PRIVATE Iconv::Iconv)
|
|
|
|
endif()
|
2017-04-07 23:53:12 +02:00
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
find_public_dependency(OpenSSL)
|
|
|
|
set_package_properties(OpenSSL
|
|
|
|
PROPERTIES
|
|
|
|
URL "https://www.openssl.org/"
|
|
|
|
DESCRIPTION "Full-strength general purpose cryptography library"
|
|
|
|
TYPE RECOMMENDED
|
|
|
|
PURPOSE "Provides HTTPS support to libtorrent"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(OPENSSL_FOUND)
|
|
|
|
target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::SSL)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_OPENSSL)
|
|
|
|
target_sources(torrent-rasterbar PRIVATE src/pe_crypto)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
if(OPENSSL_FOUND)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_LIBCRYPTO)
|
|
|
|
else(OPENSSL_FOUND)
|
|
|
|
find_public_dependency(LibGcrypt)
|
|
|
|
set_package_properties(LibGcrypt
|
|
|
|
PROPERTIES
|
|
|
|
URL "https://www.gnupg.org/software/libgcrypt/index.html"
|
|
|
|
DESCRIPTION "A general purpose cryptographic library"
|
|
|
|
TYPE RECOMMENDED
|
|
|
|
PURPOSE "Use GCrypt instead of the built-in functions for RC4 and SHA1"
|
|
|
|
)
|
|
|
|
if (LibGcrypt_FOUND)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_LIBGCRYPT)
|
|
|
|
target_link_libraries(torrent-rasterbar PRIVATE LibGcrypt::LibGcrypt)
|
|
|
|
endif()
|
|
|
|
endif(OPENSSL_FOUND)
|
|
|
|
|
|
|
|
if (encryption)
|
|
|
|
target_sources(torrent-rasterbar PRIVATE src/pe_crypto)
|
|
|
|
else()
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_DISABLE_ENCRYPTION)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (dht)
|
|
|
|
target_sources(torrent-rasterbar PRIVATE
|
2018-10-20 15:27:09 +02:00
|
|
|
${kademlia_sources}
|
|
|
|
${ed25519_sources}
|
|
|
|
${libtorrent_kademlia_include_files}
|
2018-04-27 16:27:51 +02:00
|
|
|
src/hasher512
|
2019-02-12 11:26:05 +01:00
|
|
|
src/sha512
|
2018-04-27 16:27:51 +02:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_DISABLE_DHT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Boost
|
|
|
|
find_public_dependency(Boost REQUIRED COMPONENTS system)
|
|
|
|
target_include_directories(torrent-rasterbar PUBLIC ${Boost_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(torrent-rasterbar PUBLIC ${Boost_SYSTEM_LIBRARY})
|
|
|
|
|
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
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
# developer options
|
|
|
|
option(developer-options "Activates options useful for a developer")
|
|
|
|
if(developer-options)
|
|
|
|
set(asserts "auto" CACHE STRING "use assertions")
|
|
|
|
set_property(CACHE asserts PROPERTY STRINGS auto on off production system)
|
|
|
|
if ("${asserts}" MATCHES "on|production|system")
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ASSERTS=1)
|
|
|
|
endif()
|
|
|
|
if ("${asserts}" STREQUAL "production")
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_PRODUCTION_ASSERTS=1)
|
|
|
|
elseif("${asserts}" STREQUAL "system")
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_SYSTEM_ASSERTS=1)
|
|
|
|
endif()
|
2008-09-28 02:18:03 +02:00
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC NAME asio-debugging DEFAULT OFF
|
|
|
|
ENABLED TORRENT_ASIO_DEBUGGING)
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC NAME picker-debugging DEFAULT OFF
|
|
|
|
ENABLED TORRENT_DEBUG_REFCOUNTS)
|
|
|
|
set(invariant-checks "off" CACHE STRING "")
|
|
|
|
set_property(CACHE invariant-checks PROPERTY STRINGS off on full)
|
|
|
|
if (invariant-checks MATCHES "on|full")
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_INVARIANT_CHECKS=1)
|
|
|
|
endif()
|
|
|
|
if (invariant-checks STREQUAL "full")
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_EXPENSIVE_INVARIANT_CHECKS)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC NAME utp-log DEFAULT OFF
|
|
|
|
ENABLED TORRENT_UTP_LOG_ENABLE)
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC NAME simulate-slow-read DEFAULT OFF
|
|
|
|
ENABLED TORRENT_SIMULATE_SLOW_READ)
|
|
|
|
option(debug-iterators "" OFF)
|
|
|
|
if (debug-iterators)
|
|
|
|
if (MSVC)
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC _ITERATOR_DEBUG_LEVEL=2)
|
|
|
|
endif()
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC _GLIBCXX_DEBUG _GLIBCXX_DEBUG_PEDANTIC)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
target_optional_compile_definitions(torrent-rasterbar PUBLIC NAME profile-calls DEFAULT OFF
|
|
|
|
ENABLED TORRENT_PROFILE_CALLS=1)
|
|
|
|
endif()
|
2008-12-28 21:06:40 +01:00
|
|
|
|
2019-01-06 15:35:35 +01:00
|
|
|
# There is little to none support for using pkg-config with MSVC and most users won't bother with it.
|
|
|
|
# However, msys is a linux-like platform on Windows that do support/prefer using pkg-config.
|
|
|
|
if (NOT MSVC)
|
|
|
|
generate_and_install_pkg_config_file(torrent-rasterbar libtorrent-rasterbar)
|
|
|
|
endif()
|
2008-12-28 21:06:40 +01:00
|
|
|
|
2018-04-12 14:38:05 +02:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
add_subdirectory(bindings)
|
|
|
|
|
2018-05-11 17:43:42 +02:00
|
|
|
install(TARGETS torrent-rasterbar EXPORT LibtorrentRasterbarTargets
|
2018-04-12 22:35:42 +02:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
)
|
|
|
|
install(DIRECTORY include/libtorrent DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*")
|
2008-09-28 02:26:49 +02:00
|
|
|
|
2017-07-08 23:11:22 +02:00
|
|
|
# === generate a CMake Config File ===
|
|
|
|
include(CMakePackageConfigHelpers)
|
2018-05-11 17:43:42 +02:00
|
|
|
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/LibtorrentRasterbar)
|
2018-04-26 16:13:05 +02:00
|
|
|
string(REGEX REPLACE "([^;]+)" "find_dependency(\\1)" _find_dependency_calls "${_package_dependencies}")
|
|
|
|
string(REPLACE ";" "\n" _find_dependency_calls "${_find_dependency_calls}")
|
|
|
|
|
2017-07-08 23:11:22 +02:00
|
|
|
write_basic_package_version_file(
|
2018-05-11 17:43:42 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfigVersion.cmake"
|
2018-04-12 22:35:42 +02:00
|
|
|
VERSION ${libtorrent_VERSION}
|
2018-10-20 15:27:09 +02:00
|
|
|
COMPATIBILITY SameMinorVersion
|
2017-07-08 23:11:22 +02:00
|
|
|
)
|
|
|
|
|
2018-05-11 17:43:42 +02:00
|
|
|
export(EXPORT LibtorrentRasterbarTargets
|
|
|
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarTargets.cmake"
|
|
|
|
NAMESPACE LibtorrentRasterbar::
|
2017-07-08 23:11:22 +02:00
|
|
|
)
|
|
|
|
|
2018-05-11 17:43:42 +02:00
|
|
|
configure_package_config_file(LibtorrentRasterbarConfig.cmake.in
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfig.cmake"
|
2018-04-26 16:13:05 +02:00
|
|
|
INSTALL_DESTINATION "${ConfigPackageLocation}"
|
|
|
|
NO_SET_AND_CHECK_MACRO
|
|
|
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
2017-07-08 23:11:22 +02:00
|
|
|
)
|
|
|
|
|
2018-05-11 17:43:42 +02:00
|
|
|
install(EXPORT LibtorrentRasterbarTargets
|
2017-07-08 23:11:22 +02:00
|
|
|
NAMESPACE
|
2018-05-11 17:43:42 +02:00
|
|
|
LibtorrentRasterbar::
|
2017-07-08 23:11:22 +02:00
|
|
|
DESTINATION
|
|
|
|
${ConfigPackageLocation}
|
|
|
|
)
|
|
|
|
install(
|
|
|
|
FILES
|
2018-05-11 17:43:42 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfig.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/LibtorrentRasterbar/LibtorrentRasterbarConfigVersion.cmake"
|
2017-07-08 23:11:22 +02:00
|
|
|
DESTINATION
|
|
|
|
${ConfigPackageLocation}
|
|
|
|
)
|
|
|
|
|
2018-04-27 16:27:51 +02:00
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/examples/cmake/FindLibtorrentRasterbar.cmake
|
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_DATADIR}/cmake/Modules
|
|
|
|
)
|
|
|
|
|
2018-04-27 16:37:15 +02:00
|
|
|
# === build tools ===
|
|
|
|
if (build_tools)
|
|
|
|
add_subdirectory(tools)
|
|
|
|
endif()
|
|
|
|
|
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)
|
|
|
|
enable_testing()
|
2018-02-18 21:49:13 +01:00
|
|
|
# this will make some internal functions available in the DLL interface
|
|
|
|
target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_EXPORT_EXTRA)
|
|
|
|
add_subdirectory(test)
|
2014-05-10 09:10:17 +02:00
|
|
|
endif()
|
2018-04-27 16:27:51 +02:00
|
|
|
|
|
|
|
feature_summary(DEFAULT_DESCRIPTION WHAT ALL)
|