Skip to content

Commit

Permalink
Merge pull request #634 from nadiaholmquist/system-sdl2
Browse files Browse the repository at this point in the history
cmake: Add a USE_SYSTEM_SDL2 option
  • Loading branch information
wheremyfoodat authored Nov 12, 2024
2 parents a8d3fb0 + f4eb8bc commit f16d171
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ option(ENABLE_HTTP_SERVER "Enable HTTP server. Used for Discord bot support" OFF
option(ENABLE_DISCORD_RPC "Compile with Discord RPC support (disabled by default)" ON)
option(ENABLE_LUAJIT "Enable scripting with the Lua programming language" ON)
option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
option(USE_SYSTEM_SDL2 "Use the system's SDL2 package" OFF)
option(ENABLE_GIT_VERSIONING "Enables querying git for the emulator version" ON)
option(BUILD_HYDRA_CORE "Build a Hydra core" OFF)
option(BUILD_LIBRETRO_CORE "Build a Libretro core" OFF)
Expand Down Expand Up @@ -145,18 +146,22 @@ if(ENABLE_DISCORD_RPC AND NOT ANDROID)
include_directories(third_party/discord-rpc/include)
endif()

set(SDL_STATIC ON CACHE BOOL "" FORCE)
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
set(SDL_TEST OFF CACHE BOOL "" FORCE)

if (NOT ANDROID)
add_subdirectory(third_party/SDL2)
target_link_libraries(AlberCore PUBLIC SDL2-static)
if (USE_SYSTEM_SDL2)
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(AlberCore PUBLIC SDL2::SDL2)
else()
set(SDL_STATIC ON CACHE BOOL "" FORCE)
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
set(SDL_TEST OFF CACHE BOOL "" FORCE)
add_subdirectory(third_party/SDL2)
target_link_libraries(AlberCore PUBLIC SDL2-static)
endif()
endif()

add_subdirectory(third_party/fmt)
add_subdirectory(third_party/toml11)
include_directories(${SDL2_INCLUDE_DIR})
include_directories(third_party/toml11)
include_directories(third_party/glm)
include_directories(third_party/renderdoc)
Expand Down

0 comments on commit f16d171

Please sign in to comment.