From ce5a0bf1fdc72f8e7c4bfde9ed5d9097fde94515 Mon Sep 17 00:00:00 2001 From: Nick Logozzo Date: Thu, 7 Dec 2023 00:06:23 -0500 Subject: [PATCH] Squashed commit of the following: commit 1dff12b22687fd21bf444682a8702aa8bc651179 Author: Nick Logozzo Date: Thu Dec 7 00:06:14 2023 -0500 Update CMakeLists.txt commit 75d5a56ab2d2de57f629442bf7e191109d3d3453 Author: Nick Logozzo Date: Wed Dec 6 23:39:53 2023 -0500 Update networktests.cpp commit a88932d9bb90305075bd37bf6904effcdab0a366 Author: Nick Logozzo Date: Wed Dec 6 23:01:48 2023 -0500 Update CMakeLists.txt commit 8cef02ee0f558197179ae4707914d4cee95c4bb1 Author: Nick Logozzo Date: Wed Dec 6 22:59:31 2023 -0500 Better Linux Build commit 4dcd07b83918c6980e4efc07b47e269dcfb3f2f6 Author: Nick Logozzo Date: Wed Dec 6 22:41:03 2023 -0500 Tests - Fix DisableNetCheck Test commit bae69afea3daebc11ddc2440653464ec9a68822f Author: Nick Logozzo Date: Tue Dec 5 23:17:44 2023 -0500 Try to link resolv again commit d75186e25f384c7b7f0fd8847e53bc9e473407c7 Author: Nick Logozzo Date: Tue Dec 5 23:13:12 2023 -0500 Linux - Build resolv commit a369d4139c5d6a1c68942d1686bc89afb248e62e Author: Nick Logozzo Date: Tue Dec 5 23:12:38 2023 -0500 Update networktests.cpp --- CMakeLists.txt | 9 ++++----- conanfile-linux.txt | 1 + src/keyring/passwordgenerator.cpp | 1 + tests/networktests.cpp | 11 ++++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 028bdd5..c84e224 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ include(GNUInstallDirs) #libaura Library Setup include_directories(${PROJECT_SOURCE_DIR}/include) -add_library (${PROJECT_NAME} SHARED +add_library (${PROJECT_NAME} src/events/eventargs.cpp src/helpers/stringhelpers.cpp src/helpers/webhelpers.cpp @@ -52,16 +52,16 @@ find_package(maddy REQUIRED) find_package(SQLiteCpp REQUIRED) target_link_libraries(${PROJECT_NAME} PUBLIC Intl::Intl JsonCpp::JsonCpp CURL::libcurl maddy::maddy SQLiteCpp) if(LINUX) + set(CMAKE_REQUIRED_LIBRARIES resolv) find_package(PkgConfig REQUIRED) find_package(libsecret REQUIRED CONFIG) + find_package(libuuid REQUIRED CONFIG) pkg_check_modules(glib-2.0 REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(gio-2.0 REQUIRED IMPORTED_TARGET gio-2.0) pkg_check_modules(gmodule-2.0 REQUIRED IMPORTED_TARGET gmodule-2.0) pkg_check_modules(gobject-2.0 REQUIRED IMPORTED_TARGET gobject-2.0) pkg_check_modules(gthread-2.0 REQUIRED IMPORTED_TARGET gthread-2.0) - pkg_search_module(UUID REQUIRED uuid) - target_include_directories(${PROJECT_NAME} PUBLIC ${UUID_INCLUDE_DIRS}) - target_link_libraries(${PROJECT_NAME} PUBLIC resolv libsecret::libsecret PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0 ${UUID_LIBRARIES}) + target_link_libraries(${PROJECT_NAME} PUBLIC libsecret::libsecret libuuid::libuuid PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0) endif() #libaura Install @@ -76,7 +76,6 @@ enable_testing() add_executable(${PROJECT_NAME}_test tests/eventtests.cpp tests/main.cpp - tests/networktests.cpp tests/stringtests.cpp tests/versiontests.cpp tests/webtests.cpp) diff --git a/conanfile-linux.txt b/conanfile-linux.txt index be18e8f..8cceb33 100644 --- a/conanfile-linux.txt +++ b/conanfile-linux.txt @@ -6,6 +6,7 @@ maddy/1.3.0 sqlcipher/4.5.1 sqlitecpp/3.3.1 libsecret/0.20.5 +libuuid/1.0.3 glib/2.78.1 gtest/1.14.0 diff --git a/src/keyring/passwordgenerator.cpp b/src/keyring/passwordgenerator.cpp index 1c9883a..084e9e7 100644 --- a/src/keyring/passwordgenerator.cpp +++ b/src/keyring/passwordgenerator.cpp @@ -1,4 +1,5 @@ #include "keyring/passwordgenerator.h" +#include #include namespace Nickvision::Aura::Keyring diff --git a/tests/networktests.cpp b/tests/networktests.cpp index 0438914..a32bf7d 100644 --- a/tests/networktests.cpp +++ b/tests/networktests.cpp @@ -1,6 +1,8 @@ #include -#include #include "network/networkmonitor.h" +#ifndef _WIN32 +#include +#endif using namespace Nickvision::Aura::Network; @@ -16,8 +18,11 @@ TEST(NetworkTests, ConnectedGlobal) TEST(NetworkTests, DisableNetCheck) { - std::string disableNetCheck{ "AURA_DISABLE_NETCHECK=true" }; - EXPECT_EQ(putenv(disableNetCheck.c_str()), 0); +#ifdef _WIN32 + EXPECT_EQ(_putenv("AURA_DISABLE_NETCHECK=true"), 0); +#else + EXPECT_EQ(setenv("AURA_DISABLE_NETCHECK", "true", true), 0); +#endif NetworkMonitor netmon; netmon.stateChanged() += [](const NetworkStateChangedEventArgs& e) {