forked from CorsixTH/CorsixTH
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
126 lines (112 loc) · 3.86 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Cmake File for CorsixTH
# OPTIONS AVAILABLE:
# At most, one of the following:
# - WITH_SDL : Activate SDL Renderer (default)
# - WITH_OPENGL : Activate OpenGL Renderer
# - WITH_DIRECTX : Activate DirectX Renderer (Windows only)
# Any of the following:
# - WITH_AUDIO : Activate Sound (enabled by default)
# - WITH_FREETYPE2
# - WITH_MOVIES : Activate movies (requires Sound)
# - BUILD_ANIMVIEWER
# - BUILD_MAPEDITOR
PROJECT(CorsixTH_Top_Level)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
IF(MSVC)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL" CACHE STRING "Linker flags for release" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/INCREMENTAL" CACHE STRING "Linker flags for minsizerel" FORCE)
ENDIF(MSVC)
INCLUDE(CheckIncludeFiles)
SET(CORSIX_TH_DONE_TOP_LEVEL_CMAKE ON)
IF (APPLE)
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
ENDIF()
# Define our options
OPTION(WITH_OPENGL "Activate OpenGL Renderer" OFF)
OPTION(WITH_DIRECTX "Activate DirectX Renderer" OFF)
OPTION(WITH_SDL "Activate SDL Renderer" ON) # our default option
OPTION(WITH_AUDIO "Activate Sound" ON) # enabled by default
OPTION(WITH_MOVIES "Activate in game movies" ON)
OPTION(WITH_FREETYPE2 "Enhanced Font Support" ON)
OPTION(BUILD_ANIMVIEWER "Build the animation viewer as part of the build process" OFF)
OPTION(BUILD_MAPEDITOR "Build the map editor as part of the build process" OFF)
# Option handling
IF(WITH_OPENGL)
SET(CORSIX_TH_USE_DX9_RENDERER OFF)
SET(CORSIX_TH_USE_SDL_RENDERER OFF)
SET(CORSIX_TH_USE_OGL_RENDERER ON)
MESSAGE("Note: Using OpenGL as renderer")
ENDIF(WITH_OPENGL)
IF(WITH_DIRECTX)
# DirectX will only work with win32. If we're not win32, we use OpenGL instead
IF(WIN32)
SET(CORSIX_TH_USE_DX9_RENDERER ON)
SET(CORSIX_TH_USE_SDL_RENDERER OFF)
SET(CORSIX_TH_USE_OGL_RENDERER OFF)
MESSAGE("Note: Using DirectX as renderer")
ELSE()
SET(CORSIX_TH_USE_DX9_RENDERER OFF)
SET(CORSIX_TH_USE_SDL_RENDERER OFF)
SET(CORSIX_TH_USE_OGL_RENDERER ON)
MESSAGE("Note: Cannot use DirectX due to OS, using OpenGL instead")
ENDIF(WIN32)
ENDIF(WITH_DIRECTX)
IF(NOT WITH_OPENGL)
IF(NOT WITH_DIRECTX)
IF(WITH_SDL)
SET(CORSIX_TH_USE_DX9_RENDERER OFF)
SET(CORSIX_TH_USE_SDL_RENDERER ON)
SET(CORSIX_TH_USE_OGL_RENDERER OFF)
MESSAGE("Note: Using SDL as renderer (default)")
ENDIF(WITH_SDL)
ENDIF(NOT WITH_DIRECTX)
ENDIF(NOT WITH_OPENGL)
IF(WITH_AUDIO)
SET(CORSIX_TH_USE_SDL_MIXER ON)
MESSAGE("Note: SDL audio is enabled (default)")
ELSE()
SET(CORSIX_TH_USE_SDL_MIXER OFF)
MESSAGE("Note: SDL audio is disabled")
ENDIF(WITH_AUDIO)
IF(WITH_MOVIES)
IF(WITH_AUDIO)
SET(CORSIX_TH_USE_FFMPEG ON)
MESSAGE("Note: FFMPEG video is enabled (default)")
ELSE()
SET(CORSIX_TH_USE_FFMPEG OFF)
MESSAGE("Note: FFMPEG video disabled since it requires SDL audio.")
ENDIF(WITH_AUDIO)
ELSE()
SET(CORSIX_TH_USE_FFMPEG OFF)
MESSAGE("Note: FFMPEG video is disabled")
ENDIF(WITH_MOVIES)
IF(WITH_FREETYPE2)
SET(CORSIX_TH_USE_FREETYPE2 ON)
MESSAGE("Note: FreeType2 is enabled (default)")
ELSE()
SET(CORSIX_TH_USE_FREETYPE2 OFF)
MESSAGE("Note: FreeType2 is disabled")
ENDIF(WITH_FREETYPE2)
# Environment handling
CHECK_INCLUDE_FILES(stdint.h CORSIX_TH_HAS_STDINT_H)
CHECK_INCLUDE_FILES(malloc.h CORSIX_TH_HAS_MALLOC_H)
CHECK_INCLUDE_FILES(alloca.h CORSIX_TH_HAS_ALLOCA_H)
CHECK_INCLUDE_FILES(inttypes.h CORSIX_TH_HAS_INTTYPES_H)
# Include individual projects
message("")
# We always build CorsixTH otherwise we would miss the generated header
message("Building CorsixTH")
add_subdirectory(CorsixTH)
IF(BUILD_ANIMVIEWER)
message("Building AnimView")
add_subdirectory(AnimView)
ENDIF(BUILD_ANIMVIEWER)
IF(BUILD_MAPEDITOR)
IF(WITH_OPENGL)
message("Building MapEdit")
add_subdirectory(MapEdit)
ELSE(WITH_OPENGL)
message(FATAL_ERROR "The map editor can only be built when using OpenGL as renderer")
ENDIF(WITH_OPENGL)
ENDIF(BUILD_MAPEDITOR)