- Improve help strings for GCC optimization levels.
- Add new -Ofast and -Og levels.
- Simplify gcc.cmake a bit.
- Use MINGW_TOOLCHAIN_SUFFIX.

svn path=/trunk/; revision=58201
This commit is contained in:
Dmitry Gorbachev 2013-01-22 22:38:40 +00:00
parent 7bc3ce6d8e
commit e368e3af90
4 changed files with 42 additions and 49 deletions

View file

@ -7,13 +7,15 @@ set(OARCH "athlon64" CACHE STRING
k8 opteron athlon64 athlon-fx") k8 opteron athlon64 athlon-fx")
set (OPTIMIZE "1" CACHE STRING set (OPTIMIZE "1" CACHE STRING
"What level of optimisation to use. "What level of optimization to use.
0 = off 0 = off
1 = Default option, optimize for size (-Os) with some additional options 1 = Default option, optimize for size (-Os) with some additional options
2 = -Os 2 = Optimize for size (-Os)
3 = -O1 3 = Optimize debugging experience (-Og)
4 = -O2 4 = Optimize (-O1)
5 = -O3") 5 = Optimize even more (-O2)
6 = Optimize yet more (-O3)
7 = Disregard strict standards compliance (-Ofast)")
set(LTCG FALSE CACHE BOOL set(LTCG FALSE CACHE BOOL
"Whether to build with link-time code generation") "Whether to build with link-time code generation")

View file

@ -8,13 +8,15 @@ set(OARCH "armv7-a" CACHE STRING
armv5te armv7-a") armv5te armv7-a")
set (OPTIMIZE "1" CACHE STRING set (OPTIMIZE "1" CACHE STRING
"What level of optimisation to use. "What level of optimization to use.
0 = off 0 = off
1 = Default option, optimize for size (-Os) with some additional options 1 = Default option, optimize for size (-Os) with some additional options
2 = -Os 2 = Optimize for size (-Os)
3 = -O1 3 = Optimize debugging experience (-Og)
4 = -O2 4 = Optimize (-O1)
5 = -O3") 5 = Optimize even more (-O2)
6 = Optimize yet more (-O3)
7 = Disregard strict standards compliance (-Ofast)")
set(LTCG FALSE CACHE BOOL set(LTCG FALSE CACHE BOOL
"Whether to build with link-time code generation") "Whether to build with link-time code generation")

View file

@ -1,25 +1,25 @@
set(SARCH "pc" CACHE STRING set(SARCH "pc" CACHE STRING
"Sub-architecture to build for. Specify one of: xbox") "Sub-architecture to build for. Specify one of:
pc xbox")
set(OARCH "pentium" CACHE STRING set(OARCH "pentium" CACHE STRING
"Generate instructions for this CPU type. Specify one of: "Generate instructions for this CPU type. Specify one of:
native, i386, i486, pentium, pentium-mmx, pentiumpro, i686, pentium, pentiumpro")
pentium2, pentium3, pentium-m, pentium4, prescott, nocona,
core2, k6, k6-2, athlon, athlon-xp, opteron, opteron-sse3,
barcelona, winchip-c6, winchip2, c3, c3-2, geode")
set(TUNE "i686" CACHE STRING set(TUNE "i686" CACHE STRING
"Which CPU ReactOS should be optimized for.") "Which CPU ReactOS should be optimized for.")
set(OPTIMIZE "1" CACHE STRING set(OPTIMIZE "1" CACHE STRING
"What level of optimisation to use. "What level of optimization to use.
0 = off 0 = off
1 = Default option, optimize for size (-Os) with some additional options 1 = Default option, optimize for size (-Os) with some additional options
2 = -Os 2 = Optimize for size (-Os)
3 = -O1 3 = Optimize debugging experience (-Og)
4 = -O2 4 = Optimize (-O1)
5 = -O3") 5 = Optimize even more (-O2)
6 = Optimize yet more (-O3)
7 = Disregard strict standards compliance (-Ofast)")
set(LTCG FALSE CACHE BOOL set(LTCG FALSE CACHE BOOL
"Whether to build with link-time code generation") "Whether to build with link-time code generation")

View file

@ -10,7 +10,7 @@ if(NOT DEFINED SEPARATE_DBG)
endif() endif()
# Compiler Core # Compiler Core
add_compile_flags("-pipe -fms-extensions") add_compile_flags("-pipe -fms-extensions -fno-strict-aliasing")
#bug #bug
#file(TO_NATIVE_PATH ${REACTOS_SOURCE_DIR} REACTOS_SOURCE_DIR_NATIVE) #file(TO_NATIVE_PATH ${REACTOS_SOURCE_DIR} REACTOS_SOURCE_DIR_NATIVE)
@ -28,9 +28,6 @@ else()
add_compile_flags("-gstabs+") add_compile_flags("-gstabs+")
endif() endif()
# Do not allow warnings
add_compile_flags("-Werror")
# For some reason, cmake sets -fPIC, and we don't want it # For some reason, cmake sets -fPIC, and we don't want it
if(DEFINED CMAKE_SHARED_LIBRARY_ASM_FLAGS) if(DEFINED CMAKE_SHARED_LIBRARY_ASM_FLAGS)
string(REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_ASM_FLAGS ${CMAKE_SHARED_LIBRARY_ASM_FLAGS}) string(REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_ASM_FLAGS ${CMAKE_SHARED_LIBRARY_ASM_FLAGS})
@ -44,7 +41,7 @@ else()
endif() endif()
# Warnings # Warnings
add_compile_flags("-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-unused-value") add_compile_flags("-Werror -Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-unused-value")
if(GCC_VERSION VERSION_LESS 4.6) if(GCC_VERSION VERSION_LESS 4.6)
add_compile_flags("-Wno-error=uninitialized") add_compile_flags("-Wno-error=uninitialized")
@ -62,15 +59,19 @@ endif()
# Optimizations # Optimizations
if(OPTIMIZE STREQUAL "1") if(OPTIMIZE STREQUAL "1")
add_compile_flags("-Os") add_compile_flags("-Os -ftracer")
elseif(OPTIMIZE STREQUAL "2") elseif(OPTIMIZE STREQUAL "2")
add_compile_flags("-Os") add_compile_flags("-Os")
elseif(OPTIMIZE STREQUAL "3") elseif(OPTIMIZE STREQUAL "3")
add_compile_flags("-O1") add_compile_flags("-O1 -fno-inline-functions-called-once -fno-tree-sra")
elseif(OPTIMIZE STREQUAL "4") elseif(OPTIMIZE STREQUAL "4")
add_compile_flags("-O2") add_compile_flags("-O1")
elseif(OPTIMIZE STREQUAL "5") elseif(OPTIMIZE STREQUAL "5")
add_compile_flags("-O2")
elseif(OPTIMIZE STREQUAL "6")
add_compile_flags("-O3") add_compile_flags("-O3")
elseif(OPTIMIZE STREQUAL "7")
add_compile_flags("-Ofast")
endif() endif()
# Link-time code generation # Link-time code generation
@ -78,25 +79,13 @@ if(LTCG)
add_compile_flags("-flto -Wno-error=clobbered") add_compile_flags("-flto -Wno-error=clobbered")
endif() endif()
add_compile_flags("-fno-strict-aliasing")
if(ARCH STREQUAL "i386") if(ARCH STREQUAL "i386")
add_compile_flags("-mpreferred-stack-boundary=3 -fno-set-stack-executable -fno-optimize-sibling-calls -fno-omit-frame-pointer") add_compile_flags("-mpreferred-stack-boundary=3 -fno-set-stack-executable -fno-optimize-sibling-calls -fno-omit-frame-pointer")
if(OPTIMIZE STREQUAL "1")
add_compile_flags("-ftracer")
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_flags("-momit-leaf-frame-pointer") add_compile_flags("-momit-leaf-frame-pointer")
endif() endif()
endif()
elseif(ARCH STREQUAL "amd64") elseif(ARCH STREQUAL "amd64")
add_compile_flags("-mpreferred-stack-boundary=4") add_compile_flags("-mpreferred-stack-boundary=4")
if(OPTIMIZE STREQUAL "1")
add_compile_flags("-ftracer")
endif()
elseif(ARCH STREQUAL "arm")
if(OPTIMIZE STREQUAL "1")
add_compile_flags("-ftracer")
endif()
endif() endif()
# Other # Other
@ -174,7 +163,7 @@ SET(CMAKE_CXX_COMPILE_OBJECT "${CCACHE} <CMAKE_CXX_COMPILER> <DEFINES> <FLAGS>
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>") set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>")
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 ${I18N_DEFS} <DEFINES> <SOURCE> <OBJECT>") set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 ${I18N_DEFS} <DEFINES> <SOURCE> <OBJECT>")
set(CMAKE_DEPFILE_FLAGS_RC "--preprocessor \"${MINGW_TOOLCHAIN_PREFIX}gcc -E -xc-header -MMD -MF <DEPFILE> -MT <OBJECT>\" ") set(CMAKE_DEPFILE_FLAGS_RC "--preprocessor \"${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX} -E -xc-header -MMD -MF <DEPFILE> -MT <OBJECT>\" ")
# Optional 3rd parameter: stdcall stack bytes # Optional 3rd parameter: stdcall stack bytes
function(set_entrypoint MODULE ENTRYPOINT) function(set_entrypoint MODULE ENTRYPOINT)