Squashed 'external/toxcore/c-toxcore/' changes from f1df709b87..8f0d505f9a
8f0d505f9a feat: add ngc events 9b8216e70c refactor: Make event dispatch ordered by receive time. 814c12a6f4 cleanup: Add dynamically derived array sizes to the API. 226b23be12 cleanup: Add explicit array sizes to toxencryptsave. ef33cb4de0 cleanup: Add Toxav alias for ToxAV. 1da723b34d cleanup: Make Tox_Options a typedef. b148a2afff chore: Simplify msvc build using vcpkg. 5cac6d7eb1 cleanup: Move `tox_get_system` out of the public API. c9ca4007e3 refactor: Align group message sending with other send functions. 6c6c0b1b1b cleanup: Make setters take non-const `Tox *`. a76f758d70 cleanup: Mark arrays in the tox API as `[]` instead of `*`. baf6d1f6cf cleanup: Make array params in toxav `[]` instead of `*`. 79f55bd06a cleanup: Put the size of fixed arrays into the API types. 1e73698db2 cleanup: Add typedefs for public API int identifiers. cac074c57f chore: Add fetch-sha256 script to update bootstrap node hash. 32576656bb Make the comment capitalization uniform aff4dda17c Spellcheck tox-bootstrapd 40b5fbbe9d chore: Remove settings.yml in favour of hs-github-tools. ebafd51be7 chore: Use GPL license with https. 0e42752f0f cleanup: Move all vptr-to-ptr casts to the beginning of a function. 5407384211 cleanup: Use github actions matrix to simplify CI. 82d8265688 fix: Use QueryPerformanceCounter on windows for monotonic time. 1224e656e3 chore: Add `net_(new|kill)_strerror` to cppcheck's allocators. 6a90ddfe4e cleanup: Run clang-tidy on headers, as well. bd930cc80a cleanup: Make TCP connection failures a warning instead of error. fad6e4e173 cleanup: Make all .c files include the headers they need. ef4897a898 cleanup: Upgrade to clang-tidy-17 and fix some warnings. REVERT: f1df709b87 feat: add ngc events REVERT: 1b6c907235 refactor: Make event dispatch ordered by receive time. git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 8f0d505f9a598cc41c682178e1589bcc01efe9cb
This commit is contained in:
@@ -81,7 +81,7 @@ find_package(GTest)
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
|
||||
# Set standard version for compiler.
|
||||
if(MSVC)
|
||||
if(MSVC AND MSVC_TOOLSET_VERSION LESS 143)
|
||||
# https://developercommunity.visualstudio.com/t/older-winsdk-headers-are-incompatible-with-zcprepr/1593479
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
else()
|
||||
@@ -94,6 +94,35 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
message(STATUS "Supported C compiler features = ${CMAKE_C_COMPILE_FEATURES}")
|
||||
message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
|
||||
# Enable some warnings if we know the compiler.
|
||||
if(MSVC)
|
||||
add_compile_options(/W4 /analyze)
|
||||
add_compile_options(/wd4100) # unreferenced formal parameter
|
||||
add_compile_options(/wd4267) # narrowing conversion
|
||||
add_compile_options(/wd4244) # narrowing conversion
|
||||
add_compile_options(/wd4127) # conditional expression is constant
|
||||
add_compile_options(/wd4995) # #pragma deprecated
|
||||
add_compile_options(/wd4018) # signed/unsigned compare
|
||||
add_compile_options(/wd4310) # cast truncates constant value
|
||||
add_compile_options(/wd4389) # signed/unsigned compare
|
||||
add_compile_options(/wd4245) # signed/unsigned assign/return/function call
|
||||
add_compile_options(/wd4200) # nonstandard extension used: zero-sized array in struct/union
|
||||
add_compile_options(/wd4702) # unreachable code
|
||||
add_compile_options(/wd6340) # unsigned int passed to signed parameter
|
||||
add_compile_options(/wd6326) # potential comparison of a constant with another constant
|
||||
|
||||
# TODO(iphydf): Look into these
|
||||
add_compile_options(/wd4996) # use WSAAddressToStringW() instead of WSAAddressToStringA()
|
||||
add_compile_options(/wd6255) # don't use alloca
|
||||
add_compile_options(/wd6385) # reading invalid data
|
||||
add_compile_options(/wd6001) # using uninitialized memory
|
||||
add_compile_options(/wd6101) # returning uninitialized memory
|
||||
add_compile_options(/wd6386) # buffer overrun
|
||||
add_compile_options(/wd6011) # NULL dereference
|
||||
add_compile_options(/wd6031) # sscanf return value ignored
|
||||
add_compile_options(/wd6387) # passing NULL to fwrite
|
||||
endif()
|
||||
|
||||
set(MIN_LOGGER_LEVEL "" CACHE STRING "Logging level to use (TRACE, DEBUG, INFO, WARNING, ERROR)")
|
||||
if(MIN_LOGGER_LEVEL)
|
||||
if(("${MIN_LOGGER_LEVEL}" STREQUAL "TRACE") OR
|
||||
@@ -327,10 +356,14 @@ set(toxcore_SOURCES
|
||||
toxcore/tox_unpack.h
|
||||
toxcore/util.c
|
||||
toxcore/util.h)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${LIBSODIUM_LIBRARIES})
|
||||
set(toxcore_LINK_DIRECTORIES ${toxcore_LINK_DIRECTORIES} ${LIBSODIUM_LIBRARY_DIRS})
|
||||
set(toxcore_INCLUDE_DIRECTORIES ${toxcore_INCLUDE_DIRECTORIES} ${LIBSODIUM_INCLUDE_DIRS})
|
||||
set(toxcore_COMPILE_OPTIONS ${toxcore_COMPILE_OPTIONS} ${LIBSODIUM_CFLAGS_OTHER})
|
||||
if(TARGET unofficial-sodium::sodium)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} unofficial-sodium::sodium)
|
||||
else()
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${LIBSODIUM_LIBRARIES})
|
||||
set(toxcore_LINK_DIRECTORIES ${toxcore_LINK_DIRECTORIES} ${LIBSODIUM_LIBRARY_DIRS})
|
||||
set(toxcore_INCLUDE_DIRECTORIES ${toxcore_INCLUDE_DIRECTORIES} ${LIBSODIUM_INCLUDE_DIRS})
|
||||
set(toxcore_COMPILE_OPTIONS ${toxcore_COMPILE_OPTIONS} ${LIBSODIUM_CFLAGS_OTHER})
|
||||
endif()
|
||||
set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium)
|
||||
set(toxcore_API_HEADERS
|
||||
${toxcore_SOURCE_DIR}/toxcore/tox.h^tox
|
||||
@@ -366,10 +399,14 @@ if(BUILD_TOXAV)
|
||||
set(toxcore_API_HEADERS ${toxcore_API_HEADERS}
|
||||
${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav)
|
||||
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
|
||||
set(toxcore_LINK_DIRECTORIES ${toxcore_LINK_DIRECTORIES} ${OPUS_LIBRARY_DIRS} ${VPX_LIBRARY_DIRS})
|
||||
set(toxcore_INCLUDE_DIRECTORIES ${toxcore_INCLUDE_DIRECTORIES} ${OPUS_INCLUDE_DIRS} ${VPX_INCLUDE_DIRS})
|
||||
set(toxcore_COMPILE_OPTIONS ${toxcore_COMPILE_OPTIONS} ${OPUS_CFLAGS_OTHER} ${VPX_CFLAGS_OTHER})
|
||||
if(MSVC)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} PkgConfig::OPUS PkgConfig::VPX)
|
||||
else()
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
|
||||
set(toxcore_LINK_DIRECTORIES ${toxcore_LINK_DIRECTORIES} ${OPUS_LIBRARY_DIRS} ${VPX_LIBRARY_DIRS})
|
||||
set(toxcore_INCLUDE_DIRECTORIES ${toxcore_INCLUDE_DIRECTORIES} ${OPUS_INCLUDE_DIRS} ${VPX_INCLUDE_DIRS})
|
||||
set(toxcore_COMPILE_OPTIONS ${toxcore_COMPILE_OPTIONS} ${OPUS_CFLAGS_OTHER} ${VPX_CFLAGS_OTHER})
|
||||
endif()
|
||||
set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} opus vpx)
|
||||
endif()
|
||||
|
||||
@@ -400,7 +437,6 @@ if(CMAKE_THREAD_LIBS_INIT)
|
||||
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
|
||||
if(NSL_LIBRARIES)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${NSL_LIBRARIES})
|
||||
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lnsl)
|
||||
@@ -416,9 +452,13 @@ if(SOCKET_LIBRARIES)
|
||||
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lsocket)
|
||||
endif()
|
||||
|
||||
if(TARGET PThreads4W::PThreads4W)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} PThreads4W::PThreads4W)
|
||||
elseif(TARGET Threads::Threads)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} Threads::Threads)
|
||||
endif()
|
||||
if(WIN32)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ws2_32 iphlpapi)
|
||||
set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lws2_32 -liphlpapi)
|
||||
set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} iphlpapi wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@@ -516,6 +556,14 @@ if(DHT_BOOTSTRAP)
|
||||
target_link_libraries(DHT_bootstrap PRIVATE toxcore_shared)
|
||||
endif()
|
||||
target_link_libraries(DHT_bootstrap PRIVATE misc_tools)
|
||||
if(TARGET unofficial-sodium::sodium)
|
||||
target_link_libraries(DHT_bootstrap PRIVATE unofficial-sodium::sodium)
|
||||
endif()
|
||||
if(TARGET PThreads4W::PThreads4W)
|
||||
target_link_libraries(DHT_bootstrap PRIVATE PThreads4W::PThreads4W)
|
||||
elseif(TARGET Threads::Threads)
|
||||
target_link_libraries(DHT_bootstrap PRIVATE Threads::Threads)
|
||||
endif()
|
||||
install(TARGETS DHT_bootstrap RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
|
||||
|
Reference in New Issue
Block a user