~neon/libktorrent/master

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
project(LIBKTORRENT)

cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)

# set some default settings
enable_testing()

find_package(ECM 5.15.0  NO_MODULE)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})

#
# checks for functions and stuff
#
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckTypeSize) #XFS

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings  NO_POLICY_SCOPE)
include(FeatureSummary)
include(GenerateExportHeader)
include(ECMMarkAsTest)
include(ECMSetupVersion)
include(ECMPackageConfigHelpers)

set(Boost_MIN_VERSION "1.34.0")
set(LibGMP_MIN_VERSION "6.0.0")
set(LibGcrypt_MIN_VERSION "1.4.5")
set(KF5_MIN_VERSION "5.15")
set(QT_MIN_VERSION "5.7.0")

set(LIBKTORRENT_VERSION "2.1.50")

ecm_setup_version(${LIBKTORRENT_VERSION} VARIABLE_PREFIX LIBKTORRENT
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/libktorrent_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5TorrentConfigVersion.cmake"
                        SOVERSION 1)

find_package(Qt5 "${QT_MIN_VERSION}" CONFIG REQUIRED COMPONENTS
    Core
    Network
    Xml
    Test
)

# Load the frameworks we need
find_package(KF5 "${KF5_MIN_VERSION}" REQUIRED COMPONENTS
    Archive
    Crash
    I18n
    KIO
    Solid
)

find_package(Boost "${Boost_MIN_VERSION}" REQUIRED)
find_package(LibGMP "${LibGMP_MIN_VERSION}" REQUIRED)
find_package(LibGcrypt "${LibGcrypt_MIN_VERSION}" REQUIRED)
find_package(Qca-qt5 CONFIG REQUIRED)

kde_enable_exceptions()
add_definitions(
  -DQT_USE_QSTRINGBUILDER
  -DQT_NO_CAST_TO_ASCII
#   -DQT_NO_CAST_FROM_ASCII
  -DQT_STRICT_ITERATORS
  -DQT_NO_URL_CAST_FROM_STRING
  -DQT_NO_CAST_FROM_BYTEARRAY
  -DQT_NO_CAST_TO_BYTEARRAY
  -DQT_NO_SIGNALS_SLOTS_KEYWORDS
  -DQT_USE_FAST_OPERATOR_PLUS
)
add_definitions(-DTRANSLATION_DOMAIN="libktorrent5")

include_directories(${Boost_INCLUDE_DIR})

#XFS prealloc
check_include_files(xfs/xfs.h HAVE_XFS_XFS_H)
if(HAVE_XFS_XFS_H)
    set(CMAKE_EXTRA_INCLUDE_FILES xfs/xfs.h)
    check_type_size(__u64 HAVE___U64)
    check_type_size(__s64 HAVE___S64)
    set(CMAKE_EXTRA_INCLUDE_FILES)
endif()

# check for 64 bit file I/O functions
check_function_exists(fopen64 HAVE_FOPEN64)
check_function_exists(fseeko64 HAVE_FSEEKO64)
check_function_exists(fseeko HAVE_FSEEKO)
check_function_exists(ftello64 HAVE_FTELLO64)
check_function_exists(ftello HAVE_FTELLO)
check_function_exists(fstat64 HAVE_FSTAT64)
check_function_exists(stat64 HAVE_STAT64)
check_function_exists(ftruncate64 HAVE_FTRUNCATE64)
check_function_exists(lseek64 HAVE_LSEEK64)
check_function_exists(mmap64 HAVE_MMAP64)
check_function_exists(munmap64 HAVE_MUNMAP64)
check_function_exists(posix_fallocate64 HAVE_POSIX_FALLOCATE64)
check_function_exists(posix_fallocate HAVE_POSIX_FALLOCATE)
check_function_exists(fallocate HAVE_FALLOCATE)
check_function_exists(statvfs HAVE_STATVFS)
check_function_exists(statvfs64 HAVE_STATVFS64)

add_subdirectory(src)
if(BUILD_TESTING)
    add_subdirectory(testlib)
endif()
add_subdirectory(examples)
add_subdirectory(doc)

set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Torrent")

ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5TorrentConfig.cmake.in"
                              "${CMAKE_CURRENT_BINARY_DIR}/KF5TorrentConfig.cmake"
                              INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
                              PATH_VARS INCLUDE_INSTALL_DIR
                              )

# Install the CMake modules needed to use libktorrent
add_subdirectory(cmake)

install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KF5TorrentConfig.cmake"
               "${CMAKE_CURRENT_BINARY_DIR}/KF5TorrentConfigVersion.cmake"
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT Devel)

install(EXPORT KF5TorrentTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5TorrentTargets.cmake NAMESPACE KF5:: )

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

message("NOTE: LibKTorrent will crash unless you compile Botan library without GMP support.\n")