set(ARCHEUS_SDL3_WINDOW_SOURCES packages/graphics/sdl3/config.c packages/graphics/sdl3/window.c packages/graphics/sdl3/renderer.c ) set(ARCHEUS_SDL3_INPUT_SOURCES packages/input/sdl3/input.c packages/input/sdl3/keyboard.c packages/input/sdl3/mouse.c #TODO: remove this packages/audio/sdl3/config.c ) set(ARCHEUS_SDL3_GRAPHICS_SOURCES packages/graphics/sdl3/circle.c packages/graphics/sdl3/config.c packages/graphics/sdl3/line.c packages/graphics/sdl3/obround.c packages/graphics/sdl3/rectangle.c packages/graphics/sdl3/sprite.c packages/graphics/sdl3/spritesheet.c packages/graphics/sdl3/text.c ) function(sdl3_check_and_init_needed _ARCHEUS_SOURCES _ARCHEUS_INCLUDE_DIRECTORIES _ARCHEUS_LINK_LIBRARIES ARCHEUS_WINDOW_BACKEND ARCHEUS_INPUT_BACKEND ARCHEUS_GRAPHICS_BACKEND) #if no backend uses sdl return if(NOT ${ARCHEUS_WINDOW_BACKEND} STREQUAL "SDL3" AND NOT ${ARCHEUS_INPUT_BACKEND} STREQUAL "SDL3" AND NOT ${ARCHEUS_GRAPHICS_BACKEND} STREQUAL "SDL3") return() endif() #get needed libraries for backends find_package(SDL3 REQUIRED) #add to include directories list(APPEND ${_ARCHEUS_INCLUDE_DIRECTORIES} PRIVATE ${SDL3_INCLUDE_DIRS} ) #add to link libraries list(APPEND ${_ARCHEUS_LINK_LIBRARIES} PUBLIC ${SDL3_LIBRARIES} ) #add matching files for the selected backends if(${ARCHEUS_WINDOW_BACKEND} STREQUAL "SDL3") list(APPEND ${_ARCHEUS_SOURCES} ${ARCHEUS_SDL3_WINDOW_SOURCES}) endif() if(${ARCHEUS_INPUT_BACKEND} STREQUAL "SDL3") #TODO: remove this find_package(SDL3_mixer REQUIRED) list(APPEND ${_ARCHEUS_SOURCES} ${ARCHEUS_SDL3_INPUT_SOURCES}) #TODO: remove this list(APPEND ${_ARCHEUS_LINK_LIBRARIES} PUBLIC SDL3_mixer::SDL3_mixer ) endif() if(${ARCHEUS_GRAPHICS_BACKEND} STREQUAL "SDL3") find_package(SDL3_image REQUIRED) find_package(SDL3_ttf REQUIRED) #find_package(PkgConfig REQUIRED) #pkg_check_modules(SDL3_GFX REQUIRED SDL3_gfx) list(APPEND ${_ARCHEUS_SOURCES} ${ARCHEUS_SDL3_GRAPHICS_SOURCES}) #add to include directories list(APPEND ${_ARCHEUS_INCLUDE_DIRECTORIES} PRIVATE ${SDL3IMAGE_INCLUDE_DIRS} #PRIVATE ${SDL3_GFX_INCLUDE_DIRS} ) #add to link libraries list(APPEND ${_ARCHEUS_LINK_LIBRARIES} PUBLIC SDL3_image::SDL3_image PUBLIC SDL3_ttf::SDL3_ttf #PUBLIC ${SDL3_GFX_LIBRARIES} ) endif() set(${_ARCHEUS_SOURCES} ${${_ARCHEUS_SOURCES}} PARENT_SCOPE) set(${_ARCHEUS_INCLUDE_DIRECTORIES} ${${_ARCHEUS_INCLUDE_DIRECTORIES}} PARENT_SCOPE) set(${_ARCHEUS_LINK_LIBRARIES} ${${_ARCHEUS_LINK_LIBRARIES}} PARENT_SCOPE) endfunction()