Skip to content

sdl3 build fails to find EGL/egl.h due to incorrect include path #12280

@theleopeople

Description

@theleopeople

hi guys, i fixed a bug: after generating the makefile and building with make the process would stop with this error:
fatal error: EGL/egl.h: No such file or directory
i noticed that the compiler was looking in the wrong path too (instead of src/video/khronos, include/SDL/SDL_egl.h
the same build works for me with SDL2.

how i fixed.
i added "include_directories(${CMAKE_SOURCE_DIR}/dependencies/SDL3/src/video/khronos)" before this paragraph in CMakeLists.txt:

Note: The clang toolset for Visual Studio does not support the '-idirafter' option.

if(USE_GCC OR USE_INTELCC OR (USE_CLANG AND NOT MSVC_CLANG))
sdl_compile_options(NO_EXPORT PRIVATE "$<BUILD_INTERFACE:-idirafter${SDL3_SOURCE_DIR}/src/video/khronos>")
else()
sdl_include_directories(NO_EXPORT SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/src/video/khronos>")
endif()

that obv works for me but you may fix this as it's best suitable for you.

SDL2 CMakeLists.txt same paragraph that worked for me was like this:

Note: The clang toolset for Visual Studio does not support the '-idirafter' option.

if(USE_GCC OR (USE_CLANG AND NOT MSVC_CLANG))

!!! FIXME: do we need to mess with CMAKE_C_FLAGS here?

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter "${SDL2_SOURCE_DIR}/src/video/khronos"")
else()
target_include_directories(sdl-build-options INTERFACE "${SDL2_SOURCE_DIR}/src/video/khronos")
endif()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions