diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | CMakeLists.txt | 50 | ||||
-rw-r--r-- | other/CMakeLists.txt | 1 | ||||
-rw-r--r-- | other/cmake/DHT_bootstrap.cmake | 9 | ||||
-rw-r--r-- | testing/CMakeLists.txt | 7 | ||||
-rw-r--r-- | testing/cmake/DHT_cryptosendfiletest.cmake | 9 | ||||
-rw-r--r-- | testing/cmake/DHT_sendfiletest.cmake | 9 | ||||
-rw-r--r-- | testing/cmake/DHT_test.cmake | 9 | ||||
-rw-r--r-- | testing/cmake/Lossless_UDP_testclient.cmake | 9 | ||||
-rw-r--r-- | testing/cmake/Lossless_UDP_testserver.cmake | 9 | ||||
-rw-r--r-- | testing/cmake/Messenger_test.cmake | 9 | ||||
-rw-r--r-- | testing/cmake/nTox.cmake | 11 |
13 files changed, 117 insertions, 26 deletions
@@ -3,3 +3,9 @@ | |||
3 | //nacl build | 3 | //nacl build |
4 | nacl/build/ | 4 | nacl/build/ |
5 | build | 5 | build |
6 | |||
7 | CMakeCache.txt | ||
8 | CMakeFiles | ||
9 | Makefile | ||
10 | cmake_install.cmake | ||
11 | install_manifest.txt | ||
diff --git a/.travis.yml b/.travis.yml index a304a0a4..9f62c84c 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -1,6 +1,7 @@ | |||
1 | language: c | 1 | language: c |
2 | compiler: | 2 | compiler: |
3 | - gcc | 3 | - gcc |
4 | - clang | ||
4 | 5 | ||
5 | before_script: | 6 | before_script: |
6 | - git clone git://github.com/jedisct1/libsodium.git | 7 | - git clone git://github.com/jedisct1/libsodium.git |
@@ -14,7 +15,9 @@ before_script: | |||
14 | 15 | ||
15 | script: | 16 | script: |
16 | - cmake CMakeLists.txt | 17 | - cmake CMakeLists.txt |
17 | - make -j3 | 18 | - make DHT_bootstrap -j3 |
19 | - make Messenger_test -j3 | ||
20 | - make nTox -j3 | ||
18 | 21 | ||
19 | notifications: | 22 | notifications: |
20 | email: false | 23 | email: false |
diff --git a/CMakeLists.txt b/CMakeLists.txt index ec474ffb..505983f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -1,7 +1,15 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | 1 | cmake_minimum_required(VERSION 2.6.0) |
2 | project(TOX C) | ||
3 | 2 | ||
4 | set(exe_name toxMessengerTest) | 3 | if(NOT WIN32) |
4 | if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")) | ||
5 | message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") | ||
6 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") | ||
7 | endif() | ||
8 | endif() | ||
9 | |||
10 | if(WIN32) | ||
11 | include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) | ||
12 | endif() | ||
5 | 13 | ||
6 | set(core_sources | 14 | set(core_sources |
7 | core/DHT.c | 15 | core/DHT.c |
@@ -9,29 +17,21 @@ set(core_sources | |||
9 | core/Lossless_UDP.c | 17 | core/Lossless_UDP.c |
10 | core/net_crypto.c | 18 | core/net_crypto.c |
11 | core/Messenger.c) | 19 | core/Messenger.c) |
12 | if(WIN32) | ||
13 | set(test_sources | ||
14 | testing/Messenger_test.c) | ||
15 | else() | ||
16 | set(test_sources | ||
17 | testing/nTox.c) | ||
18 | #testing/Messenger_test.c) | ||
19 | endif() | ||
20 | 20 | ||
21 | add_executable(${exe_name} | 21 | add_library(core ${core_sources}) |
22 | ${core_sources} | ||
23 | ${test_sources}) | ||
24 | 22 | ||
25 | if(WIN32) | 23 | macro(linkCoreLibraries exe_name) |
26 | include_directories(${TOX_SOURCE_DIR}/sodium/include/) | 24 | if(WIN32) |
27 | target_link_libraries(${exe_name} ws2_32 | 25 | target_link_libraries(${exe_name} core |
28 | ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a) | 26 | ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a |
29 | else() | 27 | ws2_32) |
30 | target_link_libraries(${exe_name} sodium) | 28 | else() |
31 | target_link_libraries(${exe_name} ncurses) | 29 | target_link_libraries(${exe_name} core |
32 | endif() | 30 | sodium) |
31 | endif() | ||
32 | endmacro() | ||
33 | 33 | ||
34 | if(CMAKE_COMPILER_IS_GNUCC) | 34 | cmake_policy(SET CMP0011 NEW) |
35 | message(STATUS "==== GCC detected - Adding compiler flags ====") | 35 | |
36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") | 36 | ADD_SUBDIRECTORY(testing) |
37 | endif() | 37 | ADD_SUBDIRECTORY(other) \ No newline at end of file |
diff --git a/other/CMakeLists.txt b/other/CMakeLists.txt new file mode 100644 index 00000000..22dc8e25 --- /dev/null +++ b/other/CMakeLists.txt | |||
@@ -0,0 +1 @@ | |||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_bootstrap.cmake) | |||
diff --git a/other/cmake/DHT_bootstrap.cmake b/other/cmake/DHT_bootstrap.cmake new file mode 100644 index 00000000..c3c313ae --- /dev/null +++ b/other/cmake/DHT_bootstrap.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(DHT_bootstrap C) | ||
3 | |||
4 | set(exe_name DHT_bootstrap) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | DHT_bootstrap.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) | ||
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt new file mode 100644 index 00000000..bb599b86 --- /dev/null +++ b/testing/CMakeLists.txt | |||
@@ -0,0 +1,7 @@ | |||
1 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_cryptosendfiletest.cmake) | ||
2 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_sendfiletest.cmake) | ||
3 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_test.cmake) | ||
4 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testclient.cmake) | ||
5 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake) | ||
6 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake) | ||
7 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox.cmake) \ No newline at end of file | ||
diff --git a/testing/cmake/DHT_cryptosendfiletest.cmake b/testing/cmake/DHT_cryptosendfiletest.cmake new file mode 100644 index 00000000..8d6079f8 --- /dev/null +++ b/testing/cmake/DHT_cryptosendfiletest.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(DHT_cryptosendfiletest C) | ||
3 | |||
4 | set(exe_name DHT_cryptosendfiletest) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | DHT_cryptosendfiletest.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) \ No newline at end of file | ||
diff --git a/testing/cmake/DHT_sendfiletest.cmake b/testing/cmake/DHT_sendfiletest.cmake new file mode 100644 index 00000000..93737914 --- /dev/null +++ b/testing/cmake/DHT_sendfiletest.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(DHT_sendfiletest C) | ||
3 | |||
4 | set(exe_name DHT_sendfiletest) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | DHT_sendfiletest.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) | ||
diff --git a/testing/cmake/DHT_test.cmake b/testing/cmake/DHT_test.cmake new file mode 100644 index 00000000..bcde4370 --- /dev/null +++ b/testing/cmake/DHT_test.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(DHT_test C) | ||
3 | |||
4 | set(exe_name DHT_test) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | DHT_test.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) | ||
diff --git a/testing/cmake/Lossless_UDP_testclient.cmake b/testing/cmake/Lossless_UDP_testclient.cmake new file mode 100644 index 00000000..e894d228 --- /dev/null +++ b/testing/cmake/Lossless_UDP_testclient.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(Lossless_UDP_testclient C) | ||
3 | |||
4 | set(exe_name Lossless_UDP_testclient) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | Lossless_UDP_testclient.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) | ||
diff --git a/testing/cmake/Lossless_UDP_testserver.cmake b/testing/cmake/Lossless_UDP_testserver.cmake new file mode 100644 index 00000000..04306c1a --- /dev/null +++ b/testing/cmake/Lossless_UDP_testserver.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(Lossless_UDP_testserver C) | ||
3 | |||
4 | set(exe_name Lossless_UDP_testserver) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | Lossless_UDP_testserver.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) | ||
diff --git a/testing/cmake/Messenger_test.cmake b/testing/cmake/Messenger_test.cmake new file mode 100644 index 00000000..a85e043d --- /dev/null +++ b/testing/cmake/Messenger_test.cmake | |||
@@ -0,0 +1,9 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(Messenger_test C) | ||
3 | |||
4 | set(exe_name Messenger_test) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | Messenger_test.c) | ||
8 | |||
9 | linkCoreLibraries(${exe_name}) | ||
diff --git a/testing/cmake/nTox.cmake b/testing/cmake/nTox.cmake new file mode 100644 index 00000000..1656bc80 --- /dev/null +++ b/testing/cmake/nTox.cmake | |||
@@ -0,0 +1,11 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | ||
2 | project(nTox C) | ||
3 | |||
4 | set(exe_name nTox) | ||
5 | |||
6 | add_executable(${exe_name} | ||
7 | nTox.c) | ||
8 | |||
9 | target_link_libraries(${exe_name} ncurses) | ||
10 | |||
11 | linkCoreLibraries(${exe_name}) | ||