Skip to content
Merged

dave #410

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
mingw-w64-x86_64-libhandy
mingw-w64-x86_64-opus
mingw-w64-x86_64-libsodium
mingw-w64-x86_64-openssl
mingw-w64-x86_64-spdlog

- name: Setup MSYS2 (2)
Expand Down Expand Up @@ -151,10 +152,11 @@ jobs:
brew install libsodium
brew install spdlog
brew install libhandy
brew install openssl@3

- name: Build
run: |
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }}
cmake -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
cmake --build build

- name: Setup artifact files
Expand Down Expand Up @@ -188,22 +190,15 @@ jobs:
- name: Fetch dependencies
run: |
sudo apt-get update
mkdir deps
cd deps
sudo apt-get install -y libgtkmm-3.0-dev libcurl4-gnutls-dev libopus-dev libsodium-dev libspdlog-dev libhandy-1-dev libssl-dev
mkdir deps && cd deps
git clone https://github.com/nlohmann/json
cd json
git checkout 55f93686c01528224f448c19128836e7df245f72
mkdir build
cd build
mkdir build && cd build
cmake .. -DJSON_BuildTests=OFF
make
sudo make install
sudo apt-get install libgtkmm-3.0-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libopus-dev
sudo apt-get install libsodium-dev
sudo apt-get install libspdlog-dev
sudo apt-get install libhandy-1-dev

- name: Build
run: |
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
[submodule "subprojects/qrcodegen"]
path = subprojects/qrcodegen
url = https://github.com/nayuki/QR-Code-generator
[submodule "subprojects/libdave"]
path = subprojects/libdave
url = https://github.com/discord/libdave.git
[submodule "subprojects/mlspp"]
path = subprojects/mlspp
url = https://github.com/cisco/mlspp.git
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,60 @@ if (ENABLE_VOICE)

target_link_libraries(abaddon ${CMAKE_DL_LIBS})

# mlspp and libdave need nlohmann_json::nlohmann_json target
if (NOT TARGET nlohmann_json::nlohmann_json)
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${NLOHMANN_JSON_INCLUDE_DIRS}")
endif ()

find_package(MLSPP QUIET)
if (NOT MLSPP_FOUND)
message(STATUS "mlspp not found, using subproject")
set(DISABLE_GREASE ON CACHE BOOL "" FORCE)
set(TESTING OFF CACHE BOOL "" FORCE)
set(MLS_CXX_NAMESPACE "mlspp" CACHE STRING "" FORCE)
set(CMAKE_EXPORT_PACKAGE_REGISTRY OFF CACHE BOOL "" FORCE)
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
message(STATUS "Forcing mlspp to use BoringSSL on OpenBSD")
set(REQUIRE_BORINGSSL ON CACHE BOOL "" FORCE)
set(OPENSSL_ROOT_DIR "/usr/local/eboringssl" CACHE PATH "" FORCE)
set(OPENSSL_INCLUDE_DIR "/usr/local/eboringssl/include" CACHE PATH "" FORCE)
set(OPENSSL_CRYPTO_LIBRARY "/usr/local/eboringssl/lib/libcrypto.a" CACHE FILEPATH "" FORCE)
set(OPENSSL_SSL_LIBRARY "/usr/local/eboringssl/lib/libssl.a" CACHE FILEPATH "" FORCE)
endif()
add_subdirectory(subprojects/mlspp EXCLUDE_FROM_ALL)
if (NOT TARGET MLSPP::mlspp)
add_library(MLSPP::mlspp ALIAS mlspp)
endif ()
if (NOT TARGET MLSPP::hpke)
add_library(MLSPP::hpke ALIAS hpke)
endif ()
set(MLSPP_FOUND TRUE CACHE BOOL "" FORCE)
# Write a shim config so libdave's find_dependency(MLSPP) finds this
# instead of the broken build-tree config that add_subdirectory generates
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/mlspp-shim/MLSPPConfig.cmake"
"set(MLSPP_FOUND TRUE)\n")
set(MLSPP_DIR "${CMAKE_CURRENT_BINARY_DIR}/mlspp-shim" CACHE PATH "" FORCE)
else ()
message(STATUS "Found system mlspp")
endif ()

# Prevent find_package from finding mlspp's broken build-tree config via registry
set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON)

find_package(libdave QUIET)
if (libdave_FOUND)
message(STATUS "Found system libdave")
target_link_libraries(abaddon libdave)
else ()
message(STATUS "libdave not found, using subproject")
add_subdirectory(subprojects/libdave/cpp EXCLUDE_FROM_ALL)
target_link_libraries(abaddon libdave)
endif ()

set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY OFF)

if (ENABLE_RNNOISE)
target_compile_definitions(abaddon PRIVATE WITH_RNNOISE)

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ the result of fundamental issues with Discord's thread implementation.
* mingw-w64-x86_64-libhandy
* mingw-w64-x86_64-opus
* mingw-w64-x86_64-libsodium
* mingw-w64-x86_64-openssl
* mingw-w64-x86_64-spdlog
2. `git clone --recurse-submodules="subprojects" https://github.com/uowuo/abaddon && cd abaddon`
3. `mkdir build && cd build`
4. `cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ..`
5. `ninja`
6. [Copy resources](#resources)
4. `mkdir build && cd build`
5. `cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo ..`
6. `ninja`
7. [Copy resources](#resources)

#### Mac:

Expand Down Expand Up @@ -185,6 +186,8 @@ spam filter's wrath:
* [libopus](https://opus-codec.org/) (optional, required for voice)
* [libsodium](https://doc.libsodium.org/) (optional, required for voice)
* [rnnoise](https://gitlab.xiph.org/xiph/rnnoise) (optional, provided as submodule, noise suppression and improved VAD)
* [libdave](https://github.com/discord/libdave) (provided as submodule, required for voice E2EE)
* [mlspp](https://github.com/cisco/mlspp) (provided as submodule, required for voice E2EE)

### TODO:

Expand Down
2 changes: 1 addition & 1 deletion ci/msys-deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
/bin/libsharpyuv-0.dll
/bin/libsigc-2.0-0.dll
/bin/libsodium-26.dll
/bin/libspdlog-1.15.dll
/bin/libspdlog-1.17.dll
/bin/libsqlite3-0.dll
/bin/libssh2-1.dll
/bin/libssl-3-x64.dll
Expand Down
Loading
Loading