Merge branch 'cmake-integration'
This commit is contained in:
commit
3d44598376
@ -2,27 +2,19 @@
|
|||||||
|
|
||||||
# Written by JackCarterSmith, 2021
|
# Written by JackCarterSmith, 2021
|
||||||
# This code is released under the AST license.
|
# This code is released under the AST license.
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.5.1)
|
||||||
cmake_policy(VERSION 3.1)
|
|
||||||
|
|
||||||
# define project
|
# define project
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
|
||||||
project(AST VERSION 1.0.0 DESCRIPTION "Arena Survival Tournament" LANGUAGES C)
|
project(AST VERSION 1.0.0 DESCRIPTION "Arena Survival Tournament" LANGUAGES C)
|
||||||
set(AST_NAME AST-${PROJECT_VERSION})
|
set(AST_NAME AST-${PROJECT_VERSION})
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
|
||||||
|
|
||||||
|
include(FindPkgConfig)
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
# needed packages
|
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED)
|
|
||||||
include_directories(${SDL2_INCLUDE_DIR})
|
|
||||||
find_package(SDL2_image REQUIRED)
|
|
||||||
include_directories(${SDL2_IMAGE_INCLUDE_DIR})
|
|
||||||
|
|
||||||
# define src/headers files
|
# define src/headers files
|
||||||
|
|
||||||
FILE(GLOB AST_SCRS src/*.c)
|
FILE(GLOB AST_SCRS src/*.c)
|
||||||
@ -42,7 +34,15 @@ if(MSVC)
|
|||||||
set_target_properties(AST PROPERTIES PREFIX "lib")
|
set_target_properties(AST PROPERTIES PREFIX "lib")
|
||||||
set_target_properties(AST PROPERTIES IMPORT_PREFIX "lib")
|
set_target_properties(AST PROPERTIES IMPORT_PREFIX "lib")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(AST ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES})
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||||
|
|
||||||
|
# Find SDL2, SDL2_image and SDL2_gfx libraries
|
||||||
|
find_package(SDL2 REQUIRED)
|
||||||
|
find_package(SDL2_image REQUIRED)
|
||||||
|
|
||||||
|
# Link SDL2::Main, SDL2::Image and SDL2::GFX to our project
|
||||||
|
target_link_libraries(${PROJECT_NAME} SDL2::Main SDL2::Image)
|
||||||
|
|
||||||
# install executable
|
# install executable
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "arenaEngine.h"
|
#include "arenaEngine.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#ifndef IAENGINE_H_
|
#ifndef IAENGINE_H_
|
||||||
#define IAENGINE_H_
|
#define IAENGINE_H_
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL2/SDL_image.h>
|
#include <SDL_image.h>
|
||||||
#include "fileHandler.h"
|
#include "fileHandler.h"
|
||||||
#include "logHelper.h"
|
#include "logHelper.h"
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#include "arenaEngine.h"
|
#include "arenaEngine.h"
|
||||||
#include "logHelper.h"
|
#include "logHelper.h"
|
||||||
#include "IAEngine.h"
|
#include "IAEngine.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL2/SDL_image.h>
|
#include <SDL_image.h>
|
||||||
//#include <SDL2/SDL_ttf.h>
|
//#include <SDL2/SDL_ttf.h>
|
||||||
|
|
||||||
#ifndef ARENAGUI_H_
|
#ifndef ARENAGUI_H_
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "SDL2/SDL.h"
|
|
||||||
#include "SDL2/SDL_image.h"
|
|
||||||
|
|
||||||
#include "fileHandler.h"
|
#include "fileHandler.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <SDL_image.h>
|
||||||
|
|
||||||
#ifndef FILEHANDLER_H_
|
#ifndef FILEHANDLER_H_
|
||||||
#define FILEHANDLER_H_
|
#define FILEHANDLER_H_
|
||||||
|
10
src/main.c
10
src/main.c
@ -3,11 +3,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "logHelper.h"
|
#include "logHelper.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL2/SDL_image.h>
|
#include <SDL_image.h>
|
||||||
//#include <SDL2/SDL_ttf.h>
|
//#include <SDL_ttf.h>
|
||||||
//#include <SDL2/SDL_thread.h>
|
//#include <SDL_thread.h>
|
||||||
//#include <SDL2/SDL_mutex.h>
|
//#include <SDL_mutex.h>
|
||||||
#include "arenaEngine.h"
|
#include "arenaEngine.h"
|
||||||
#include "arenaGUI.h"
|
#include "arenaGUI.h"
|
||||||
#include "IAEngine.h"
|
#include "IAEngine.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <SDL2/SDL.h>
|
#include "menuGUI.h"
|
||||||
|
|
||||||
int createGameMenuWindows() {
|
int createGameMenuWindows() {
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
#ifndef MENUGUI_H_
|
#ifndef MENUGUI_H_
|
||||||
#define MENUGUI_H_
|
#define MENUGUI_H_
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user