Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7520 for code


Ignore:
Timestamp:
Oct 11, 2010, 12:29:16 PM (14 years ago)
Author:
rgrieder
Message:

Added some useful compiler options found in the Ogre build system.
SSE for GCC and fp:fast for MSVC are commented (not tested yet).

Location:
code/branches/ois_update/cmake
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ois_update/cmake/CompilerConfigGCC.cmake

    r7518 r7520  
    2626INCLUDE(FlagUtilities)
    2727INCLUDE(CompareVersionStrings)
     28INCLUDE(CheckCXXCompilerFlag)
    2829
    2930# Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC
     
    6465
    6566# CMake doesn't seem to set the PIC flags right on certain 64 bit systems
     67# Todo: MinGW too?
    6668IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
    6769  ADD_COMPILER_FLAGS("-fPIC" CACHE)
    6870ENDIF()
     71
     72# Use SSE if possible
     73#CHECK_CXX_COMPILER_FLAG(-msse _gcc_have_sse)
     74#IF(_gcc_have_sse)
     75#  ADD_COMPILER_FLAGS("-msse" CACHE)
     76#ENDIF()
     77
     78IF(NOT MINGW)
     79  # Have GCC visibility?
     80  CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" _gcc_have_visibility)
     81  IF(_gcc_have_visibility)
     82    # Note: There is a possible bug with the flag in gcc < 4.2 and Debug versions
     83    COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.2.0" _compare_result)
     84    IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" OR _compare_result SMALLER GREATER -1)
     85      ADD_COMPILER_FLAGS("-DORXONOX_GCC_VISIBILITY -fvisibility=hidden -fvisibility-inlines-hidden" CACHE)
     86    ENDIF()
     87  ENDIF(_have_gcc_visibility)
     88ENDIF(NOT MINGW)
    6989
    7090# We have some unconformant code, disable an optimisation feature
  • code/branches/ois_update/cmake/CompilerConfigMSVC.cmake

    r7440 r7520  
    7171
    7272# Overwrite CMake default flags here for the individual configurations
    73 SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -RTC1" Debug          CACHE)
    74 SET_COMPILER_FLAGS("-MD  -O2     -DNDEBUG"       Release        CACHE)
    75 SET_COMPILER_FLAGS("-MD  -O2 -Zi -DNDEBUG"       RelWithDebInfo CACHE)
    76 SET_COMPILER_FLAGS("-MD  -O1     -DNDEBUG"       MinSizeRel     CACHE)
    77 ADD_COMPILER_FLAGS("-D_SECURE_SCL=0"       MSVC9 ReleaseAll     CACHE)
     73SET_COMPILER_FLAGS("-MDd -Od -Oi -Zi -D_DEBUG -RTC1" Debug          CACHE)
     74SET_COMPILER_FLAGS("-MD  -O2         -DNDEBUG"       Release        CACHE)
     75SET_COMPILER_FLAGS("-MD  -O2 -Zi     -DNDEBUG"       RelWithDebInfo CACHE)
     76SET_COMPILER_FLAGS("-MD  -O1         -DNDEBUG"       MinSizeRel     CACHE)
     77ADD_COMPILER_FLAGS("-D_SECURE_SCL=0"           MSVC9 ReleaseAll     CACHE)
     78
     79# Enable non standard floating point optimisations
     80# Note: It hasn't been checked yet whether we have code that might break
     81#ADD_COMPILER_FLAGS("-fp:fast" CACHE)
    7882
    7983# Use Link time code generation for Release config if ORXONOX_RELEASE is defined
Note: See TracChangeset for help on using the changeset viewer.