add option to remove winscard dependency (#400)

## Link to GitHub Issue, if one exists
n/a

## Description of change
Add CMake option to disable SCard functionality. Needed by some builds
of WINE, where distributor opted to not enable scard functionality for
whatever reason

## Testing
Building with `cmake -DWITH_SCARD=OFF` does not link against winscard
Building without this option at all links against winscard
This commit is contained in:
kazakhstan-sila
2025-10-14 00:13:51 +03:00
committed by GitHub
parent be2dab9a1a
commit a10ca5236b
4 changed files with 44 additions and 8 deletions
+13 -1
View File
@@ -6,6 +6,10 @@
#include <fstream>
#ifndef WITH_SCARD
#define WITH_SCARD 0
#endif
static const std::vector<std::string> CATEGORY_ORDER_API = {
"SpiceCompanion and API",
"API (Serial)",
@@ -1385,21 +1389,27 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.name = "scard",
.desc = "Detects and uses HID smart card readers for card input. Developed for ACR122U reader",
.type = OptionType::Bool,
.hidden = !WITH_SCARD,
.category = "NFC Card Readers",
.disabled = !WITH_SCARD,
},
{
.title = "HID SmartCard Order Flip",
.name = "scardflip",
.desc = "Flips the order of detection for P1/P2",
.type = OptionType::Bool,
.hidden = !WITH_SCARD,
.category = "NFC Card Readers",
.disabled = !WITH_SCARD,
},
{
.title = "HID SmartCard Order Toggle",
.name = "scardtoggle",
.desc = "Toggles reader between P1/P2 using the NumLock key state",
.type = OptionType::Bool,
.hidden = !WITH_SCARD,
.category = "NFC Card Readers",
.disabled = !WITH_SCARD,
},
{
// HIDSmartCardIdConvert
@@ -1413,12 +1423,14 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
"For example, abcd56780123 is converted to e00401abcd567801 on card in. This results in different card numbers so "
"be careful when connecting to servers!",
.type = OptionType::Enum,
.hidden = !WITH_SCARD,
.category = "NFC Card Readers",
.elements = {
{"legacy", "Use cards as-is"},
{"fix", "Fix bad cards only"},
{"all", "Force all cards"},
},
.disabled = !WITH_SCARD,
},
{
// SextetStreamPort
@@ -2844,4 +2856,4 @@ launcher::GameVersion launcher::detect_gameversion(const std::string &ea3_user,
// error
log_warning("options", "unable to find /ea3/soft/model in {}", ea3_path);
return detect_gameversion_ident(bootstrap_user);
}
}