Skip to content

Commit b627815

Browse files
Yara-X on Windows #132
Enabled building of Windows executable with Yara-X library using pkg-config-lite.
1 parent 67eb1a4 commit b627815

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ Release
8181
maskromtool
8282
MaskRomToolInstaller
8383
*.zip
84+
tmp

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets LinguistTools Charts PrintSupport C
2323

2424

2525
# Neither PkgConfig nor YaraX are required.
26+
set(ENV{PKG_CONFIG_PATH} "c:/lib/pkgconfig")
27+
2628
find_package(PkgConfig)
2729
# https://virustotal.github.io/yara-x/docs/api/c/c-/
2830
pkg_check_modules(YARAX IMPORTED_TARGET yara_x_capi)
@@ -31,12 +33,14 @@ pkg_check_modules(YARAX IMPORTED_TARGET yara_x_capi)
3133
# Check if the library was found
3234
if (YARAX_FOUND)
3335
set(YARAX PkgConfig::YARAX )
34-
message(STATUS "Found yarax: ${YARAX}")
36+
message(STATUS "Found YaraX: ${YARAX}")
3537
# Sometimes macOS doesn't include /usr/local/include.
3638
include_directories(${YARAX_INCLUDE_DIRS})
37-
39+
elseif(EXISTS "C:/lib/yara_x_capi.lib")
40+
message(STATUS "You have Yara-X installed on windows, but not pkg-config-lite.")
41+
message(STATUS "winget install \"Pkg Config Lite\"")
3842
else()
39-
message(STATUS "Yarax not found. Will build without it.")
43+
message(STATUS "YaraX not found. Will build without it.")
4044
endif()
4145

4246
# GoodASM as a disassembler and library.

buildrelease.bat

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ git submodule update --remote
1010

1111

1212
REM Import the Qt and VS2022 paths.
13-
set PATH=C:\Qt\Tools\CMake_64\bin;C:\Qt\6.9.2\msvc2022_64\bin;%PATH%
13+
set PATH=C:\Qt\Tools\CMake_64\bin;C:\Qt\6.10.0\msvc2022_64\bin;%PATH%
1414
REM "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
1515
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsMSBuildCmd"
1616

@@ -37,22 +37,25 @@ copy extern\goodasm\Release\goodasm.exe ..\Release\
3737
cd ..
3838

3939
REM Adding files that windeployqt forgets.
40-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6Charts.dll Release\
41-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6OpenGL.dll Release\
42-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6OpenGLWidgets.dll Release\
43-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6Widgets.dll Release\
44-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6Gui.dll Release\
45-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6PrintSupport.dll Release\
46-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6Pdf.dll Release\
47-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6Svg.dll Release\
48-
rem copy C:\Qt\6.9.2\msvc2022_64\bin\Qt6Core.dll Release\
49-
copy C:\Qt\6.9.2\msvc2022_64\bin\*.dll Release\
40+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6Charts.dll Release\
41+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6OpenGL.dll Release\
42+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6OpenGLWidgets.dll Release\
43+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6Widgets.dll Release\
44+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6Gui.dll Release\
45+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6PrintSupport.dll Release\
46+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6Pdf.dll Release\
47+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6Svg.dll Release\
48+
rem copy C:\Qt\6.10.0\msvc2022_64\bin\Qt6Core.dll Release\
49+
copy C:\Qt\6.10.0\msvc2022_64\bin\*.dll Release\
50+
51+
REM Adding Yara lib if it exists.
52+
copy c:\bin\yara_x_capi.dll Release\
5053

5154
echo Finishing packing Release. Now making installer.
5255

5356

5457
REM Including the path.
55-
set PATH=C:\Qt\Tools\QtInstallerFramework\4.8\bin;C:\Qt\Tools\CMake_64\bin;C:\Qt\6.9.2\msvc2022_64\bin;C:\Qt\Tools\QtInstallerFramework\4.8\bin;%PATH%
58+
set PATH=C:\Qt\Tools\QtInstallerFramework\4.8\bin;C:\Qt\Tools\CMake_64\bin;C:\Qt\6.10.0\msvc2022_64\bin;C:\Qt\Tools\QtInstallerFramework\4.8\bin;%PATH%
5659

5760
REM Copying packages.
5861
xcopy/y/s Release\* Deployment\packages\com.maskromtool.maskromtool\data\

0 commit comments

Comments
 (0)