Skip to content

Commit 68d2915

Browse files
committed
ci: set up SDL3 dependency
1 parent 87aa066 commit 68d2915

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: libsdl-org/setup-sdl@main
5151
with:
5252
cmake-generator: Ninja
53-
version: 2-head
53+
version: 3-head
5454
sdl-test: true
5555
shell: ${{ matrix.platform.shell }}
5656
add-to-environment: true

cmake/test/CMakeLists.txt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,18 @@ add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
1818

1919
if(TEST_SHARED)
2020
# FIXME: in the distant future, must become REQUIRED
21-
find_package(SDL2 CONFIG COMPONENTS SDL2)
22-
# FIXME: and the following should be removed
23-
if(NOT TARGET SDL2::SDL2)
24-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
25-
include(PrivateSdlFunctions)
26-
sdl_find_sdl2(SDL2::SDL2 2.0)
27-
endif()
21+
find_package(SDL3 CONFIG REQUIRED COMPONENTS SDL3)
2822
find_package(SDL2_net REQUIRED CONFIG)
2923
add_executable(main_shared main.c)
30-
target_link_libraries(main_shared PRIVATE SDL2::SDL2 SDL2_net::SDL2_net)
24+
target_link_libraries(main_shared PRIVATE SDL3::SDL3 SDL2_net::SDL2_net)
3125
endif()
3226

3327
if(TEST_STATIC)
3428
# FIXME: in the distant future, must become REQUIRED
35-
find_package(SDL2 CONFIG COMPONENTS SDL2-static)
36-
# FIXME: and the following should be removed
37-
if(NOT TARGET SDL2::SDL2-static)
38-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
39-
include(PrivateSdlFunctions)
40-
sdl_find_sdl2(SDL2::SDL2-static 2.0)
41-
endif()
29+
find_package(SDL3 CONFIG REQUIRED COMPONENTS SDL3-static)
4230
find_package(SDL2_net REQUIRED CONFIG)
4331
add_executable(main_static main.c)
44-
target_link_libraries(main_static PRIVATE SDL2::SDL2-static SDL2_net::SDL2_net-static)
32+
target_link_libraries(main_static PRIVATE SDL3::SDL3-static SDL2_net::SDL2_net-static)
4533
endif()
4634

4735
feature_summary(WHAT ALL)

cmake/test/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#define SDL_MAIN_HANDLED
2-
#include "SDL.h"
2+
#include <SDL3/SDL.h>
3+
#include <SDL3/SDL_main.h>
34
#include "SDL_net.h"
45
#include <stdio.h>
56

67
int main(int argc, char *argv[]) {
78
SDL_SetMainReady();
8-
if (SDL_Init(0) < 0) {
9+
if (!SDL_Init(0)) {
910
fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
1011
return 1;
1112
}

0 commit comments

Comments
 (0)