forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
89 lines (73 loc) · 2.78 KB
/
CMakeLists.txt
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# WARNING: Only linux is currently supported by this cmake build file.
# This file is used to build cataclysm with CMake.
#
# To use it, install cmake, then:
#
# cd cataclysm
# mkdir build
# cd build
# cmake -G "Unix Makefiles" -DLOCALIZE=ON -DSDL=OFF ..
# make
#
# This will build and install cataclysm into the build directory.
#
# "Unix Makefiles" is a generator, you can get a list of supported generators
# on your system by running "cmake" without any arguments.
#
# -DOPTION_NAME=ON/OFF enables/disables OPTION_NAME
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
PROJECT(CataclysmDDA)
OPTION(LOCALIZE "Toggle gettext localization/translation." ON)
OPTION(SDL "Use SDL curses emulation instead of terminal support." OFF)
OPTION(TILES "Enable tileset support." OFF)
# Note: The CMake documentation says it's better to list the actual source
# files here, as otherwise cmake won't know to rerun when a new file
# is added. However, currently the Makefile also just scans for source
# files, so this approach should be "good enough".
FILE(GLOB CataclysmDDA_SRCS *.cpp)
FILE(GLOB CataclysmDDA_HDRS *.h)
ADD_EXECUTABLE(cataclysm ${CataclysmDDA_SRCS} ${CataclysmDDA_HDRS})
# Custom command that will be executed whenever the "cataclysm" target is built.
# Copy all the relevant game data into the build directory.
ADD_CUSTOM_COMMAND(
TARGET cataclysm PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data $<TARGET_FILE_DIR:cataclysm>/data
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/LICENSE.txt $<TARGET_FILE_DIR:cataclysm> # Don't forget the license :)
)
IF(MINGW)
add_definitions("-D_WINDOWS -D_MINGW -D_WIN32 -DWIN32 -D__MINGW__")
ENDIF()
IF(LOCALIZE)
add_definitions(-DLOCALIZE)
#TARGET_LINK_LIBRARIES(cataclysm
# intl
#)
ENDIF()
# TODO: windows rc stuff
IF(SDL OR TILES)
# CMake ships with a few helpful include's to find common libraries
# like SDL
Include(FindSDL)
Include(FindSDL_ttf)
Find_Package(SDL REQUIRED)
Find_Package(SDL_ttf REQUIRED)
TARGET_LINK_LIBRARIES(cataclysm ${SDL_LIBRARY} ${SDLTTF_LIBRARY})
IF(TILES)
# Install GFX directory
ADD_CUSTOM_COMMAND(
TARGET cataclysm PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/gfx $<TARGET_FILE_DIR:cataclysm>/gfx
)
Include(FindSDL_image)
TARGET_LINK_LIBRARIES(cataclysm ${SDLIMAGE_LIBRARY})
ADD_DEFINITIONS(-DSDLTILES -DTILES)
ELSE()
ADD_DEFINITIONS(-DTILES)
ENDIF()
ELSEIF(MSVC OR MINGW)
# On windows our default isn't curses, but rather GDI
TARGET_LINK_LIBRARIES(cataclysm gdi32 intl iconv winmm)
add_definitions(-Wl,-stack,12000000,-subsystem,windows)
ELSE()
TARGET_LINK_LIBRARIES(cataclysm curses)
ENDIF()