Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem3/bin/CMakeLists.txt @ 2670

Last change on this file since 2670 was 2664, checked in by rgrieder, 16 years ago

Merged buildsystem2 to buildsystem3.

Note: Bare merge, just resolved conflicts. To testing, no nothing.

  • Property svn:eol-style set to native
File size: 4.8 KB
RevLine 
[2626]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 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Configures the binary output directory with files required for Orxonox
24 #    to run like orxonox.ini or the default keybindings.
25 #    Also creates a run-script in the root directory of the build tree.
26 #
27 
[2598]28SET(READ_ONLY_CONFIG_FILES
[2243]29  def_keybindings.ini
[2523]30  def_masterKeybindings.ini
[2243]31  disco.txt
32  irc.tcl
33  remote.tcl
34  telnet_server.tcl
[2199]35)
36
[2598]37SET(WRITABLE_CONFIG_FILES
38)
39
[2644]40# Not getting installed
41SET(ORXONOX_INI orxonox.ini)
42
[2583]43IF(TARDIS)
[2510]44  # OGRE can't find fonts to display config screen on Tardis,
[2583]45  # so providing default config file here (bug).
[2598]46  LIST(APPEND WRITABLE_CONFIG_FILES ogre.cfg)
[2583]47ENDIF(TARDIS)
[2243]48
[2598]49# We need the same code for both READ_ONLY and WRITABLE config files
50MACRO(CONFIGURE_FILES _file_name _build_configs _read_only_arg)
51  SET(_read_only ${_read_only_arg})
52  FOREACH(_build_config ${_build_configs})
[2590]53    # Is there an extra file in bin/Debug or bin/Release?
54    IF(${_build_config} MATCHES "Rel")
55      SET(_build_config_short "Release")
[2624]56    ELSE()
[2590]57      SET(_build_config_short "Debug")
[2624]58    ENDIF()
[2590]59    IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name})
60      SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name})
[2624]61    ELSE()
[2590]62      SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file_name})
[2624]63    ENDIF()
[2590]64
65    # Copy to the folder named like the build config for Visual Studio
66    IF(CMAKE_CONFIGURATION_TYPES)
67      SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_build_config}/${_file_name})
[2624]68    ELSE()
[2590]69      SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_file_name})
[2624]70    ENDIF()
[2590]71    # Only copy if target file doesn't exist. This may result in problems but
[2598]72    # otherwise we might delete a user's config
[2624]73    IF(NOT EXISTS ${_out_file} OR _read_only)
[2590]74      CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY)
[2624]75    ENDIF()
[2598]76  ENDFOREACH(_build_config)
77ENDMACRO(CONFIGURE_FILES)
[2590]78
[2598]79# Copy config files to all Visual Studio output directories
80IF(CMAKE_CONFIGURATION_TYPES)
81  SET(BUILD_CONFIGS ${CMAKE_CONFIGURATION_TYPES})
[2624]82ELSE()
[2598]83  SET(CONFIG_OUT_PATHS_REL ".")
84  SET(BUILD_CONFIGS ${CMAKE_BUILD_TYPE})
[2624]85ENDIF()
[2598]86
87FOREACH(_file_name ${READ_ONLY_CONFIG_FILES})
88  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" TRUE)
89ENDFOREACH(_file_name)
[2644]90FOREACH(_file_name ${WRITABLE_CONFIG_FILES} ${ORXONOX_INI})
[2598]91  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" FALSE)
92ENDFOREACH(_file_name)
93
[2644]94
95################ Installation #################
96
97# Not using collective call to allow configuration with CMake.
98FOREACH(_file ${READ_ONLY_CONFIG_FILES} ${WRITABLE_CONFIG_FILES})
99  IF(CMAKE_CONFIGURATION_TYPES)
100    FOREACH(_configuration ${CMAKE_CONFIGURATION_TYPES})
[2657]101      INSTALL(
102        FILES ${CMAKE_BINARY_DIR}/bin/${_configuration}/${_file}
103        DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
104        CONFIGURATIONS ${_configuration}
105      )
[2644]106    ENDFOREACH(_configuration)
107  ELSE()
[2659]108    INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${_file} DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH})
[2644]109  ENDIF()
110ENDFOREACH(_file)
111
112
[2598]113################ Run Scripts ##################
114
[2590]115# Create a run script for both Windows and Linux in the source root path if
116# CMake is not used to create multi-configuration project files
117IF(NOT CMAKE_CONFIGURATION_TYPES)
118  IF(WIN32)
[2591]119    SET(RUN_SCRIPT run.bat)
[2598]120    # Note: Do not use FILE(TO_NATIVE_PATH) because it doesn't work for MinGW
[2595]121    STRING(REGEX REPLACE "^([A-Z]\\:)\\/.*$" "\\1" WINDOWS_DRIVE_CHANGE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
122    STRING(REPLACE "/" "\\" CMAKE_RUNTIME_OUTPUT_DIRECTORY_WINDOWS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
[2621]123    STRING(REPLACE "/" "\\" ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS ${ORXONOX_RUNTIME_LIBRARY_DIRECTORY})
[2590]124  ELSE(UNIX)
[2591]125    SET(RUN_SCRIPT run)
[2590]126  ENDIF(WIN32)
[2628]127  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${RUN_SCRIPT} ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT} @ONLY)
128  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${RUN_SCRIPT} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${RUN_SCRIPT} @ONLY)
[2590]129ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
Note: See TracBrowser for help on using the repository browser.