1 | SET(READ_ONLY_CONFIG_FILES |
---|
2 | def_keybindings.ini |
---|
3 | def_masterKeybindings.ini |
---|
4 | disco.txt |
---|
5 | irc.tcl |
---|
6 | remote.tcl |
---|
7 | telnet_server.tcl |
---|
8 | ) |
---|
9 | |
---|
10 | SET(WRITABLE_CONFIG_FILES |
---|
11 | orxonox.ini |
---|
12 | ) |
---|
13 | |
---|
14 | IF(TARDIS) |
---|
15 | # OGRE can't find fonts to display config screen on Tardis, |
---|
16 | # so providing default config file here (bug). |
---|
17 | LIST(APPEND WRITABLE_CONFIG_FILES ogre.cfg) |
---|
18 | ENDIF(TARDIS) |
---|
19 | |
---|
20 | # We need the same code for both READ_ONLY and WRITABLE config files |
---|
21 | MACRO(CONFIGURE_FILES _file_name _build_configs _read_only_arg) |
---|
22 | SET(_read_only ${_read_only_arg}) |
---|
23 | FOREACH(_build_config ${_build_configs}) |
---|
24 | # Is there an extra file in bin/Debug or bin/Release? |
---|
25 | IF(${_build_config} MATCHES "Rel") |
---|
26 | SET(_build_config_short "Release") |
---|
27 | ELSE(${_build_config} MATCHES "Rel") |
---|
28 | SET(_build_config_short "Debug") |
---|
29 | ENDIF(${_build_config} MATCHES "Rel") |
---|
30 | IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name}) |
---|
31 | SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name}) |
---|
32 | ELSE(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name}) |
---|
33 | SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file_name}) |
---|
34 | ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name}) |
---|
35 | |
---|
36 | # Copy to the folder named like the build config for Visual Studio |
---|
37 | IF(CMAKE_CONFIGURATION_TYPES) |
---|
38 | SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_build_config}/${_file_name}) |
---|
39 | ELSE(CMAKE_CONFIGURATION_TYPES) |
---|
40 | SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_file_name}) |
---|
41 | ENDIF(CMAKE_CONFIGURATION_TYPES) |
---|
42 | # Only copy if target file doesn't exist. This may result in problems but |
---|
43 | # otherwise we might delete a user's config |
---|
44 | IF (NOT EXISTS ${_out_file} OR _read_only) |
---|
45 | CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY) |
---|
46 | ENDIF (NOT EXISTS ${_out_file} OR _read_only) |
---|
47 | ENDFOREACH(_build_config) |
---|
48 | ENDMACRO(CONFIGURE_FILES) |
---|
49 | |
---|
50 | # Copy config files to all Visual Studio output directories |
---|
51 | IF(CMAKE_CONFIGURATION_TYPES) |
---|
52 | SET(BUILD_CONFIGS ${CMAKE_CONFIGURATION_TYPES}) |
---|
53 | ELSE(CMAKE_CONFIGURATION_TYPES) |
---|
54 | SET(CONFIG_OUT_PATHS_REL ".") |
---|
55 | SET(BUILD_CONFIGS ${CMAKE_BUILD_TYPE}) |
---|
56 | ENDIF(CMAKE_CONFIGURATION_TYPES) |
---|
57 | |
---|
58 | FOREACH(_file_name ${READ_ONLY_CONFIG_FILES}) |
---|
59 | CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" TRUE) |
---|
60 | ENDFOREACH(_file_name) |
---|
61 | FOREACH(_file_name ${WRITABLE_CONFIG_FILES}) |
---|
62 | CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" FALSE) |
---|
63 | ENDFOREACH(_file_name) |
---|
64 | |
---|
65 | ################ Run Scripts ################## |
---|
66 | |
---|
67 | # Create a run script for both Windows and Linux in the source root path if |
---|
68 | # CMake is not used to create multi-configuration project files |
---|
69 | IF(NOT CMAKE_CONFIGURATION_TYPES) |
---|
70 | IF(WIN32) |
---|
71 | SET(RUN_SCRIPT run.bat) |
---|
72 | # Note: Do not use FILE(TO_NATIVE_PATH) because it doesn't work for MinGW |
---|
73 | STRING(REGEX REPLACE "^([A-Z]\\:)\\/.*$" "\\1" WINDOWS_DRIVE_CHANGE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
74 | STRING(REPLACE "/" "\\" CMAKE_RUNTIME_OUTPUT_DIRECTORY_WINDOWS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
---|
75 | ELSE(UNIX) |
---|
76 | SET(RUN_SCRIPT run) |
---|
77 | ENDIF(WIN32) |
---|
78 | IF (NOT EXISTS ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT}) |
---|
79 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${RUN_SCRIPT} ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT} @ONLY) |
---|
80 | ENDIF (NOT EXISTS ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT}) |
---|
81 | ENDIF(NOT CMAKE_CONFIGURATION_TYPES) |
---|