feat: Initial CMakeLists.txt setup for cross-platform C project
This commit is contained in:
parent
ecaaf1d652
commit
820813e24b
1 changed files with 9 additions and 30 deletions
|
|
@ -1,34 +1,13 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(openkknd C)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(OpenKND C VERSION 1.0)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
# Definiere die Source-Dateien (Du musst hier deine tatsächlichen C-Dateien anpassen!)
|
||||
set(SOURCE_FILES main.c include/ok_render.h)
|
||||
|
||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" OPENKKND_VERSION)
|
||||
string(STRIP "${OPENKKND_VERSION}" OPENKKND_VERSION)
|
||||
# Standard-Executable definieren
|
||||
add_executable(openkknd ${SOURCE_FILES})
|
||||
|
||||
add_executable(openkknd
|
||||
src/main.c
|
||||
src/game.c
|
||||
src/map.c
|
||||
src/unit.c
|
||||
src/render.c
|
||||
)
|
||||
# Hier werden später die Plattform-spezifischen Einstellungen eingebunden
|
||||
# include(packaging/cmake/linux.cmake) # Beispiel für zukünftige Einbindung
|
||||
|
||||
target_include_directories(openkknd PRIVATE include)
|
||||
target_compile_definitions(openkknd PRIVATE
|
||||
OPENKKND_VERSION="${OPENKKND_VERSION}"
|
||||
)
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
if(TARGET SDL2::SDL2)
|
||||
target_link_libraries(openkknd PRIVATE SDL2::SDL2)
|
||||
elseif(TARGET SDL2::SDL2-static)
|
||||
target_link_libraries(openkknd PRIVATE SDL2::SDL2-static)
|
||||
else()
|
||||
target_include_directories(openkknd PRIVATE ${SDL2_INCLUDE_DIRS})
|
||||
target_link_libraries(openkknd PRIVATE ${SDL2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
install(TARGETS openkknd RUNTIME DESTINATION bin)
|
||||
message(STATUS "Project setup complete. Ready for platform configuration.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue