Merge remote-tracking branch 'origin/master'

This commit is contained in:
Selim Mustafaev 2022-05-17 00:40:10 +03:00
commit 4590aeaee8
2 changed files with 31 additions and 7 deletions

View File

@ -2,16 +2,33 @@ cmake_minimum_required(VERSION 3.0)
project(autocat_gnome) project(autocat_gnome)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines") set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines-ts")
endif()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -g -Og") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -g -Og")
if(APPLE) if(APPLE)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/libsoup@2/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/libsoup@2/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig")
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
set(OPENSSL_LIBRARIES /usr/local/opt/openssl/lib)
set(FOLLY_DEP folly)
include(FetchContent)
FetchContent_Declare(
folly
GIT_REPOSITORY https://github.com/facebook/folly.git
GIT_TAG v2022.05.16.00
)
FetchContent_MakeAvailable(folly)
else()
find_package(folly REQUIRED)
set(FOLLY_DEP Folly::folly)
endif() endif()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(nlohmann_json REQUIRED) find_package(nlohmann_json REQUIRED)
find_package(folly REQUIRED)
pkg_check_modules(GTK REQUIRED gtk4) pkg_check_modules(GTK REQUIRED gtk4)
pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GLIB REQUIRED glib-2.0)
@ -72,7 +89,7 @@ target_link_libraries(autocat_gnome ${GTK_LIBRARIES}
${LIBADWAITA_LIBRARIES} ${LIBADWAITA_LIBRARIES}
${LIBSIGCPP_LIBRARIES} ${LIBSIGCPP_LIBRARIES}
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json
Folly::folly) ${FOLLY_DEP})
set(XML gui/MainWindow.xml) set(XML gui/MainWindow.xml)

View File

@ -5,19 +5,26 @@
#ifndef AUTOCAT_GNOME_CORO_H #ifndef AUTOCAT_GNOME_CORO_H
#define AUTOCAT_GNOME_CORO_H #define AUTOCAT_GNOME_CORO_H
#include <coroutine>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#if __cpp_lib_coroutine
#include <coroutine>
namespace corons = std;
#else
#include <experimental/coroutine>
namespace corons = std::experimental;
#endif
template<typename... Args> template<typename... Args>
struct std::coroutine_traits<void, Args...> { struct corons::coroutine_traits<void, Args...> {
struct promise_type { struct promise_type {
void get_return_object() noexcept {} void get_return_object() noexcept {}
std::suspend_never initial_suspend() const noexcept { corons::suspend_never initial_suspend() const noexcept {
return {}; return {};
} }
std::suspend_never final_suspend() const noexcept { corons::suspend_never final_suspend() const noexcept {
return {}; return {};
} }