Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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/cmake
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.