mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
commit
7252456c87
|
@ -1,11 +1,14 @@
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
cmake_minimum_required(VERSION 2.6.0)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
|
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
|
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
|
||||||
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
|
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
|
||||||
endif()
|
endif()
|
||||||
|
find_package(SODIUM REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
macro(linkCoreLibraries exe_name)
|
macro(linkCoreLibraries exe_name)
|
||||||
|
@ -16,8 +19,9 @@ macro(linkCoreLibraries exe_name)
|
||||||
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
|
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
|
||||||
ws2_32)
|
ws2_32)
|
||||||
else()
|
else()
|
||||||
|
include_directories(${SODIUM_INCLUDE_DIR})
|
||||||
target_link_libraries(${exe_name} core
|
target_link_libraries(${exe_name} core
|
||||||
sodium)
|
${SODIUM_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
15
cmake/FindLIBCONFIG.cmake
Normal file
15
cmake/FindLIBCONFIG.cmake
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Find LIBCONFIG
|
||||||
|
#
|
||||||
|
# LIBCONFIG_INCLUDE_DIR
|
||||||
|
# LIBCONFIG_LIBRARY
|
||||||
|
# LIBCONFIG_FOUND
|
||||||
|
#
|
||||||
|
|
||||||
|
FIND_PATH(LIBCONFIG_INCLUDE_DIR NAMES libconfig.h)
|
||||||
|
|
||||||
|
FIND_LIBRARY(LIBCONFIG_LIBRARY NAMES config)
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCONFIG DEFAULT_MSG LIBCONFIG_LIBRARY LIBCONFIG_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARY)
|
15
cmake/FindSODIUM.cmake
Normal file
15
cmake/FindSODIUM.cmake
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Find SODIUM
|
||||||
|
#
|
||||||
|
# SODIUM_INCLUDE_DIR
|
||||||
|
# SODIUM_LIBRARY
|
||||||
|
# SODIUM_FOUND
|
||||||
|
#
|
||||||
|
|
||||||
|
FIND_PATH(SODIUM_INCLUDE_DIR NAMES sodium.h)
|
||||||
|
|
||||||
|
FIND_LIBRARY(SODIUM_LIBRARY NAMES sodium)
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SODIUM DEFAULT_MSG SODIUM_LIBRARY SODIUM_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(SODIUM_INCLUDE_DIR SODIUM_LIBRARY)
|
|
@ -3,6 +3,8 @@ project(core C)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
|
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
|
||||||
|
else(WIN32)
|
||||||
|
include_directories(${SODIUM_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(core_sources
|
set(core_sources
|
||||||
|
|
|
@ -3,11 +3,15 @@ project(DHT_bootstrap_daemon C)
|
||||||
|
|
||||||
set(exe_name DHT_bootstrap_daemon)
|
set(exe_name DHT_bootstrap_daemon)
|
||||||
|
|
||||||
|
find_package(LIBCONFIG REQUIRED)
|
||||||
|
|
||||||
|
include_directories(${LIBCONFIG_INCLUDE_DIR})
|
||||||
|
|
||||||
add_executable(${exe_name}
|
add_executable(${exe_name}
|
||||||
DHT_bootstrap_daemon.c)
|
DHT_bootstrap_daemon.c)
|
||||||
|
|
||||||
target_link_libraries(${exe_name}
|
target_link_libraries(${exe_name}
|
||||||
config)
|
${LIBCONFIG_LIBRARY})
|
||||||
|
|
||||||
linkCoreLibraries(${exe_name})
|
linkCoreLibraries(${exe_name})
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void print_friendlist()
|
||||||
for(i = 0; i < 4; i++) {
|
for(i = 0; i < 4; i++) {
|
||||||
printf("ClientID: ");
|
printf("ClientID: ");
|
||||||
for(j = 0; j < 32; j++) {
|
for(j = 0; j < 32; j++) {
|
||||||
if(0 <= friends_list[k].client_list[i].client_id[j] && friends_list[k].client_list[i].client_id[j] < 16)
|
if(friends_list[k].client_list[i].client_id[j] < 16)
|
||||||
printf("0");
|
printf("0");
|
||||||
printf("%hhX", friends_list[k].client_list[i].client_id[j]);
|
printf("%hhX", friends_list[k].client_list[i].client_id[j]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user