summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt116
-rw-r--r--other/pkgconfig/toxav.pc.in2
-rw-r--r--other/pkgconfig/toxcore.pc.in2
-rw-r--r--other/pkgconfig/toxdns.pc.in2
-rw-r--r--other/pkgconfig/toxencryptsave.pc.in2
-rwxr-xr-xother/travis/toxcore-script2
6 files changed, 94 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b264d3f4..9b1ba642 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,12 +9,20 @@ set(PROJECT_VERSION "0.0.0")
9 9
10################################################################################ 10################################################################################
11# 11#
12# :: Dependencies and configuration. 12# :: Dependencies and configuration
13# 13#
14################################################################################ 14################################################################################
15 15
16set(CMAKE_MACOSX_RPATH ON) 16set(CMAKE_MACOSX_RPATH ON)
17 17
18option(LOGGING "Enable internal library logging" OFF)
19if(LOGGING)
20 add_definitions(
21 -DTOX_LOGGER=1
22 -DLOGGER_LEVEL=LOG_DEBUG
23 -DLOGGER_OUTPUT_FILE="libtoxcore.log")
24endif()
25
18find_package(PkgConfig REQUIRED) 26find_package(PkgConfig REQUIRED)
19find_package(Threads REQUIRED) 27find_package(Threads REQUIRED)
20 28
@@ -74,40 +82,78 @@ endif()
74 82
75################################################################################ 83################################################################################
76# 84#
77# :: Libraries. 85# :: Tox Core Library
78# 86#
79################################################################################ 87################################################################################
80 88
81add_library(toxcore ${LIBTYPE} 89# LAYER 1: Crypto core
90# --------------------
91add_library(toxcrypto ${LIBTYPE}
92 toxcore/crypto_core.c)
93target_link_libraries(toxcrypto ${LIBSODIUM_LIBRARIES})
94
95# LAYER 2: Basic networking
96# -------------------------
97add_library(toxnetwork ${LIBTYPE}
98 toxcore/logger.c
99 toxcore/network.c
100 toxcore/util.c)
101target_link_libraries(toxnetwork toxcrypto)
102
103# LAYER 3: Distributed Hash Table
104# -------------------------------
105add_library(toxdht ${LIBTYPE}
82 toxcore/DHT.c 106 toxcore/DHT.c
83 toxcore/LAN_discovery.c 107 toxcore/LAN_discovery.c
84 toxcore/Messenger.c 108 toxcore/assoc.c
109 toxcore/ping.c
110 toxcore/ping_array.c)
111target_link_libraries(toxdht toxnetwork)
112
113# LAYER 4: Onion routing, TCP connections, crypto connections
114# -----------------------------------------------------------
115add_library(toxnetcrypto ${LIBTYPE}
85 toxcore/TCP_client.c 116 toxcore/TCP_client.c
86 toxcore/TCP_connection.c 117 toxcore/TCP_connection.c
87 toxcore/TCP_server.c 118 toxcore/TCP_server.c
88 toxcore/assoc.c
89 toxcore/crypto_core.c
90 toxcore/friend_connection.c
91 toxcore/friend_requests.c
92 toxcore/group.c
93 toxcore/list.c 119 toxcore/list.c
94 toxcore/logger.c
95 toxcore/net_crypto.c 120 toxcore/net_crypto.c
96 toxcore/network.c
97 toxcore/onion.c 121 toxcore/onion.c
98 toxcore/onion_announce.c 122 toxcore/onion_announce.c
99 toxcore/onion_client.c 123 toxcore/onion_client.c)
100 toxcore/ping.c 124target_link_libraries(toxnetcrypto toxdht)
101 toxcore/ping_array.c
102 toxcore/tox.c
103 toxcore/util.c)
104 125
105target_link_libraries(toxcore ${LIBSODIUM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 126# LAYER 5: Friend requests and connections
127# ----------------------------------------
128add_library(toxfriends ${LIBTYPE}
129 toxcore/friend_connection.c
130 toxcore/friend_requests.c)
131target_link_libraries(toxfriends toxnetcrypto)
132
133# LAYER 6: Tox messenger
134# ----------------------
135add_library(toxmessenger ${LIBTYPE}
136 toxcore/Messenger.c)
137target_link_libraries(toxmessenger toxfriends)
138
139# LAYER 7: Group chats
140# --------------------
141add_library(toxgroup ${LIBTYPE}
142 toxcore/group.c)
143target_link_libraries(toxgroup toxmessenger)
144
145# LAYER 8: Public API
146# -------------------
147add_library(toxcore ${LIBTYPE}
148 toxcore/tox.c)
149target_link_libraries(toxcore toxgroup)
150
151target_link_libraries(toxcore ${CMAKE_THREAD_LIBS_INIT})
106if(CMAKE_THREAD_LIBS_INIT) 152if(CMAKE_THREAD_LIBS_INIT)
107 set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-l${CMAKE_THREAD_LIBS_INIT}") 153 set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-l${CMAKE_THREAD_LIBS_INIT}")
108endif() 154endif()
109if(RT_LIBRARIES) 155if(RT_LIBRARIES)
110 target_link_libraries(toxcore ${RT_LIBRARIES}) 156 target_link_libraries(toxnetwork ${RT_LIBRARIES})
111 set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lrt") 157 set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lrt")
112endif() 158endif()
113 159
@@ -115,6 +161,13 @@ if(WIN32)
115 target_link_libraries(toxcore ws2_32 iphlpapi) 161 target_link_libraries(toxcore ws2_32 iphlpapi)
116endif() 162endif()
117 163
164
165################################################################################
166#
167# :: Audio/Video Library
168#
169################################################################################
170
118add_library(toxav ${LIBTYPE} 171add_library(toxav ${LIBTYPE}
119 toxav/audio.c 172 toxav/audio.c
120 toxav/bwcontroller.c 173 toxav/bwcontroller.c
@@ -124,25 +177,27 @@ add_library(toxav ${LIBTYPE}
124 toxav/toxav.c 177 toxav/toxav.c
125 toxav/toxav_old.c 178 toxav/toxav_old.c
126 toxav/video.c) 179 toxav/video.c)
180target_link_libraries(toxav toxcore ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
181
127 182
128target_link_libraries(toxav toxcore) 183################################################################################
129target_link_libraries(toxav ${OPUS_LIBRARIES}) 184#
130target_link_libraries(toxav ${VPX_LIBRARIES}) 185# :: ToxDNS and block encryption libraries
186#
187################################################################################
131 188
132add_library(toxdns ${LIBTYPE} 189add_library(toxdns ${LIBTYPE}
133 toxdns/toxdns.c) 190 toxdns/toxdns.c)
134
135target_link_libraries(toxdns toxcore) 191target_link_libraries(toxdns toxcore)
136 192
137add_library(toxencryptsave ${LIBTYPE} 193add_library(toxencryptsave ${LIBTYPE}
138 toxencryptsave/toxencryptsave.c) 194 toxencryptsave/toxencryptsave.c)
139
140target_link_libraries(toxencryptsave toxcore) 195target_link_libraries(toxencryptsave toxcore)
141 196
142 197
143################################################################################ 198################################################################################
144# 199#
145# :: Automated regression tests. 200# :: Automated regression tests
146# 201#
147################################################################################ 202################################################################################
148 203
@@ -176,7 +231,7 @@ auto_test(toxav_many_test)
176 231
177################################################################################ 232################################################################################
178# 233#
179# :: Bootstrap daemon. 234# :: Bootstrap daemon
180# 235#
181################################################################################ 236################################################################################
182 237
@@ -200,7 +255,7 @@ endif()
200 255
201################################################################################ 256################################################################################
202# 257#
203# :: Test programs. 258# :: Test programs
204# 259#
205################################################################################ 260################################################################################
206 261
@@ -236,7 +291,7 @@ endif()
236 291
237################################################################################ 292################################################################################
238# 293#
239# :: Installation and pkg-config. 294# :: Installation and pkg-config
240# 295#
241################################################################################ 296################################################################################
242 297
@@ -274,8 +329,15 @@ install(FILES
274install(TARGETS 329install(TARGETS
275 toxav 330 toxav
276 toxcore 331 toxcore
332 toxcrypto
333 toxdht
277 toxdns 334 toxdns
278 toxencryptsave 335 toxencryptsave
336 toxfriends
337 toxgroup
338 toxmessenger
339 toxnetcrypto
340 toxnetwork
279 DESTINATION "lib") 341 DESTINATION "lib")
280install(FILES 342install(FILES
281 toxav/toxav.h 343 toxav/toxav.h
diff --git a/other/pkgconfig/toxav.pc.in b/other/pkgconfig/toxav.pc.in
index bb480d72..6b56500b 100644
--- a/other/pkgconfig/toxav.pc.in
+++ b/other/pkgconfig/toxav.pc.in
@@ -6,5 +6,5 @@ Name: toxav
6Description: Tox A/V library 6Description: Tox A/V library
7Requires: opus toxcore vpx 7Requires: opus toxcore vpx
8Version: @PROJECT_VERSION@ 8Version: @PROJECT_VERSION@
9Libs: -L${libdir} -ltoxav @toxav_PKGCONFIG_LIBS@ 9Libs: -L${libdir} @toxav_PKGCONFIG_LIBS@ -ltoxav
10Cflags: -I${includedir} 10Cflags: -I${includedir}
diff --git a/other/pkgconfig/toxcore.pc.in b/other/pkgconfig/toxcore.pc.in
index 09556494..c77cb5be 100644
--- a/other/pkgconfig/toxcore.pc.in
+++ b/other/pkgconfig/toxcore.pc.in
@@ -6,5 +6,5 @@ Name: toxcore
6Description: Tox protocol library 6Description: Tox protocol library
7Requires: libsodium 7Requires: libsodium
8Version: @PROJECT_VERSION@ 8Version: @PROJECT_VERSION@
9Libs: -L${libdir} -ltoxcore @toxcore_PKGCONFIG_LIBS@ 9Libs: -L${libdir} @toxcore_PKGCONFIG_LIBS@ -ltoxcrypto -ltoxnetwork -ltoxdht -ltoxnetcrypto -ltoxfriends -ltoxmessenger -ltoxgroup -ltoxcore
10Cflags: -I${includedir} 10Cflags: -I${includedir}
diff --git a/other/pkgconfig/toxdns.pc.in b/other/pkgconfig/toxdns.pc.in
index 92f3ad40..0f69130c 100644
--- a/other/pkgconfig/toxdns.pc.in
+++ b/other/pkgconfig/toxdns.pc.in
@@ -6,5 +6,5 @@ Name: toxdns
6Description: Tox DNS3 library 6Description: Tox DNS3 library
7Requires: toxcore 7Requires: toxcore
8Version: @PROJECT_VERSION@ 8Version: @PROJECT_VERSION@
9Libs: -L${libdir} -ltoxdns @toxdns_PKGCONFIG_LIBS@ 9Libs: -L${libdir} @toxdns_PKGCONFIG_LIBS@ -ltoxdns
10Cflags: -I${includedir} 10Cflags: -I${includedir}
diff --git a/other/pkgconfig/toxencryptsave.pc.in b/other/pkgconfig/toxencryptsave.pc.in
index 30f47b36..bd717f53 100644
--- a/other/pkgconfig/toxencryptsave.pc.in
+++ b/other/pkgconfig/toxencryptsave.pc.in
@@ -6,5 +6,5 @@ Name: toxencryptsave
6Description: Tox block encryption library 6Description: Tox block encryption library
7Requires: toxcore 7Requires: toxcore
8Version: @PROJECT_VERSION@ 8Version: @PROJECT_VERSION@
9Libs: -L${libdir} -ltoxencryptsave @toxencryptsave_PKGCONFIG_LIBS@ 9Libs: -L${libdir} @toxencryptsave_PKGCONFIG_LIBS@ -ltoxencryptsave
10Cflags: -I${includedir} 10Cflags: -I${includedir}
diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script
index ed9377fe..20ad6d8e 100755
--- a/other/travis/toxcore-script
+++ b/other/travis/toxcore-script
@@ -12,7 +12,7 @@ git diff --exit-code
12 12
13# Build toxcore and run tests. 13# Build toxcore and run tests.
14export CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage -DTRAVIS_ENV=1" 14export CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage -DTRAVIS_ENV=1"
15RUN $CMAKE -B$BUILD_DIR -H. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX 15RUN $CMAKE -B$BUILD_DIR -H. -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DLOGGING=ON
16 16
17export CTEST_OUTPUT_ON_FAILURE=1 17export CTEST_OUTPUT_ON_FAILURE=1
18 18