diff options
author | Josh Blum <josh@joshknows.com> | 2010-06-26 23:06:47 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-06-26 23:06:47 -0700 |
commit | a34f930a79a0c626706a5f7532d8f692446d3c35 (patch) | |
tree | a5361d106c0f38187b3eb3e0b661f4a6d4c626cf | |
parent | 0a57031a8a2eee5c490350484b32ac3ccb000b2f (diff) | |
download | uhd-a34f930a79a0c626706a5f7532d8f692446d3c35.tar.gz uhd-a34f930a79a0c626706a5f7532d8f692446d3c35.tar.bz2 uhd-a34f930a79a0c626706a5f7532d8f692446d3c35.zip |
uhd: removed hackery to set performance flags, use release mode.
The correct optimization flags are added when the build type is set to release.
Made a change to set built type to release if not specified, and added build guide notes.
For MSVC, one must set release mode from the visual studio IDE.
-rw-r--r-- | host/CMakeLists.txt | 13 | ||||
-rw-r--r-- | host/docs/build.rst | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 2979b4279..c60372fb9 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -55,6 +55,12 @@ MACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG flag have) ENDIF(${have}) ENDMACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG) +#select the release build type by default to get optimization flags +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") + MESSAGE(STATUS "Build type not specified: defaulting to release.") +ENDIF(NOT CMAKE_BUILD_TYPE) + IF(CMAKE_COMPILER_IS_GNUCXX) UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-Wall HAVE_WALL) UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-Wextra HAVE_WEXTRA) @@ -62,19 +68,14 @@ IF(CMAKE_COMPILER_IS_GNUCXX) UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-ansi HAVE_ANSI) #only export symbols that are declared to be part of the uhd api: UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN) - UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-O3 HAVE_O3) #have some optimizations ENDIF(CMAKE_COMPILER_IS_GNUCXX) IF(MSVC) - #Set the predefined cxx debug flags to have only the debug flags - #because the default flags disable optimization which we want to have. - #Setting CMAKE_BUILD_TYPE to "release" does not seem to fix this issue. - SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd") #FIXME better way to do this? ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS) #avoid warnings from boost::split ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc - ADD_DEFINITIONS(/arch:SSE2 /G7 /O2 /fp:fast) #optimization flags + ADD_DEFINITIONS(/arch:SSE2 /G7) #processor optimization flags ENDIF(MSVC) ######################################################################## diff --git a/host/docs/build.rst b/host/docs/build.rst index f5a8dac8d..a00cefabd 100644 --- a/host/docs/build.rst +++ b/host/docs/build.rst @@ -138,6 +138,7 @@ Generate the project with cmake Build the project in MSVC ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * Open the generated project file in MSVC. +* Change the build type from "Debug" to "Release". * Select the build all target, right click, and choose build. * Select the install target, right click, and choose build. |