From d5128a5ea951ab7295d25d6703ae33affb7a9f2f Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 26 Mar 2022 23:05:02 +1000 Subject: [PATCH] HTTPDownloader: Move to common --- src/common/CMakeLists.txt | 21 +++++++++++++++++++ src/common/common.vcxproj | 14 +++++++++++++ src/common/common.vcxproj.filters | 6 ++++++ .../http_downloader.cpp | 6 +++--- .../http_downloader.h | 0 .../http_downloader_curl.cpp | 0 .../http_downloader_curl.h | 0 .../http_downloader_uwp.cpp | 8 +++---- .../http_downloader_uwp.h | 1 + .../http_downloader_winhttp.cpp | 8 +++---- .../http_downloader_winhttp.h | 0 src/frontend-common/CMakeLists.txt | 19 ----------------- src/frontend-common/cheevos.cpp | 2 +- src/frontend-common/frontend-common.vcxproj | 14 ------------- .../frontend-common.vcxproj.filters | 6 ------ 15 files changed, 54 insertions(+), 51 deletions(-) rename src/{frontend-common => common}/http_downloader.cpp (98%) rename src/{frontend-common => common}/http_downloader.h (100%) rename src/{frontend-common => common}/http_downloader_curl.cpp (100%) rename src/{frontend-common => common}/http_downloader_curl.h (100%) rename src/{frontend-common => common}/http_downloader_uwp.cpp (98%) rename src/{frontend-common => common}/http_downloader_uwp.h (98%) rename src/{frontend-common => common}/http_downloader_winhttp.cpp (98%) rename src/{frontend-common => common}/http_downloader_winhttp.h (100%) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 7fbf9e239..f3b2de432 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -246,6 +246,27 @@ if(APPLE) ) endif() +if(ENABLE_CHEEVOS) + target_sources(common PRIVATE + http_downloader.cpp + http_downloader.h + ) + if(WIN32) + target_sources(common PRIVATE + http_downloader_winhttp.cpp + http_downloader_winhttp.h + ) + elseif(NOT ANDROID) + target_sources(common PRIVATE + http_downloader_curl.cpp + http_downloader_curl.h + ) + target_link_libraries(common PRIVATE + CURL::libcurl + ) + endif() +endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") # We need -lrt for shm_unlink target_link_libraries(common PRIVATE rt) diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj index b27d2fc4d..beba97268 100644 --- a/src/common/common.vcxproj +++ b/src/common/common.vcxproj @@ -40,6 +40,13 @@ + + + true + + + true + @@ -125,6 +132,13 @@ + + + true + + + true + diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters index 4195d1136..4e3e97536 100644 --- a/src/common/common.vcxproj.filters +++ b/src/common/common.vcxproj.filters @@ -134,6 +134,9 @@ d3d12 + + + @@ -264,6 +267,9 @@ d3d12 + + + diff --git a/src/frontend-common/http_downloader.cpp b/src/common/http_downloader.cpp similarity index 98% rename from src/frontend-common/http_downloader.cpp rename to src/common/http_downloader.cpp index 4ca161649..8fe209f68 100644 --- a/src/frontend-common/http_downloader.cpp +++ b/src/common/http_downloader.cpp @@ -1,7 +1,7 @@ #include "http_downloader.h" -#include "common/assert.h" -#include "common/log.h" -#include "common/timer.h" +#include "assert.h" +#include "log.h" +#include "timer.h" Log_SetChannel(HTTPDownloader); static constexpr float DEFAULT_TIMEOUT_IN_SECONDS = 30; diff --git a/src/frontend-common/http_downloader.h b/src/common/http_downloader.h similarity index 100% rename from src/frontend-common/http_downloader.h rename to src/common/http_downloader.h diff --git a/src/frontend-common/http_downloader_curl.cpp b/src/common/http_downloader_curl.cpp similarity index 100% rename from src/frontend-common/http_downloader_curl.cpp rename to src/common/http_downloader_curl.cpp diff --git a/src/frontend-common/http_downloader_curl.h b/src/common/http_downloader_curl.h similarity index 100% rename from src/frontend-common/http_downloader_curl.h rename to src/common/http_downloader_curl.h diff --git a/src/frontend-common/http_downloader_uwp.cpp b/src/common/http_downloader_uwp.cpp similarity index 98% rename from src/frontend-common/http_downloader_uwp.cpp rename to src/common/http_downloader_uwp.cpp index 70bee2564..0f1ff98a7 100644 --- a/src/frontend-common/http_downloader_uwp.cpp +++ b/src/common/http_downloader_uwp.cpp @@ -1,8 +1,8 @@ #include "http_downloader_uwp.h" -#include "common/assert.h" -#include "common/log.h" -#include "common/string_util.h" -#include "common/timer.h" +#include "assert.h" +#include "log.h" +#include "string_util.h" +#include "timer.h" #include Log_SetChannel(HTTPDownloaderWinHttp); diff --git a/src/frontend-common/http_downloader_uwp.h b/src/common/http_downloader_uwp.h similarity index 98% rename from src/frontend-common/http_downloader_uwp.h rename to src/common/http_downloader_uwp.h index 28d82d9da..f476f5205 100644 --- a/src/frontend-common/http_downloader_uwp.h +++ b/src/common/http_downloader_uwp.h @@ -1,4 +1,5 @@ #pragma once +#pragma once #include "http_downloader.h" #include "common/windows_headers.h" diff --git a/src/frontend-common/http_downloader_winhttp.cpp b/src/common/http_downloader_winhttp.cpp similarity index 98% rename from src/frontend-common/http_downloader_winhttp.cpp rename to src/common/http_downloader_winhttp.cpp index c7a3e4c38..b99dede86 100644 --- a/src/frontend-common/http_downloader_winhttp.cpp +++ b/src/common/http_downloader_winhttp.cpp @@ -1,8 +1,8 @@ #include "http_downloader_winhttp.h" -#include "common/assert.h" -#include "common/log.h" -#include "common/string_util.h" -#include "common/timer.h" +#include "assert.h" +#include "log.h" +#include "string_util.h" +#include "timer.h" #include #include Log_SetChannel(HTTPDownloaderWinHttp); diff --git a/src/frontend-common/http_downloader_winhttp.h b/src/common/http_downloader_winhttp.h similarity index 100% rename from src/frontend-common/http_downloader_winhttp.h rename to src/common/http_downloader_winhttp.h diff --git a/src/frontend-common/CMakeLists.txt b/src/frontend-common/CMakeLists.txt index 4a56607c8..5613c66d6 100644 --- a/src/frontend-common/CMakeLists.txt +++ b/src/frontend-common/CMakeLists.txt @@ -113,25 +113,6 @@ if(ENABLE_DISCORD_PRESENCE) endif() if(ENABLE_CHEEVOS) - target_sources(frontend-common PRIVATE - http_downloader.cpp - http_downloader.h - ) - if(WIN32) - target_sources(frontend-common PRIVATE - http_downloader_winhttp.cpp - http_downloader_winhttp.h - ) - elseif(NOT ANDROID) - target_sources(frontend-common PRIVATE - http_downloader_curl.cpp - http_downloader_curl.h - ) - target_link_libraries(frontend-common PRIVATE - CURL::libcurl - ) - endif() - target_sources(frontend-common PRIVATE cheevos.cpp cheevos.h diff --git a/src/frontend-common/cheevos.cpp b/src/frontend-common/cheevos.cpp index 8c4e48925..6b0cb8691 100644 --- a/src/frontend-common/cheevos.cpp +++ b/src/frontend-common/cheevos.cpp @@ -1,6 +1,7 @@ #include "cheevos.h" #include "common/cd_image.h" #include "common/file_system.h" +#include "common/http_downloader.h" #include "common/log.h" #include "common/md5_digest.h" #include "common/platform.h" @@ -13,7 +14,6 @@ #include "core/host_display.h" #include "core/system.h" #include "fullscreen_ui.h" -#include "http_downloader.h" #include "imgui_fullscreen.h" #include "rapidjson/document.h" #include "rc_url.h" diff --git a/src/frontend-common/frontend-common.vcxproj b/src/frontend-common/frontend-common.vcxproj index dbb02a4a4..7095e5e2d 100644 --- a/src/frontend-common/frontend-common.vcxproj +++ b/src/frontend-common/frontend-common.vcxproj @@ -17,13 +17,6 @@ - - - true - - - true - @@ -69,13 +62,6 @@ - - - true - - - true - diff --git a/src/frontend-common/frontend-common.vcxproj.filters b/src/frontend-common/frontend-common.vcxproj.filters index 980b960cf..2e34d4e2f 100644 --- a/src/frontend-common/frontend-common.vcxproj.filters +++ b/src/frontend-common/frontend-common.vcxproj.filters @@ -28,15 +28,12 @@ - - - @@ -66,15 +63,12 @@ - - -