Add Windows build support via MSYS2 and fix platform-specific code

Guard X11 display crash handler with __linux__, add Windows GlobalMemoryStatusEx
path in memory_monitor, guard warden cache paths with APPDATA on Windows, and
make pkg-config optional in CMakeLists with a find_library fallback. Add Windows
x86-64 CI job using MSYS2 MINGW64 to the build workflow.
This commit is contained in:
Kelsi 2026-02-18 17:38:08 -08:00
parent 02fd0166e9
commit cb01821d89
6 changed files with 125 additions and 16 deletions

View file

@ -22,8 +22,25 @@ find_package(GLEW REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFMPEG REQUIRED libavformat libavcodec libswscale libavutil)
if(WIN32)
find_package(PkgConfig QUIET)
else()
find_package(PkgConfig REQUIRED)
endif()
if(PkgConfig_FOUND)
pkg_check_modules(FFMPEG REQUIRED libavformat libavcodec libswscale libavutil)
else()
# Fallback for MSVC/vcpkg — find FFmpeg libraries manually
find_path(FFMPEG_INCLUDE_DIRS libavformat/avformat.h)
find_library(AVFORMAT_LIB NAMES avformat)
find_library(AVCODEC_LIB NAMES avcodec)
find_library(AVUTIL_LIB NAMES avutil)
find_library(SWSCALE_LIB NAMES swscale)
set(FFMPEG_LIBRARIES ${AVFORMAT_LIB} ${AVCODEC_LIB} ${AVUTIL_LIB} ${SWSCALE_LIB})
if(NOT AVFORMAT_LIB)
message(FATAL_ERROR "FFmpeg not found. On Windows install via MSYS2: mingw-w64-x86_64-ffmpeg")
endif()
endif()
# Unicorn Engine (x86 emulator for cross-platform Warden module execution)
find_library(UNICORN_LIBRARY NAMES unicorn)