forked from CorsixTH/CorsixTH
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
96 lines (85 loc) · 3.06 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
# 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
# - WITH_LUAJIT : Whether to use LuaJIT 2 instead of Lua51 (default is LuaJIT 2)
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)
IF (MINGW)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
ENDIF(MINGW)
INCLUDE(CheckIncludeFiles)
SET(CORSIX_TH_DONE_TOP_LEVEL_CMAKE ON)
IF(APPLE)
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
SET(CMAKE_OSX_ARCHITECTURES x86_64)
ENDIF()
# Define our options
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(WITH_LUAJIT "Use LuaJIT instead of Lua" 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)
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)