From e3af26a50872f1de9a5ed92a8efb70bcc64aa3ad Mon Sep 17 00:00:00 2001 From: PalindromicBreadLoaf Date: Fri, 29 Aug 2025 13:09:24 -0400 Subject: [PATCH] Implement support for building on Linux. Hopefully doesn't break Windows/macOS --- CMakeLists.txt | 12 +++++++++++- src/bus.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2f3998..b058df5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,10 +46,20 @@ elseif(APPLE) find_package(SDL2 REQUIRED CONFIG) message(STATUS "Found SDL2 at: ${SDL2_DIR}") -elseif(UNIX) +elseif(UNIX AND NOT APPLE) + find_package(SDL2 CONFIG QUIET) + if(NOT SDL2_FOUND) + # Use pkg-config as fallback find_package(PkgConfig REQUIRED) pkg_check_modules(SDL2 REQUIRED sdl2) + + add_library(SDL2::SDL2 UNKNOWN IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" + INTERFACE_COMPILE_OPTIONS "${SDL2_CFLAGS_OTHER}" + ) endif() endif() diff --git a/src/bus.h b/src/bus.h index b77b967..90248a2 100644 --- a/src/bus.h +++ b/src/bus.h @@ -5,6 +5,7 @@ #ifndef BUS_H #define BUS_H #include +#include #include // Memory Bus - handles memory mapping