mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
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:
@@ -3,6 +3,11 @@ cmake_policy(SET CMP0069 NEW)
|
|||||||
project(spicetools)
|
project(spicetools)
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
|
|
||||||
|
option(WITH_SCARD "Build spice2x with SCard support" ON)
|
||||||
|
if(WITH_SCARD)
|
||||||
|
add_definitions(-DWITH_SCARD)
|
||||||
|
endif()
|
||||||
|
|
||||||
# set language level
|
# set language level
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
@@ -357,7 +362,6 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
external/cardio/cardio_runner.cpp
|
external/cardio/cardio_runner.cpp
|
||||||
|
|
||||||
# external misc
|
# external misc
|
||||||
external/scard/scard.cpp
|
|
||||||
external/stackwalker/stackwalker.cpp
|
external/stackwalker/stackwalker.cpp
|
||||||
external/tinyxml2/tinyxml2.cpp
|
external/tinyxml2/tinyxml2.cpp
|
||||||
external/http-parser/http_parser.c
|
external/http-parser/http_parser.c
|
||||||
@@ -613,6 +617,9 @@ set(SOURCE_FILES ${SOURCE_FILES}
|
|||||||
util/dependencies.cpp
|
util/dependencies.cpp
|
||||||
util/deferlog.cpp
|
util/deferlog.cpp
|
||||||
)
|
)
|
||||||
|
if(WITH_SCARD)
|
||||||
|
list(APPEND SOURCE_FILES external/scard/scard.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCE_FILES})
|
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCE_FILES})
|
||||||
|
|
||||||
@@ -622,8 +629,11 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOUR
|
|||||||
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
||||||
add_executable(spicetools_spice ${SOURCE_FILES} ${RESOURCE_FILES})
|
add_executable(spicetools_spice ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
target_link_libraries(spicetools_spice
|
target_link_libraries(spicetools_spice
|
||||||
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
if(WITH_SCARD)
|
||||||
|
target_link_libraries(spicetools_spice PUBLIC winscard)
|
||||||
|
endif()
|
||||||
set_target_properties(spicetools_spice PROPERTIES PREFIX "")
|
set_target_properties(spicetools_spice PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_spice PROPERTIES OUTPUT_NAME "spice")
|
set_target_properties(spicetools_spice PROPERTIES OUTPUT_NAME "spice")
|
||||||
|
|
||||||
@@ -637,8 +647,11 @@ endif()
|
|||||||
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
set(RESOURCE_FILES build/manifest.manifest build/manifest.rc build/icon.rc cfg/Win32D.rc)
|
||||||
add_executable(spicetools_spice_laa ${SOURCE_FILES} ${RESOURCE_FILES})
|
add_executable(spicetools_spice_laa ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
target_link_libraries(spicetools_spice_laa
|
target_link_libraries(spicetools_spice_laa
|
||||||
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
if(WITH_SCARD)
|
||||||
|
target_link_libraries(spicetools_spice_laa PUBLIC winscard)
|
||||||
|
endif()
|
||||||
set_target_properties(spicetools_spice_laa PROPERTIES PREFIX "")
|
set_target_properties(spicetools_spice_laa PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_spice_laa PROPERTIES OUTPUT_NAME "spice_laa")
|
set_target_properties(spicetools_spice_laa PROPERTIES OUTPUT_NAME "spice_laa")
|
||||||
target_compile_definitions(spicetools_spice_laa PRIVATE SPICE32_LARGE_ADDRESS_AWARE=1)
|
target_compile_definitions(spicetools_spice_laa PRIVATE SPICE32_LARGE_ADDRESS_AWARE=1)
|
||||||
@@ -655,9 +668,11 @@ add_executable(spicetools_spice64 ${SOURCE_FILES} ${RESOURCE_FILES})
|
|||||||
|
|
||||||
# do NOT link against: mf, mfplat, mfreadwrite; otherwise unity games will break
|
# do NOT link against: mf, mfplat, mfreadwrite; otherwise unity games will break
|
||||||
target_link_libraries(spicetools_spice64
|
target_link_libraries(spicetools_spice64
|
||||||
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp mfuuid strmiids dxva2
|
PUBLIC d3d9 ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp mfuuid strmiids dxva2
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
if(WITH_SCARD)
|
||||||
|
target_link_libraries(spicetools_spice64 PUBLIC winscard)
|
||||||
|
endif()
|
||||||
set_target_properties(spicetools_spice64 PROPERTIES PREFIX "")
|
set_target_properties(spicetools_spice64 PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_spice64 PROPERTIES OUTPUT_NAME "spice64")
|
set_target_properties(spicetools_spice64 PROPERTIES OUTPUT_NAME "spice64")
|
||||||
target_compile_definitions(spicetools_spice64 PRIVATE SPICE64=1)
|
target_compile_definitions(spicetools_spice64 PRIVATE SPICE64=1)
|
||||||
@@ -673,8 +688,11 @@ set(SOURCE_FILES ${SOURCE_FILES} launcher/options.h launcher/options.cpp)
|
|||||||
set(RESOURCE_FILES cfg/manifest.manifest cfg/manifest.rc cfg/icon.rc cfg/Win32D.rc)
|
set(RESOURCE_FILES cfg/manifest.manifest cfg/manifest.rc cfg/icon.rc cfg/Win32D.rc)
|
||||||
add_executable(spicetools_cfg WIN32 ${SOURCE_FILES} ${RESOURCE_FILES})
|
add_executable(spicetools_cfg WIN32 ${SOURCE_FILES} ${RESOURCE_FILES})
|
||||||
target_link_libraries(spicetools_cfg
|
target_link_libraries(spicetools_cfg
|
||||||
PUBLIC ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winscard winhttp strmiids
|
PUBLIC ws2_32 version comctl32 shlwapi iphlpapi hid secur32 setupapi psapi winmm winhttp strmiids
|
||||||
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
PRIVATE fmt-header-only discord-rpc imgui hash-library minhook imm32 dwmapi CpuFeatures::cpu_features)
|
||||||
|
if(WITH_SCARD)
|
||||||
|
target_link_libraries(spicetools_cfg PUBLIC winscard)
|
||||||
|
endif()
|
||||||
set_target_properties(spicetools_cfg PROPERTIES PREFIX "")
|
set_target_properties(spicetools_cfg PROPERTIES PREFIX "")
|
||||||
set_target_properties(spicetools_cfg PROPERTIES OUTPUT_NAME "spicecfg")
|
set_target_properties(spicetools_cfg PROPERTIES OUTPUT_NAME "spicecfg")
|
||||||
target_compile_definitions(spicetools_cfg PRIVATE SPICETOOLS_SPICECFG_STANDALONE=1)
|
target_compile_definitions(spicetools_cfg PRIVATE SPICETOOLS_SPICECFG_STANDALONE=1)
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
#include "cfg/screen_resize.h"
|
#include "cfg/screen_resize.h"
|
||||||
#include "easrv/easrv.h"
|
#include "easrv/easrv.h"
|
||||||
#include "external/cardio/cardio_runner.h"
|
#include "external/cardio/cardio_runner.h"
|
||||||
|
#ifdef WITH_SCARD
|
||||||
#include "external/scard/scard.h"
|
#include "external/scard/scard.h"
|
||||||
|
#endif
|
||||||
#include "games/game.h"
|
#include "games/game.h"
|
||||||
#include "games/io.h"
|
#include "games/io.h"
|
||||||
#include "games/bbc/bbc.h"
|
#include "games/bbc/bbc.h"
|
||||||
@@ -817,6 +819,7 @@ int main_implementation(int argc, char *argv[]) {
|
|||||||
for (auto &sextet : options[launcher::Options::SextetStreamPort].values_text()) {
|
for (auto &sextet : options[launcher::Options::SextetStreamPort].values_text()) {
|
||||||
sextet_devices.emplace_back(sextet);
|
sextet_devices.emplace_back(sextet);
|
||||||
}
|
}
|
||||||
|
#ifdef WITH_SCARD
|
||||||
if (options[launcher::Options::HIDSmartCard].value_bool()) {
|
if (options[launcher::Options::HIDSmartCard].value_bool()) {
|
||||||
WINSCARD_CONFIG.cardinfo_callback = eamuse_scard_callback;
|
WINSCARD_CONFIG.cardinfo_callback = eamuse_scard_callback;
|
||||||
scard_threadstart();
|
scard_threadstart();
|
||||||
@@ -836,6 +839,7 @@ int main_implementation(int argc, char *argv[]) {
|
|||||||
WINSCARD_CONFIG.add_padding_to_felica = true;
|
WINSCARD_CONFIG.add_padding_to_felica = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (options[launcher::Options::CardIOHIDReaderOrderFlip].value_bool()) {
|
if (options[launcher::Options::CardIOHIDReaderOrderFlip].value_bool()) {
|
||||||
CARDIO_RUNNER_FLIP = true;
|
CARDIO_RUNNER_FLIP = true;
|
||||||
}
|
}
|
||||||
@@ -2315,8 +2319,10 @@ int main_implementation(int argc, char *argv[]) {
|
|||||||
// debug hook
|
// debug hook
|
||||||
debughook::detach();
|
debughook::detach();
|
||||||
|
|
||||||
|
#ifdef WITH_SCARD
|
||||||
// scard
|
// scard
|
||||||
scard_fini();
|
scard_fini();
|
||||||
|
#endif
|
||||||
|
|
||||||
// stop reader thread in case it was running
|
// stop reader thread in case it was running
|
||||||
stop_reader_thread();
|
stop_reader_thread();
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#ifndef WITH_SCARD
|
||||||
|
#define WITH_SCARD 0
|
||||||
|
#endif
|
||||||
|
|
||||||
static const std::vector<std::string> CATEGORY_ORDER_API = {
|
static const std::vector<std::string> CATEGORY_ORDER_API = {
|
||||||
"SpiceCompanion and API",
|
"SpiceCompanion and API",
|
||||||
"API (Serial)",
|
"API (Serial)",
|
||||||
@@ -1385,21 +1389,27 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
|||||||
.name = "scard",
|
.name = "scard",
|
||||||
.desc = "Detects and uses HID smart card readers for card input. Developed for ACR122U reader",
|
.desc = "Detects and uses HID smart card readers for card input. Developed for ACR122U reader",
|
||||||
.type = OptionType::Bool,
|
.type = OptionType::Bool,
|
||||||
|
.hidden = !WITH_SCARD,
|
||||||
.category = "NFC Card Readers",
|
.category = "NFC Card Readers",
|
||||||
|
.disabled = !WITH_SCARD,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.title = "HID SmartCard Order Flip",
|
.title = "HID SmartCard Order Flip",
|
||||||
.name = "scardflip",
|
.name = "scardflip",
|
||||||
.desc = "Flips the order of detection for P1/P2",
|
.desc = "Flips the order of detection for P1/P2",
|
||||||
.type = OptionType::Bool,
|
.type = OptionType::Bool,
|
||||||
|
.hidden = !WITH_SCARD,
|
||||||
.category = "NFC Card Readers",
|
.category = "NFC Card Readers",
|
||||||
|
.disabled = !WITH_SCARD,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.title = "HID SmartCard Order Toggle",
|
.title = "HID SmartCard Order Toggle",
|
||||||
.name = "scardtoggle",
|
.name = "scardtoggle",
|
||||||
.desc = "Toggles reader between P1/P2 using the NumLock key state",
|
.desc = "Toggles reader between P1/P2 using the NumLock key state",
|
||||||
.type = OptionType::Bool,
|
.type = OptionType::Bool,
|
||||||
|
.hidden = !WITH_SCARD,
|
||||||
.category = "NFC Card Readers",
|
.category = "NFC Card Readers",
|
||||||
|
.disabled = !WITH_SCARD,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// HIDSmartCardIdConvert
|
// 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 "
|
"For example, abcd56780123 is converted to e00401abcd567801 on card in. This results in different card numbers so "
|
||||||
"be careful when connecting to servers!",
|
"be careful when connecting to servers!",
|
||||||
.type = OptionType::Enum,
|
.type = OptionType::Enum,
|
||||||
|
.hidden = !WITH_SCARD,
|
||||||
.category = "NFC Card Readers",
|
.category = "NFC Card Readers",
|
||||||
.elements = {
|
.elements = {
|
||||||
{"legacy", "Use cards as-is"},
|
{"legacy", "Use cards as-is"},
|
||||||
{"fix", "Fix bad cards only"},
|
{"fix", "Fix bad cards only"},
|
||||||
{"all", "Force all cards"},
|
{"all", "Force all cards"},
|
||||||
},
|
},
|
||||||
|
.disabled = !WITH_SCARD,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// SextetStreamPort
|
// SextetStreamPort
|
||||||
|
|||||||
Reference in New Issue
Block a user