11cmake_minimum_required (VERSION 3.5)
2+ include (CMakeFindDependencyMacro)
3+
4+ configure_file (config.h.in config.h)
25
36# X86 is no longer supported, but you could edit this to bring it back.
47# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
@@ -15,8 +18,26 @@ set(CMAKE_AUTORCC ON)
1518set (CMAKE_CXX_STANDARD 17)
1619set (CMAKE_CXX_STANDARD_REQUIRED ON )
1720
18- find_package (QT NAMES Qt6 REQUIRED COMPONENTS Widgets LinguistTools Charts PrintSupport Core Quick Qml)
19- find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools Charts PrintSupport Core Quick Qml)
21+ #find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets LinguistTools Charts PrintSupport Core Quick Qml)
22+ find_package (Qt6 REQUIRED COMPONENTS Widgets LinguistTools Charts PrintSupport Core Quick Qml)
23+
24+ # Optional packages.
25+ # https://virustotal.github.io/yara-x/docs/api/c/c-/
26+ #find_library(YARAX NAMES yara_x_capi)
27+ #find_library(YARAX NAMES libyara_x_capi.a)
28+
29+
30+ find_package (PkgConfig REQUIRED)
31+ pkg_check_modules(YARAX REQUIRED IMPORTED_TARGET yara_x_capi)
32+
33+
34+ # Check if the library was found
35+ if (YARAX_FOUND)
36+ set (YARAX ${YARAX_STATIC_LIBRARIES} )
37+ message (STATUS "Found yarax: ${YARAX} " )
38+ else ()
39+ message (STATUS "Yarax not found. Will build without it." )
40+ endif ()
2041
2142# GoodASM as a disassembler and library.
2243if (NOT EXISTS "${PROJECT_SOURCE_DIR} /extern/goodasm/CMakeLists.txt" )
@@ -54,12 +75,11 @@ set(GATOROM_SOURCES
5475 gatograderbytes.h gatograderbytes.cpp
5576 gatograderstring.h gatograderstring.cpp
5677 gatograderascii.h gatograderascii.cpp
57- gatograderyara.h gatograderyara.cpp
78+ gatograderyara.h gatograderyara.cpp # Old Yara from CLI.
79+ gatograderyarax.h gatograderyarax.cpp # New Yara-X from library.
5880 gatogradergoodasm.h gatogradergoodasm.cpp
5981 # Decoders that are new to GatoRom.
6082 gatodecoderinfo.h gatodecoderinfo.cpp # Just info, no details.
61- # gatodecoderarm6.h gatodecoderarm6.cpp # MYK82 Clipper Chip Decoder. Use cols-left instead.
62- # gatodecodermsp430.h gatodecodermsp430.cpp # MSP430 ROM
6383 gatodecodertlcsfont.h gatodecodertlcsfont.cpp # TMP47C434N Font ROM
6484 gatodecoderz86x1.h gatodecoderz86x1.cpp # Zilog Z8 Z86x1
6585 gatodecodercolsdownlswap.h gatodecodercolsdownlswap.cpp # Used in NEC uCOM4 Micros
@@ -97,7 +117,6 @@ set(MRT_SOURCES
97117 romdecoderasciidamage.h romdecoderasciidamage.cpp
98118 romdecoderjson.h romdecoderjson.cpp
99119 romdecodercsv.h romdecodercsv.cpp
100- # romdecodermarc4.h romdecodermarc4.cpp # Deprecated, needs to move to gatorom.
101120 romdecoderphotograph.h romdecoderphotograph.cpp
102121 romdecoderhistogram.h romdecoderhistogram.cpp
103122 romencoderdiff.h romencoderdiff.cpp
@@ -133,12 +152,17 @@ if(NOT WIN32)
133152endif ()
134153
135154
155+
156+
157+
136158qt_add_executable(maskromtool
137159 MANUAL_FINALIZATION
138160 ${MRT_SOURCES}
139161)
140162qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES} )
141- target_link_libraries (maskromtool PRIVATE Qt${QT_VERSION_MAJOR} ::Widgets Qt${QT_VERSION_MAJOR} ::Charts Qt${QT_VERSION_MAJOR} ::PrintSupport libgoodasm ${READLINE} )
163+ target_link_libraries (maskromtool PRIVATE Qt6::Widgets
164+ Qt6::Charts Qt6::PrintSupport
165+ libgoodasm ${READLINE} PkgConfig::YARAX)
142166
143167
144168set_target_properties (maskromtool PROPERTIES
@@ -156,7 +180,9 @@ if(WIN32)
156180 MANUAL_FINALIZATION
157181 ${MRT_SOURCES}
158182 )
159- target_link_libraries (maskromtoolcli PRIVATE Qt${QT_VERSION_MAJOR} ::Widgets Qt${QT_VERSION_MAJOR} ::Charts Qt${QT_VERSION_MAJOR} ::PrintSupport libgoodasm ${READLINE} )
183+ target_link_libraries (maskromtoolcli PRIVATE Qt6::Widgets
184+ Qt6::Charts Qt6::PrintSupport
185+ libgoodasm ${READLINE} ${YARAX_LIBRARIES} )
160186 qt_finalize_executable(maskromtoolcli)
161187 install (TARGETS maskromtoolcli DESTINATION bin)
162188endif ()
@@ -173,7 +199,8 @@ add_executable(gatorom
173199 # CLI
174200 gatomain.cpp
175201)
176- target_link_libraries (gatorom Qt${QT_VERSION_MAJOR} ::Core Qt${QT_VERSION_MAJOR} ::PrintSupport libgoodasm ${READLINE} )
202+ target_link_libraries (gatorom Qt6::Core
203+ Qt6::PrintSupport libgoodasm ${READLINE} ${YARAX_LIBRARIES} )
177204
178205install (TARGETS gatorom
179206 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
0 commit comments