New game project.

This commit is contained in:
King_DuckZ 2015-05-25 01:38:00 +02:00
parent ea71478948
commit 55ca7028b5
4 changed files with 59 additions and 0 deletions

View file

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_policy(SET CMP0040 NEW) #add_custom_command's target must exist
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -g -O0 -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -O3 -Wall -Wextra")
@ -18,3 +19,4 @@ include_directories(
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(game)

33
game/CMakeLists.txt Normal file
View file

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_policy(SET CMP0048 NEW) #to use VERSION in project()
project(game VERSION 0.1.0 LANGUAGES CXX)
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
pkg_search_module(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.h"
)
include_directories(
.
"${CMAKE_CURRENT_BINARY_DIR}"
${SDL2_INCLUDE_DIR}
)
add_executable(${PROJECT_NAME}
main.cpp
)
target_link_libraries(${PROJECT_NAME}
doorkeeper
${SDL2_LIBRARIES}
${SDL2IMAGE_LIBRARIES}
)
#add_custom_command(
# TARGET game POST_BUILD
# COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/game game
#)

9
game/gameConfig.h.in Normal file
View file

@ -0,0 +1,9 @@
#ifndef idCEA37B5347F14CCF96AFC7ED83C9DE4F
#define idCEA37B5347F14CCF96AFC7ED83C9DE4F
#define GAME_NAME "@PROJECT_NAME@"
#define GAME_VER_MAJOR @PROJECT_VERSION_MAJOR@
#define GAME_VER_MINOR @PROJECT_VERSION_MINOR@
#define GAME_VER_PATCH @PROJECT_VERSION_PATCH@
#endif

15
game/main.cpp Normal file
View file

@ -0,0 +1,15 @@
#include "doorkeeper/doorkeeper2d.hpp"
#include "gameConfig.h"
#include <iostream>
int main() {
using dk::Tyler2d;
using dk::coords2;
using dk::Viewport2d;
using dk::Layer2d;
std::cout << "Welcome to " GAME_NAME " v" << GAME_VER_MAJOR << '.' << GAME_VER_MINOR << '.' << GAME_VER_PATCH << '\n';
Tyler2d tiler(coords2(64, 33));
return 0;
}