Cockatrice/tests/oracle/CMakeLists.txt
Lukas Brübach f154335f5c Merge upstream/master into scryfall-tagger-tags
Conflict resolution: keep both the tag database and the upstream database writer in the oracle test targets and both includes in the importer test; restore the tags.svg resource entry that the rerere replay dropped.

Upstream's icon rules also landed mid-branch: use loadThemedIcon() for the tag quick-filter button and re-author tags.svg as a 24x24 currentColor icon so IconAssets.AssetsFollowTheRules passes.
2026-11-08 20:44:00 +01:00

85 lines
2.8 KiB
CMake

# Optional compression libs, mirrored from oracle/CMakeLists.txt, so the tag database
# loader can decompress whatever format the tag source serves, and the benchmark can
# download and decompress whatever AllPrintings format the default URL selects.
# add_definitions() is directory-scoped and order-independent, so HAS_ZLIB/HAS_LZMA
# reach every test target below regardless of where they are declared.
set(_ORACLE_COMPRESSION_SOURCES)
set(_ORACLE_COMPRESSION_LIBRARIES)
find_package(ZLIB)
if(ZLIB_FOUND)
add_definitions("-DHAS_ZLIB")
list(APPEND _ORACLE_COMPRESSION_SOURCES ../../oracle/src/zip/unzip.cpp ../../oracle/src/zip/zipglobal.cpp)
cockatrice_disable_sanitizers_for(${_ORACLE_COMPRESSION_SOURCES})
cockatrice_disable_coverage_for(${_ORACLE_COMPRESSION_SOURCES})
list(APPEND _ORACLE_COMPRESSION_LIBRARIES ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
else()
message(STATUS "Oracle tests: zlib not found; gzip/zip tag databases and the zip download benchmark disabled")
endif()
find_package(LibLZMA)
if(LIBLZMA_FOUND)
add_definitions("-DHAS_LZMA")
list(APPEND _ORACLE_COMPRESSION_SOURCES ../../oracle/src/lzma/decompress.cpp)
cockatrice_disable_sanitizers_for(../../oracle/src/lzma/decompress.cpp)
cockatrice_disable_coverage_for(../../oracle/src/lzma/decompress.cpp)
list(APPEND _ORACLE_COMPRESSION_LIBRARIES ${LIBLZMA_LIBRARIES})
include_directories(${LIBLZMA_INCLUDE_DIRS})
else()
message(STATUS "Oracle tests: LibLZMA not found; xz tag databases and the xz download benchmark disabled")
endif()
cockatrice_add_test(NAME parse_cipt_test SOURCES ../../oracle/src/parsehelpers.cpp parse_cipt_test.cpp)
# Oracle importer unit tests
cockatrice_add_test(
NAME
oracle_importer_test
SOURCES
${VERSION_STRING_CPP}
../../oracle/src/oracleimporter.cpp
../../oracle/src/parsehelpers.cpp
../../oracle/src/raw_json_scanner.cpp
../../oracle/src/tag_database.cpp
../../oracle/src/database_writer.cpp
oracle_importer_test.cpp
${_ORACLE_COMPRESSION_SOURCES}
LIBS
libcockatrice_card
libcockatrice_interfaces
EXTRA_LIBS
${_ORACLE_COMPRESSION_LIBRARIES}
)
# Tag database format detection, parsing and parent expansion
cockatrice_add_test(
NAME
tag_database_test
SOURCES
../../oracle/src/tag_database.cpp
tag_database_test.cpp
${_ORACLE_COMPRESSION_SOURCES}
EXTRA_LIBS
${_ORACLE_COMPRESSION_LIBRARIES}
)
# Oracle importer benchmark tests (manual, not run in CI, incl. RAM benchmark)
cockatrice_add_manual_test(
NAME
oracle_importer_benchmark_test
SOURCES
${VERSION_STRING_CPP}
../../oracle/src/oracleimporter.cpp
../../oracle/src/parsehelpers.cpp
../../oracle/src/raw_json_scanner.cpp
../../oracle/src/tag_database.cpp
oracle_importer_benchmark_test.cpp
${_ORACLE_COMPRESSION_SOURCES}
LIBS
libcockatrice_card
libcockatrice_interfaces
EXTRA_LIBS
${_ORACLE_COMPRESSION_LIBRARIES}
MANUAL
)