| [2579] | 1 | # |
|---|
| 2 | # ORXONOX - the hottest 3D action shooter ever to exist |
|---|
| 3 | # > www.orxonox.net < |
|---|
| 4 | # |
|---|
| 5 | # |
|---|
| 6 | # License notice: |
|---|
| 7 | # |
|---|
| 8 | # This program is free software; you can redistribute it and/or |
|---|
| 9 | # modify it under the terms of the GNU General Public License |
|---|
| 10 | # as published by the Free Software Foundation; either version 2 |
|---|
| 11 | # of the License, or (at your option) any later version. |
|---|
| 12 | # |
|---|
| 13 | # This program is distributed in the hope that it will be useful, |
|---|
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | # GNU General Public License for more details. |
|---|
| 17 | # |
|---|
| 18 | # You should have received a copy of the GNU General Public License |
|---|
| 19 | # along with this program; if not, write to the Free Software |
|---|
| 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 21 | # |
|---|
| 22 | # Author: |
|---|
| 23 | # Reto Grieder |
|---|
| 24 | # Co-authors: |
|---|
| 25 | # ... |
|---|
| 26 | # |
|---|
| 27 | |
|---|
| [2582] | 28 | # If you want to set specific options for your platform, simply |
|---|
| 29 | # create a file called "ConfigUser.cmake" in the binary folder |
|---|
| 30 | # (see at the bottom of the file) |
|---|
| [2579] | 31 | |
|---|
| [2582] | 32 | ############ Misc Default Options ############### |
|---|
| 33 | |
|---|
| [2583] | 34 | # When searching for debug libraries, this is appended to the libarary name |
|---|
| [2579] | 35 | SET(LIBRARY_DEBUG_POSTFIX "_d") |
|---|
| [2590] | 36 | # Sets where to find the binary directory of external libraries |
|---|
| 37 | SET(ORXONOX_LIBRARY_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
|---|
| [2583] | 38 | # Working directory for the tolua parser. Adjust for windows because lua.dll has to be there! |
|---|
| 39 | SET(TOLUA_PARSER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) |
|---|
| [2582] | 40 | |
|---|
| [2583] | 41 | OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)") |
|---|
| [2582] | 42 | IF(EXTRA_WARNINGS) |
|---|
| 43 | SET(ORXONOX_WARNING_FLAGS "-Wextra --Wno-unsued-parameter") |
|---|
| 44 | ELSE(EXTRA_WARNINGS) |
|---|
| 45 | SET(ORXONOX_WARNING_FLAGS "-Wall") |
|---|
| 46 | ENDIF(EXTRA_WARNINGS) |
|---|
| 47 | |
|---|
| [2585] | 48 | SET(ORXONOX_MEDIA_DIRECTORY "${CMAKE_SOURCE_DIR}/../media") |
|---|
| 49 | # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager |
|---|
| 50 | # Render systems may be optional, but at least one has to be found in FindOgre |
|---|
| [2592] | 51 | SET(OGRE_PLUGINS RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX) |
|---|
| 52 | IF(WIN32) |
|---|
| 53 | # CG program manager is probably DirectX related (not available under unix) |
|---|
| 54 | LIST(APPEND OGRE_PLUGINS Plugin_CgProgramManager) |
|---|
| 55 | ENDIF(WIN32) |
|---|
| [2585] | 56 | |
|---|
| 57 | |
|---|
| [2582] | 58 | ###### Default Compiler/Linker Options ########## |
|---|
| 59 | # Most people use GCC to compile orxonox, so use that as default |
|---|
| 60 | |
|---|
| 61 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC") |
|---|
| 62 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC") |
|---|
| 63 | # These flags are added to the flags above |
|---|
| 64 | SET(CMAKE_C_FLAGS_DEBUG " -g -ggdb") |
|---|
| 65 | SET(CMAKE_CXX_FLAGS_DEBUG " -g -ggdb") |
|---|
| 66 | SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") |
|---|
| 67 | SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") |
|---|
| 68 | SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG") |
|---|
| 69 | SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG") |
|---|
| 70 | SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") |
|---|
| 71 | SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") |
|---|
| 72 | |
|---|
| 73 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
|---|
| 74 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
|---|
| 75 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
|---|
| 76 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
|---|
| 77 | |
|---|
| [2588] | 78 | # Also define macros to easily extend the compiler flags |
|---|
| 79 | # Additional argument is a condition |
|---|
| 80 | MACRO(ADD_CXX_FLAGS _flag _cond) |
|---|
| 81 | IF(${_cond}) |
|---|
| 82 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}") |
|---|
| 83 | ENDIF(${_cond}) |
|---|
| 84 | ENDMACRO(ADD_CXX_FLAGS _flag) |
|---|
| 85 | MACRO(ADD_C_FLAGS _flag) |
|---|
| 86 | IF(${_cond}) |
|---|
| 87 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}") |
|---|
| 88 | ENDIF(${_cond}) |
|---|
| 89 | ENDMACRO(ADD_C_FLAGS _flag) |
|---|
| 90 | |
|---|
| [2582] | 91 | ########## Plaform Specific Config ############## |
|---|
| 92 | |
|---|
| [2579] | 93 | # Set the platform specific options and paths |
|---|
| 94 | INCLUDE(ConfigTardis) |
|---|
| 95 | INCLUDE(ConfigMSVC) |
|---|
| 96 | INCLUDE(ConfigMinGW) |
|---|
| [2582] | 97 | # User can create his own file if required |
|---|
| 98 | IF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake) |
|---|
| 99 | INCLUDE(${CMAKE_BINARY_DIR}/ConfigUser) |
|---|
| 100 | ENDIF(EXISTS ${CMAKE_BINARY_DIR}/ConfigUser.cmake) |
|---|