Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/cmake/ConfigMSVC.cmake @ 2588

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

Visual Studio generator working for all build types. Compiles but does not run yet.

  • Had to define some export symbols
  • tinyxml and cpptcl have to be linked statically
  • some other libraries can be linked shared that were linked statically for windows (now for mingw only)
  • added two macros: ADD_CXX_FLAG(_flag _condition) and ADD_C_FLAG(_flag _condition)
  • Property svn:eol-style set to native
File size: 5.7 KB
Line 
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 
28###################### MSVC config ########################
29# Set the library directories and special options when
30# using Visual Studio.
31###########################################################
32
33IF (MSVC)
34  MESSAGE(STATUS "Running on MSVC. Using customized paths and options.")
35
36  ###################### Libraries ########################
37
38  # Determine library directory
39  IF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
40    SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8")
41  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8)
42    SET(MSVC_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/../lib_dist/vc8/dependencies/orxonox_vc8")
43  ELSE(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
44    MESSAGE(FATAL_ERROR "Could not find dependency directory for the Visual Studio libraries")
45  ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/dependencies/orxonox_vc8)
46
47  # Set variables for the include directories and the libraries
48  # Note: When setting ENV${} variables, make sure to use quotes when
49  #       having multiple directories.
50  SET(ENV{BOOST_ROOT}        ${MSVC_LIBRARY_DIR}/boost-1.35.0)
51  SET(ENV{CEGUIDIR}          ${MSVC_LIBRARY_DIR}/cegui-0.6.1)
52  SET(ENV{ENETDIR}           ${MSVC_LIBRARY_DIR}/enet-1.2)
53  SET(ENV{ALUTDIR}           ${MSVC_LIBRARY_DIR}/freealut-1.1.0)
54  SET(ENV{OGGDIR}            ${MSVC_LIBRARY_DIR}/libogg-1.1.3)
55  SET(ENV{VORBISDIR}         ${MSVC_LIBRARY_DIR}/libvorbis-1.2.0)
56  SET(ENV{OPENALDIR}         ${MSVC_LIBRARY_DIR}/openal-1.1)
57  SET(ENV{LUA_DIR}           ${MSVC_LIBRARY_DIR}/lua-5.1.3)
58  SET(ENV{OGRE_HOME}        "${MSVC_LIBRARY_DIR}/ogre-1.4.9;${MSVC_LIBRARY_DIR}/bin")
59  SET(TCL_INCLUDE_PATH       ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include)
60  SET(TCL_LIBRARY            ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
61  SET(TCL_FOUND TRUE)
62  # Do some hacking to avoid "Tclsh not found" message
63  SET(TCL_TCLSH              ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
64  SET(TCL_TCLSH_FOUND TRUE)
65  SET(ZLIB_INCLUDE_DIR       ${MSVC_LIBRARY_DIR}/zlib-1.2.3/include)
66  SET(ZLIB_LIBRARY optimized ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib.lib
67                   debug     ${MSVC_LIBRARY_DIR}/zlib-1.2.3/lib/zlib_d.lib)
68  SET(ZLIB_FOUND TRUE)
69
70  #################### Compiler Flags #####################
71
72  # /MD    Minimal Rebuild
73  # /RTC1  Both basic runtime checks
74  # /MD[d] Multithreaded [debug] DLL
75  # /Zi    Program Database
76  # /ZI    Program Database for Edit & Continue
77  # /WX    Warning Level X
78  # /wdX   Disable specific warning X
79  SET(MSVC_CL_FLAGS "
80    /D WIN32 /D __WIN32__ /D _WIN32 /D _WINDOWS
81    /D BOOST_ALL_DYN_LINK
82    /D OIS_DYNAMIC_LIB
83    /D ZLIB_WINAPI
84    /D LUA_BUILD_AS_DLL
85    /D _CRT_SECURE_NO_WARNINGS
86    /W3
87    /EHsc
88    /wd4522
89    /wd4251
90    /wd4800
91  ")
92  SET(CMAKE_C_FLAGS                  "${MSVC_CL_FLAGS}")
93  SET(CMAKE_CXX_FLAGS                "${MSVC_CL_FLAGS}")
94
95  # Note: ${CMAKE_C_FLAGS} get added to the specific ones
96  SET(MSVC_CL_FLAGS_DEBUG            "/MDd /Od  /Zi /Gm /RTC1")
97  SET(MSVC_CL_FLAGS_RELEASE          "/MD  /MP2 /D TOLUA_RELEASE")
98  SET(CMAKE_C_FLAGS_DEBUG            "${MSVC_CL_FLAGS_DEBUG}")
99  SET(CMAKE_CXX_FLAGS_DEBUG          "${MSVC_CL_FLAGS_DEBUG}")
100  SET(CMAKE_C_FLAGS_RELEASE          "${MSVC_CL_FLAGS_RELEASE} /O2")
101  SET(CMAKE_CXX_FLAGS_RELEASE        "${MSVC_CL_FLAGS_RELEASE} /O2")
102  SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "${MSVC_CL_FLAGS_RELEASE} /O2 /Zi")
103  SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${MSVC_CL_FLAGS_RELEASE} /O2 /Zi")
104  SET(CMAKE_C_FLAGS_MINSIZEREL       "${MSVC_CL_FLAGS_RELEASE} /O1")
105  SET(CMAKE_CXX_FLAGS_MINSIZEREL     "${MSVC_CL_FLAGS_RELEASE} /O1")
106
107  ##################### Linker Flags ######################
108
109  SET(MSVC_LINKER_FLAGS                        "")
110  SET(CMAKE_EXE_LINKER_FLAGS                   "${MSVC_LINKER_FLAGS}")
111  SET(CMAKE_SHARED_LINKER_FLAGS                "${MSVC_LINKER_FLAGS}")
112
113  # Note: ${CMAKE_EXE_LINKER_FLAGS} get added to the specific ones
114  SET(MSVC_LINKER_FLAGS_DEBUG                  "/INCREMENTAL:YES")
115  SET(MSVC_LINKER_FLAGS_RELEASE                "/INCREMENTAL:NO /OPT:REF /OPT:ICF")
116  SET(CMAKE_EXE_LINKER_FLAGS_DEBUG             "${MSVC_LINKER_FLAGS_DEBUG}")
117  SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG          "${MSVC_LINKER_FLAGS_DEBUG}")
118  SET(CMAKE_EXE_LINKER_FLAGS_RELEASE           "${MSVC_LINKER_FLAGS_RELEASE}")
119  SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE        "${MSVC_LINKER_FLAGS_RELEASE}")
120  SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO    "${MSVC_LINKER_FLAGS_RELEASE}")
121  SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${MSVC_LINKER_FLAGS_RELEASE}")
122  SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL        "${MSVC_LINKER_FLAGS_RELEASE}")
123  SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL     "${MSVC_LINKER_FLAGS_RELEASE}")
124
125  ######################### Misc ##########################
126
127  # Set tolua working directory because lua.dll is not where tolua is
128  SET(TOLUA_PARSER_WORKING_DIRECTORY ${MSVC_LIBRARY_DIR}/bin)
129ENDIF (MSVC)
Note: See TracBrowser for help on using the repository browser.