Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
138
external/sdl/SDL/cmake/FindFFmpeg.cmake
vendored
Normal file
138
external/sdl/SDL/cmake/FindFFmpeg.cmake
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
|
||||
#
|
||||
# Once done this will define
|
||||
# FFMPEG_FOUND - System has the all required components.
|
||||
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
|
||||
#
|
||||
# For each of the components it will additionally set.
|
||||
# - AVCODEC
|
||||
# - AVDEVICE
|
||||
# - AVFORMAT
|
||||
# - AVFILTER
|
||||
# - AVUTIL
|
||||
# - POSTPROC
|
||||
# - SWSCALE
|
||||
# the following target will be defined
|
||||
# FFmpeg::SDL::<component> - link to this target to
|
||||
# the following variables will be defined
|
||||
# FFmpeg_<component>_FOUND - System has <component>
|
||||
# FFmpeg_<component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
|
||||
# FFmpeg_<component>_LIBRARIES - Link these to use <component>
|
||||
# FFmpeg_<component>_DEFINITIONS - Compiler switches required for using <component>
|
||||
# FFmpeg_<component>_VERSION - The components version
|
||||
#
|
||||
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
|
||||
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
|
||||
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
|
||||
# Copyright (c) 2023, Sam lantinga, <slouken@libsdl.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PkgConfigHelper.cmake")
|
||||
|
||||
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
||||
if(NOT FFmpeg_FIND_COMPONENTS)
|
||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
|
||||
foreach(_component IN LISTS FFmpeg_FIND_COMPONENTS)
|
||||
set(FFmpeg_FIND_REQUIRED_${_component} TRUE)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
#
|
||||
### Macro: find_component
|
||||
#
|
||||
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
|
||||
# include directories.
|
||||
#
|
||||
macro(find_component _component _pkgconfig _library _header)
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_${_component} QUIET ${_pkgconfig})
|
||||
endif()
|
||||
|
||||
find_path(FFmpeg_${_component}_INCLUDE_DIRS
|
||||
NAMES ${_header}
|
||||
HINTS
|
||||
${PC_${_component}_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES
|
||||
ffmpeg
|
||||
)
|
||||
|
||||
find_library(FFmpeg_${_component}_LIBRARY
|
||||
NAMES ${_library}
|
||||
HINTS
|
||||
${PC_${_component}_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(FFmpeg_${_component}_INCLUDE_DIRS AND FFmpeg_${_component}_LIBRARY)
|
||||
set(FFmpeg_${_component}_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(PC_${_component}_FOUND)
|
||||
get_flags_from_pkg_config("${FFmpeg_${_component}_LIBRARY}" "PC_${_component}" "${_component}")
|
||||
endif()
|
||||
|
||||
set(FFmpeg_${_component}_VERSION "${PC_${_component}_VERSION}")
|
||||
|
||||
set(FFmpeg_${_component}_COMPILE_OPTIONS "${${_component}_options}" CACHE STRING "Extra compile options of FFmpeg ${_component}")
|
||||
|
||||
set(FFmpeg_${_component}_LIBRARIES "${${_component}_link_libraries}" CACHE STRING "Extra link libraries of FFmpeg ${_component}")
|
||||
|
||||
set(FFmpeg_${_component}_LINK_OPTIONS "${${_component}_link_options}" CACHE STRING "Extra link flags of FFmpeg ${_component}")
|
||||
|
||||
set(FFmpeg_${_component}_LINK_DIRECTORIES "${${_component}_link_directories}" CACHE PATH "Extra link directories of FFmpeg ${_component}")
|
||||
|
||||
mark_as_advanced(
|
||||
FFmpeg_${_component}_INCLUDE_DIRS
|
||||
FFmpeg_${_component}_LIBRARY
|
||||
FFmpeg_${_component}_COMPILE_OPTIONS
|
||||
FFmpeg_${_component}_LIBRARIES
|
||||
FFmpeg_${_component}_LINK_OPTIONS
|
||||
FFmpeg_${_component}_LINK_DIRECTORIES
|
||||
)
|
||||
endmacro()
|
||||
|
||||
# Check for all possible component.
|
||||
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
||||
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
|
||||
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
|
||||
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
|
||||
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
|
||||
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
|
||||
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
|
||||
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
|
||||
|
||||
# Compile the list of required vars
|
||||
set(_FFmpeg_REQUIRED_VARS)
|
||||
foreach(_component ${FFmpeg_FIND_COMPONENTS})
|
||||
list(APPEND _FFmpeg_REQUIRED_VARS FFmpeg_${_component}_INCLUDE_DIRS FFmpeg_${_component}_LIBRARY)
|
||||
endforeach ()
|
||||
|
||||
# Give a nice error message if some of the required vars are missing.
|
||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
|
||||
|
||||
set(FFMPEG_LIBRARIES)
|
||||
if(FFmpeg_FOUND)
|
||||
foreach(_component IN LISTS FFmpeg_FIND_COMPONENTS)
|
||||
if(FFmpeg_${_component}_FOUND)
|
||||
list(APPEND FFMPEG_LIBRARIES FFmpeg::SDL::${_component})
|
||||
if(NOT TARGET FFmpeg::SDL::${_component})
|
||||
add_library(FFmpeg::SDL::${_component} UNKNOWN IMPORTED)
|
||||
set_target_properties(FFmpeg::SDL::${_component} PROPERTIES
|
||||
IMPORTED_LOCATION "${FFmpeg_${_component}_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FFmpeg_${_component}_INCLUDE_DIRS}"
|
||||
INTERFACE_COMPILE_OPTIONS "${FFmpeg_${_component}_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${FFmpeg_${_component}_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${FFmpeg_${_component}_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${FFmpeg_${_component}_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
5
external/sdl/SDL/cmake/PkgConfigHelper.cmake
vendored
5
external/sdl/SDL/cmake/PkgConfigHelper.cmake
vendored
@ -2,13 +2,11 @@
|
||||
|
||||
function(get_flags_from_pkg_config _library _pc_prefix _out_prefix)
|
||||
if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
|
||||
set(_include_dirs ${_pc_prefix}_STATIC_INCLUDE_DIRS)
|
||||
set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER)
|
||||
set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES)
|
||||
set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER)
|
||||
set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS)
|
||||
else()
|
||||
set(_include_dirs ${_pc_prefix}_INCLUDE_DIRS)
|
||||
set(_cflags ${_pc_prefix}_CFLAGS_OTHER)
|
||||
set(_link_libraries ${_pc_prefix}_LIBRARIES)
|
||||
set(_link_options ${_pc_prefix}_LDFLAGS_OTHER)
|
||||
@ -21,9 +19,6 @@ function(get_flags_from_pkg_config _library _pc_prefix _out_prefix)
|
||||
# Work around CMake's flag deduplication when pc files use `-framework A` instead of `-Wl,-framework,A`
|
||||
string(REPLACE "-framework;" "-Wl,-framework," "_filtered_link_options" "${${_link_options}}")
|
||||
|
||||
set(${_out_prefix}_include_dirs
|
||||
"${${_include_dirs}}"
|
||||
PARENT_SCOPE)
|
||||
set(${_out_prefix}_compile_options
|
||||
"${${_cflags}}"
|
||||
PARENT_SCOPE)
|
||||
|
5
external/sdl/SDL/cmake/SDL3Config.cmake.in
vendored
5
external/sdl/SDL/cmake/SDL3Config.cmake.in
vendored
@ -48,6 +48,11 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3jarTargets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3jarTargets.cmake")
|
||||
set(SDL3_Jar_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(SDL3_SDL3-shared_FOUND OR SDL3_SDL3-static_FOUND)
|
||||
set(SDL3_SDL3_FOUND TRUE)
|
||||
endif()
|
||||
|
10
external/sdl/SDL/cmake/SDL3jarTargets.cmake.in
vendored
Normal file
10
external/sdl/SDL/cmake/SDL3jarTargets.cmake.in
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(SDL3_JAR "@PACKAGE_SDL_INSTALL_JAVADIR@/SDL3/SDL3-@SDL3_VERSION@.jar")
|
||||
|
||||
if(NOT TARGET SDL3::Jar)
|
||||
add_library(SDL3::Jar INTERFACE IMPORTED)
|
||||
set_property(TARGET SDL3::Jar PROPERTY JAR_FILE "${SDL3_JAR}")
|
||||
endif()
|
||||
|
||||
unset(SDL3_JAR)
|
54
external/sdl/SDL/cmake/macros.cmake
vendored
54
external/sdl/SDL/cmake/macros.cmake
vendored
@ -82,16 +82,48 @@ if(APPLE)
|
||||
enable_language(OBJC)
|
||||
endif()
|
||||
|
||||
function(SDL_detect_linker)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.29)
|
||||
if(NOT DEFINED SDL_CMAKE_C_COMPILER_LINKER_ID)
|
||||
execute_process(COMMAND ${CMAKE_LINKER} -v OUTPUT_VARIABLE LINKER_OUTPUT ERROR_VARIABLE LINKER_OUTPUT)
|
||||
string(REGEX REPLACE "[\r\n]" " " LINKER_OUTPUT "${LINKER_OUTPUT}")
|
||||
if(LINKER_OUTPUT MATCHES ".*Microsoft.*")
|
||||
set(linker MSVC)
|
||||
else()
|
||||
set(linker GNUlike)
|
||||
endif()
|
||||
message(STATUS "Linker identification: ${linker}")
|
||||
set(SDL_CMAKE_C_COMPILER_LINKER_ID "${linker}" CACHE STRING "Linker identification")
|
||||
mark_as_advanced(SDL_CMAKE_C_COMPILER_LINKER_ID)
|
||||
endif()
|
||||
set(CMAKE_C_COMPILER_LINKER_ID "${SDL_CMAKE_C_COMPILER_LINKER_ID}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(check_linker_supports_version_file VAR)
|
||||
SDL_detect_linker()
|
||||
if(CMAKE_C_COMPILER_LINKER_ID MATCHES "^(MSVC)$")
|
||||
set(LINKER_SUPPORTS_VERSION_SCRIPT FALSE)
|
||||
else()
|
||||
cmake_push_check_state(RESET)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.sym" "n_0 {\n global:\n func;\n local: *;\n};\n")
|
||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/dummy.sym")
|
||||
check_c_source_compiles("int func(void) {return 0;} int main(int argc,char*argv[]){(void)argc;(void)argv;return func();}" LINKER_SUPPORTS_VERSION_SCRIPT FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
set(${VAR} "${LINKER_SUPPORTS_VERSION_SCRIPT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 3.18)
|
||||
function(check_linker_flag LANG FLAG VAR)
|
||||
cmake_push_check_state()
|
||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${FLAG} )
|
||||
cmake_push_check_state(RESET)
|
||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${FLAG})
|
||||
if(LANG STREQUAL "C")
|
||||
include(CheckCSourceCompiles)
|
||||
check_c_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "warning")
|
||||
check_c_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)")
|
||||
elseif(LANG STREQUAL "CXX")
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "warning")
|
||||
check_cxx_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported language: ${LANG}")
|
||||
endif()
|
||||
@ -169,3 +201,17 @@ function(SDL_PrintSummary)
|
||||
message(STATUS "")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(SDL_install_pdb TARGET DIRECTORY)
|
||||
get_property(type TARGET ${TARGET} PROPERTY TYPE)
|
||||
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
|
||||
elseif(type STREQUAL "STATIC_LIBRARY")
|
||||
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
|
||||
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
|
||||
else()
|
||||
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
21
external/sdl/SDL/cmake/sdlchecks.cmake
vendored
21
external/sdl/SDL/cmake/sdlchecks.cmake
vendored
@ -162,7 +162,7 @@ endmacro()
|
||||
# - HAVE_SDL_LOADSO opt
|
||||
macro(CheckPulseAudio)
|
||||
if(SDL_PULSEAUDIO)
|
||||
set(PulseAudio_PKG_CONFIG_SPEC "libpulse>=5.0")
|
||||
set(PulseAudio_PKG_CONFIG_SPEC "libpulse>=0.9.15")
|
||||
pkg_check_modules(PC_PULSEAUDIO IMPORTED_TARGET ${PulseAudio_PKG_CONFIG_SPEC})
|
||||
if(PC_PULSEAUDIO_FOUND)
|
||||
set(HAVE_PULSEAUDIO TRUE)
|
||||
@ -307,7 +307,9 @@ macro(CheckX11)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/x11/*.c")
|
||||
set(SDL_VIDEO_DRIVER_X11 1)
|
||||
|
||||
# !!! FIXME: why is this disabled for Apple?
|
||||
# Note: Disabled on Apple because the dynamic mode backend for X11 doesn't
|
||||
# work properly on Apple during several issues like inconsistent paths
|
||||
# among platforms. See #6778 (https://github.com/libsdl-org/SDL/issues/6778)
|
||||
if(APPLE)
|
||||
set(SDL_X11_SHARED OFF)
|
||||
endif()
|
||||
@ -533,11 +535,6 @@ macro(CheckWayland)
|
||||
WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL3_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}")
|
||||
endforeach()
|
||||
|
||||
if(SDL_WAYLAND_QT_TOUCH)
|
||||
set(HAVE_WAYLAND_QT_TOUCH TRUE)
|
||||
set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
|
||||
endif()
|
||||
|
||||
if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO)
|
||||
message(WARNING "You must have SDL_LoadObject() support for dynamic Wayland loading")
|
||||
endif()
|
||||
@ -560,10 +557,10 @@ macro(CheckWayland)
|
||||
set(LibDecor_PKG_CONFIG_SPEC libdecor-0)
|
||||
pkg_check_modules(PC_LIBDECOR IMPORTED_TARGET ${LibDecor_PKG_CONFIG_SPEC})
|
||||
if(PC_LIBDECOR_FOUND)
|
||||
# Version 0.1.2 or higher is needed for suspended window state and statically linked min/max getters.
|
||||
if(PC_LIBDECOR_VERSION VERSION_GREATER_EQUAL "0.1.2")
|
||||
set(SDL_HAVE_LIBDECOR_VER_0_1_2 1)
|
||||
set(LibDecor_PKG_CONFIG_SPEC "libdecor-0>=0.1.2")
|
||||
# Version 0.2.0 or higher is needed for suspended window state and statically linked min/max getters.
|
||||
if(PC_LIBDECOR_VERSION VERSION_GREATER_EQUAL "0.2.0")
|
||||
set(SDL_HAVE_LIBDECOR_VER_0_2_0 1)
|
||||
set(LibDecor_PKG_CONFIG_SPEC "libdecor-0>=0.2.0")
|
||||
endif()
|
||||
set(HAVE_WAYLAND_LIBDECOR TRUE)
|
||||
set(HAVE_LIBDECOR_H 1)
|
||||
@ -1024,7 +1021,7 @@ macro(CheckHIDAPI)
|
||||
if(SDL_HIDAPI_LIBUSB)
|
||||
set(HAVE_LIBUSB FALSE)
|
||||
|
||||
set(LibUSB_PKG_CONFIG_SPEC libusb-1.0)
|
||||
set(LibUSB_PKG_CONFIG_SPEC libusb-1.0>=1.0.16)
|
||||
pkg_check_modules(PC_LIBUSB IMPORTED_TARGET ${LibUSB_PKG_CONFIG_SPEC})
|
||||
if(PC_LIBUSB_FOUND)
|
||||
cmake_push_check_state()
|
||||
|
26
external/sdl/SDL/cmake/sdlcompilers.cmake
vendored
26
external/sdl/SDL/cmake/sdlcompilers.cmake
vendored
@ -49,12 +49,12 @@ function(SDL_AddCommonCompilerFlags TARGET)
|
||||
|
||||
check_c_compiler_flag(-Wundef HAVE_GCC_WUNDEF)
|
||||
if(HAVE_GCC_WUNDEF)
|
||||
target_compile_options(${TARGET} PRIVATE "-Wundef")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wundef>")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING)
|
||||
if(HAVE_GCC_NO_STRICT_ALIASING)
|
||||
target_compile_options(${TARGET} PRIVATE "-fno-strict-aliasing")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-fno-strict-aliasing>")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-Wdocumentation HAVE_GCC_WDOCUMENTATION)
|
||||
@ -62,10 +62,10 @@ function(SDL_AddCommonCompilerFlags TARGET)
|
||||
if(SDL_WERROR)
|
||||
check_c_compiler_flag(-Werror=documentation HAVE_GCC_WERROR_DOCUMENTATION)
|
||||
if(HAVE_GCC_WERROR_DOCUMENTATION)
|
||||
target_compile_options(${TARGET} PRIVATE "-Werror=documentation")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Werror=documentation>")
|
||||
endif()
|
||||
endif()
|
||||
target_compile_options(${TARGET} PRIVATE "-Wdocumentation")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wdocumentation>")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-Wdocumentation-unknown-command HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND)
|
||||
@ -73,30 +73,30 @@ function(SDL_AddCommonCompilerFlags TARGET)
|
||||
if(SDL_WERROR)
|
||||
check_c_compiler_flag(-Werror=documentation-unknown-command HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND)
|
||||
if(HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND)
|
||||
target_compile_options(${TARGET} PRIVATE "-Werror=documentation-unknown-command")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Werror=documentation-unknown-command>")
|
||||
endif()
|
||||
endif()
|
||||
target_compile_options(${TARGET} PRIVATE "-Wdocumentation-unknown-command")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wdocumentation-unknown-command>")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-fcomment-block-commands=threadsafety HAVE_GCC_COMMENT_BLOCK_COMMANDS)
|
||||
if(HAVE_GCC_COMMENT_BLOCK_COMMANDS)
|
||||
target_compile_options(${TARGET} PRIVATE "-fcomment-block-commands=threadsafety")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-fcomment-block-commands=threadsafety>")
|
||||
else()
|
||||
check_c_compiler_flag(/clang:-fcomment-block-commands=threadsafety HAVE_CLANG_COMMENT_BLOCK_COMMANDS)
|
||||
if(HAVE_CLANG_COMMENT_BLOCK_COMMANDS)
|
||||
target_compile_options(${TARGET} PRIVATE "/clang:-fcomment-block-commands=threadsafety")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:/clang:-fcomment-block-commands=threadsafety>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
|
||||
if(HAVE_GCC_WSHADOW)
|
||||
target_compile_options(${TARGET} PRIVATE "-Wshadow")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wshadow>")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-Wunused-local-typedefs HAVE_GCC_WUNUSED_LOCAL_TYPEDEFS)
|
||||
if(HAVE_GCC_WUNUSED_LOCAL_TYPEDEFS)
|
||||
target_compile_options(${TARGET} PRIVATE "-Wno-unused-local-typedefs")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-local-typedefs>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -109,7 +109,7 @@ function(SDL_AddCommonCompilerFlags TARGET)
|
||||
elseif(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QNX)
|
||||
check_c_compiler_flag(-Werror HAVE_WERROR)
|
||||
if(HAVE_WERROR)
|
||||
target_compile_options(${TARGET} PRIVATE "-Werror")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Werror>")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -117,12 +117,12 @@ function(SDL_AddCommonCompilerFlags TARGET)
|
||||
if(USE_CLANG)
|
||||
check_c_compiler_flag("-fcolor-diagnostics" COMPILER_SUPPORTS_FCOLOR_DIAGNOSTICS)
|
||||
if(COMPILER_SUPPORTS_FCOLOR_DIAGNOSTICS)
|
||||
target_compile_options(${TARGET} PRIVATE "-fcolor-diagnostics")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-fcolor-diagnostics>")
|
||||
endif()
|
||||
else()
|
||||
check_c_compiler_flag("-fdiagnostics-color=always" COMPILER_SUPPORTS_FDIAGNOSTICS_COLOR_ALWAYS)
|
||||
if(COMPILER_SUPPORTS_FDIAGNOSTICS_COLOR_ALWAYS)
|
||||
target_compile_options(${TARGET} PRIVATE "-fdiagnostics-color=always")
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-fdiagnostics-color=always>")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
2
external/sdl/SDL/cmake/sdlmanpages.cmake
vendored
2
external/sdl/SDL/cmake/sdlmanpages.cmake
vendored
@ -19,7 +19,7 @@ function(SDL_generate_manpages)
|
||||
endif()
|
||||
|
||||
if(NOT ARG_HEADERS_DIR)
|
||||
set(ARG_HEADERS_DIR "${PROJECT_SOURCE_DIR}/include/SDL3")
|
||||
message(FATAL_ERROR "Missing required HEADERS_DIR argument")
|
||||
endif()
|
||||
|
||||
# FIXME: get rid of SYMBOL and let the perl script figure out the dependencies
|
||||
|
3
external/sdl/SDL/cmake/sdltargets.cmake
vendored
3
external/sdl/SDL/cmake/sdltargets.cmake
vendored
@ -332,6 +332,9 @@ function(configure_sdl3_pc)
|
||||
endif()
|
||||
|
||||
# Calculate prefix relative to location of sdl3.pc
|
||||
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDL_PKGCONFIG_INSTALLDIR}" "${CMAKE_INSTALL_PREFIX}")
|
||||
string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
|
||||
set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}")
|
||||
|
4
external/sdl/SDL/cmake/test/CMakeLists.txt
vendored
4
external/sdl/SDL/cmake/test/CMakeLists.txt
vendored
@ -93,4 +93,8 @@ find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
||||
add_executable(gui-whatever WIN32 main_gui.c)
|
||||
target_link_libraries(gui-whatever PRIVATE SDL3::SDL3)
|
||||
|
||||
if(ANDROID)
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS Jar)
|
||||
endif()
|
||||
|
||||
feature_summary(WHAT ALL)
|
||||
|
2
external/sdl/SDL/cmake/test/main_gui.c
vendored
2
external/sdl/SDL/cmake/test/main_gui.c
vendored
@ -10,7 +10,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
window = SDL_CreateWindow("Hello SDL", 640, 480, 0);
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_Log("could not create window: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user