mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'master' of https://github.com/xzfc/ProjectTox-Core into xzfc-master
Conflicts: CMakeLists.txt
This commit is contained in:
commit
f2f266e9a7
|
@ -2,6 +2,21 @@ cmake_minimum_required(VERSION 2.6.0)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
option(USE_NACL "Use NaCl library instead of libsodium")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT USE_NACL)
|
||||||
|
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
|
||||||
|
else()
|
||||||
|
find_package(NaCl REQUIRED)
|
||||||
|
|
||||||
|
include_directories(${NACL_INCLUDE_DIR})
|
||||||
|
add_definitions(-DVANILLA_NACL)
|
||||||
|
|
||||||
|
set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
#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"))
|
||||||
|
@ -21,7 +36,8 @@ macro(linkCoreLibraries exe_name)
|
||||||
else()
|
else()
|
||||||
include_directories(${SODIUM_INCLUDE_DIR})
|
include_directories(${SODIUM_INCLUDE_DIR})
|
||||||
target_link_libraries(${exe_name} core
|
target_link_libraries(${exe_name} core
|
||||||
${SODIUM_LIBRARY})
|
${LINK_CRYPTO_LIBRARY})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
17
cmake/FindNaCl.cmake
Normal file
17
cmake/FindNaCl.cmake
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
find_path(NACL_INCLUDE_DIR crypto_box.h
|
||||||
|
$ENV{NACL_INCLUDE_DIR} /usr/include/nacl/
|
||||||
|
DOC "Directory which contain NaCl headers")
|
||||||
|
|
||||||
|
find_path(NACL_LIBRARY_DIR libnacl.a
|
||||||
|
$ENV{NACL_LIBRARY_DIR} /usr/lib/nacl
|
||||||
|
DOC "Directory which contain libnacl.a, cpucycles.o, and randombytes.o")
|
||||||
|
|
||||||
|
if(NACL_LIBRARY_DIR)
|
||||||
|
set(NACL_LIBRARIES
|
||||||
|
"${NACL_LIBRARY_DIR}/cpucycles.o"
|
||||||
|
"${NACL_LIBRARY_DIR}/libnacl.a"
|
||||||
|
"${NACL_LIBRARY_DIR}/randombytes.o")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(NaCl DEFAULT_MSG NACL_INCLUDE_DIR NACL_LIBRARY_DIR NACL_LIBRARIES)
|
|
@ -56,11 +56,7 @@
|
||||||
/* we use libsodium by default */
|
/* we use libsodium by default */
|
||||||
#include <sodium.h>
|
#include <sodium.h>
|
||||||
#else
|
#else
|
||||||
|
#include <crypto_box.h>
|
||||||
/* TODO: Including stuff like this is bad. This needs fixing.
|
|
||||||
We keep support for the original NaCl for now. */
|
|
||||||
#include "../nacl/build/Linux/include/amd64/crypto_box.h"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue
Block a user