blob: 0cade19125eb1ee39d02cb4c57405f4983d6a69b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
cmake_minimum_required(VERSION 2.6)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
project(subconscious)
########################################################################
# Source Code
########################################################################
# Configuration headers
set(subconscious_VERSION_MAJOR 0)
set(subconscious_VERSION_MINOR 1)
configure_file(
"${PROJECT_SOURCE_DIR}/src/main/headers/config.h.in"
"${PROJECT_SOURCE_DIR}/src/main/headers/config.h"
)
# include directories
include_directories("${PROJECT_SOURCE_DIR}/src/main/headers")
# sources
file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "src/main/cpp/*.cpp")
########################################################################
# Binary
########################################################################
# executable
set(EXECUTABLE_NAME "subconscious")
add_executable(${EXECUTABLE_NAME} ${SOURCES})
# compiler settings
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
endif ()
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif ()
########################################################################
# Libraies / Dependencies
########################################################################
# SFML library
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2 REQUIRED network audio graphics window system)
if (SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
endif ()
# libtmx
add_subdirectory("lib/libtmx/src")
########################################################################
# CPack packaging
########################################################################
# install target
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
include(InstallRequiredSystemLibraries)
set(CMAKE_PACKAGE_NAME "subconcious")
set(CPACK_GENERATOR "DEB;ZIP;TGZ;STGZ")
# set(CPACK_RESOURCES_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_VERSION_MAJOR "${subconscious_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${subconscious_VERSION_MINOR}")
# debian package
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nao Pross <naopross@thearcway.org>")
set(CPACK_PACKAGE_DEBIAN_DESCRIPTION "RPG game")
include(CPack)
|