-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
CMakeLists.txt
92 lines (78 loc) · 3.03 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
#
#============================================================================
#
# DOOM Retro
# The classic, refined DOOM source port. For Windows PC.
#
#============================================================================
#
# Copyright © 1993-2024 by id Software LLC, a ZeniMax Media company.
# Copyright © 2013-2024 by Brad Harding <mailto:[email protected]>.
#
# This file is a part of DOOM Retro.
#
# DOOM Retro is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the license, or (at your
# option) any later version.
#
# DOOM Retro is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DOOM Retro. If not, see <https://www.gnu.org/licenses/>.
#
# DOOM is a registered trademark of id Software LLC, a ZeniMax Media
# company, in the US and/or other countries, and is used without
# permission. All other trademarks are the property of their respective
# holders. DOOM Retro is in no way affiliated with nor endorsed by
# id Software.
#
#============================================================================
#
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(doomretro C)
INCLUDE(GNUInstallDirs)
FILE(GLOB_RECURSE SOURCES ${CMAKE_SOURCE_DIR}/src/*.c)
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
ENDIF()
IF (APPLE)
ADD_DEFINITIONS(-D__APPLE__=1)
SET(OBJECTIVE_C_FILES
${CMAKE_SOURCE_DIR}/src/d_main.c
${CMAKE_SOURCE_DIR}/src/m_misc.c)
SET_SOURCE_FILES_PROPERTIES(${OBJECTIVE_C_FILES} COMPILE_FLAGS "-x objective-c")
ENDIF()
ADD_EXECUTABLE(doomretro ${SOURCES})
SET_TARGET_PROPERTIES(doomretro PROPERTIES LINKER_LANGUAGE C)
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2_MIXER REQUIRED SDL2_mixer)
PKG_SEARCH_MODULE(SDL2_IMAGE REQUIRED SDL2_image)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src ${SDL2_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS})
IF (APPLE)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
ENDIF()
IF (UNIX)
INCLUDE(CheckCCompilerFlag)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
CHECK_C_COMPILER_FLAG("-Wno-deprecated-non-prototype" HAS_NON_PROTO_FLAG)
IF (HAS_NON_PROTO_FLAG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype")
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(
doomretro
${SDL2_LINK_LIBRARIES}
${SDL2_MIXER_LINK_LIBRARIES}
${SDL2_IMAGE_LINK_LIBRARIES}
${COCOA_LIBRARY}
m
)
FILE(GLOB RESOURCES LIST_DIRECTORIES false ${CMAKE_SOURCE_DIR}/res/*)
FILE(COPY ${RESOURCES} DESTINATION ${CMAKE_BINARY_DIR})
INSTALL(TARGETS doomretro DESTINATION ${CMAKE_INSTALL_BINDIR})
INSTALL(FILES ${RESOURCES} DESTINATION ${CMAKE_INSTALL_DATADIR}/doomretro)