mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.74k stars 439 forks source link

magnum example code can't find SDL2 file #598

Closed strattonbrazil closed 1 year ago

strattonbrazil commented 1 year ago

I'm trying to build the box2d example from the website and encountering an error in one of the early includes:

#include <Magnum/Platform/Sdl2Application.h>

which complains about not finding "SDL_keycode.h", which is present on my system with the other SDL2 files. I'm wondering if this is just a problem with my CMake configuration:

cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
project(example)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})

find_package(Magnum REQUIRED Sdl2Application) 

Do I need to do anything else to pull in the relevant SDL2 files?

mosra commented 1 year ago

Hi,

can you post the full error message here, including the compiler command line used if possible, and the CMakeCache.txt file from the build dir?

The include/SDL2 (or equivalent) directory, which contains SDL_keycode.h and others, should be on the compiler include path. The path is supplied either from the SDL2_INCLUDE_DIR CMake variable (which should be autodetected), or from SDL's own CMake config files. There's unfortunately many possible cases of how SDL gets found, and then unfortunately also many possible variants of how built/installed SDL is organized, so I'm not able to suggest a solution until I know more details.

mosra commented 1 year ago

Closing due to lack of activity.