File: CMakeLists.txt

package info (click to toggle)
seriousproton 2020.01.15+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 720 kB
  • sloc: cpp: 7,666; ansic: 376; php: 59; makefile: 15
file content (113 lines) | stat: -rw-r--r-- 3,620 bytes parent folder | download
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
cmake_minimum_required(VERSION 3.9)
project(SeriousProton VERSION 2019.05.21 DESCRIPTION "C++ game engine")
set(CMAKE_MODULE_PATH
	${CMAKE_SOURCE_DIR}/cmake/
	${CMAKE_MODULE_PATH}
)

#---------------------------------File lists-----------------------------------
set(source_files_relative #All SeriousProton's objects to compile
	src/clipboard.cpp
	src/collisionable.cpp
	src/engine.cpp
	src/event.cpp
	src/fixedSocket.cpp
	src/gameEntity.cpp
	src/httpServer.cpp
	src/input.cpp
	src/logging.cpp
	src/multiplayer.cpp
	src/multiplayer_client.cpp
	src/multiplayer_server.cpp
	src/multiplayer_server_scanner.cpp
	src/networkAudioStream.cpp
	src/networkRecorder.cpp
	src/PlayerController.cpp
	src/postProcessManager.cpp
	src/random.cpp
	src/Renderable.cpp
	src/resources.cpp
	src/scriptInterface.cpp
	src/scriptInterfaceMagic.cpp
	src/shaderManager.cpp
	src/soundManager.cpp
	src/stringImproved.cpp
	src/textureManager.cpp
	src/tween.cpp
	src/Updatable.cpp
	src/windowManager.cpp
)
set(source_files "")
foreach(source_file_relative ${source_files_relative})
	list(APPEND source_files ${CMAKE_CURRENT_SOURCE_DIR}/${source_file_relative})
endforeach()

set(seriousproton_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/src/)

include_directories(
	${CMAKE_CURRENT_BINARY_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}/src
)

#----------------------------------Compiling-----------------------------------
if(CMAKE_VERSION VERSION_LESS "3.1")
	if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
		set(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
	endif()
else()
	set(CMAKE_CXX_STANDARD 11)
endif()

add_library(seriousproton SHARED ${source_files})
set_property(TARGET seriousproton PROPERTY SOVERSION 0 )

#--------------------------------Dependencies----------------------------------
include(ExternalProject)

include(FindPkgConfig)
pkg_check_modules(box2d box2d REQUIRED)
pkg_check_modules(glew  glew  REQUIRED)
pkg_check_modules(lua   lua53 REQUIRED)

find_package(SFML 2.3 COMPONENTS system audio network window graphics)
if(NOT ${SFML_FOUND})
	message(STATUS "Couldn't find SFML. Building it from scratch. Installing to ${CMAKE_INSTALL_PREFIX}")
	ExternalProject_Add(SFML
		GIT_REPOSITORY https://github.com/SFML/SFML.git
		GIT_TAG 2.4.2 #Always build with this tag, so we're sure it is stable.
		CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF
	)
	set(SFML_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) #Otherwise this is filled by FindSFML.cmake.
	set(SFML_LIBRARIES
		${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sfml-audio${CMAKE_STATIC_LIBRARY_SUFFIX}
		${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sfml-graphics${CMAKE_STATIC_LIBRARY_SUFFIX}
		${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sfml-network${CMAKE_STATIC_LIBRARY_SUFFIX}
		${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sfml-system${CMAKE_STATIC_LIBRARY_SUFFIX}
		${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sfml-window${CMAKE_STATIC_LIBRARY_SUFFIX}
	)
	add_dependencies(seriousproton SFML)
endif()
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(seriousproton ${SFML_LIBRARIES})

#--------------------------------Installation----------------------------------
install(
	TARGETS seriousproton
	EXPORT seriousproton
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib
)
install(
	DIRECTORY ${seriousproton_include_dir}
	DESTINATION include/seriousproton
	FILES_MATCHING PATTERN "*.h"
)
install(
	DIRECTORY ${seriousproton_include_dir}
	DESTINATION include/seriousproton
	FILES_MATCHING PATTERN "*.hpp"
)
install(
	EXPORT seriousproton
	DESTINATION share/seriousproton
)