mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 22:19:10 +00:00
cmake: fail configuring when no X11 or wayland could be found (#11310)
It's still possible to build SDL by configuring with -DSDL_NO_UNIX_DESKTOP_SANITY_CHECK=ON
This commit is contained in:
parent
540db0d164
commit
e8b69b03fe
3 changed files with 27 additions and 5 deletions
6
.github/workflows/create-test-plan.py
vendored
6
.github/workflows/create-test-plan.py
vendored
|
@ -608,7 +608,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
|||
job.cmake_arguments.extend((
|
||||
f"-DCMAKE_C_COMPILER={job.cc}",
|
||||
f"-DCMAKE_CXX_COMPILER={job.cxx}",
|
||||
"-DCMAKE_SYSTEM_NAME=Haiku",
|
||||
"-DSDL_UNIX_CONSOLE_BUILD=ON",
|
||||
))
|
||||
job.shared_lib = SharedLibType.SO_0
|
||||
job.static_lib = StaticLibType.A
|
||||
|
@ -621,6 +621,9 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
|||
job.apt_packages = []
|
||||
job.shared_lib = SharedLibType.SO_0
|
||||
job.static_lib = StaticLibType.A
|
||||
job.cmake_arguments.extend((
|
||||
"-DSDL_UNIX_CONSOLE_BUILD=ON",
|
||||
))
|
||||
case SdlPlatform.LoongArch64:
|
||||
job.run_tests = False
|
||||
job.cc = "${LOONGARCH64_CC}"
|
||||
|
@ -628,6 +631,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
|||
job.cmake_arguments.extend((
|
||||
f"-DCMAKE_C_COMPILER={job.cc}",
|
||||
f"-DCMAKE_CXX_COMPILER={job.cxx}",
|
||||
"-DSDL_UNIX_CONSOLE_BUILD=ON",
|
||||
"-DCMAKE_SYSTEM_NAME=Linux",
|
||||
))
|
||||
job.shared_lib = SharedLibType.SO_0
|
||||
|
|
|
@ -394,11 +394,21 @@ function(SDL_PrintSummary)
|
|||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN))
|
||||
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS))
|
||||
if(NOT (HAVE_X11 OR HAVE_WAYLAND))
|
||||
message(STATUS "SDL is being built without a X11 or wayland video driver.")
|
||||
message(STATUS "The library will not be able to create windows on most unix environments.")
|
||||
message(STATUS "")
|
||||
if(NOT SDL_UNIX_CONSOLE_BUILD)
|
||||
message(FATAL_ERROR
|
||||
"SDL could not find X11 or Wayland development libraries on your system. "
|
||||
"This means SDL will not be able to create windows on a typical unix operating system. "
|
||||
"Most likely, this is not wanted."
|
||||
"\n"
|
||||
"On Linux, install the packages listed at "
|
||||
"https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md#build-dependencies "
|
||||
"\n"
|
||||
"If you really don't need desktop windows, the documentation tells you how to skip this check. "
|
||||
"https://github.com/libsdl-org/SDL/blob/main/docs/README-cmake.md#cmake-fails-to-build-without-x11-or-wayland-support\n"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
|
@ -306,6 +306,14 @@ Configure your project with `-DSDL_LIBC=ON` to make use of sanitizers.
|
|||
|
||||
## CMake FAQ
|
||||
|
||||
### CMake fails to build without X11 or Wayland support
|
||||
|
||||
Install the required system packages prior to running CMake.
|
||||
See [README-linux][README-linux.md#build-dependencies] for the list of dependencies on Linux.
|
||||
Other unix operationg systems should provide similar packages.
|
||||
|
||||
If you **really** don't need to show windows, add `-DSDL_UNIX_CONSOLE_BUILD=ON` to the CMake configure command.
|
||||
|
||||
### How do I copy a SDL3 dynamic library to another location?
|
||||
|
||||
Use [CMake generator expressions](https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#target-dependent-expressions).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue