-
Notifications
You must be signed in to change notification settings - Fork 44
/
CMakeLists.txt
112 lines (91 loc) · 3.79 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
################################################################
# Project M.A.R.S.
################################################################
PROJECT(MARS)
# version number
set(mars_MAJOR 0)
set(mars_MINOR 7)
set(mars_PATCH 5)
set(mars_VERSION ${mars_MAJOR}.${mars_MINOR}.${mars_PATCH})
set(mars_DESCRIPTION "M.A.R.S. - a ridiculous Shooter")
set(mars_HOMEPAGE "http://www.marsshooter.org")
set(mars_EXENAME "marsshooter")
set(mars_PACKAGENAME "mars")
# We require at least version 3.7.2
cmake_minimum_required(VERSION 3.7.2)
#####################################################################
# Installation directories
#####################################################################
include(GNUInstallDirs)
set(mars_DATA_DEST_DIR ${CMAKE_INSTALL_FULL_DATAROOTDIR}/games/marsshooter CACHE STRING "marsshooter data files destdir")
set(mars_EXE_DEST_DIR ${CMAKE_INSTALL_PREFIX}/games CACHE STRING "marsshooter exe destdir")
#####################################################################
# Configure and find libraries
#####################################################################
# find OpenGL headers and library
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
# find the sfml2 headers and library
find_package(SFML REQUIRED audio graphics)
# Foundation library needed for apple
if(APPLE)
find_library(FOUNDATION_LIBRARY Foundation)
endif(APPLE)
# Xrandr library needed for unix
# if(UNIX)
# find_library(XRANDR_LIBRARY Xrandr)
# endif(UNIX)
# tag library needed for reading tags of music files
find_library(TAG_LIBRARY tag)
# Fribidi library needed for bi-directional texts
find_library(FRIBIDI_LIBRARY fribidi)
# set the executable output path
if(APPLE)
set(EXECUTABLE_OUTPUT_PATH ${MARS_BINARY_DIR})
else(APPLE)
set(EXECUTABLE_OUTPUT_PATH ${MARS_SOURCE_DIR})
endif(APPLE)
# include the 'include' directory
include_directories(${MARS_SOURCE_DIR}/include)
#####################################################################
# Create executable
#####################################################################
# compile source
add_subdirectory(src)
set(CMAKE_CXX_FLAGS "-s" CACHE STRING "CXX flags")
#####################################################################
# Create package
#####################################################################
# CPack version numbers for release tarball name.
set(CPACK_PACKAGE_VERSION_MAJOR ${mars_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${mars_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${mars_PATCH})
# To Create a package, one can run "cpack -G DragNDrop CPackConfig.cmake" on Mac OS X
# where CPackConfig.cmake is created by including CPack
# And then there's ways to customize this as well
set(CPACK_DMG_VOLUME_NAME "mars")
set(CPACK_BINARY_DRAGNDROP ON)
include(CPack)
################################################################
# Summary
################################################################
message( "" )
message( "Summary:" )
message( " CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" )
message( " WIN32 = ${WIN32}" )
message( " UNIX = ${UNIX}" )
message( " APPLE = ${APPLE}" )
message( " CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
message( " CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
message( " CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}" )
message( " CMAKE_OSX_SYSROOT = ${CMAKE_OSX_SYSROOT}" )
message( " CMAKE_OSX_DEPLOYMENT_TARGET = ${CMAKE_OSX_DEPLOYMENT_TARGET}" )
message( " CMAKE_GENERATOR = ${CMAKE_GENERATOR}" )
message( " SFML_INCLUDE_DIR = ${SFML_INCLUDE_DIR}" )
message( " SFML_LIBRARIES = ${SFML_LIBRARIES}" )
message( " OPENGL_INCLUDE_DIR = ${OPENGL_INCLUDE_DIR}" )
message( " OPENGL_LIBRARIES = ${OPENGL_LIBRARIES}" )
message( " XRANDR_LIBRARY = ${XRANDR_LIBRARY}" )
message( " FRIBIDI_LIBRARY = ${FRIBIDI_LIBRARY}" )
message( " TAG_LIBRARY = ${TAG_LIBRARY}" )
message( "" )