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)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(openkknd C)
|
project(OpenKND C VERSION 1.0)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
# Definiere die Source-Dateien (Du musst hier deine tatsächlichen C-Dateien anpassen!)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(SOURCE_FILES main.c include/ok_render.h)
|
||||||
set(CMAKE_C_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" OPENKKND_VERSION)
|
# Standard-Executable definieren
|
||||||
string(STRIP "${OPENKKND_VERSION}" OPENKKND_VERSION)
|
add_executable(openkknd ${SOURCE_FILES})
|
||||||
|
|
||||||
add_executable(openkknd
|
# Hier werden später die Plattform-spezifischen Einstellungen eingebunden
|
||||||
src/main.c
|
# include(packaging/cmake/linux.cmake) # Beispiel für zukünftige Einbindung
|
||||||
src/game.c
|
|
||||||
src/map.c
|
|
||||||
src/unit.c
|
|
||||||
src/render.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(openkknd PRIVATE include)
|
message(STATUS "Project setup complete. Ready for platform configuration.")
|
||||||
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)
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue