build: CMake and public headers
This commit is contained in:
parent
1455cf7ac9
commit
87d99f7007
6 changed files with 107 additions and 0 deletions
34
CMakeLists.txt
Normal file
34
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(openkknd C)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
|
||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" OPENKKND_VERSION)
|
||||
string(STRIP "${OPENKKND_VERSION}" OPENKKND_VERSION)
|
||||
|
||||
add_executable(openkknd
|
||||
src/main.c
|
||||
src/game.c
|
||||
src/map.c
|
||||
src/unit.c
|
||||
src/render.c
|
||||
)
|
||||
|
||||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue