From 04310100b527dd1dd96d8e47180dd8ea01d813e8 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 13 Jan 2023 19:40:23 +0100 Subject: [PATCH] initial setup --- .gitignore | 31 +++ .gitmodules | 11 + CMakeLists.txt | 53 +++++ external/CMakeLists.txt | 6 + external/tox_ngc_ext/CMakeLists.txt | 14 ++ external/tox_ngc_ext/tox_ngc_ext | 1 + external/tox_ngc_ft1/CMakeLists.txt | 13 ++ external/tox_ngc_ft1/tox_ngc_ft1 | 1 + external/toxcore/CMakeLists.txt | 7 + external/toxcore/c-toxcore | 1 + external/toxcore/cmake/Findsodium.cmake | 297 ++++++++++++++++++++++++ external/toxcore/toxcore.cmake | 158 +++++++++++++ src/CMakeLists.txt | 18 ++ src/main.cpp | 7 + 14 files changed, 618 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 external/CMakeLists.txt create mode 100644 external/tox_ngc_ext/CMakeLists.txt create mode 160000 external/tox_ngc_ext/tox_ngc_ext create mode 100644 external/tox_ngc_ft1/CMakeLists.txt create mode 160000 external/tox_ngc_ft1/tox_ngc_ft1 create mode 100644 external/toxcore/CMakeLists.txt create mode 160000 external/toxcore/c-toxcore create mode 100644 external/toxcore/cmake/Findsodium.cmake create mode 100644 external/toxcore/toxcore.cmake create mode 100644 src/CMakeLists.txt create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e3d45c --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +.vs/ +*.o +*.swp +~* +*~ +.idea/ +cmake-build-debug/ +cmake-build-debugandtest/ +cmake-build-release/ +*.stackdump +*.coredump +compile_commands.json + +/build* +/out + +.clangd +.cache + +*.srctrlbm +*.srctrldb +*.srctrlprj +CMakeSettings.json + +.DS_Store +.AppleDouble +.LSOverride + +CMakeLists.txt.user* +CMakeCache.txt +.vscode diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7d5b926 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,11 @@ +[submodule "external/toxcore/c-toxcore"] + path = external/toxcore/c-toxcore + url = https://github.com/TokTok/c-toxcore.git + shallow = true + ignore = dirty +[submodule "external/tox_ngc_ext/tox_ngc_ext"] + path = external/tox_ngc_ext/tox_ngc_ext + url = https://github.com/Green-Sky/tox_ngc_ext +[submodule "external/tox_ngc_ft1/tox_ngc_ft1"] + path = external/tox_ngc_ft1/tox_ngc_ft1 + url = https://github.com/Green-Sky/tox_ngc_ft1 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..47c098a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +# cmake setup begin +project(tox_ngc_ft1_tool C CXX) + +# defaulting to debug mode, if not specified +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug") +endif() + +# setup my vim ycm :D +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# paths +#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# more paths +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +# external libs +add_subdirectory(./external) # before increasing warn levels (sad :( ) + +set(CMAKE_CXX_EXTENSIONS OFF) + +# bump up warning levels appropriately for clang, gcc & msvc +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + add_compile_options( + -Wall -Wextra # Reasonable and standard + -Wpedantic # Warn if non-standard C++ is used + -Wunused # Warn on anything being unused + #-Wconversion # Warn on type conversions that may lose data + #-Wsign-conversion # Warn on sign conversions + -Wshadow # Warn if a variable declaration shadows one from a parent context + ) + + if (NOT WIN32) + link_libraries(-fsanitize=address,undefined) + #link_libraries(-fsanitize=undefined) + endif() +elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") + if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() +endif() + +# cmake setup end + +add_subdirectory(./src) + diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 0000000..975ad0e --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +add_subdirectory(./toxcore) +add_subdirectory(./tox_ngc_ext) +add_subdirectory(./tox_ngc_ft1) + diff --git a/external/tox_ngc_ext/CMakeLists.txt b/external/tox_ngc_ext/CMakeLists.txt new file mode 100644 index 0000000..b71bc63 --- /dev/null +++ b/external/tox_ngc_ext/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +add_library(tox_ngc_ext STATIC + ./tox_ngc_ext/ngc_ext.h + ./tox_ngc_ext/ngc_ext.hpp + ./tox_ngc_ext/ngc_ext.cpp +) + +target_include_directories(tox_ngc_ext PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/tox_ngc_ext") + +target_compile_features(tox_ngc_ext PUBLIC cxx_std_17) + +target_link_libraries(tox_ngc_ext PUBLIC toxcore) + diff --git a/external/tox_ngc_ext/tox_ngc_ext b/external/tox_ngc_ext/tox_ngc_ext new file mode 160000 index 0000000..c947915 --- /dev/null +++ b/external/tox_ngc_ext/tox_ngc_ext @@ -0,0 +1 @@ +Subproject commit c9479153892ff3aee0e65d33cc61aff8df6aa7bc diff --git a/external/tox_ngc_ft1/CMakeLists.txt b/external/tox_ngc_ft1/CMakeLists.txt new file mode 100644 index 0000000..8c5dd65 --- /dev/null +++ b/external/tox_ngc_ft1/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +add_library(tox_ngc_ft1 STATIC + ./tox_ngc_ft1/ngc_ft1.h + ./tox_ngc_ft1/ngc_ft1.cpp +) + +target_include_directories(tox_ngc_ft1 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/tox_ngc_ft1") + +target_compile_features(tox_ngc_ft1 PUBLIC cxx_std_17) + +target_link_libraries(tox_ngc_ft1 PUBLIC toxcore tox_ngc_ext) + diff --git a/external/tox_ngc_ft1/tox_ngc_ft1 b/external/tox_ngc_ft1/tox_ngc_ft1 new file mode 160000 index 0000000..27f4dd7 --- /dev/null +++ b/external/tox_ngc_ft1/tox_ngc_ft1 @@ -0,0 +1 @@ +Subproject commit 27f4dd7180be0309aa201cdf2453197ce7acea32 diff --git a/external/toxcore/CMakeLists.txt b/external/toxcore/CMakeLists.txt new file mode 100644 index 0000000..624fe1b --- /dev/null +++ b/external/toxcore/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +include(./toxcore.cmake) + + diff --git a/external/toxcore/c-toxcore b/external/toxcore/c-toxcore new file mode 160000 index 0000000..88ffd1a --- /dev/null +++ b/external/toxcore/c-toxcore @@ -0,0 +1 @@ +Subproject commit 88ffd1a6495aa59dcd7144b552a91df0bdb5b6d9 diff --git a/external/toxcore/cmake/Findsodium.cmake b/external/toxcore/cmake/Findsodium.cmake new file mode 100644 index 0000000..a210c00 --- /dev/null +++ b/external/toxcore/cmake/Findsodium.cmake @@ -0,0 +1,297 @@ +# Written in 2016 by Henrik Steffen Gaßmann +# +# To the extent possible under law, the author(s) have dedicated all +# copyright and related and neighboring rights to this software to the +# public domain worldwide. This software is distributed without any warranty. +# +# You should have received a copy of the CC0 Public Domain Dedication +# along with this software. If not, see +# +# http://creativecommons.org/publicdomain/zero/1.0/ +# +######################################################################## +# Tries to find the local libsodium installation. +# +# On Windows the sodium_DIR environment variable is used as a default +# hint which can be overridden by setting the corresponding cmake variable. +# +# Once done the following variables will be defined: +# +# sodium_FOUND +# sodium_INCLUDE_DIR +# sodium_LIBRARY_DEBUG +# sodium_LIBRARY_RELEASE +# +# +# Furthermore an imported "sodium" target is created. +# + +if (CMAKE_C_COMPILER_ID STREQUAL "GNU" + OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(_GCC_COMPATIBLE 1) +endif() + +# static library option +if (NOT DEFINED sodium_USE_STATIC_LIBS) + option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF) +endif() +if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST)) + unset(sodium_LIBRARY CACHE) + unset(sodium_LIBRARY_DEBUG CACHE) + unset(sodium_LIBRARY_RELEASE CACHE) + unset(sodium_DLL_DEBUG CACHE) + unset(sodium_DLL_RELEASE CACHE) + set(sodium_USE_STATIC_LIBS_LAST ${sodium_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable") +endif() + + +######################################################################## +# UNIX +if (UNIX) + # import pkg-config + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_check_modules(sodium_PKG QUIET libsodium) + endif() + + if(sodium_USE_STATIC_LIBS) + foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) + if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a + list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") + endif() + endforeach() + list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) + + # if pkgconfig for libsodium doesn't provide + # static lib info, then override PKG_STATIC here.. + if (NOT sodium_PKG_STATIC_FOUND) + set(sodium_PKG_STATIC_LIBRARIES libsodium.a) + endif() + + set(XPREFIX sodium_PKG_STATIC) + else() + if (NOT sodium_PKG_FOUND) + set(sodium_PKG_LIBRARIES sodium) + endif() + + set(XPREFIX sodium_PKG) + endif() + + find_path(sodium_INCLUDE_DIR sodium.h + HINTS ${${XPREFIX}_INCLUDE_DIRS} + ) + find_library(sodium_LIBRARY_DEBUG NAMES ${${XPREFIX}_LIBRARIES} + HINTS ${${XPREFIX}_LIBRARY_DIRS} + ) + find_library(sodium_LIBRARY_RELEASE NAMES ${${XPREFIX}_LIBRARIES} + HINTS ${${XPREFIX}_LIBRARY_DIRS} + ) + + +######################################################################## +# Windows +elseif (WIN32) + set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory") + mark_as_advanced(sodium_DIR) + + find_path(sodium_INCLUDE_DIR sodium.h + HINTS ${sodium_DIR} + PATH_SUFFIXES include + ) + + if (MSVC) + # detect target architecture + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" [=[ + #if defined _M_IX86 + #error ARCH_VALUE x86_32 + #elif defined _M_X64 + #error ARCH_VALUE x86_64 + #endif + #error ARCH_VALUE unknown + ]=]) + try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" + OUTPUT_VARIABLE _COMPILATION_LOG + ) + string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}") + + # construct library path + if (_TARGET_ARCH STREQUAL "x86_32") + string(APPEND _PLATFORM_PATH "Win32") + elseif(_TARGET_ARCH STREQUAL "x86_64") + string(APPEND _PLATFORM_PATH "x64") + else() + message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.") + endif() + string(APPEND _PLATFORM_PATH "/$$CONFIG$$") + + if (MSVC_VERSION LESS 1900) + math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60") + else() + math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50") + endif() + string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}") + + if (sodium_USE_STATIC_LIBS) + string(APPEND _PLATFORM_PATH "/static") + else() + string(APPEND _PLATFORM_PATH "/dynamic") + endif() + + string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}") + string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}") + + find_library(sodium_LIBRARY_DEBUG libsodium.lib + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} + ) + find_library(sodium_LIBRARY_RELEASE libsodium.lib + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} + ) + if (NOT sodium_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") + find_library(sodium_DLL_DEBUG libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} + ) + find_library(sodium_DLL_RELEASE libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} + ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK}) + endif() + + elseif(_GCC_COMPATIBLE) + if (sodium_USE_STATIC_LIBS) + find_library(sodium_LIBRARY_DEBUG libsodium.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib + ) + find_library(sodium_LIBRARY_RELEASE libsodium.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib + ) + else() + find_library(sodium_LIBRARY_DEBUG libsodium.dll.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib + ) + find_library(sodium_LIBRARY_RELEASE libsodium.dll.a + HINTS ${sodium_DIR} + PATH_SUFFIXES lib + ) + + file(GLOB _DLL + LIST_DIRECTORIES false + RELATIVE "${sodium_DIR}/bin" + "${sodium_DIR}/bin/libsodium*.dll" + ) + find_library(sodium_DLL_DEBUG ${_DLL} libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES bin + ) + find_library(sodium_DLL_RELEASE ${_DLL} libsodium + HINTS ${sodium_DIR} + PATH_SUFFIXES bin + ) + endif() + else() + message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") + endif() + + +######################################################################## +# unsupported +else() + message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") +endif() + + +######################################################################## +# common stuff + +# extract sodium version +if (sodium_INCLUDE_DIR) + set(_VERSION_HEADER "${_INCLUDE_DIR}/sodium/version.h") + if (EXISTS _VERSION_HEADER) + file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT) + string(REGEX REPLACE ".*#[ \t]*define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*" "\\1" + sodium_VERSION "${_VERSION_HEADER_CONTENT}") + set(sodium_VERSION "${sodium_VERSION}" PARENT_SCOPE) + endif() +endif() + +# communicate results +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + sodium # The name must be either uppercase or match the filename case. + REQUIRED_VARS + sodium_LIBRARY_RELEASE + sodium_LIBRARY_DEBUG + sodium_INCLUDE_DIR + VERSION_VAR + sodium_VERSION +) + +if(Sodium_FOUND) + set(sodium_LIBRARIES + optimized ${sodium_LIBRARY_RELEASE} debug ${sodium_LIBRARY_DEBUG}) +endif() + +# mark file paths as advanced +mark_as_advanced(sodium_INCLUDE_DIR) +mark_as_advanced(sodium_LIBRARY_DEBUG) +mark_as_advanced(sodium_LIBRARY_RELEASE) +if (WIN32) + mark_as_advanced(sodium_DLL_DEBUG) + mark_as_advanced(sodium_DLL_RELEASE) +endif() + +# create imported target +if(sodium_USE_STATIC_LIBS) + set(_LIB_TYPE STATIC) +else() + set(_LIB_TYPE SHARED) +endif() + +if(NOT TARGET sodium) + add_library(sodium ${_LIB_TYPE} IMPORTED) +endif() + +set_target_properties(sodium PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${sodium_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" +) + +if (sodium_USE_STATIC_LIBS) + set_target_properties(sodium PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "SODIUM_STATIC" + IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" + ) +else() + if (UNIX) + set_target_properties(sodium PROPERTIES + IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" + ) + elseif (WIN32) + set_target_properties(sodium PROPERTIES + IMPORTED_IMPLIB "${sodium_LIBRARY_RELEASE}" + IMPORTED_IMPLIB_DEBUG "${sodium_LIBRARY_DEBUG}" + ) + if (NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND")) + set_target_properties(sodium PROPERTIES + IMPORTED_LOCATION_DEBUG "${sodium_DLL_DEBUG}" + ) + endif() + if (NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND")) + set_target_properties(sodium PROPERTIES + IMPORTED_LOCATION_RELWITHDEBINFO "${sodium_DLL_RELEASE}" + IMPORTED_LOCATION_MINSIZEREL "${sodium_DLL_RELEASE}" + IMPORTED_LOCATION_RELEASE "${sodium_DLL_RELEASE}" + ) + endif() + endif() +endif() diff --git a/external/toxcore/toxcore.cmake b/external/toxcore/toxcore.cmake new file mode 100644 index 0000000..de52c2f --- /dev/null +++ b/external/toxcore/toxcore.cmake @@ -0,0 +1,158 @@ +set(TOX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/c-toxcore/") + +# TODO: shared +add_library(toxcore STATIC + ${TOX_DIR}third_party/cmp/cmp.c + ${TOX_DIR}third_party/cmp/cmp.h + + ${TOX_DIR}toxcore/announce.c + ${TOX_DIR}toxcore/announce.h + ${TOX_DIR}toxcore/bin_pack.c + ${TOX_DIR}toxcore/bin_pack.h + ${TOX_DIR}toxcore/bin_unpack.c + ${TOX_DIR}toxcore/bin_unpack.h + ${TOX_DIR}toxcore/ccompat.c + ${TOX_DIR}toxcore/ccompat.h + ${TOX_DIR}toxcore/crypto_core.c + ${TOX_DIR}toxcore/crypto_core.h + ${TOX_DIR}toxcore/DHT.c + ${TOX_DIR}toxcore/DHT.h + ${TOX_DIR}toxcore/events/conference_connected.c + ${TOX_DIR}toxcore/events/conference_invite.c + ${TOX_DIR}toxcore/events/conference_message.c + ${TOX_DIR}toxcore/events/conference_peer_list_changed.c + ${TOX_DIR}toxcore/events/conference_peer_name.c + ${TOX_DIR}toxcore/events/conference_title.c + ${TOX_DIR}toxcore/events/events_alloc.c + ${TOX_DIR}toxcore/events/events_alloc.h + ${TOX_DIR}toxcore/events/file_chunk_request.c + ${TOX_DIR}toxcore/events/file_recv.c + ${TOX_DIR}toxcore/events/file_recv_chunk.c + ${TOX_DIR}toxcore/events/file_recv_control.c + ${TOX_DIR}toxcore/events/friend_connection_status.c + ${TOX_DIR}toxcore/events/friend_lossless_packet.c + ${TOX_DIR}toxcore/events/friend_lossy_packet.c + ${TOX_DIR}toxcore/events/friend_message.c + ${TOX_DIR}toxcore/events/friend_name.c + ${TOX_DIR}toxcore/events/friend_read_receipt.c + ${TOX_DIR}toxcore/events/friend_request.c + ${TOX_DIR}toxcore/events/friend_status.c + ${TOX_DIR}toxcore/events/friend_status_message.c + ${TOX_DIR}toxcore/events/friend_typing.c + ${TOX_DIR}toxcore/events/self_connection_status.c + ${TOX_DIR}toxcore/forwarding.c + ${TOX_DIR}toxcore/forwarding.h + ${TOX_DIR}toxcore/friend_connection.c + ${TOX_DIR}toxcore/friend_connection.h + ${TOX_DIR}toxcore/friend_requests.c + ${TOX_DIR}toxcore/friend_requests.h + ${TOX_DIR}toxcore/group.c + ${TOX_DIR}toxcore/group.h + ${TOX_DIR}toxcore/group_announce.c + ${TOX_DIR}toxcore/group_announce.h + ${TOX_DIR}toxcore/group_moderation.c + ${TOX_DIR}toxcore/group_moderation.h + ${TOX_DIR}toxcore/group_chats.c + ${TOX_DIR}toxcore/group_chats.h + ${TOX_DIR}toxcore/group_common.h + ${TOX_DIR}toxcore/group_connection.c + ${TOX_DIR}toxcore/group_connection.h + ${TOX_DIR}toxcore/group_onion_announce.c + ${TOX_DIR}toxcore/group_onion_announce.h + ${TOX_DIR}toxcore/group_pack.c + ${TOX_DIR}toxcore/group_pack.h + ${TOX_DIR}toxcore/LAN_discovery.c + ${TOX_DIR}toxcore/LAN_discovery.h + ${TOX_DIR}toxcore/list.c + ${TOX_DIR}toxcore/list.h + ${TOX_DIR}toxcore/logger.c + ${TOX_DIR}toxcore/logger.h + ${TOX_DIR}toxcore/Messenger.c + ${TOX_DIR}toxcore/Messenger.h + ${TOX_DIR}toxcore/mono_time.c + ${TOX_DIR}toxcore/mono_time.h + ${TOX_DIR}toxcore/net_crypto.c + ${TOX_DIR}toxcore/net_crypto.h + ${TOX_DIR}toxcore/network.c + ${TOX_DIR}toxcore/network.h + ${TOX_DIR}toxcore/onion_announce.c + ${TOX_DIR}toxcore/onion_announce.h + ${TOX_DIR}toxcore/onion.c + ${TOX_DIR}toxcore/onion_client.c + ${TOX_DIR}toxcore/onion_client.h + ${TOX_DIR}toxcore/onion.h + ${TOX_DIR}toxcore/ping_array.c + ${TOX_DIR}toxcore/ping_array.h + ${TOX_DIR}toxcore/ping.c + ${TOX_DIR}toxcore/ping.h + ${TOX_DIR}toxcore/shared_key_cache.c + ${TOX_DIR}toxcore/shared_key_cache.h + ${TOX_DIR}toxcore/state.c + ${TOX_DIR}toxcore/state.h + ${TOX_DIR}toxcore/TCP_client.c + ${TOX_DIR}toxcore/TCP_client.h + ${TOX_DIR}toxcore/TCP_common.c + ${TOX_DIR}toxcore/TCP_common.h + ${TOX_DIR}toxcore/TCP_connection.c + ${TOX_DIR}toxcore/TCP_connection.h + ${TOX_DIR}toxcore/TCP_server.c + ${TOX_DIR}toxcore/TCP_server.h + ${TOX_DIR}toxcore/timed_auth.c + ${TOX_DIR}toxcore/timed_auth.h + ${TOX_DIR}toxcore/tox_api.c + ${TOX_DIR}toxcore/tox.c + ${TOX_DIR}toxcore/tox_dispatch.c + ${TOX_DIR}toxcore/tox_dispatch.h + ${TOX_DIR}toxcore/tox_events.c + ${TOX_DIR}toxcore/tox_events.h + ${TOX_DIR}toxcore/tox.h + ${TOX_DIR}toxcore/tox_private.c + ${TOX_DIR}toxcore/tox_private.h + ${TOX_DIR}toxcore/tox_unpack.c + ${TOX_DIR}toxcore/tox_unpack.h + ${TOX_DIR}toxcore/util.c + ${TOX_DIR}toxcore/util.h +) + +# HACK: "install" api headers into self +# this is dirty, should be binary dir +# TODO: add the others +configure_file( + ${TOX_DIR}toxcore/tox.h + ${TOX_DIR}tox/tox.h + @ONLY +) + +target_include_directories(toxcore PRIVATE "${TOX_DIR}toxcore") +target_include_directories(toxcore PUBLIC "${TOX_DIR}") + +target_compile_definitions(toxcore PUBLIC USE_IPV6=1) +target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_DEBUG) + +find_package(unofficial-sodium CONFIG QUIET) +find_package(sodium QUIET) +if(unofficial-sodium_FOUND) # vcpkg + target_link_libraries(toxcore unofficial-sodium::sodium unofficial-sodium::sodium_config_public) +elseif(sodium_FOUND) + target_link_libraries(toxcore sodium) +else() + message(SEND_ERROR "missing libsodium") +endif() + +if(WIN32) + target_link_libraries(toxcore ws2_32 iphlpapi) +endif() + +find_package(Threads REQUIRED) +target_link_libraries(toxcore Threads::Threads) + +add_executable(DHT_Bootstrap EXCLUDE_FROM_ALL + ${TOX_DIR}other/DHT_bootstrap.c + ${TOX_DIR}other/bootstrap_node_packets.h + ${TOX_DIR}other/bootstrap_node_packets.c + ${TOX_DIR}testing/misc_tools.h + ${TOX_DIR}testing/misc_tools.c +) + +target_link_libraries(DHT_Bootstrap toxcore) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..d295d41 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +project(tox_ngc_ft1_tool C CXX) + +######################################## + +add_executable(tox_ngc_ft1_tool + ./main.cpp +) + +target_compile_features(tox_ngc_ft1_tool PUBLIC cxx_std_17) + +target_link_libraries(tox_ngc_ft1_tool + toxcore + tox_ngc_ext + tox_ngc_ft1 +) + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..462ba71 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char** argv) { + + return 0; +} +