/
CMakeLists.txt
126 lines (107 loc) · 3.98 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
# The Doomsday Engine Project -- Client
# Copyright (c) 2012-2015 Jaakko Keränen <jaakko.keranen@iki.fi>
# Copyright (c) 2012-2014 Daniel Swanson <danij@dengine.net>
cmake_minimum_required (VERSION 3.0)
project (DENG_CLIENT)
set (DENG_ENABLE_PK3S ON)
include (../../cmake/Config.cmake)
# Dependencies.
find_package (Qt5 COMPONENTS Gui OpenGL Widgets)
find_package (DengAppfw QUIET)
find_package (DengDoomsday QUIET)
find_package (Amethyst QUIET)
find_package (SDL2)
find_package (LZSS)
include (OpenGL)
if (WIN32)
find_package (DirectX)
endif ()
include_directories (include ${DENG_API_DIR})
add_definitions (-D__DOOMSDAY__ -D__CLIENT__)
file (GLOB API_HEADERS ../api/*.h)
file (GLOB_RECURSE HEADERS include/*)
file (GLOB_RECURSE SOURCES src/*.cpp src/*.c)
if (APPLE)
include_directories (include/macx)
list (APPEND HEADERS include/macx/MusicPlayer.h)
list (APPEND SOURCES src/macx/MusicPlayer.mm)
elseif (WIN32)
include_directories (include/windows)
else ()
include_directories (include/unix)
endif ()
if (AMETHYST_FOUND)
if (APPLE)
set (readme "${CMAKE_CURRENT_BINARY_DIR}/Read Me.rtf")
deng_add_amedoc (RTF ${readme} ${DENG_SOURCE_DIR}/doc/readme readme.ame)
install (FILES ${readme} DESTINATION .)
list (APPEND SOURCES ${readme})
else ()
# Plain text readme for other platforms.
set (readme "${CMAKE_CURRENT_BINARY_DIR}/readme.txt")
deng_add_amedoc (TXT ${readme} ${DENG_SOURCE_DIR}/doc/readme readme.ame)
list (APPEND SOURCES ${readme})
endif ()
# Manual page.
if (UNIX)
set (MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/doomsday.6)
deng_add_amedoc (MAN ${MAN_PAGE} ${DENG_SOURCE_DIR}/doc/readme readme.ame)
list (APPEND src ${MAN_PAGE})
endif ()
endif ()
deng_filter_platform_sources (src ${SOURCES} ${HEADERS} ${API_HEADERS})
deng_add_package (net.dengine.client)
# OS X: Packages and other resources to bundle with the application.
set (MACX_RESOURCES
res/macx/deng.icns
res/macx/English.lproj
doomsday.pk3
)
deng_add_application (client ${src} EXTRA_RESOURCES ${MACX_RESOURCES})
# There's some old code here so relax the warnings a bit.
relaxed_warnings (client)
# Libraries.
target_link_libraries (client PUBLIC Deng::libappfw Deng::libdoomsday lzss opengl)
if (APPLE)
link_framework (client PUBLIC Cocoa)
link_framework (client PUBLIC QTKit) # MusicPlayer
endif ()
if (TARGET SDL2)
target_link_libraries (client PUBLIC SDL2)
endif ()
if (TARGET SDL2_mixer)
target_link_libraries (client PUBLIC SDL2_mixer)
endif ()
if (TARGET DirectX)
target_link_libraries (client PUBLIC DirectX)
endif ()
# Deployment -----------------------------------------------------------------
if (WIN32 OR APPLE)
set_property (TARGET client PROPERTY OUTPUT_NAME "Doomsday")
set (MACOSX_BUNDLE_BUNDLE_EXECUTABLE "Doomsday")
set (MACOSX_BUNDLE_ICON_FILE "deng.icns")
else ()
set_property (TARGET client PROPERTY OUTPUT_NAME "doomsday")
endif ()
if (APPLE)
deng_install_bundle_deps (client
Deng::libcore Deng::libshell
Deng::libgui Deng::libappfw
Deng::liblegacy Deng::libdoomsday
SDL2 SDL2_mixer
)
set_target_properties (client PROPERTIES
INSTALL_RPATH "@executable_path/../Frameworks"
)
# Plugins are bundled inside the client app. We'll run macdeployqt on the
# installed app before the plugins are there so it won't do unnecessary
# work on them -- plugins are already self-contained.
get_property (outName TARGET client PROPERTY OUTPUT_NAME)
set (stageDir "${CMAKE_INSTALL_PREFIX}/${DENG_INSTALL_STAGING_DIR}/DengPlugins")
set (destDir "${CMAKE_INSTALL_PREFIX}/${outName}.app/Contents/DengPlugins")
install (CODE "execute_process (COMMAND ${CMAKE_COMMAND} -E remove_directory \"${destDir}\")")
deng_install_deployqt (client)
install (CODE "execute_process (COMMAND ${CMAKE_COMMAND} -E copy_directory \"${stageDir}\" \"${destDir}\")")
else ()
deng_install_deployqt (client)
endif ()