From dfbfe66a1535a9cf6df6317c704b0266c78a1752 Mon Sep 17 00:00:00 2001 From: Vincent Yang Date: Wed, 14 Jan 2026 17:38:44 +0800 Subject: [PATCH] Replaced build system with cmake --- .gitignore | 5 +++++ CMakeLists.txt | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 66c7095..2b6204a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ build/ .vscode/ +.idea/ +*.class +*.jar +*.pyc +__pycache__/ *.o *.exe *.out diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0f22450 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +# Specify the minimum required version of CMake +cmake_minimum_required(VERSION 3.14) + +# Specify the C++ standard to use +set(CMAKE_C_STANDARD 17) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_COMPILER gcc) + +# Define the project name and enable C language +project(starinvaders LANGUAGES C CXX) + +# Find all source files in the "src" directory +file(GLOB SOURCES "src/*.c") + +# Find zlib and sdl2 +find_package(ZLIB REQUIRED) +find_package(SDL2 CONFIG REQUIRED) + +# Add an executable target named "starinvaders" from the source files in the "src" directory +add_executable(starinvaders ${SOURCES}) +target_link_libraries(starinvaders PRIVATE ZLIB::ZLIB) +target_link_libraries(starinvaders PRIVATE SDL2::SDL2) \ No newline at end of file