This repository has been archived by the owner on Jun 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
78 lines (67 loc) · 2.37 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
cmake_minimum_required(VERSION 2.6)
project(ZELDA_XD2_MERCURIS_CHESS)
set(quest_name "zelda_xd2_mercuris_chess")
set(SOLARUS_INSTALL_DATAROOTDIR "share" CACHE PATH "dataroot dir")
set(SOLARUS_INSTALL_DATADIR "${SOLARUS_INSTALL_DATAROOTDIR}/solarus" CACHE PATH "data dir")
set(SOLARUS_INSTALL_BINDIR "bin" CACHE PATH "bin dir")
if (IS_ABSOLUTE ${SOLARUS_INSTALL_DATADIR})
set(SOLARUS_INSTALL_ABSOLUTE_DATADIR ${SOLARUS_INSTALL_DATADIR})
else()
set(SOLARUS_INSTALL_ABSOLUTE_DATADIR ${CMAKE_INSTALL_PREFIX}/${SOLARUS_INSTALL_DATADIR})
endif()
# data files list
file(GLOB_RECURSE data_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/data
${CMAKE_CURRENT_SOURCE_DIR}/data/*.spc
${CMAKE_CURRENT_SOURCE_DIR}/data/*.ogg
${CMAKE_CURRENT_SOURCE_DIR}/data/*.it
${CMAKE_CURRENT_SOURCE_DIR}/data/*.png
${CMAKE_CURRENT_SOURCE_DIR}/data/*.dat
${CMAKE_CURRENT_SOURCE_DIR}/data/*.lua
${CMAKE_CURRENT_SOURCE_DIR}/data/*.ttf
${CMAKE_CURRENT_SOURCE_DIR}/data/*.ttc
${CMAKE_CURRENT_SOURCE_DIR}/data/*.fon
${CMAKE_CURRENT_SOURCE_DIR}/data/*.glsl
)
file(GLOB_RECURSE data_files_prefixed
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/data/*.spc
${CMAKE_CURRENT_SOURCE_DIR}/data/*.ogg
${CMAKE_CURRENT_SOURCE_DIR}/data/*.it
${CMAKE_CURRENT_SOURCE_DIR}/data/*.png
${CMAKE_CURRENT_SOURCE_DIR}/data/*.dat
${CMAKE_CURRENT_SOURCE_DIR}/data/*.lua
${CMAKE_CURRENT_SOURCE_DIR}/data/*.ttf
${CMAKE_CURRENT_SOURCE_DIR}/data/*.ttc
${CMAKE_CURRENT_SOURCE_DIR}/data/*.fon
${CMAKE_CURRENT_SOURCE_DIR}/data/*.glsl
)
# add other data to zip archive
add_custom_command(
OUTPUT data.solarus
DEPENDS ${data_files_prefixed}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data
COMMAND zip -q ${CMAKE_CURRENT_BINARY_DIR}/data.solarus ${data_files}
)
add_custom_target(${quest_name}_data
ALL
DEPENDS data.solarus
)
# create a script that executes the engine with this quest
add_custom_command(
OUTPUT ${quest_name}
COMMAND echo '\#!/bin/sh' > ${quest_name}
COMMAND echo 'solarus-run ${SOLARUS_INSTALL_ABSOLUTE_DATADIR}/${quest_name} $$*' >> ${quest_name}
)
add_custom_target(${quest_name}_command
ALL
DEPENDS ${quest_name}
)
# install the data archive
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/data.solarus
DESTINATION ${SOLARUS_INSTALL_DATADIR}/${quest_name}
)
# install the script
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${quest_name}
DESTINATION ${SOLARUS_INSTALL_BINDIR}
)