summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2013-07-17 18:06:05 -0400
committerMaxim Biro <nurupo.contributions@gmail.com>2013-07-17 18:18:27 -0400
commitef0efd72b51a44d30272dccffdc365165d385291 (patch)
treefd408b402da7a983ea71a1ea4b466f335cd853c0
parent817ad50d9640b8ccce3636a00f732245ff09d38c (diff)
Improved build system
-rw-r--r--.gitignore6
-rw-r--r--.travis.yml4
-rw-r--r--CMakeLists.txt51
-rw-r--r--other/CMakeLists.txt1
-rw-r--r--other/cmake/DHT_bootstrap.cmake10
-rw-r--r--testing/CMakeLists.txt7
-rw-r--r--testing/cmake/DHT_cryptosendfiletest.cmake10
-rw-r--r--testing/cmake/DHT_sendfiletest.cmake10
-rw-r--r--testing/cmake/DHT_test.cmake10
-rw-r--r--testing/cmake/Lossless_UDP_testclient.cmake10
-rw-r--r--testing/cmake/Lossless_UDP_testserver.cmake10
-rw-r--r--testing/cmake/Messenger_test.cmake10
-rw-r--r--testing/cmake/nTox.cmake12
13 files changed, 125 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index 263cdb90..0b178e8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,9 @@
3//nacl build 3//nacl build
4nacl/build/ 4nacl/build/
5build 5build
6
7CMakeCache.txt
8CMakeFiles
9Makefile
10cmake_install.cmake
11install_manifest.txt
diff --git a/.travis.yml b/.travis.yml
index a304a0a4..fe62910d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,9 @@ before_script:
14 14
15script: 15script:
16 - cmake CMakeLists.txt 16 - cmake CMakeLists.txt
17 - make -j3 17 - make DHT_bootstrap -j3
18 - make Messenger_test -j3
19 - make nTox -j3
18 20
19notifications: 21notifications:
20 email: false 22 email: false
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec474ffb..db417a2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,8 @@
1cmake_minimum_required(VERSION 2.6.0) 1cmake_minimum_required(VERSION 2.6.0)
2project(TOX C)
3 2
4set(exe_name toxMessengerTest) 3if(WIN32)
4 include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
5endif()
5 6
6set(core_sources 7set(core_sources
7 core/DHT.c 8 core/DHT.c
@@ -9,29 +10,29 @@ set(core_sources
9 core/Lossless_UDP.c 10 core/Lossless_UDP.c
10 core/net_crypto.c 11 core/net_crypto.c
11 core/Messenger.c) 12 core/Messenger.c)
12if(WIN32)
13 set(test_sources
14 testing/Messenger_test.c)
15else()
16 set(test_sources
17 testing/nTox.c)
18 #testing/Messenger_test.c)
19endif()
20 13
21add_executable(${exe_name} 14add_library(core ${core_sources})
22 ${core_sources}
23 ${test_sources})
24 15
25if(WIN32) 16macro(linkCoreLibraries exe_name)
26 include_directories(${TOX_SOURCE_DIR}/sodium/include/) 17 if(WIN32)
27 target_link_libraries(${exe_name} ws2_32 18 target_link_libraries(${exe_name} core
28 ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a) 19 ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
29else() 20 ws2_32)
30 target_link_libraries(${exe_name} sodium) 21 else()
31 target_link_libraries(${exe_name} ncurses) 22 target_link_libraries(${exe_name} core
32endif() 23 sodium)
24 endif()
25endmacro()
33 26
34if(CMAKE_COMPILER_IS_GNUCC) 27
35 message(STATUS "==== GCC detected - Adding compiler flags ====") 28macro(addCompilerFlags)
36 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") 29 if(NOT WIN32)
37endif() 30 if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
31 message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
32 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
33 endif()
34 endif()
35endmacro()
36
37ADD_SUBDIRECTORY(testing)
38ADD_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..f978baa4
--- /dev/null
+++ b/other/cmake/DHT_bootstrap.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(DHT_bootstrap C)
3
4set(exe_name DHT_bootstrap)
5
6add_executable(${exe_name}
7 DHT_bootstrap.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
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 @@
1include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_cryptosendfiletest.cmake)
2include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_sendfiletest.cmake)
3include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_test.cmake)
4include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testclient.cmake)
5include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake)
6include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake)
7include(${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..9396d91a
--- /dev/null
+++ b/testing/cmake/DHT_cryptosendfiletest.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(DHT_cryptosendfiletest C)
3
4set(exe_name DHT_cryptosendfiletest)
5
6add_executable(${exe_name}
7 DHT_cryptosendfiletest.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
diff --git a/testing/cmake/DHT_sendfiletest.cmake b/testing/cmake/DHT_sendfiletest.cmake
new file mode 100644
index 00000000..c7595224
--- /dev/null
+++ b/testing/cmake/DHT_sendfiletest.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(DHT_sendfiletest C)
3
4set(exe_name DHT_sendfiletest)
5
6add_executable(${exe_name}
7 DHT_sendfiletest.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
diff --git a/testing/cmake/DHT_test.cmake b/testing/cmake/DHT_test.cmake
new file mode 100644
index 00000000..e5c18c03
--- /dev/null
+++ b/testing/cmake/DHT_test.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(DHT_test C)
3
4set(exe_name DHT_test)
5
6add_executable(${exe_name}
7 DHT_test.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
diff --git a/testing/cmake/Lossless_UDP_testclient.cmake b/testing/cmake/Lossless_UDP_testclient.cmake
new file mode 100644
index 00000000..375bb733
--- /dev/null
+++ b/testing/cmake/Lossless_UDP_testclient.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(Lossless_UDP_testclient C)
3
4set(exe_name Lossless_UDP_testclient)
5
6add_executable(${exe_name}
7 Lossless_UDP_testclient.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
diff --git a/testing/cmake/Lossless_UDP_testserver.cmake b/testing/cmake/Lossless_UDP_testserver.cmake
new file mode 100644
index 00000000..fe16e937
--- /dev/null
+++ b/testing/cmake/Lossless_UDP_testserver.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(Lossless_UDP_testserver C)
3
4set(exe_name Lossless_UDP_testserver)
5
6add_executable(${exe_name}
7 Lossless_UDP_testserver.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
diff --git a/testing/cmake/Messenger_test.cmake b/testing/cmake/Messenger_test.cmake
new file mode 100644
index 00000000..2848818b
--- /dev/null
+++ b/testing/cmake/Messenger_test.cmake
@@ -0,0 +1,10 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(Messenger_test C)
3
4set(exe_name Messenger_test)
5
6add_executable(${exe_name}
7 Messenger_test.c)
8
9linkCoreLibraries(${exe_name})
10addCompilerFlags()
diff --git a/testing/cmake/nTox.cmake b/testing/cmake/nTox.cmake
new file mode 100644
index 00000000..814b1427
--- /dev/null
+++ b/testing/cmake/nTox.cmake
@@ -0,0 +1,12 @@
1cmake_minimum_required(VERSION 2.6.0)
2project(nTox C)
3
4set(exe_name nTox)
5
6add_executable(${exe_name}
7 nTox.c)
8
9target_link_libraries(${exe_name} ncurses)
10
11linkCoreLibraries(${exe_name})
12addCompilerFlags()