1 | # |
---|
2 | # ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | # > www.orxonox.net < |
---|
4 | # |
---|
5 | # This program is free software; you can redistribute it and/or |
---|
6 | # modify it under the terms of the GNU General Public License |
---|
7 | # as published by the Free Software Foundation; either version 2 |
---|
8 | # of the License, or (at your option) any later version. |
---|
9 | # |
---|
10 | # This program is distributed in the hope that it will be useful, |
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | # GNU General Public License for more details. |
---|
14 | # |
---|
15 | # You should have received a copy of the GNU General Public License along |
---|
16 | # with this program; if not, write to the Free Software Foundation, |
---|
17 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
18 | # |
---|
19 | |
---|
20 | SET(ORXONOX_CONFIG_DEV_PATH ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) |
---|
21 | |
---|
22 | SET(READ_ONLY_CONFIG_FILES |
---|
23 | def_keybindings.ini |
---|
24 | def_masterKeybindings.ini |
---|
25 | ) |
---|
26 | |
---|
27 | SET(WRITABLE_CONFIG_FILES |
---|
28 | ) |
---|
29 | |
---|
30 | IF(TARDIS) |
---|
31 | # OGRE can't find fonts to display config screen on Tardis, |
---|
32 | # so providing default config file here (bug). |
---|
33 | LIST(APPEND WRITABLE_CONFIG_FILES ogre.cfg) |
---|
34 | ENDIF(TARDIS) |
---|
35 | |
---|
36 | # We need the same code for both READ_ONLY and WRITABLE config files |
---|
37 | MACRO(CONFIGURE_FILES _file_name _build_configs _read_only_arg) |
---|
38 | SET(_read_only ${_read_only_arg}) |
---|
39 | FOREACH(_build_config ${_build_configs}) |
---|
40 | # Is there an extra file in bin/Debug or bin/Release? |
---|
41 | IF(${_build_config} MATCHES "Rel") |
---|
42 | SET(_build_config_short "Release") |
---|
43 | ELSE() |
---|
44 | SET(_build_config_short "Debug") |
---|
45 | ENDIF() |
---|
46 | IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name}) |
---|
47 | SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name}) |
---|
48 | ELSE() |
---|
49 | SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file_name}) |
---|
50 | ENDIF() |
---|
51 | |
---|
52 | # Copy to the folder named like the build config for Visual Studio |
---|
53 | IF(CMAKE_CONFIGURATION_TYPES) |
---|
54 | SET(_out_file ${CMAKE_CURRENT_BINARY_DIR}/${_build_config}/${_file_name}) |
---|
55 | ELSE() |
---|
56 | SET(_out_file ${CMAKE_CURRENT_BINARY_DIR}/${_file_name}) |
---|
57 | ENDIF() |
---|
58 | # Only copy if target file doesn't exist. This may result in problems but |
---|
59 | # otherwise we might delete a user's config |
---|
60 | IF(NOT EXISTS ${_out_file} OR _read_only) |
---|
61 | CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY) |
---|
62 | ENDIF() |
---|
63 | ENDFOREACH(_build_config) |
---|
64 | ENDMACRO(CONFIGURE_FILES) |
---|
65 | |
---|
66 | # Copy config files to all Visual Studio output directories |
---|
67 | IF(CMAKE_CONFIGURATION_TYPES) |
---|
68 | SET(BUILD_CONFIGS ${CMAKE_CONFIGURATION_TYPES}) |
---|
69 | ELSE() |
---|
70 | SET(BUILD_CONFIGS ${CMAKE_BUILD_TYPE}) |
---|
71 | ENDIF() |
---|
72 | |
---|
73 | FOREACH(_file_name ${READ_ONLY_CONFIG_FILES}) |
---|
74 | CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" TRUE) |
---|
75 | ENDFOREACH(_file_name) |
---|
76 | FOREACH(_file_name ${WRITABLE_CONFIG_FILES}) |
---|
77 | CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" FALSE) |
---|
78 | ENDFOREACH(_file_name) |
---|
79 | |
---|
80 | |
---|
81 | ################ Installation ################# |
---|
82 | |
---|
83 | # Not using collective call to allow configuration with CMake. |
---|
84 | FOREACH(_file ${READ_ONLY_CONFIG_FILES} ${WRITABLE_CONFIG_FILES}) |
---|
85 | IF(CMAKE_CONFIGURATION_TYPES) |
---|
86 | FOREACH(_configuration ${CMAKE_CONFIGURATION_TYPES}) |
---|
87 | INSTALL( |
---|
88 | FILES ${CMAKE_CURRENT_BINARY_DIR}/${_configuration}/${_file} |
---|
89 | DESTINATION ${ORXONOX_CONFIG_INSTALL_PATH} |
---|
90 | CONFIGURATIONS ${_configuration} |
---|
91 | ) |
---|
92 | ENDFOREACH(_configuration) |
---|
93 | ELSE() |
---|
94 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_file} DESTINATION ${ORXONOX_CONFIG_INSTALL_PATH}) |
---|
95 | ENDIF() |
---|
96 | ENDFOREACH(_file) |
---|