~adrian-arroyocalle/freerct/freerct

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
# $Id$
#
# This file is part of FreeRCT.
# FreeRCT 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, version 2.
# FreeRCT 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 FreeRCT. If not, see <http://www.gnu.org/licenses/>.
#

# CMake File for FreeRCT

project(FreeRCT)
cmake_minimum_required(VERSION 2.8)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
set(FREERCT_DONE_TOP_LEVEL_CMAKE ON)
set(CMAKE_USE_RELATIVE_PATHS ON)

option(OVERRIDE_VCS "Override the lack of a VCS checkout")

# Create the directories that the binaries and data files go into
set(FRCT_BINARY_DIR ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${FRCT_BINARY_DIR})
file(MAKE_DIRECTORY ${FRCT_BINARY_DIR}/rcd)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${FRCT_BINARY_DIR})

# Include individual projects
message(STATUS "")

message(STATUS "Building rcdgen")
add_subdirectory(src/rcdgen)

message(STATUS "Building RCD Files")
add_subdirectory(graphics/rcd)

message(STATUS "Building FreeRCT")
add_subdirectory(src)

IF(NOT MSVC)
	add_custom_target(run
	                  COMMAND freerct
	                  WORKING_DIRECTORY ${FRCT_BINARY_DIR}
	)
	add_dependencies(run freerct)

	# Warning: assumes gdb exists
	add_custom_target(gdbrun
	                  COMMAND gdb freerct
	                  WORKING_DIRECTORY ${FRCT_BINARY_DIR}
	)
	add_dependencies(gdbrun freerct)

	# Documentation rules
	find_package(Doxygen)
	IF(DOXYGEN_FOUND)
		add_custom_target(doc
		                  COMMAND ${DOXYGEN_EXECUTABLE}
		                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
		)
	ENDIF()

	list(APPEND DOCFILES
	     "data_format"
		 "manual"
		 "savegame"
	)

	# Warning: assumes rst2html exists
	FOREACH(DOCFILE ${DOCFILES})
		add_custom_target(${DOCFILE}.html
		                  COMMAND rst2html ${DOCFILE}.rst ${DOCFILE}.html
		                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/doc
		)
	ENDFOREACH()

ENDIF()