forked from sourcehold/Sourcehold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
111 lines (92 loc) · 2.97 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
cmake_minimum_required(VERSION 3.2)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
# Project
project(Stronghold)
set(Stronghold_VERSION, 0.1.0)
include_directories(src)
# Thirdparty
include_directories(thirdparty/cxxopts/include/)
# Find pthread
find_package (Threads)
# Find SDL2
find_package(SDL2 REQUIRED)
if(NOT SDL2_FOUND)
message(FATAL_ERROR "SDL2 has to be installed!")
endif(NOT SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
# Find OpenAL
find_package(OpenAL REQUIRED)
if(NOT OPENAL_FOUND)
message(FATAL_ERROR "OpenAL has to be installed!")
endif(NOT OPENAL_FOUND)
include_directories(${OPENAL_INCLUDE_DIR})
# Find FFMPEG
find_package(FFmpeg REQUIRED)
if(FFMPEG_FOUND)
include_directories(${FFMPEG_INCLUDE_DIRS})
if(NOT SWSCALE_FOUND)
message(FATAL_ERROR "libswscale has to be installed (provided by FFmpeg)!")
else()
include_directories(${SWSCALE_INCLUDE_DIRS})
endif()
else(FFMPEG_FOUND)
message(FATAL_ERROR "FFMPEG has to be installed!")
endif(FFMPEG_FOUND)
# Find swresample
find_package(Libswresample REQUIRED)
if(NOT LIBSWRESAMPLE_FOUND)
message(FATAL_ERROR "libswresample has to be installed (provided by FFmpeg)!")
else(NOT LIBSWRESAMPLE_FOUND)
include_directories( ${LIBSWRESAMPLE_INCLUDE_DIRS})
endif(NOT LIBSWRESAMPLE_FOUND)
# Find boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
find_package(Boost 1.45.0 COMPONENTS filesystem)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else(Boost_FOUND)
message(FATAL_ERROR "the following boost components need to be installed: fileystem")
endif(Boost_FOUND)
# Include sources
file(GLOB_RECURSE SOURCES src/*.cpp)
# Fixes legacy stuff (i.e. strcmp)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
# Link our exe
add_executable(Stronghold ${SOURCES})
add_definitions(-Wno-reorder -pedantic-errors -Ofast)
set_target_properties(Stronghold PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
# Defaults to win32 app
if(WIN32)
target_compile_options(Stronghold PRIVATE -Wl,-subsystem,console)
endif()
target_link_libraries(
Stronghold
${SDL2_LIBRARY}
${Boost_LIBRARIES}
${OPENAL_LIBRARY}
${FFMPEG_LIBRARIES}
${SWSCALE_LIBRARIES}
${LIBSWRESAMPLE_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES}
)
# cpack stuff
#SET(CPACK_GENERATOR "DEB")
#SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Julian Offenhäuser")
#SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open source engine implementation of Stronghold by Firefly Studios")
#SET(CPACK_PACKAGE_VENDOR "Julian Offenhäuser")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
#SET(CPACK_PACKAGE_VERSION_MAJOR "0")
#SET(CPACK_PACKAGE_VERSION_MINOR "1")
#SET(CPACK_PACKAGE_VERSION_PATCH "0")
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Sourcehold ${Stronghold_VERSION}")
#INCLUDE(CPack)