2017-10-25 14:57:25 +00:00
|
|
|
if(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
pkg_check_modules(PC_SDL2 sdl2)
|
|
|
|
endif()
|
2017-02-28 23:51:22 +00:00
|
|
|
|
2017-10-24 10:10:46 +00:00
|
|
|
set_extra_dirs_lib(SDL2 sdl)
|
|
|
|
find_library(SDL2_LIBRARY
|
|
|
|
NAMES SDL2
|
|
|
|
HINTS ${HINTS_SDL2_LIBDIR} ${PC_SDL2_LIBDIR} ${PC_SDL2_LIBRARY_DIRS}
|
|
|
|
PATHS ${PATHS_SDL2_LIBDIR}
|
2017-10-25 14:57:25 +00:00
|
|
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
2017-10-24 10:10:46 +00:00
|
|
|
)
|
2017-10-25 14:57:25 +00:00
|
|
|
set(CMAKE_FIND_FRAMEWORK FIRST)
|
2017-10-24 10:10:46 +00:00
|
|
|
set_extra_dirs_include(SDL2 sdl "${SDL2_LIBRARY}")
|
2018-02-04 15:00:47 +00:00
|
|
|
# Looking for 'SDL.h' directly might accidentally find a SDL instead of SDL 2
|
2017-07-26 02:30:56 +00:00
|
|
|
# installation. Look for a header file only present in SDL 2 instead.
|
|
|
|
find_path(SDL2_INCLUDEDIR SDL_assert.h
|
2017-02-28 23:51:22 +00:00
|
|
|
PATH_SUFFIXES SDL2
|
2017-07-31 16:30:24 +00:00
|
|
|
HINTS ${HINTS_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDE_DIRS}
|
|
|
|
PATHS ${PATHS_SDL2_INCLUDEDIR}
|
2021-08-24 10:18:20 +00:00
|
|
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
2017-02-28 23:51:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(SDL2 DEFAULT_MSG SDL2_LIBRARY SDL2_INCLUDEDIR)
|
|
|
|
|
|
|
|
mark_as_advanced(SDL2_LIBRARY SDL2_INCLUDEDIR)
|
|
|
|
|
2018-02-12 22:14:14 +00:00
|
|
|
if(SDL2_FOUND)
|
|
|
|
set(SDL2_LIBRARIES ${SDL2_LIBRARY})
|
|
|
|
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDEDIR})
|
2017-03-07 14:24:08 +00:00
|
|
|
|
2018-02-12 22:14:14 +00:00
|
|
|
is_bundled(SDL2_BUNDLED "${SDL2_LIBRARY}")
|
|
|
|
if(SDL2_BUNDLED AND TARGET_OS STREQUAL "windows")
|
|
|
|
set(SDL2_COPY_FILES "${EXTRA_SDL2_LIBDIR}/SDL2.dll")
|
2020-08-23 06:01:51 +00:00
|
|
|
if(TARGET_BITS EQUAL 32)
|
|
|
|
list(APPEND OPUSFILE_COPY_FILES
|
|
|
|
"${EXTRA_SDL2_LIBDIR}/libgcc_s_dw2-1.dll"
|
|
|
|
)
|
|
|
|
endif()
|
2018-02-12 22:14:14 +00:00
|
|
|
else()
|
|
|
|
set(SDL2_COPY_FILES)
|
|
|
|
endif()
|
2017-03-07 14:24:08 +00:00
|
|
|
endif()
|