summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--cmake/FindLIBCONFIG.cmake15
-rw-r--r--cmake/FindSODIUM.cmake15
-rw-r--r--core/CMakeLists.txt2
-rw-r--r--core/friend_requests.h2
-rw-r--r--other/bootstrap_serverdaemon/CMakeLists.txt6
-rw-r--r--testing/DHT_test.c2
-rw-r--r--testing/Lossless_UDP_testclient.c2
-rw-r--r--testing/Lossless_UDP_testserver.c2
-rw-r--r--testing/misc_tools.h2
10 files changed, 48 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c16ce6fe..c18d41d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,14 @@
1cmake_minimum_required(VERSION 2.6.0) 1cmake_minimum_required(VERSION 2.6.0)
2 2
3set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
4
3#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail 5#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
4if(NOT WIN32) 6if(NOT WIN32)
5 if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")) 7 if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
6 message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====") 8 message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
7 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") 9 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
8 endif() 10 endif()
11 find_package(SODIUM REQUIRED)
9endif() 12endif()
10 13
11macro(linkCoreLibraries exe_name) 14macro(linkCoreLibraries exe_name)
@@ -16,8 +19,9 @@ macro(linkCoreLibraries exe_name)
16 ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a 19 ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
17 ws2_32) 20 ws2_32)
18 else() 21 else()
22 include_directories(${SODIUM_INCLUDE_DIR})
19 target_link_libraries(${exe_name} core 23 target_link_libraries(${exe_name} core
20 sodium) 24 ${SODIUM_LIBRARY})
21 endif() 25 endif()
22endmacro() 26endmacro()
23 27
@@ -25,4 +29,4 @@ cmake_policy(SET CMP0011 NEW)
25 29
26add_subdirectory(core) 30add_subdirectory(core)
27add_subdirectory(testing) 31add_subdirectory(testing)
28add_subdirectory(other) \ No newline at end of file 32add_subdirectory(other)
diff --git a/cmake/FindLIBCONFIG.cmake b/cmake/FindLIBCONFIG.cmake
new file mode 100644
index 00000000..d5018240
--- /dev/null
+++ b/cmake/FindLIBCONFIG.cmake
@@ -0,0 +1,15 @@
1# Find LIBCONFIG
2#
3# LIBCONFIG_INCLUDE_DIR
4# LIBCONFIG_LIBRARY
5# LIBCONFIG_FOUND
6#
7
8FIND_PATH(LIBCONFIG_INCLUDE_DIR NAMES libconfig.h)
9
10FIND_LIBRARY(LIBCONFIG_LIBRARY NAMES config)
11
12INCLUDE(FindPackageHandleStandardArgs)
13FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCONFIG DEFAULT_MSG LIBCONFIG_LIBRARY LIBCONFIG_INCLUDE_DIR)
14
15MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARY)
diff --git a/cmake/FindSODIUM.cmake b/cmake/FindSODIUM.cmake
new file mode 100644
index 00000000..ffb6a1f7
--- /dev/null
+++ b/cmake/FindSODIUM.cmake
@@ -0,0 +1,15 @@
1# Find SODIUM
2#
3# SODIUM_INCLUDE_DIR
4# SODIUM_LIBRARY
5# SODIUM_FOUND
6#
7
8FIND_PATH(SODIUM_INCLUDE_DIR NAMES sodium.h)
9
10FIND_LIBRARY(SODIUM_LIBRARY NAMES sodium)
11
12INCLUDE(FindPackageHandleStandardArgs)
13FIND_PACKAGE_HANDLE_STANDARD_ARGS(SODIUM DEFAULT_MSG SODIUM_LIBRARY SODIUM_INCLUDE_DIR)
14
15MARK_AS_ADVANCED(SODIUM_INCLUDE_DIR SODIUM_LIBRARY)
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index 420308d8..44ae980c 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -3,6 +3,8 @@ project(core C)
3 3
4if(WIN32) 4if(WIN32)
5 include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) 5 include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
6else(WIN32)
7 include_directories(${SODIUM_INCLUDE_DIR})
6endif() 8endif()
7 9
8set(core_sources 10set(core_sources
diff --git a/core/friend_requests.h b/core/friend_requests.h
index e38f7edc..4dfc5130 100644
--- a/core/friend_requests.h
+++ b/core/friend_requests.h
@@ -48,4 +48,4 @@ int friendreq_handlepacket(uint8_t *packet, uint32_t length, IP_Port source);
48} 48}
49#endif 49#endif
50 50
51#endif \ No newline at end of file 51#endif
diff --git a/other/bootstrap_serverdaemon/CMakeLists.txt b/other/bootstrap_serverdaemon/CMakeLists.txt
index f675396d..512179f3 100644
--- a/other/bootstrap_serverdaemon/CMakeLists.txt
+++ b/other/bootstrap_serverdaemon/CMakeLists.txt
@@ -3,11 +3,15 @@ project(DHT_bootstrap_daemon C)
3 3
4set(exe_name DHT_bootstrap_daemon) 4set(exe_name DHT_bootstrap_daemon)
5 5
6find_package(LIBCONFIG REQUIRED)
7
8include_directories(${LIBCONFIG_INCLUDE_DIR})
9
6add_executable(${exe_name} 10add_executable(${exe_name}
7 DHT_bootstrap_daemon.c) 11 DHT_bootstrap_daemon.c)
8 12
9target_link_libraries(${exe_name} 13target_link_libraries(${exe_name}
10 config) 14 ${LIBCONFIG_LIBRARY})
11 15
12linkCoreLibraries(${exe_name}) 16linkCoreLibraries(${exe_name})
13 17
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index a215463d..588450e2 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -87,7 +87,7 @@ void print_friendlist()
87 for(i = 0; i < 4; i++) { 87 for(i = 0; i < 4; i++) {
88 printf("ClientID: "); 88 printf("ClientID: ");
89 for(j = 0; j < 32; j++) { 89 for(j = 0; j < 32; j++) {
90 if(0 <= friends_list[k].client_list[i].client_id[j] && friends_list[k].client_list[i].client_id[j] < 16) 90 if(friends_list[k].client_list[i].client_id[j] < 16)
91 printf("0"); 91 printf("0");
92 printf("%hhX", friends_list[k].client_list[i].client_id[j]); 92 printf("%hhX", friends_list[k].client_list[i].client_id[j]);
93 } 93 }
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c
index c1eaa69d..b96756ab 100644
--- a/testing/Lossless_UDP_testclient.c
+++ b/testing/Lossless_UDP_testclient.c
@@ -211,4 +211,4 @@ int main(int argc, char *argv[])
211 } 211 }
212 212
213 return 0; 213 return 0;
214} \ No newline at end of file 214}
diff --git a/testing/Lossless_UDP_testserver.c b/testing/Lossless_UDP_testserver.c
index 4b437f0e..29b0ade5 100644
--- a/testing/Lossless_UDP_testserver.c
+++ b/testing/Lossless_UDP_testserver.c
@@ -198,4 +198,4 @@ int main(int argc, char *argv[])
198 } 198 }
199 199
200 return 0; 200 return 0;
201} \ No newline at end of file 201}
diff --git a/testing/misc_tools.h b/testing/misc_tools.h
index 29b37ce5..5079e15d 100644
--- a/testing/misc_tools.h
+++ b/testing/misc_tools.h
@@ -26,4 +26,4 @@
26 26
27unsigned char * hex_string_to_bin(char hex_string[]); 27unsigned char * hex_string_to_bin(char hex_string[]);
28 28
29#endif // MISC_TOOLS_H \ No newline at end of file 29#endif // MISC_TOOLS_H