From ee0dc7edc8dd35e6e666a65d3a8f185bf08a74a2 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 18 Feb 2026 20:02:46 +0100 Subject: refactor: extract SDL2 bindings build configuration --- CMakeLists.txt | 16 ++-------------- libs/CMakeLists.txt | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 libs/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index d8f7928..9e2baef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,18 +6,7 @@ project("snake.s" LANGUAGES ASM ) -find_package("SDL2" REQUIRED) - -add_library("SDL2_bindings" INTERFACE - "libs/SDL.S" - "libs/SDL/init.S" - "libs/SDL/render.S" - "libs/SDL/video.S" -) - -target_include_directories("SDL2_bindings" INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/libs" -) +add_subdirectory("libs") add_executable("snake.s" "src/error.S" @@ -25,8 +14,7 @@ add_executable("snake.s" ) target_link_libraries("snake.s" PRIVATE - "SDL2::SDL2" - "SDL2_bindings" + "bindings::SDL2" ) install(TARGETS "snake.s") diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt new file mode 100644 index 0000000..9c1ac14 --- /dev/null +++ b/libs/CMakeLists.txt @@ -0,0 +1,22 @@ +find_package("SDL2" REQUIRED) + +add_library("bindings_SDL2" INTERFACE + "SDL.S" + + "SDL/error.S" + "SDL/events.S" + "SDL/init.S" + "SDL/rect.S" + "SDL/render.S" + "SDL/video.S" +) + +target_include_directories("bindings_SDL2" INTERFACE + "${CMAKE_CURRENT_SOURCE_DIR}" +) + +target_link_libraries("bindings_SDL2" INTERFACE + "SDL2::SDL2" +) + +add_library("bindings::SDL2" ALIAS "bindings_SDL2") \ No newline at end of file -- cgit v1.2.3