From 5ae8e9710f4d09af15bb35cfaa6918c9ba24d8c2 Mon Sep 17 00:00:00 2001 From: Michal Vaniš Date: Thu, 13 Apr 2023 22:20:29 +0200 Subject: docs: Fix Fedora's install deps (#150) * correct Fedora install deps * Update README.md * remove arch --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 372354f..051c9ff 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ the result of fundamental issues with Discord's thread implementation. ```Shell $ sudo dnf install g++ cmake gtkmm3.0-devel libcurl-devel sqlite-devel openssl-devel json-devel libsecret-devel libhandy-devel ``` + > **Note:** On older versions of fedora you might need to install gtkmm30-devel instead of gtkmm3.0-devel. Use `dnf search gtkmm3` to see available packages. 2. `git clone https://github.com/uowuo/abaddon --recurse-submodules="subprojects" && cd abaddon` 3. `mkdir build && cd build` 4. `cmake ..` -- cgit v1.2.3 From c5af6edf0d4c51a7e7cd6d038a17a9ec84e63e60 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Wed, 26 Apr 2023 21:55:12 -0400 Subject: link CMAKE_DL_LIBS (#155) --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3af60f..7dc31d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,7 @@ target_link_libraries(abaddon ${GTKMM_LIBRARIES}) target_link_libraries(abaddon ${CURL_LIBRARIES}) target_link_libraries(abaddon ${ZLIB_LIBRARY}) target_link_libraries(abaddon ${NLOHMANN_JSON_LIBRARIES}) +target_link_libraries(abaddon ${CMAKE_DL_LIBS}) if (USE_LIBHANDY) find_package(libhandy REQUIRED) -- cgit v1.2.3 From deda464b235bf33739cf09b93918d08029d7112c Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:06:54 -0400 Subject: try linking atomic if necessary --- CMakeLists.txt | 5 +++ cmake/CheckAtomic.cmake | 107 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 cmake/CheckAtomic.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dc31d2..c6f0ec0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,11 @@ target_link_libraries(abaddon ${ZLIB_LIBRARY}) target_link_libraries(abaddon ${NLOHMANN_JSON_LIBRARIES}) target_link_libraries(abaddon ${CMAKE_DL_LIBS}) +include(CheckAtomic) +if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) + target_link_libraries(abaddon atomic) +endif () + if (USE_LIBHANDY) find_package(libhandy REQUIRED) target_include_directories(abaddon PUBLIC ${libhandy_INCLUDE_DIRS}) diff --git a/cmake/CheckAtomic.cmake b/cmake/CheckAtomic.cmake new file mode 100644 index 0000000..f7e79e8 --- /dev/null +++ b/cmake/CheckAtomic.cmake @@ -0,0 +1,107 @@ +#[[ +From https://github.com/pothosware/SoapyRTLSDR/blob/master/CheckAtomic.cmake +This file is licensed as MIT: +The MIT License (MIT) + +Copyright (c) 2015 Charles J. Cliffe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +]] + +# - Try to find if atomics need -latomic linking +# Once done this will define +# HAVE_CXX_ATOMICS_WITHOUT_LIB - Wether atomic types work without -latomic +# HAVE_CXX_ATOMICS64_WITHOUT_LIB - Wether 64 bit atomic types work without -latomic + +INCLUDE(CheckCXXSourceCompiles) +INCLUDE(CheckLibraryExists) + +# Sometimes linking against libatomic is required for atomic ops, if +# the platform doesn't support lock-free atomics. + +function(check_working_cxx_atomics varname) +set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") +CHECK_CXX_SOURCE_COMPILES(" +#include +std::atomic x; +int main() { +return std::atomic_is_lock_free(&x); +} +" ${varname}) +set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +endfunction(check_working_cxx_atomics) + +function(check_working_cxx_atomics64 varname) +set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") +CHECK_CXX_SOURCE_COMPILES(" +#include +#include +std::atomic x (0); +int main() { +uint64_t i = x.load(std::memory_order_relaxed); +return std::atomic_is_lock_free(&x); +} +" ${varname}) +set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +endfunction(check_working_cxx_atomics64) + +# Check for atomic operations. +if(MSVC) + # This isn't necessary on MSVC. + set(HAVE_CXX_ATOMICS_WITHOUT_LIB True) +else() + # First check if atomics work without the library. + check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) +endif() + +# If not, check if the library exists, and atomics work with it. +if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) + check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) + if(NOT HAVE_LIBATOMIC) + message(STATUS "Host compiler appears to require libatomic, but cannot locate it.") + endif() + list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") + check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) + if (NOT HAVE_CXX_ATOMICS_WITH_LIB) + message(FATAL_ERROR "Host compiler must support std::atomic!") + endif() +endif() + +# Check for 64 bit atomic operations. +if(MSVC) + set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True) +else() + check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) +endif() + +# If not, check if the library exists, and atomics work with it. +if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) + check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMIC64) + if(NOT HAVE_LIBATOMIC64) + message(STATUS "Host compiler appears to require libatomic, but cannot locate it.") + endif() + list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") + check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) + if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) + message(FATAL_ERROR "Host compiler must support std::atomic!") + endif() +endif() + -- cgit v1.2.3 From 425fdb3d944aff685ce6ad860a58ea31fe1f5e65 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 28 Apr 2023 23:07:35 -0400 Subject: update miniaudio to dev --- subprojects/miniaudio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/miniaudio b/subprojects/miniaudio index c153a94..1ac2abc 160000 --- a/subprojects/miniaudio +++ b/subprojects/miniaudio @@ -1 +1 @@ -Subproject commit c153a947919808419b0bf3f56b6f2ee606d6c5f4 +Subproject commit 1ac2abc36e86623d386b489962d5190d387c042f -- cgit v1.2.3 From 45e6cdae36c2f328d5bc58db3f2f8c56205f58f8 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 29 Apr 2023 01:49:47 -0400 Subject: fix up server listing again (#154) --- src/components/channels.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/components/channels.cpp b/src/components/channels.cpp index b691ab5..865465a 100644 --- a/src/components/channels.cpp +++ b/src/components/channels.cpp @@ -291,23 +291,33 @@ void ChannelList::UpdateListing() { int sort_value = 0; const auto folders = discord.GetUserSettings().GuildFolders; - if (folders.empty()) { - // fallback if no organization has occurred (guild_folders will be empty) - const auto guild_ids = discord.GetUserSortedGuilds(); - for (const auto &guild_id : guild_ids) { - const auto guild = discord.GetGuild(guild_id); - if (!guild.has_value()) continue; + const auto guild_ids = discord.GetUserSortedGuilds(); - auto iter = AddGuild(*guild, m_model->children()); - if (iter) (*iter)[m_columns.m_sort] = sort_value++; - } - } else { - for (const auto &group : folders) { - auto iter = AddFolder(group); - if (iter) (*iter)[m_columns.m_sort] = sort_value++; + // user_settings.guild_folders may not contain every guild the user is in + // this seems to be the case if you organize your guilds and join a server without further organization + // so add guilds not present in guild_folders by descending id order first + + std::set foldered_guilds; + for (const auto &group : folders) { + foldered_guilds.insert(group.GuildIDs.begin(), group.GuildIDs.end()); + } + + for (auto iter = guild_ids.rbegin(); iter != guild_ids.rend(); iter++) { + if (foldered_guilds.find(*iter) == foldered_guilds.end()) { + const auto guild = discord.GetGuild(*iter); + if (!guild.has_value()) continue; + auto tree_iter = AddGuild(*guild, m_model->children()); + if (tree_iter) (*tree_iter)[m_columns.m_sort] = sort_value++; } } + // then whatever is in folders + + for (const auto &group : folders) { + auto iter = AddFolder(group); + if (iter) (*iter)[m_columns.m_sort] = sort_value++; + } + m_updating_listing = false; AddPrivateChannels(); -- cgit v1.2.3 From 012b8329e5776a0161c194daf31a6e1c2d15cf62 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 29 Apr 2023 20:30:13 -0400 Subject: update miniaudio to release version --- subprojects/miniaudio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/miniaudio b/subprojects/miniaudio index 1ac2abc..7384bde 160000 --- a/subprojects/miniaudio +++ b/subprojects/miniaudio @@ -1 +1 @@ -Subproject commit 1ac2abc36e86623d386b489962d5190d387c042f +Subproject commit 7384bde3725412523871f0fcf60efe5c47fbbfc6 -- cgit v1.2.3