[wifi] conditionally enable
All checks were successful
eden-license / license-header (pull_request) Successful in 24s

This commit is contained in:
lizzie 2025-07-22 07:23:00 +01:00
parent 7db5eb8f08
commit 360cbb89ae
3 changed files with 10 additions and 4 deletions

View file

@ -50,6 +50,7 @@ option(ENABLE_QT_UPDATE_CHECKER "Enable update checker for the Qt frontend" OFF)
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF) CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF)
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
option(ENABLE_WIFI_SCAN "Enable WiFi scanning" OFF)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" OFF) option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" OFF)

View file

@ -1150,8 +1150,9 @@ add_library(core STATIC
tools/renderdoc.h tools/renderdoc.h
) )
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if (ENABLE_WIFI_SCAN)
# find_package(libiw REQUIRED) # find_package(libiw REQUIRED)
target_compile_definitions(core PRIVATE -DENABLE_WIFI_SCAN)
target_link_libraries(core PRIVATE iw) target_link_libraries(core PRIVATE iw)
endif() endif()

View file

@ -19,7 +19,7 @@ using namespace std::chrono_literals;
#endif #endif
namespace Network { namespace Network {
#ifdef ENABLE_WIFI_SCAN
#ifdef _WIN32 #ifdef _WIN32
static u8 QualityToPercent(DWORD q) { static u8 QualityToPercent(DWORD q) {
return static_cast<u8>(q); return static_cast<u8>(q);
@ -173,16 +173,20 @@ static std::vector<Network::ScanData> ScanWifiLinux(std::chrono::milliseconds de
return out; return out;
} }
#endif /* linux */ #endif /* linux */
#endif
std::vector<Network::ScanData> ScanWifiNetworks(std::chrono::milliseconds deadline) { std::vector<Network::ScanData> ScanWifiNetworks(std::chrono::milliseconds deadline) {
#ifdef _WIN32 #ifdef ENABLE_WIFI_SCAN
#if defined(_WIN32)
return ScanWifiWin(deadline); return ScanWifiWin(deadline);
#elif defined(__linux__) && !defined(ANDROID) #elif defined(__linux__) && !defined(ANDROID)
return ScanWifiLinux(deadline); return ScanWifiLinux(deadline);
#else #else
std::this_thread::sleep_for(deadline);
return {}; // unsupported host, pretend no results return {}; // unsupported host, pretend no results
#endif #endif
#else
return {}; // disabled, pretend no results
#endif
} }
} // namespace Network } // namespace Network