From 88a8261f680c65cf3b0e0e0a0334a0fb6031c32e Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 3 Aug 2024 11:10:56 +0200 Subject: [PATCH] more deps --- external/CMakeLists.txt | 18 ++++++++++ external/toxcore/CMakeLists.txt | 62 +++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 external/toxcore/CMakeLists.txt diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 04568b6..638de32 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -26,6 +26,24 @@ if (NOT TARGET solanaceae_contact) FetchContent_MakeAvailable(solanaceae_contact) endif() +if (NOT TARGET solanaceae_message3) + FetchContent_Declare(solanaceae_message3 + GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_message3.git + GIT_TAG master + ) + FetchContent_MakeAvailable(solanaceae_message3) +endif() + +add_subdirectory(./toxcore) + +if (NOT TARGET solanaceae_toxcore) + FetchContent_Declare(solanaceae_toxcore + GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_toxcore.git + GIT_TAG master + ) + FetchContent_MakeAvailable(solanaceae_toxcore) +endif() + # only need the contact stuff if (NOT TARGET solanaceae_tox_contacts) FetchContent_Declare(solanaceae_tox diff --git a/external/toxcore/CMakeLists.txt b/external/toxcore/CMakeLists.txt new file mode 100644 index 0000000..36d0be5 --- /dev/null +++ b/external/toxcore/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR) + +include(FetchContent) + +if (NOT TARGET toxcore) + set(EXPERIMENTAL_API ON CACHE BOOL "" FORCE) + set(UNITTEST OFF CACHE BOOL "" FORCE) + set(DHT_BOOTSTRAP OFF CACHE BOOL "" FORCE) + set(BOOTSTRAP_DAEMON OFF CACHE BOOL "" FORCE) + set(BUILD_TOXAV OFF CACHE BOOL "" FORCE) + set(ENABLE_SHARED OFF CACHE BOOL "" FORCE) + set(TOXCORE_COMMIT_HASH "102a1fa") + + FetchContent_Declare(c-toxcore + GIT_REPOSITORY https://github.com/TokTok/c-toxcore + GIT_TAG ${TOXCORE_COMMIT_HASH} + + FIND_PACKAGE_ARGS # for the future + ) + FetchContent_MakeAvailable(c-toxcore) + + # the sad case + add_library(toxcore INTERFACE) + + if (TARGET toxcore_static) + target_link_libraries(toxcore INTERFACE toxcore_static) + else() + target_link_libraries(toxcore INTERFACE toxcore_shared) + endif() + + target_compile_definitions(toxcore INTERFACE TOXCORE_COMMIT_HASH="${TOXCORE_COMMIT_HASH}") + + # HACK: "install" api headers into binary dir + configure_file( + ${c-toxcore_SOURCE_DIR}/toxcore/tox.h + ${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox.h + @ONLY + ) + configure_file( + ${c-toxcore_SOURCE_DIR}/toxcore/tox_events.h + ${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox_events.h + @ONLY + ) + configure_file( + ${c-toxcore_SOURCE_DIR}/toxcore/tox_private.h + ${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox_private.h + @ONLY + ) + configure_file( + ${c-toxcore_SOURCE_DIR}/toxencryptsave/toxencryptsave.h + ${CMAKE_CURRENT_BINARY_DIR}/include/tox/toxencryptsave.h + @ONLY + ) + configure_file( + ${c-toxcore_SOURCE_DIR}/toxav/toxav.h + ${CMAKE_CURRENT_BINARY_DIR}/include/tox/toxav.h + @ONLY + ) + + target_include_directories(toxcore INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include/) +endif() +