Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/bin-config/CMakeLists.txt @ 2603

Last change on this file since 2603 was 2598, checked in by rgrieder, 16 years ago

Divided init files in bi-config into two groups:

  • The ones that always overwrite the old files (def_keybindings.ini tcl scripts, etc.)
  • The ones that only get copied when the file doesn't exist yet (orxonox.ini, ogre.cfg for tardis)
  • Property svn:eol-style set to native
File size: 3.2 KB
RevLine 
[2598]1SET(READ_ONLY_CONFIG_FILES
[2243]2  def_keybindings.ini
[2523]3  def_masterKeybindings.ini
[2243]4  disco.txt
5  irc.tcl
6  remote.tcl
7  telnet_server.tcl
[2199]8)
9
[2598]10SET(WRITABLE_CONFIG_FILES
11  orxonox.ini
12)
13
[2583]14IF(TARDIS)
[2510]15  # OGRE can't find fonts to display config screen on Tardis,
[2583]16  # so providing default config file here (bug).
[2598]17  LIST(APPEND WRITABLE_CONFIG_FILES ogre.cfg)
[2583]18ENDIF(TARDIS)
[2243]19
[2598]20# We need the same code for both READ_ONLY and WRITABLE config files
21MACRO(CONFIGURE_FILES _file_name _build_configs _read_only_arg)
22  SET(_read_only ${_read_only_arg})
23  FOREACH(_build_config ${_build_configs})
[2590]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
[2598]43    # otherwise we might delete a user's config
44    IF (NOT EXISTS ${_out_file} OR _read_only)
[2590]45      CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY)
[2598]46    ENDIF (NOT EXISTS ${_out_file} OR _read_only)
47  ENDFOREACH(_build_config)
48ENDMACRO(CONFIGURE_FILES)
[2590]49
[2598]50# Copy config files to all Visual Studio output directories
51IF(CMAKE_CONFIGURATION_TYPES)
52  SET(BUILD_CONFIGS ${CMAKE_CONFIGURATION_TYPES})
53ELSE(CMAKE_CONFIGURATION_TYPES)
54  SET(CONFIG_OUT_PATHS_REL ".")
55  SET(BUILD_CONFIGS ${CMAKE_BUILD_TYPE})
56ENDIF(CMAKE_CONFIGURATION_TYPES)
57
58FOREACH(_file_name ${READ_ONLY_CONFIG_FILES})
59  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" TRUE)
60ENDFOREACH(_file_name)
61FOREACH(_file_name ${WRITABLE_CONFIG_FILES})
62  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" FALSE)
63ENDFOREACH(_file_name)
64
65################ Run Scripts ##################
66
[2590]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
69IF(NOT CMAKE_CONFIGURATION_TYPES)
70  IF(WIN32)
[2591]71    SET(RUN_SCRIPT run.bat)
[2598]72    # Note: Do not use FILE(TO_NATIVE_PATH) because it doesn't work for MinGW
[2595]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})
[2590]75  ELSE(UNIX)
[2591]76    SET(RUN_SCRIPT run)
[2590]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})
81ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
Note: See TracBrowser for help on using the repository browser.