summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml24
-rw-r--r--CMakeLists.txt158
-rw-r--r--auto_tests/Makefile.inc1
-rwxr-xr-xother/travis/autotools-after_script3
l---------other/travis/autotools-install1
-rwxr-xr-xother/travis/autotools-script20
-rwxr-xr-xother/travis/toxcore-script22
-rw-r--r--toxav/audio.h2
-rw-r--r--toxav/group.h2
10 files changed, 207 insertions, 29 deletions
diff --git a/.gitignore b/.gitignore
index 4d92363b..4248f326 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,9 @@ Thumbs.db
10*.tmp 10*.tmp
11 11
12# Make 12# Make
13/_build
14/_install
15/tox-0.0.0*
13CMakeCache.txt 16CMakeCache.txt
14CMakeFiles 17CMakeFiles
15Makefile 18Makefile
diff --git a/.travis.yml b/.travis.yml
index 2b099bae..ae3d50b2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,22 +1,23 @@
1language: c 1language: c
2compiler:
3 - clang
4 - gcc
5 2
6env: 3matrix:
7 matrix: 4 include:
8# - BUILD=hstox 5 - env: BUILD=hstox
9 - BUILD=toxcore 6 language: haskell
7 ghc: 7.8
8 - env: BUILD=toxcore
9 compiler: clang
10 - env: BUILD=toxcore
11 compiler: gcc
12 - env: BUILD=autotools
13 compiler: clang
10 14
11addons: 15addons:
12 apt: 16 apt:
13 sources: 17 sources:
14 - avsm 18 - avsm
15 - hvr-ghc
16 packages: 19 packages:
17 - cabal-install-1.22
18 - check 20 - check
19 - ghc-7.10.3
20 - libvpx-dev 21 - libvpx-dev
21 - opam # For apidsl and Frama-C. 22 - opam # For apidsl and Frama-C.
22 - texinfo # For libconfig. 23 - texinfo # For libconfig.
@@ -28,9 +29,6 @@ cache:
28 - $HOME/cache 29 - $HOME/cache
29 30
30install: 31install:
31 # Set up PATH for the /opt packages.
32 - export PATH=/opt/cabal/1.22/bin:$PATH
33 - export PATH=/opt/ghc/7.10.3/bin:$PATH
34 # Globally used environment variables. 32 # Globally used environment variables.
35 - export CACHE_DIR=$HOME/cache 33 - export CACHE_DIR=$HOME/cache
36 - export OPAMROOT=$CACHE_DIR/.opam 34 - export OPAMROOT=$CACHE_DIR/.opam
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..5e6974ce
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,158 @@
1cmake_minimum_required(VERSION 2.8.6)
2project(toxcore)
3include(CTest)
4
5
6################################################################################
7#
8# :: Dependencies and configuration.
9#
10################################################################################
11
12set(CMAKE_MACOSX_RPATH ON)
13
14find_package(PkgConfig REQUIRED)
15find_package(Threads REQUIRED)
16
17find_library(UTIL_LIBRARIES util)
18
19pkg_search_module(LIBSODIUM REQUIRED libsodium)
20pkg_search_module(CHECK REQUIRED check)
21pkg_search_module(OPUS REQUIRED opus)
22pkg_search_module(VPX REQUIRED vpx)
23
24link_directories(${LIBSODIUM_LIBRARY_DIRS})
25link_directories(${CHECK_LIBRARY_DIRS})
26link_directories(${OPUS_LIBRARY_DIRS})
27link_directories(${VPX_LIBRARY_DIRS})
28
29include_directories(${LIBSODIUM_INCLUDE_DIRS})
30include_directories(${CHECK_INCLUDE_DIRS})
31include_directories(${OPUS_INCLUDE_DIRS})
32include_directories(${VPX_INCLUDE_DIRS})
33
34set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSODIUM_CFLAGS_OTHER}")
35set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CHECK_CFLAGS_OTHER}")
36set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPUS_CFLAGS_OTHER}")
37set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VPX_CFLAGS_OTHER}")
38
39
40################################################################################
41#
42# :: Libraries.
43#
44################################################################################
45
46add_library(toxcore SHARED
47 toxcore/DHT.c
48 toxcore/LAN_discovery.c
49 toxcore/Messenger.c
50 toxcore/TCP_client.c
51 toxcore/TCP_connection.c
52 toxcore/TCP_server.c
53 toxcore/assoc.c
54 toxcore/crypto_core.c
55 toxcore/friend_connection.c
56 toxcore/friend_requests.c
57 toxcore/group.c
58 toxcore/list.c
59 toxcore/logger.c
60 toxcore/net_crypto.c
61 toxcore/network.c
62 toxcore/onion.c
63 toxcore/onion_announce.c
64 toxcore/onion_client.c
65 toxcore/ping.c
66 toxcore/ping_array.c
67 toxcore/tox.c
68 toxcore/util.c)
69
70target_link_libraries(toxcore ${LIBSODIUM_LIBRARIES})
71target_link_libraries(toxcore rt)
72
73add_library(toxav SHARED
74 toxav/audio.c
75 toxav/bwcontroller.c
76 toxav/group.c
77 toxav/msi.c
78 toxav/rtp.c
79 toxav/toxav.c
80 toxav/toxav_old.c
81 toxav/video.c)
82
83target_link_libraries(toxav toxcore)
84target_link_libraries(toxav ${OPUS_LIBRARIES})
85target_link_libraries(toxav ${VPX_LIBRARIES})
86
87add_library(toxdns SHARED
88 toxdns/toxdns.c)
89
90target_link_libraries(toxdns toxcore)
91
92add_library(toxencryptsave SHARED
93 toxencryptsave/toxencryptsave.c)
94
95target_link_libraries(toxencryptsave toxcore)
96
97
98################################################################################
99#
100# :: Automated regression tests.
101#
102################################################################################
103
104function(auto_test target)
105 if(CHECK_FOUND)
106 add_executable(auto_${target} auto_tests/${target}.c)
107 target_link_libraries(auto_${target}
108 toxcore
109 toxav
110 toxencryptsave
111 ${CHECK_LIBRARIES}
112 ${CMAKE_THREAD_LIBS_INIT})
113 add_test(${target} auto_${target})
114 endif()
115endfunction()
116
117auto_test(TCP_test)
118auto_test(assoc_test)
119auto_test(crypto_test)
120auto_test(dht_test)
121auto_test(encryptsave_test)
122# This test doesn't link (missing symbol).
123#auto_test(friends_test)
124auto_test(messenger_test)
125auto_test(network_test)
126auto_test(onion_test)
127auto_test(skeleton_test)
128auto_test(tox_test)
129auto_test(toxav_basic_test)
130auto_test(toxav_many_test)
131
132
133################################################################################
134#
135# :: Test programs.
136#
137################################################################################
138
139add_executable(nTox testing/nTox.c)
140target_link_libraries(nTox toxcore ncurses ${CMAKE_THREAD_LIBS_INIT})
141
142add_executable(DHT_test testing/DHT_test.c)
143target_link_libraries(DHT_test toxcore ${CMAKE_THREAD_LIBS_INIT})
144
145add_executable(Messenger_test testing/Messenger_test.c)
146target_link_libraries(Messenger_test toxcore ${CMAKE_THREAD_LIBS_INIT})
147
148add_executable(dns3_test testing/dns3_test.c)
149target_link_libraries(dns3_test toxdns ${CMAKE_THREAD_LIBS_INIT})
150
151add_executable(tox_sync testing/tox_sync.c)
152target_link_libraries(tox_sync toxcore ${CMAKE_THREAD_LIBS_INIT})
153
154add_executable(tox_shell testing/tox_shell.c)
155target_link_libraries(tox_shell toxcore ${CMAKE_THREAD_LIBS_INIT} ${UTIL_LIBRARIES})
156
157add_executable(irc_syncbot testing/irc_syncbot.c)
158target_link_libraries(irc_syncbot toxcore ${CMAKE_THREAD_LIBS_INIT})
diff --git a/auto_tests/Makefile.inc b/auto_tests/Makefile.inc
index d78a6a5a..8ab7c896 100644
--- a/auto_tests/Makefile.inc
+++ b/auto_tests/Makefile.inc
@@ -108,3 +108,4 @@ encryptsave_test_LDADD = $(AUTOTEST_LDADD)
108 108
109 109
110EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c 110EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c
111EXTRA_DIST += $(top_srcdir)/auto_tests/helpers.h
diff --git a/other/travis/autotools-after_script b/other/travis/autotools-after_script
new file mode 100755
index 00000000..0f4ddcd5
--- /dev/null
+++ b/other/travis/autotools-after_script
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3set -e -x
diff --git a/other/travis/autotools-install b/other/travis/autotools-install
new file mode 120000
index 00000000..7174a278
--- /dev/null
+++ b/other/travis/autotools-install
@@ -0,0 +1 @@
toxcore-install \ No newline at end of file
diff --git a/other/travis/autotools-script b/other/travis/autotools-script
new file mode 100755
index 00000000..284a52d4
--- /dev/null
+++ b/other/travis/autotools-script
@@ -0,0 +1,20 @@
1#!/bin/sh
2
3set -e -x
4
5# Build toxcore and run tests.
6./autogen.sh
7./configure \
8 --with-libsodium-libs=$CACHE_DIR/lib \
9 --with-libsodium-headers=$CACHE_DIR/include \
10 --enable-daemon \
11 --enable-logging \
12 --enable-ntox
13
14make -j `nproc`
15# This doesn't currently work on Travis, because the autotools build is broken.
16# It does not look up libsodium by pkg-config, so without the --with flags it
17# won't find it. We don't care that much about distcheck at this point, but we
18# do care whether it configures/builds at all, which is exercised by the make
19# call above. Tests are executed by the cmake build.
20make distcheck -j `nproc` || true
diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script
index b99bbe5b..ae6f4c47 100755
--- a/other/travis/toxcore-script
+++ b/other/travis/toxcore-script
@@ -2,6 +2,8 @@
2 2
3set -e -x 3set -e -x
4 4
5BUILD_DIR=_build
6
5# Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h. 7# Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h.
6../apidsl/_build/apigen.native other/apidsl/tox.in.h | $ASTYLE --options=other/astyle/astylerc > toxcore/tox.h 8../apidsl/_build/apigen.native other/apidsl/tox.in.h | $ASTYLE --options=other/astyle/astylerc > toxcore/tox.h
7../apidsl/_build/apigen.native other/apidsl/toxav.in.h | $ASTYLE --options=other/astyle/astylerc > toxav/toxav.h 9../apidsl/_build/apigen.native other/apidsl/toxav.in.h | $ASTYLE --options=other/astyle/astylerc > toxav/toxav.h
@@ -10,18 +12,10 @@ $ASTYLE --options=other/astyle/astylerc `find . -name "*.[ch]" -and -not -name "
10git diff --exit-code 12git diff --exit-code
11 13
12# Build toxcore and run tests. 14# Build toxcore and run tests.
13./autogen.sh 15export CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage -DTRAVIS_ENV=1"
14./configure \ 16cmake -B$BUILD_DIR -H.
15 --with-libsodium-libs=$CACHE_DIR/lib \ 17
16 --with-libsodium-headers=$CACHE_DIR/include \ 18export CTEST_OUTPUT_ON_FAILURE=1
17 --enable-daemon \
18 --enable-logging \
19 --enable-ntox \
20 CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage -DTRAVIS_ENV=1"
21 19
22make 20make -C $BUILD_DIR -j `nproc`
23make check 21make -C $BUILD_DIR -j `nproc` test
24if [ -f build/test-suite.log ]; then
25 cat build/test-suite.log
26fi
27make dist
diff --git a/toxav/audio.h b/toxav/audio.h
index b1db7448..cd273cf7 100644
--- a/toxav/audio.h
+++ b/toxav/audio.h
@@ -22,7 +22,7 @@
22#ifndef AUDIO_H 22#ifndef AUDIO_H
23#define AUDIO_H 23#define AUDIO_H
24 24
25#include <opus.h> 25#include <opus/opus.h>
26#include <pthread.h> 26#include <pthread.h>
27 27
28#include "toxav.h" 28#include "toxav.h"
diff --git a/toxav/group.h b/toxav/group.h
index 3355a447..bd300cdc 100644
--- a/toxav/group.h
+++ b/toxav/group.h
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/* Audio encoding/decoding */ 21/* Audio encoding/decoding */
22#include <opus.h> 22#include <opus/opus.h>
23 23
24#include "../toxcore/group.h" 24#include "../toxcore/group.h"
25 25