Proof-reading changes.
[kdenetwork.git] / kget / transfer-plugins / bittorrent / CMakeLists.txt
blob5070aa525fffd49cbb97d8b4a66879bfc66b358b
1 option(ENABLE_EMBEDDED_TORRENT_SUPPORT "Whether to build KGet torrent support with embedded torrent library or not" true)
3 if (ENABLE_EMBEDDED_TORRENT_SUPPORT)
4     message(STATUS "Building KGet torrent support with embedded torrent library (libbtcore) (-DENABLE_EMBEDDED_TORRENT_SUPPORT=false to disable)")
5     add_definitions(-DENABLE_EMBEDDED_TORRENT_SUPPORT)
7     macro_optional_find_package(GMP)
8     macro_log_feature(GMP_FOUND "GMP" "The GNU Multiple Precision Arithmetic Library" "http://gmplib.org/" FALSE "" "Needed to build KGet Torrent support.")
10 if (GMP_FOUND AND QCA2_FOUND)
11 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
13 include_directories(
14    ../../
15    libbtcore
16    ${QCA2_INCLUDE_DIR}
17    ${GMP_INCLUDE_DIR}
20 # keep the following list in sync with libbtcore/CMakeLists.txt
21 #XFS prealloc
22 CHECK_INCLUDE_FILES(xfs/xfs.h HAVE_XFS_XFS_H)
23 IF(HAVE_XFS_XFS_H)
24        SET(CMAKE_EXTRA_INCLUDE_FILES xfs/xfs.h)
25        CHECK_TYPE_SIZE(__u64 HAVE___U64)
26        CHECK_TYPE_SIZE(__s64 HAVE___S64)
27        SET(CMAKE_EXTRA_INCLUDE_FILES)
28 ENDIF(HAVE_XFS_XFS_H)
30 # check for 64 bit file I/O functions
31 check_function_exists(fopen64 HAVE_FOPEN64)
32 check_function_exists(fseeko64 HAVE_FSEEKO64)
33 check_function_exists(fseeko HAVE_FSEEKO)
34 check_function_exists(ftello64 HAVE_FTELLO64)
35 check_function_exists(ftello HAVE_FTELLO)
36 check_function_exists(fstat64 HAVE_FSTAT64)
37 check_function_exists(stat64 HAVE_STAT64)
38 check_function_exists(ftruncate64 HAVE_FTRUNCATE64)
39 check_function_exists(lseek64 HAVE_LSEEK64)
40 check_function_exists(mmap64 HAVE_MMAP64)
41 check_function_exists(munmap64 HAVE_MUNMAP64)
42 check_function_exists(posix_fallocate64 HAVE_POSIX_FALLOCATE64)
43 check_function_exists(posix_fallocate HAVE_POSIX_FALLOCATE)
44 check_function_exists(statvfs HAVE_STATVFS)
45 check_function_exists(statvfs64 HAVE_STATVFS64)
47 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libbtcore/config-btcore.h.cmake ${CMAKE_BINARY_DIR}/config-btcore.h)
49 set(libbtcore_SRC
50     libbtcore/util/bitset.cpp
51     libbtcore/util/timer.cpp
52     libbtcore/util/urlencoder.cpp
53     libbtcore/util/sha1hashgen.cpp
54     libbtcore/util/sha1hash.cpp
55     libbtcore/util/functions.cpp
56     libbtcore/util/ptrmap.cpp
57     libbtcore/util/array.cpp
58     libbtcore/util/error.cpp
59     libbtcore/util/file.cpp
60     libbtcore/util/fileops.cpp
61     libbtcore/util/log.cpp
62     libbtcore/util/waitjob.cpp
63     libbtcore/util/autorotatelogjob.cpp
64     libbtcore/util/compressfilejob.cpp
65     libbtcore/util/logsystemmanager.cpp
67     libbtcore/bcodec/bdecoder.cpp  
68     libbtcore/bcodec/bencoder.cpp  
69     libbtcore/bcodec/bnode.cpp  
70     libbtcore/bcodec/value.cpp
72     libbtcore/net/address.cpp  
73     libbtcore/net/bufferedsocket.cpp  
74     libbtcore/net/portlist.cpp  
75     libbtcore/net/socket.cpp  
76     libbtcore/net/socketmonitor.cpp  
77     libbtcore/net/speed.cpp
78     libbtcore/net/uploadthread.cpp
79     libbtcore/net/downloadthread.cpp
80     libbtcore/net/networkthread.cpp
81     libbtcore/net/socketgroup.cpp
82     libbtcore/net/socks.cpp
83     libbtcore/net/wakeuppipe.cpp
84     
85     libbtcore/mse/bigint.cpp  
86     libbtcore/mse/functions.cpp  
87     libbtcore/mse/rc4encryptor.cpp  
88     libbtcore/mse/streamsocket.cpp
89     libbtcore/mse/encryptedauthenticate.cpp
90     libbtcore/mse/encryptedserverauthenticate.cpp
91     
92     libbtcore/peer/authenticatebase.cpp
93     libbtcore/peer/authenticate.cpp
94     libbtcore/peer/serverauthenticate.cpp
95     libbtcore/peer/authenticationmonitor.cpp
96     libbtcore/peer/chunkcounter.cpp
97     libbtcore/peer/peerid.cpp
98     libbtcore/peer/peer.cpp
99     libbtcore/peer/peermanager.cpp
100     libbtcore/peer/peerdownloader.cpp
101     libbtcore/peer/peeruploader.cpp
102     libbtcore/peer/packetwriter.cpp
103     libbtcore/peer/packetreader.cpp
104     libbtcore/peer/utpex.cpp
105     libbtcore/peer/accessmanager.cpp
106     libbtcore/peer/badpeerslist.cpp
108     libbtcore/download/piece.cpp
109     libbtcore/download/request.cpp
110     libbtcore/download/packet.cpp
111     libbtcore/download/webseed.cpp
112     libbtcore/download/chunkdownload.cpp
113     libbtcore/download/chunkselector.cpp
114     libbtcore/download/downloader.cpp
115     libbtcore/download/httpconnection.cpp
117     libbtcore/interfaces/piecedownloader.cpp
118     libbtcore/interfaces/peerinterface.cpp
119     libbtcore/interfaces/peersource.cpp
120     libbtcore/interfaces/torrentinterface.cpp
121     libbtcore/interfaces/torrentfileinterface.cpp
122     libbtcore/interfaces/trackerslist.cpp
123     libbtcore/interfaces/logmonitorinterface.cpp
124     libbtcore/interfaces/blocklistinterface.cpp
125     libbtcore/interfaces/exitoperation.cpp
126     libbtcore/interfaces/chunkdownloadinterface.cpp
127     libbtcore/interfaces/monitorinterface.cpp
128     libbtcore/interfaces/queuemanagerinterface.cpp
129     libbtcore/interfaces/chunkselectorinterface.cpp
130     libbtcore/interfaces/cachefactory.cpp
131     libbtcore/interfaces/webseedinterface.cpp
133     libbtcore/torrent/globals.cpp
134     libbtcore/torrent/server.cpp
135     libbtcore/torrent/torrent.cpp
136     libbtcore/torrent/torrentfile.cpp
137     libbtcore/torrent/peersourcemanager.cpp
138     libbtcore/torrent/uploader.cpp
139     libbtcore/torrent/timeestimator.cpp
140     libbtcore/torrent/statsfile.cpp
141     libbtcore/torrent/choker.cpp
142     libbtcore/torrent/advancedchokealgorithm.cpp
143     libbtcore/torrent/torrentcontrol.cpp
144     libbtcore/torrent/torrentcreator.cpp
146     libbtcore/dht/announcetask.cpp  
147     libbtcore/dht/dht.cpp                
148     libbtcore/dht/kclosestnodessearch.cpp  
149     libbtcore/dht/nodelookup.cpp  
150     libbtcore/dht/rpcmsg.cpp     
151     libbtcore/dht/taskmanager.cpp
152     libbtcore/dht/database.cpp      
153     libbtcore/dht/dhttrackerbackend.cpp  
154     libbtcore/dht/key.cpp                  
155     libbtcore/dht/pack.cpp        
156     libbtcore/dht/rpcserver.cpp
157     libbtcore/dht/dhtbase.cpp       
158     libbtcore/dht/kbucket.cpp            
159     libbtcore/dht/node.cpp                 
160     libbtcore/dht/rpccall.cpp     
161     libbtcore/dht/task.cpp
163     libbtcore/diskio/cache.cpp      
164     libbtcore/diskio/chunk.cpp         
165     libbtcore/diskio/dndfile.cpp         
166     libbtcore/diskio/singlefilecache.cpp
167     libbtcore/diskio/multifilecache.cpp
168     libbtcore/diskio/preallocationthread.cpp
169     libbtcore/diskio/movedatafilesjob.cpp
170     libbtcore/diskio/deletedatafilesjob.cpp
171     libbtcore/diskio/piecedata.cpp
172     libbtcore/diskio/cachefile.cpp  
173     libbtcore/diskio/chunkmanager.cpp  
175     libbtcore/tracker/httptracker.cpp  
176     libbtcore/tracker/tracker.cpp  
177     libbtcore/tracker/udptracker.cpp  
178     libbtcore/tracker/udptrackersocket.cpp
179     
180     libbtcore/datachecker/datachecker.cpp          
181     libbtcore/datachecker/datacheckerthread.cpp  
182     libbtcore/datachecker/singledatachecker.cpp
183     libbtcore/datachecker/datacheckerlistener.cpp  
184     libbtcore/datachecker/multidatachecker.cpp
185     
186     libbtcore/migrate/cachemigrate.cpp  
187     libbtcore/migrate/ccmigrate.cpp  
188     libbtcore/migrate/migrate.cpp
189     
190     libbtcore/btversion.cpp
193 if(WIN32)
194 # Compile stuff for windows
195 set(libbtcore_SRC ${libbtcore_SRC} libbtcore/util/win32.cpp)
196 endif(WIN32)
199 set(kget_bittorrentfactory_PART_SRCS
200   bttransfer.cpp
201   bttransferfactory.cpp
202   bttransferhandler.cpp
203   btdetailswidget.cpp
204   scandlg.cpp
205   #btdatasource.cpp
206   #btchunkselector.cpp
207   #btcache.cpp
208   advanceddetails/btadvanceddetailswidget.cpp
209   advanceddetails/chunkdownloadmodel.cpp
210   advanceddetails/chunkdownloadview.cpp
211   advanceddetails/fileview.cpp
212   advanceddetails/iwfilelistmodel.cpp
213   advanceddetails/iwfiletreemodel.cpp
214   advanceddetails/peerview.cpp
215   advanceddetails/peerviewmodel.cpp
216   advanceddetails/torrentfilelistmodel.cpp
217   advanceddetails/torrentfilemodel.cpp
218   advanceddetails/torrentfiletreemodel.cpp
219   advanceddetails/monitor.cpp
220   advanceddetails/trackerview.cpp
221   advanceddetails/trackermodel.cpp
222   advanceddetails/webseedsmodel.cpp
223   advanceddetails/webseedstab.cpp
226 kde4_add_ui_files(kget_bittorrentfactory_PART_SRCS
227   btdetailswidgetfrm.ui
228   scandlg.ui
229   advanceddetails/chunkdownloadview.ui
230   advanceddetails/trackerview.ui
231   advanceddetails/webseedstab.ui
234 ###Build KCM-Module
235 set(kcm_kget_bittorrentfactory_PART_SRCS
236   btsettingswidget.cpp
239 kde4_add_ui_files(kcm_kget_bittorrentfactory_PART_SRCS
240   btsettingswidget.ui
243 kde4_add_kcfg_files(kcm_kget_bittorrentfactory_PART_SRCS bittorrentsettings.kcfgc)
244 kde4_add_plugin(kcm_kget_bittorrentfactory ${kcm_kget_bittorrentfactory_PART_SRCS})
245 target_link_libraries(kcm_kget_bittorrentfactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
246 install(TARGETS kcm_kget_bittorrentfactory DESTINATION ${PLUGIN_INSTALL_DIR})
248 install(FILES kget_bittorrentfactory_config.desktop DESTINATION ${SERVICES_INSTALL_DIR})
250 endif (GMP_FOUND AND QCA2_FOUND)
251 else (ENABLE_EMBEDDED_TORRENT_SUPPORT)
252     find_package(BTCore REQUIRED)
253     macro_log_feature(BTCORE_FOUND "BTCore" "KTorrent core library" "http://ktorrent.org/" FALSE "" "Needed to build Torrent support in KGet. Please install it or pass -DENABLE_EMBEDDED_TORRENT_SUPPORT=true to build embedded torrent support.")
255     include_directories(
256         ../../
257        ${BTCORE_INCLUDE_DIR}
258     )
259 endif (ENABLE_EMBEDDED_TORRENT_SUPPORT)
261 if (GMP_FOUND AND QCA2_FOUND AND ENABLE_EMBEDDED_TORRENT_SUPPORT)
262     kde4_add_kcfg_files(kget_bittorrentfactory_PART_SRCS bittorrentsettings.kcfgc)
263     kde4_add_plugin(kget_bittorrentfactory ${kget_bittorrentfactory_PART_SRCS} ${libbtcore_SRC})
264     target_link_libraries(kget_bittorrentfactory ${KDE4_KIO_LIBS} ${GMP_LIBRARIES} ${QCA2_LIBRARIES} kgetcore)
265     install(TARGETS kget_bittorrentfactory DESTINATION  ${PLUGIN_INSTALL_DIR})
266     install(FILES kget_bittorrentfactory.desktop DESTINATION ${SERVICES_INSTALL_DIR})
267 else (GMP_FOUND AND QCA2_FOUND AND ENABLE_EMBEDDED_TORRENT_SUPPORT)
268     kde4_add_kcfg_files(kget_bittorrentfactory_PART_SRCS bittorrentsettings.kcfgc)
269     kde4_add_plugin(kget_bittorrentfactory ${kget_bittorrentfactory_PART_SRCS})
270     target_link_libraries(kget_bittorrentfactory ${KDE4_KIO_LIBS} ${BTCORE_LIBRARIES} kgetcore)
271     install(TARGETS kget_bittorrentfactory DESTINATION  ${PLUGIN_INSTALL_DIR})
272     install(FILES kget_bittorrentfactory.desktop DESTINATION ${SERVICES_INSTALL_DIR})
273 endif (GMP_FOUND AND QCA2_FOUND AND ENABLE_EMBEDDED_TORRENT_SUPPORT)