Merge branch 'cmake-integration'
This commit is contained in:
commit
84c0c9c19c
15
.gitignore
vendored
15
.gitignore
vendored
@ -15,6 +15,7 @@
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
src/config.h
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
@ -53,3 +54,17 @@ modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# CMake files
|
||||
build/
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
47
CMakeLists.txt
Normal file
47
CMakeLists.txt
Normal file
@ -0,0 +1,47 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
# Written by JackCarterSmith, 2021
|
||||
# This code is released under the AST license.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_policy(VERSION 3.1)
|
||||
|
||||
# define project
|
||||
project(ast VERSION 1.0.0 DESCRIPTION "Arena Survival Tournament" LANGUAGES C)
|
||||
set(AST_NAME AST-${PROJECT_VERSION})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
# needed packages
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
include_directories(${SDL2_INCLUDE_DIR})
|
||||
|
||||
# define src/headers files
|
||||
|
||||
FILE(GLOB AST_SCRS src/*.c)
|
||||
FILE(GLOB AST_HRDS src/*.h)
|
||||
SOURCE_GROUP("Source Files" FILES ${AST_SCRS})
|
||||
SOURCE_GROUP("Header Files" FILES ${AST_HRDS})
|
||||
|
||||
# begin building ast
|
||||
|
||||
#set(CMAKE_BUILD_TYPE Debug)
|
||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_executable(ast ${AST_SCRS} ${AST_HRDS})
|
||||
#set_property(TARGET ast PROPERTY C_STANDARD 99)
|
||||
set_target_properties(ast PROPERTIES OUTPUT_NAME ${AST_NAME})
|
||||
if(MSVC)
|
||||
# msvc does not append 'lib' - do it here to have consistent name
|
||||
set_target_properties(ast PROPERTIES PREFIX "lib")
|
||||
set_target_properties(ast PROPERTIES IMPORT_PREFIX "lib")
|
||||
endif()
|
||||
target_link_libraries(ast ${SDL2_LIBRARIES})
|
||||
|
||||
# install executable
|
||||
|
||||
install(TARGETS ast
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
1
src/config.h.in
Normal file
1
src/config.h.in
Normal file
@ -0,0 +1 @@
|
||||
#define VERSION "@PROJECT_VERSION@"
|
Loading…
x
Reference in New Issue
Block a user