diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .travis.yml | 24 | ||||
-rw-r--r-- | CMakeLists.txt | 158 | ||||
-rw-r--r-- | auto_tests/Makefile.inc | 1 | ||||
-rwxr-xr-x | other/travis/autotools-after_script | 3 | ||||
l--------- | other/travis/autotools-install | 1 | ||||
-rwxr-xr-x | other/travis/autotools-script | 20 | ||||
-rwxr-xr-x | other/travis/toxcore-script | 22 | ||||
-rw-r--r-- | toxav/audio.h | 2 | ||||
-rw-r--r-- | toxav/group.h | 2 |
10 files changed, 207 insertions, 29 deletions
@@ -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* | ||
13 | CMakeCache.txt | 16 | CMakeCache.txt |
14 | CMakeFiles | 17 | CMakeFiles |
15 | Makefile | 18 | Makefile |
diff --git a/.travis.yml b/.travis.yml index 2b099bae..ae3d50b2 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -1,22 +1,23 @@ | |||
1 | language: c | 1 | language: c |
2 | compiler: | ||
3 | - clang | ||
4 | - gcc | ||
5 | 2 | ||
6 | env: | 3 | matrix: |
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 | ||
11 | addons: | 15 | addons: |
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 | ||
30 | install: | 31 | install: |
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 @@ | |||
1 | cmake_minimum_required(VERSION 2.8.6) | ||
2 | project(toxcore) | ||
3 | include(CTest) | ||
4 | |||
5 | |||
6 | ################################################################################ | ||
7 | # | ||
8 | # :: Dependencies and configuration. | ||
9 | # | ||
10 | ################################################################################ | ||
11 | |||
12 | set(CMAKE_MACOSX_RPATH ON) | ||
13 | |||
14 | find_package(PkgConfig REQUIRED) | ||
15 | find_package(Threads REQUIRED) | ||
16 | |||
17 | find_library(UTIL_LIBRARIES util) | ||
18 | |||
19 | pkg_search_module(LIBSODIUM REQUIRED libsodium) | ||
20 | pkg_search_module(CHECK REQUIRED check) | ||
21 | pkg_search_module(OPUS REQUIRED opus) | ||
22 | pkg_search_module(VPX REQUIRED vpx) | ||
23 | |||
24 | link_directories(${LIBSODIUM_LIBRARY_DIRS}) | ||
25 | link_directories(${CHECK_LIBRARY_DIRS}) | ||
26 | link_directories(${OPUS_LIBRARY_DIRS}) | ||
27 | link_directories(${VPX_LIBRARY_DIRS}) | ||
28 | |||
29 | include_directories(${LIBSODIUM_INCLUDE_DIRS}) | ||
30 | include_directories(${CHECK_INCLUDE_DIRS}) | ||
31 | include_directories(${OPUS_INCLUDE_DIRS}) | ||
32 | include_directories(${VPX_INCLUDE_DIRS}) | ||
33 | |||
34 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSODIUM_CFLAGS_OTHER}") | ||
35 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CHECK_CFLAGS_OTHER}") | ||
36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPUS_CFLAGS_OTHER}") | ||
37 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VPX_CFLAGS_OTHER}") | ||
38 | |||
39 | |||
40 | ################################################################################ | ||
41 | # | ||
42 | # :: Libraries. | ||
43 | # | ||
44 | ################################################################################ | ||
45 | |||
46 | add_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 | |||
70 | target_link_libraries(toxcore ${LIBSODIUM_LIBRARIES}) | ||
71 | target_link_libraries(toxcore rt) | ||
72 | |||
73 | add_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 | |||
83 | target_link_libraries(toxav toxcore) | ||
84 | target_link_libraries(toxav ${OPUS_LIBRARIES}) | ||
85 | target_link_libraries(toxav ${VPX_LIBRARIES}) | ||
86 | |||
87 | add_library(toxdns SHARED | ||
88 | toxdns/toxdns.c) | ||
89 | |||
90 | target_link_libraries(toxdns toxcore) | ||
91 | |||
92 | add_library(toxencryptsave SHARED | ||
93 | toxencryptsave/toxencryptsave.c) | ||
94 | |||
95 | target_link_libraries(toxencryptsave toxcore) | ||
96 | |||
97 | |||
98 | ################################################################################ | ||
99 | # | ||
100 | # :: Automated regression tests. | ||
101 | # | ||
102 | ################################################################################ | ||
103 | |||
104 | function(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() | ||
115 | endfunction() | ||
116 | |||
117 | auto_test(TCP_test) | ||
118 | auto_test(assoc_test) | ||
119 | auto_test(crypto_test) | ||
120 | auto_test(dht_test) | ||
121 | auto_test(encryptsave_test) | ||
122 | # This test doesn't link (missing symbol). | ||
123 | #auto_test(friends_test) | ||
124 | auto_test(messenger_test) | ||
125 | auto_test(network_test) | ||
126 | auto_test(onion_test) | ||
127 | auto_test(skeleton_test) | ||
128 | auto_test(tox_test) | ||
129 | auto_test(toxav_basic_test) | ||
130 | auto_test(toxav_many_test) | ||
131 | |||
132 | |||
133 | ################################################################################ | ||
134 | # | ||
135 | # :: Test programs. | ||
136 | # | ||
137 | ################################################################################ | ||
138 | |||
139 | add_executable(nTox testing/nTox.c) | ||
140 | target_link_libraries(nTox toxcore ncurses ${CMAKE_THREAD_LIBS_INIT}) | ||
141 | |||
142 | add_executable(DHT_test testing/DHT_test.c) | ||
143 | target_link_libraries(DHT_test toxcore ${CMAKE_THREAD_LIBS_INIT}) | ||
144 | |||
145 | add_executable(Messenger_test testing/Messenger_test.c) | ||
146 | target_link_libraries(Messenger_test toxcore ${CMAKE_THREAD_LIBS_INIT}) | ||
147 | |||
148 | add_executable(dns3_test testing/dns3_test.c) | ||
149 | target_link_libraries(dns3_test toxdns ${CMAKE_THREAD_LIBS_INIT}) | ||
150 | |||
151 | add_executable(tox_sync testing/tox_sync.c) | ||
152 | target_link_libraries(tox_sync toxcore ${CMAKE_THREAD_LIBS_INIT}) | ||
153 | |||
154 | add_executable(tox_shell testing/tox_shell.c) | ||
155 | target_link_libraries(tox_shell toxcore ${CMAKE_THREAD_LIBS_INIT} ${UTIL_LIBRARIES}) | ||
156 | |||
157 | add_executable(irc_syncbot testing/irc_syncbot.c) | ||
158 | target_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 | ||
110 | EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c | 110 | EXTRA_DIST += $(top_srcdir)/auto_tests/friends_test.c |
111 | EXTRA_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 | |||
3 | set -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 | |||
3 | set -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 | |||
14 | make -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. | ||
20 | make 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 | ||
3 | set -e -x | 3 | set -e -x |
4 | 4 | ||
5 | BUILD_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 " | |||
10 | git diff --exit-code | 12 | git diff --exit-code |
11 | 13 | ||
12 | # Build toxcore and run tests. | 14 | # Build toxcore and run tests. |
13 | ./autogen.sh | 15 | export CFLAGS="-O0 -Wall -Wextra -fprofile-arcs -ftest-coverage -DTRAVIS_ENV=1" |
14 | ./configure \ | 16 | cmake -B$BUILD_DIR -H. |
15 | --with-libsodium-libs=$CACHE_DIR/lib \ | 17 | |
16 | --with-libsodium-headers=$CACHE_DIR/include \ | 18 | export 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 | ||
22 | make | 20 | make -C $BUILD_DIR -j `nproc` |
23 | make check | 21 | make -C $BUILD_DIR -j `nproc` test |
24 | if [ -f build/test-suite.log ]; then | ||
25 | cat build/test-suite.log | ||
26 | fi | ||
27 | make 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 | ||