diff options
Diffstat (limited to 'contrib/SDL-3.2.8/cmake/macros.cmake')
| -rw-r--r-- | contrib/SDL-3.2.8/cmake/macros.cmake | 410 |
1 files changed, 410 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/cmake/macros.cmake b/contrib/SDL-3.2.8/cmake/macros.cmake new file mode 100644 index 0000000..3885aba --- /dev/null +++ b/contrib/SDL-3.2.8/cmake/macros.cmake | |||
| @@ -0,0 +1,410 @@ | |||
| 1 | macro(add_to_alloptions _NEWNAME) | ||
| 2 | list(APPEND ALLOPTIONS ${_NEWNAME}) | ||
| 3 | endmacro() | ||
| 4 | |||
| 5 | macro(set_option _NAME _DESC) | ||
| 6 | add_to_alloptions(${_NAME}) | ||
| 7 | if(${ARGC} EQUAL 3) | ||
| 8 | set(_DEFLT ${ARGV2}) | ||
| 9 | else() | ||
| 10 | set(_DEFLT OFF) | ||
| 11 | endif() | ||
| 12 | option(${_NAME} ${_DESC} ${_DEFLT}) | ||
| 13 | endmacro() | ||
| 14 | |||
| 15 | macro(dep_option _NAME _DESC _DEFLT _DEPTEST _FAILDFLT) | ||
| 16 | add_to_alloptions("${_NAME}") | ||
| 17 | cmake_dependent_option("${_NAME}" "${_DESC}" "${_DEFLT}" "${_DEPTEST}" "${_FAILDFLT}") | ||
| 18 | endmacro() | ||
| 19 | |||
| 20 | macro(option_string _NAME _DESC _VALUE) | ||
| 21 | add_to_alloptions(${_NAME}) | ||
| 22 | set(${_NAME} ${_VALUE} CACHE STRING "${_DESC}") | ||
| 23 | set(HAVE_${_NAME} ${_VALUE}) | ||
| 24 | ENDMACRO() | ||
| 25 | |||
| 26 | macro(message_bool_option _NAME _VALUE) | ||
| 27 | set(_PAD "\t") | ||
| 28 | if(${ARGC} EQUAL 3) | ||
| 29 | set(_PAD ${ARGV2}) | ||
| 30 | endif() | ||
| 31 | if(${_VALUE}) | ||
| 32 | message(STATUS " ${_NAME}:${_PAD}ON") | ||
| 33 | else() | ||
| 34 | message(STATUS " ${_NAME}:${_PAD}OFF") | ||
| 35 | endif() | ||
| 36 | endmacro() | ||
| 37 | |||
| 38 | macro(message_tested_option _NAME) | ||
| 39 | set(_REQVALUE ${${_NAME}}) | ||
| 40 | set(_PAD " ") | ||
| 41 | if(${ARGC} EQUAL 2) | ||
| 42 | set(_PAD ${ARGV1}) | ||
| 43 | endif() | ||
| 44 | string(SUBSTRING "${_NAME}" 0 4 _NAMESTART) | ||
| 45 | if(_NAMESTART STREQUAL "SDL_") | ||
| 46 | string(SUBSTRING "${_NAME}" 4 -1 _STRIPPEDNAME) | ||
| 47 | else() | ||
| 48 | set(_STRIPPEDNAME "${_NAME}") | ||
| 49 | endif() | ||
| 50 | if(NOT HAVE_${_STRIPPEDNAME}) | ||
| 51 | set(HAVE_${_STRIPPEDNAME} OFF) | ||
| 52 | elseif("${HAVE_${_STRIPPEDNAME}}" MATCHES "1|TRUE|YES|Y") | ||
| 53 | set(HAVE_${_STRIPPEDNAME} ON) | ||
| 54 | endif() | ||
| 55 | message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}") | ||
| 56 | endmacro() | ||
| 57 | |||
| 58 | function(find_stringlength_longest_item inList outLength) | ||
| 59 | set(maxLength 0) | ||
| 60 | foreach(item IN LISTS ${inList}) | ||
| 61 | string(LENGTH "${item}" slen) | ||
| 62 | if(slen GREATER maxLength) | ||
| 63 | set(maxLength ${slen}) | ||
| 64 | endif() | ||
| 65 | endforeach() | ||
| 66 | set("${outLength}" ${maxLength} PARENT_SCOPE) | ||
| 67 | endfunction() | ||
| 68 | |||
| 69 | function(message_dictlist inList) | ||
| 70 | find_stringlength_longest_item(${inList} maxLength) | ||
| 71 | foreach(name IN LISTS ${inList}) | ||
| 72 | # Get the padding | ||
| 73 | string(LENGTH ${name} nameLength) | ||
| 74 | math(EXPR padLength "(${maxLength} + 1) - ${nameLength}") | ||
| 75 | string(RANDOM LENGTH ${padLength} ALPHABET " " padding) | ||
| 76 | message_tested_option(${name} ${padding}) | ||
| 77 | endforeach() | ||
| 78 | endfunction() | ||
| 79 | |||
| 80 | if(APPLE) | ||
| 81 | include(CheckOBJCSourceCompiles) | ||
| 82 | enable_language(OBJC) | ||
| 83 | endif() | ||
| 84 | |||
| 85 | function(SDL_detect_linker) | ||
| 86 | if(CMAKE_VERSION VERSION_LESS 3.29) | ||
| 87 | if(NOT DEFINED SDL_CMAKE_C_COMPILER_LINKER_ID) | ||
| 88 | execute_process(COMMAND ${CMAKE_LINKER} -v OUTPUT_VARIABLE LINKER_OUTPUT ERROR_VARIABLE LINKER_OUTPUT) | ||
| 89 | string(REGEX REPLACE "[\r\n]" " " LINKER_OUTPUT "${LINKER_OUTPUT}") | ||
| 90 | if(LINKER_OUTPUT MATCHES ".*Microsoft.*") | ||
| 91 | set(linker MSVC) | ||
| 92 | else() | ||
| 93 | set(linker GNUlike) | ||
| 94 | endif() | ||
| 95 | message(STATUS "Linker identification: ${linker}") | ||
| 96 | set(SDL_CMAKE_C_COMPILER_LINKER_ID "${linker}" CACHE STRING "Linker identification") | ||
| 97 | mark_as_advanced(SDL_CMAKE_C_COMPILER_LINKER_ID) | ||
| 98 | endif() | ||
| 99 | set(CMAKE_C_COMPILER_LINKER_ID "${SDL_CMAKE_C_COMPILER_LINKER_ID}" PARENT_SCOPE) | ||
| 100 | endif() | ||
| 101 | endfunction() | ||
| 102 | |||
| 103 | function(read_absolute_symlink DEST PATH) | ||
| 104 | file(READ_SYMLINK "${PATH}" p) | ||
| 105 | if(NOT IS_ABSOLUTE "${p}") | ||
| 106 | get_filename_component(pdir "${PATH}" DIRECTORY) | ||
| 107 | set(p "${pdir}/${p}") | ||
| 108 | endif() | ||
| 109 | get_filename_component(p "${p}" ABSOLUTE) | ||
| 110 | set("${DEST}" "${p}" PARENT_SCOPE) | ||
| 111 | endfunction() | ||
| 112 | |||
| 113 | function(win32_implib_identify_dll DEST IMPLIB) | ||
| 114 | cmake_parse_arguments(ARGS "NOTFATAL" "" "" ${ARGN}) | ||
| 115 | if(CMAKE_DLLTOOL) | ||
| 116 | execute_process( | ||
| 117 | COMMAND "${CMAKE_DLLTOOL}" --identify "${IMPLIB}" | ||
| 118 | RESULT_VARIABLE retcode | ||
| 119 | OUTPUT_VARIABLE stdout | ||
| 120 | ERROR_VARIABLE stderr) | ||
| 121 | if(NOT retcode EQUAL 0) | ||
| 122 | if(NOT ARGS_NOTFATAL) | ||
| 123 | message(FATAL_ERROR "${CMAKE_DLLTOOL} failed.") | ||
| 124 | else() | ||
| 125 | set("${DEST}" "${DEST}-NOTFOUND" PARENT_SCOPE) | ||
| 126 | return() | ||
| 127 | endif() | ||
| 128 | endif() | ||
| 129 | string(STRIP "${stdout}" result) | ||
| 130 | set(${DEST} "${result}" PARENT_SCOPE) | ||
| 131 | elseif(MSVC) | ||
| 132 | get_filename_component(CMAKE_C_COMPILER_DIRECTORY "${CMAKE_C_COMPILER}" DIRECTORY CACHE) | ||
| 133 | find_program(CMAKE_DUMPBIN NAMES dumpbin PATHS "${CMAKE_C_COMPILER_DIRECTORY}") | ||
| 134 | if(CMAKE_DUMPBIN) | ||
| 135 | execute_process( | ||
| 136 | COMMAND "${CMAKE_DUMPBIN}" "-headers" "${IMPLIB}" | ||
| 137 | RESULT_VARIABLE retcode | ||
| 138 | OUTPUT_VARIABLE stdout | ||
| 139 | ERROR_VARIABLE stderr) | ||
| 140 | if(NOT retcode EQUAL 0) | ||
| 141 | if(NOT ARGS_NOTFATAL) | ||
| 142 | message(FATAL_ERROR "dumpbin failed.") | ||
| 143 | else() | ||
| 144 | set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE) | ||
| 145 | return() | ||
| 146 | endif() | ||
| 147 | endif() | ||
| 148 | string(REGEX MATCH "DLL name[ ]+:[ ]+([^\n]+)\n" match "${stdout}") | ||
| 149 | if(NOT match) | ||
| 150 | if(NOT ARGS_NOTFATAL) | ||
| 151 | message(FATAL_ERROR "dumpbin did not find any associated dll for ${IMPLIB}.") | ||
| 152 | else() | ||
| 153 | set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE) | ||
| 154 | return() | ||
| 155 | endif() | ||
| 156 | endif() | ||
| 157 | set(result "${CMAKE_MATCH_1}") | ||
| 158 | set(${DEST} "${result}" PARENT_SCOPE) | ||
| 159 | else() | ||
| 160 | message(FATAL_ERROR "Cannot find dumpbin, please set CMAKE_DUMPBIN cmake variable") | ||
| 161 | endif() | ||
| 162 | else() | ||
| 163 | if(NOT ARGS_NOTFATAL) | ||
| 164 | message(FATAL_ERROR "Don't know how to identify dll from import library. Set CMAKE_DLLTOOL (for mingw) or CMAKE_DUMPBIN (for MSVC)") | ||
| 165 | else() | ||
| 166 | set(${DEST} "${DEST}-NOTFOUND") | ||
| 167 | endif() | ||
| 168 | endif() | ||
| 169 | endfunction() | ||
| 170 | |||
| 171 | function(get_actual_target) | ||
| 172 | set(dst "${ARGV0}") | ||
| 173 | set(target "${${dst}}") | ||
| 174 | set(input "${target}") | ||
| 175 | get_target_property(alias "${target}" ALIASED_TARGET) | ||
| 176 | while(alias) | ||
| 177 | set(target "${alias}") | ||
| 178 | get_target_property(alias "${target}" ALIASED_TARGET) | ||
| 179 | endwhile() | ||
| 180 | message(DEBUG "get_actual_target(\"${input}\") -> \"${target}\"") | ||
| 181 | set("${dst}" "${target}" PARENT_SCOPE) | ||
| 182 | endfunction() | ||
| 183 | |||
| 184 | function(target_get_dynamic_library DEST TARGET) | ||
| 185 | set(result) | ||
| 186 | get_actual_target(TARGET) | ||
| 187 | if(WIN32) | ||
| 188 | # Use the target dll of the import library | ||
| 189 | set(props_to_check IMPORTED_IMPLIB) | ||
| 190 | if(CMAKE_BUILD_TYPE) | ||
| 191 | list(APPEND props_to_check IMPORTED_IMPLIB_${CMAKE_BUILD_TYPE}) | ||
| 192 | endif() | ||
| 193 | list(APPEND props_to_check IMPORTED_LOCATION) | ||
| 194 | if(CMAKE_BUILD_TYPE) | ||
| 195 | list(APPEND props_to_check IMPORTED_LOCATION_${CMAKE_BUILD_TYPE}) | ||
| 196 | endif() | ||
| 197 | foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL) | ||
| 198 | list(APPEND props_to_check IMPORTED_IMPLIB_${config_type}) | ||
| 199 | list(APPEND props_to_check IMPORTED_LOCATION_${config_type}) | ||
| 200 | endforeach() | ||
| 201 | |||
| 202 | foreach(prop_to_check ${props_to_check}) | ||
| 203 | if(NOT result) | ||
| 204 | get_target_property(propvalue "${TARGET}" ${prop_to_check}) | ||
| 205 | if(propvalue AND EXISTS "${propvalue}") | ||
| 206 | win32_implib_identify_dll(result "${propvalue}" NOTFATAL) | ||
| 207 | endif() | ||
| 208 | endif() | ||
| 209 | endforeach() | ||
| 210 | else() | ||
| 211 | # 1. find the target library a file might be symbolic linking to | ||
| 212 | # 2. find all other files in the same folder that symbolic link to it | ||
| 213 | # 3. sort all these files, and select the 1st item on Linux, and last on macOS | ||
| 214 | set(location_properties IMPORTED_LOCATION) | ||
| 215 | if(CMAKE_BUILD_TYPE) | ||
| 216 | list(APPEND location_properties IMPORTED_LOCATION_${CMAKE_BUILD_TYPE}) | ||
| 217 | endif() | ||
| 218 | foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL) | ||
| 219 | list(APPEND location_properties IMPORTED_LOCATION_${config_type}) | ||
| 220 | endforeach() | ||
| 221 | if(APPLE) | ||
| 222 | set(valid_shared_library_regex "\\.[0-9]+\\.dylib$") | ||
| 223 | else() | ||
| 224 | set(valid_shared_library_regex "\\.so\\.([0-9.]+)?[0-9]") | ||
| 225 | endif() | ||
| 226 | foreach(location_property ${location_properties}) | ||
| 227 | if(NOT result) | ||
| 228 | get_target_property(library_path "${TARGET}" ${location_property}) | ||
| 229 | message(DEBUG "get_target_property(${TARGET} ${location_property}) -> ${library_path}") | ||
| 230 | if(EXISTS "${library_path}") | ||
| 231 | get_filename_component(library_path "${library_path}" ABSOLUTE) | ||
| 232 | while (IS_SYMLINK "${library_path}") | ||
| 233 | read_absolute_symlink(library_path "${library_path}") | ||
| 234 | endwhile() | ||
| 235 | message(DEBUG "${TARGET} -> ${library_path}") | ||
| 236 | get_filename_component(libdir "${library_path}" DIRECTORY) | ||
| 237 | file(GLOB subfiles "${libdir}/*") | ||
| 238 | set(similar_files "${library_path}") | ||
| 239 | foreach(subfile ${subfiles}) | ||
| 240 | if(IS_SYMLINK "${subfile}") | ||
| 241 | read_absolute_symlink(subfile_target "${subfile}") | ||
| 242 | while(IS_SYMLINK "${subfile_target}") | ||
| 243 | read_absolute_symlink(subfile_target "${subfile_target}") | ||
| 244 | endwhile() | ||
| 245 | get_filename_component(subfile_target "${subfile_target}" ABSOLUTE) | ||
| 246 | if(subfile_target STREQUAL library_path AND subfile MATCHES "${valid_shared_library_regex}") | ||
| 247 | list(APPEND similar_files "${subfile}") | ||
| 248 | endif() | ||
| 249 | endif() | ||
| 250 | endforeach() | ||
| 251 | list(SORT similar_files) | ||
| 252 | message(DEBUG "files that are similar to \"${library_path}\"=${similar_files}") | ||
| 253 | if(APPLE) | ||
| 254 | list(REVERSE similar_files) | ||
| 255 | endif() | ||
| 256 | list(GET similar_files 0 item) | ||
| 257 | get_filename_component(result "${item}" NAME) | ||
| 258 | endif() | ||
| 259 | endif() | ||
| 260 | endforeach() | ||
| 261 | endif() | ||
| 262 | if(result) | ||
| 263 | string(TOLOWER "${result}" result_lower) | ||
| 264 | if(WIN32 OR OS2) | ||
| 265 | if(NOT result_lower MATCHES ".*dll") | ||
| 266 | message(FATAL_ERROR "\"${result}\" is not a .dll library") | ||
| 267 | endif() | ||
| 268 | elseif(APPLE) | ||
| 269 | if(NOT result_lower MATCHES ".*dylib.*") | ||
| 270 | message(FATAL_ERROR "\"${result}\" is not a .dylib shared library") | ||
| 271 | endif() | ||
| 272 | else() | ||
| 273 | if(NOT result_lower MATCHES ".*so.*") | ||
| 274 | message(FATAL_ERROR "\"${result}\" is not a .so shared library") | ||
| 275 | endif() | ||
| 276 | endif() | ||
| 277 | else() | ||
| 278 | get_target_property(target_type ${TARGET} TYPE) | ||
| 279 | if(target_type MATCHES "SHARED_LIBRARY|MODULE_LIBRARY") | ||
| 280 | # OK | ||
| 281 | elseif(target_type MATCHES "STATIC_LIBRARY|OBJECT_LIBRARY|INTERFACE_LIBRARY|EXECUTABLE") | ||
| 282 | message(SEND_ERROR "${TARGET} is not a shared library, but has type=${target_type}") | ||
| 283 | else() | ||
| 284 | message(WARNING "Unable to extract dynamic library from target=${TARGET}, type=${target_type}.") | ||
| 285 | endif() | ||
| 286 | # TARGET_SONAME_FILE is not allowed for DLL target platforms. | ||
| 287 | if(WIN32) | ||
| 288 | set(result "$<TARGET_FILE_NAME:${TARGET}>") | ||
| 289 | else() | ||
| 290 | set(result "$<TARGET_SONAME_FILE_NAME:${TARGET}>") | ||
| 291 | endif() | ||
| 292 | endif() | ||
| 293 | set(${DEST} ${result} PARENT_SCOPE) | ||
| 294 | endfunction() | ||
| 295 | |||
| 296 | function(check_linker_supports_version_file VAR) | ||
| 297 | SDL_detect_linker() | ||
| 298 | if(CMAKE_C_COMPILER_LINKER_ID MATCHES "^(MSVC)$") | ||
| 299 | set(LINKER_SUPPORTS_VERSION_SCRIPT FALSE) | ||
| 300 | else() | ||
| 301 | cmake_push_check_state(RESET) | ||
| 302 | file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/dummy.sym" "n_0 {\n global:\n func;\n local: *;\n};\n") | ||
| 303 | list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/dummy.sym") | ||
| 304 | 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)") | ||
| 305 | cmake_pop_check_state() | ||
| 306 | endif() | ||
| 307 | set(${VAR} "${LINKER_SUPPORTS_VERSION_SCRIPT}" PARENT_SCOPE) | ||
| 308 | endfunction() | ||
| 309 | |||
| 310 | if(CMAKE_VERSION VERSION_LESS 3.18) | ||
| 311 | function(check_linker_flag LANG FLAG VAR) | ||
| 312 | cmake_push_check_state(RESET) | ||
| 313 | list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${FLAG}) | ||
| 314 | if(LANG STREQUAL "C") | ||
| 315 | include(CheckCSourceCompiles) | ||
| 316 | check_c_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)") | ||
| 317 | elseif(LANG STREQUAL "CXX") | ||
| 318 | include(CheckCXXSourceCompiles) | ||
| 319 | check_cxx_source_compiles("int main(int argc,char*argv[]){(void)argc;(void)argv;return 0;}" ${VAR} FAIL_REGEX "(unsupported|syntax error)") | ||
| 320 | else() | ||
| 321 | message(FATAL_ERROR "Unsupported language: ${LANG}") | ||
| 322 | endif() | ||
| 323 | cmake_pop_check_state() | ||
| 324 | endfunction() | ||
| 325 | else() | ||
| 326 | cmake_policy(SET CMP0057 NEW) # Support new if() IN_LIST operator. (used inside check_linker_flag, used in CMake 3.18) | ||
| 327 | include(CheckLinkerFlag) | ||
| 328 | endif() | ||
| 329 | |||
| 330 | if(APPLE) | ||
| 331 | check_language(OBJC) | ||
| 332 | if(NOT CMAKE_OBJC_COMPILER) | ||
| 333 | message(WARNING "Cannot find working OBJC compiler.") | ||
| 334 | endif() | ||
| 335 | endif() | ||
| 336 | |||
| 337 | function(SDL_PrintSummary) | ||
| 338 | ##### Info output ##### | ||
| 339 | message(STATUS "") | ||
| 340 | message(STATUS "SDL3 was configured with the following options:") | ||
| 341 | message(STATUS "") | ||
| 342 | message(STATUS "Platform: ${CMAKE_SYSTEM}") | ||
| 343 | message(STATUS "64-bit: ${ARCH_64}") | ||
| 344 | message(STATUS "Compiler: ${CMAKE_C_COMPILER}") | ||
| 345 | message(STATUS "Revision: ${SDL_REVISION}") | ||
| 346 | message(STATUS "Vendor: ${SDL_VENDOR_INFO}") | ||
| 347 | message(STATUS "") | ||
| 348 | message(STATUS "Subsystems:") | ||
| 349 | |||
| 350 | find_stringlength_longest_item(SDL_SUBSYSTEMS maxLength) | ||
| 351 | foreach(_SUB IN LISTS SDL_SUBSYSTEMS) | ||
| 352 | string(LENGTH ${_SUB} _SUBLEN) | ||
| 353 | math(EXPR _PADLEN "(${maxLength} + 1) - ${_SUBLEN}") | ||
| 354 | string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING) | ||
| 355 | string(TOUPPER ${_SUB} _OPT) | ||
| 356 | message_bool_option(${_SUB} SDL_${_OPT} ${_PADDING}) | ||
| 357 | endforeach() | ||
| 358 | message(STATUS "") | ||
| 359 | message(STATUS "Options:") | ||
| 360 | list(SORT ALLOPTIONS) | ||
| 361 | message_dictlist(ALLOPTIONS) | ||
| 362 | message(STATUS "") | ||
| 363 | message(STATUS " Build Shared Library: ${SDL_SHARED}") | ||
| 364 | message(STATUS " Build Static Library: ${SDL_STATIC}") | ||
| 365 | if(SDL_STATIC) | ||
| 366 | message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}") | ||
| 367 | endif() | ||
| 368 | if(APPLE) | ||
| 369 | message(STATUS " Build libraries as Apple Framework: ${SDL_FRAMEWORK}") | ||
| 370 | endif() | ||
| 371 | message(STATUS "") | ||
| 372 | if(UNIX) | ||
| 373 | message(STATUS "If something was not detected, although the libraries") | ||
| 374 | message(STATUS "were installed, then make sure you have set the") | ||
| 375 | message(STATUS "CMAKE_C_FLAGS and CMAKE_PREFIX_PATH CMake variables correctly.") | ||
| 376 | message(STATUS "") | ||
| 377 | endif() | ||
| 378 | |||
| 379 | if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS)) | ||
| 380 | if(NOT (HAVE_X11 OR HAVE_WAYLAND)) | ||
| 381 | if(NOT SDL_UNIX_CONSOLE_BUILD) | ||
| 382 | message(FATAL_ERROR | ||
| 383 | "SDL could not find X11 or Wayland development libraries on your system. " | ||
| 384 | "This means SDL will not be able to create windows on a typical unix operating system. " | ||
| 385 | "Most likely, this is not wanted." | ||
| 386 | "\n" | ||
| 387 | "On Linux, install the packages listed at " | ||
| 388 | "https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md#build-dependencies " | ||
| 389 | "\n" | ||
| 390 | "If you really don't need desktop windows, the documentation tells you how to skip this check. " | ||
| 391 | "https://github.com/libsdl-org/SDL/blob/main/docs/README-cmake.md#cmake-fails-to-build-without-x11-or-wayland-support\n" | ||
| 392 | ) | ||
| 393 | endif() | ||
| 394 | endif() | ||
| 395 | endif() | ||
| 396 | endfunction() | ||
| 397 | |||
| 398 | function(SDL_install_pdb TARGET DIRECTORY) | ||
| 399 | get_property(type TARGET ${TARGET} PROPERTY TYPE) | ||
| 400 | if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$") | ||
| 401 | install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL) | ||
| 402 | elseif(type STREQUAL "STATIC_LIBRARY") | ||
| 403 | # FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244) | ||
| 404 | if(CMAKE_GENERATOR MATCHES "^Visual Studio.*") | ||
| 405 | install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")") | ||
| 406 | else() | ||
| 407 | install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")") | ||
| 408 | endif() | ||
| 409 | endif() | ||
| 410 | endfunction() | ||
