2022-05-19 09:41:33 +00:00
|
|
|
# Build static lib only
|
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
|
|
set(SDL_SHARED OFF)
|
|
|
|
set(SDL_STATIC ON)
|
|
|
|
|
|
|
|
# Fixes _ftol2_sse already defined
|
|
|
|
set(SDL_LIBC ON)
|
|
|
|
|
2022-07-26 01:30:17 +00:00
|
|
|
if (ANDROID)
|
|
|
|
set(SDL_STATIC_PIC ON)
|
|
|
|
endif()
|
|
|
|
|
2022-05-19 09:41:33 +00:00
|
|
|
include(FetchContent)
|
|
|
|
|
|
|
|
FetchContent_Declare(sdl2
|
|
|
|
GIT_REPOSITORY "https://github.com/libsdl-org/SDL"
|
2022-12-08 16:48:53 +00:00
|
|
|
GIT_TAG "release-2.26.1"
|
2022-05-19 09:41:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
FetchContent_GetProperties(sdl2)
|
|
|
|
if (NOT sdl2_POPULATED)
|
|
|
|
FetchContent_Populate(sdl2)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_subdirectory(${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR} EXCLUDE_FROM_ALL)
|
2022-05-28 05:24:55 +00:00
|
|
|
|
|
|
|
set(SDL2_INCLUDE_DIRS ${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR} PARENT_SCOPE)
|
|
|
|
set(SDL2_LIBRARIES SDL2-static SDL2::SDL2main PARENT_SCOPE)
|