Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2588


Ignore:
Timestamp:
Jan 12, 2009, 4:18:11 PM (16 years ago)
Author:
rgrieder
Message:

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)
Location:
code/branches/buildsystem2
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2/CMakeLists.txt

    r2583 r2588  
    4545SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 CACHE STRING "")
    4646FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
     47# With MSVC, automatic linking is performed for boost. So wee need to tell
     48# the linker where to find them. Also note that when running FindBoost for the
     49# first time, it will set ${Boost_LIBRARIES} to "" but afterwards to the libs.
     50IF (MSVC)
     51  LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
     52ENDIF (MSVC)
    4753FIND_PACKAGE(OGRE REQUIRED)
    4854FIND_PACKAGE(CEGUI REQUIRED)
  • code/branches/buildsystem2/cmake/ConfigMSVC.cmake

    r2585 r2588  
    2626 #
    2727 
    28 ############## MSVC config ################
    29 # Set the library directory when using precompiled tarballs for
    30 # the dependencies under windows (MSVC)
    31 ###########################################
     28###################### MSVC config ########################
     29# Set the library directories and special options when
     30# using Visual Studio.
     31###########################################################
    3232
    3333IF (MSVC)
    3434  MESSAGE(STATUS "Running on MSVC. Using customized paths and options.")
     35
     36  ###################### Libraries ########################
    3537
    3638  # Determine library directory
     
    5456  SET(ENV{OPENALDIR}         ${MSVC_LIBRARY_DIR}/openal-1.1)
    5557  SET(ENV{LUA_DIR}           ${MSVC_LIBRARY_DIR}/lua-5.1.3)
    56   SET(ENV{OGRE_HOME}        "${MSVC_LIBRARY_DIR}/ogre-1.4.9;${ORXONOX_LIBRARY_BIN_DIR}")
     58  SET(ENV{OGRE_HOME}        "${MSVC_LIBRARY_DIR}/ogre-1.4.9;${MSVC_LIBRARY_DIR}/bin")
    5759  SET(TCL_INCLUDE_PATH       ${MSVC_LIBRARY_DIR}/tcl-8.5.2/include)
    5860  SET(TCL_LIBRARY            ${MSVC_LIBRARY_DIR}/tcl-8.5.2/lib/tcl85t.lib)
     
    6668  SET(ZLIB_FOUND TRUE)
    6769
     70  #################### Compiler Flags #####################
    6871
    69   # Set standard compiler flags
    70   SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   ${ORXONOX_WARNING_FLAGS} -fPIC")
    71   SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} ${ORXONOX_WARNING_FLAGS} -fPIC")
    72   # These flags are added to the flags above
    73   SET(CMAKE_C_FLAGS_DEBUG            "    -g -ggdb")
    74   SET(CMAKE_CXX_FLAGS_DEBUG          "    -g -ggdb")
    75   SET(CMAKE_C_FLAGS_RELEASE          "-O3          -DNDEBUG")
    76   SET(CMAKE_CXX_FLAGS_RELEASE        "-O3          -DNDEBUG")
    77   SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -ggdb -DNDEBUG")
    78   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -ggdb -DNDEBUG")
    79   SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os          -DNDEBUG")
    80   SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os          -DNDEBUG")
     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}")
    8194
    82   # Linker flags
    83   SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
    84   SET(CMAKE_EXE_LINKER_FLAGS    " --no-undefined")
    85   SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
    86   SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
     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}")
    87124
    88125  ######################### Misc ##########################
  • code/branches/buildsystem2/cmake/ConfigPlatforms.cmake

    r2585 r2588  
    7070SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
    7171
     72# Also define macros to easily extend the compiler flags
     73# Additional argument is a condition
     74MACRO(ADD_CXX_FLAGS _flag _cond)
     75  IF(${_cond})
     76    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
     77  ENDIF(${_cond})
     78ENDMACRO(ADD_CXX_FLAGS _flag)
     79MACRO(ADD_C_FLAGS _flag)
     80  IF(${_cond})
     81    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}")
     82  ENDIF(${_cond})
     83ENDMACRO(ADD_C_FLAGS _flag)
     84
    7285########## Plaform Specific Config ##############
    7386
  • code/branches/buildsystem2/src/CMakeLists.txt

    r2583 r2588  
    3737
    3838# Set special macro symbols across all libraries
    39 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIXML_USE_TICPP")
     39ADD_CXX_FLAGS("-DTIXML_USE_TICPP" TRUE)
     40ADD_C_FLAGS("-DTIXML_USE_TICPP" TRUE)
    4041
    4142# Include macros
  • code/branches/buildsystem2/src/audio/CMakeLists.txt

    r2583 r2588  
    66)
    77
    8 IF (WIN32)
     8ADD_CXX_FLAGS("-wd4244" MSVC)
     9
     10IF (MINGW)
    911  ADD_LIBRARY( audio ${AUDIO_SRC_FILES} )
    10 ELSE (WIN32)
     12ELSE (MINGW)
    1113  ADD_LIBRARY( audio SHARED ${AUDIO_SRC_FILES} )
    12 ENDIF (WIN32)
     14ENDIF (MINGW)
    1315
     16SET_TARGET_PROPERTIES(audio PROPERTIES DEFINE_SYMBOL "AUDIO_SHARED_BUILD")
    1417TARGET_LINK_LIBRARIES( audio
    1518  ${OPENAL_LIBRARY}
  • code/branches/buildsystem2/src/ceguilua-0.5.0/ceguilua/CMakeLists.txt

    r2579 r2588  
    66)
    77
     8ADD_CXX_FLAGS("-wd4996" MSVC)
     9
    810ADD_LIBRARY( ceguilua_orxonox SHARED ${CEGUILUA_SRC_FILES} )
    911
     12SET_TARGET_PROPERTIES(ceguilua_orxonox PROPERTIES DEFINE_SYMBOL "CEGUILUA_EXPORTS")
    1013TARGET_LINK_LIBRARIES(ceguilua_orxonox
    1114  tolualib_orxonox
  • code/branches/buildsystem2/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt

    r2579 r2588  
    66)
    77
     8ADD_CXX_FLAGS("-wd4996" MSVC)
     9
    810ADD_LIBRARY( ceguilua_orxonox SHARED ${CEGUILUA_SRC_FILES} )
    911
     12SET_TARGET_PROPERTIES(ceguilua_orxonox PROPERTIES DEFINE_SYMBOL "CEGUILUA_EXPORTS")
    1013TARGET_LINK_LIBRARIES(ceguilua_orxonox
    1114  tolualib_orxonox
  • code/branches/buildsystem2/src/core/CMakeLists.txt

    r2579 r2588  
    5151ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
    5252
     53SET_TARGET_PROPERTIES(core PROPERTIES DEFINE_SYMBOL "CORE_SHARED_BUILD")
    5354TARGET_LINK_LIBRARIES(core
    5455  ${OGRE_LIBRARY}
  • code/branches/buildsystem2/src/cpptcl/CMakeLists.txt

    r2579 r2588  
    1 ADD_LIBRARY(cpptcl_orxonox SHARED CppTcl.cc)
     1IF(MSVC)
     2  ADD_LIBRARY(cpptcl_orxonox STATIC CppTcl.cc)
     3ELSE(MSVC)
     4  ADD_LIBRARY(cpptcl_orxonox SHARED CppTcl.cc)
     5ENDIF(MSVC)
    26
    37TARGET_LINK_LIBRARIES(cpptcl_orxonox
  • code/branches/buildsystem2/src/network/CMakeLists.txt

    r2583 r2588  
    1818
    1919WRITE_SOURCE_FILES(NETWORK_SRC_FILES)
    20 IF(WIN32)
     20
     21IF(MINGW)
    2122  ADD_LIBRARY( network ${NETWORK_SRC_FILES} )
    22 ELSE(WIN32)
     23ELSE(MINGW)
    2324  ADD_LIBRARY( network SHARED ${NETWORK_SRC_FILES} )
    24 ENDIF(WIN32)
     25ENDIF(MINGW)
    2526
    26 TARGET_LINK_LIBRARIES( network
     27SET_TARGET_PROPERTIES(network PROPERTIES DEFINE_SYMBOL "NETWORK_SHARED_BUILD")
     28TARGET_LINK_LIBRARIES(network
    2729  ${ZLIB_LIBRARY}
    2830  ${ENET_LIBRARY}
  • code/branches/buildsystem2/src/ogreceguirenderer/CMakeLists.txt

    r2583 r2588  
    77ADD_LIBRARY(ogreceguirenderer_orxonox SHARED ${SRC_FILES})
    88
     9SET_TARGET_PROPERTIES(ogreceguirenderer_orxonox PROPERTIES DEFINE_SYMBOL "OGRE_GUIRENDERER_EXPORTS")
    910TARGET_LINK_LIBRARIES(ogreceguirenderer_orxonox
    1011  ${OGRE_LIBRARY}
  • code/branches/buildsystem2/src/ois/CMakeLists.txt

    r2579 r2588  
    3939
    4040ADD_LIBRARY( ois_orxonox SHARED ${OIS_SRC_FILES} )
     41SET_TARGET_PROPERTIES(ois_orxonox PROPERTIES DEFINE_SYMBOL "OIS_NONCLIENT_BUILD")
    4142
    4243IF(WIN32)
  • code/branches/buildsystem2/src/orxonox/CMakeLists.txt

    r2579 r2588  
    2020# Not using precompiled header files: Avoid dependencies
    2121INCLUDE_DIRECTORIES(pch/nopch)
     22
     23# Enlarge heap size for precompiled header files
     24ADD_CXX_FLAGS("-Zm200" MSVC)
    2225
    2326ADD_EXECUTABLE(orxonox ${ORXONOX_SRC_FILES})
  • code/branches/buildsystem2/src/tinyxml/CMakeLists.txt

    r2579 r2588  
    77)
    88
    9 ADD_LIBRARY(tinyxml_orxonox SHARED ${TINYXML_SRC_FILES})
     9IF(MSVC)
     10  ADD_LIBRARY(tinyxml_orxonox STATIC ${TINYXML_SRC_FILES})
     11ELSE(MSVC)
     12  ADD_LIBRARY(tinyxml_orxonox SHARED ${TINYXML_SRC_FILES})
     13ENDIF(MSVC)
    1014
    1115IF (NOT WIN32)
  • code/branches/buildsystem2/src/tolua/CMakeLists.txt

    r2583 r2588  
     1ADD_C_FLAGS("-wd4996" MSVC)
     2
    13ADD_LIBRARY(tolualib_orxonox SHARED
    24  tolua_event.c
     
    68  tolua_to.c
    79)
     10SET_TARGET_PROPERTIES(tolualib_orxonox PROPERTIES DEFINE_SYMBOL "TOLUA_SHARED_BUILD")
    811TARGET_LINK_LIBRARIES(tolualib_orxonox ${LUA_LIBRARY})
    912
  • code/branches/buildsystem2/src/util/CMakeLists.txt

    r2579 r2588  
    1414
    1515ADD_LIBRARY(util SHARED ${UTIL_SRC_FILES})
     16SET_TARGET_PROPERTIES(util PROPERTIES DEFINE_SYMBOL "UTIL_SHARED_BUILD")
    1617TARGET_LINK_LIBRARIES(util ${OGRE_LIBRARY})
    1718
Note: See TracChangeset for help on using the changeset viewer.