Skip to content

Commit

Permalink
Build: Set FLOATTEST* by default for AArch64, PPC
Browse files Browse the repository at this point in the history
Because of 47656a0, we can now
reliably determine the correct default values for FLOATTEST8 and
FLOATTEST12 when using Clang or GCC to build for AArch64 or PowerPC
platforms.  (Testing confirms that this is the case with GCC 5-13 and
Clang 5-14 on Ubuntu/AArch64, GCC 4 on CentOS 7/PPC, and GCC 8-10 and
Clang 6-12 on Ubuntu/PPCLE.)  Other CPU architectures and compilers can
be added on a case-by-case basis as they are tested.
  • Loading branch information
dcommander committed Oct 11, 2023
1 parent da48edf commit 5b2beb4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Expand Up @@ -894,6 +894,17 @@ if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386")
elseif(CPU_TYPE STREQUAL "x86_64")
set(DEFAULT_FLOATTEST8 no-fp-contract)
endif()
elseif(CPU_TYPE STREQUAL "powerpc" OR CPU_TYPE STREQUAL "arm64")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL 14.0.0 OR
CMAKE_C_COMPILER_VERSION VERSION_GREATER 14.0.0)
set(DEFAULT_FLOATTEST8 fp-contract)
else()
set(DEFAULT_FLOATTEST8 no-fp-contract)
endif()
elseif(CMAKE_COMPILER_IS_GNUCC)
set(DEFAULT_FLOATTEST8 fp-contract)
endif()
# else we can't really set an intelligent default for FLOATTEST8. The
# appropriate value could be no-fp-contract, fp-contract, 387, or msvc,
# depending on the compiler and compiler options. We leave it to the user to
Expand Down Expand Up @@ -925,6 +936,17 @@ endif()

if(CPU_TYPE STREQUAL "x86_64")
set(DEFAULT_FLOATTEST12 no-fp-contract)
elseif(CPU_TYPE STREQUAL "powerpc" OR CPU_TYPE STREQUAL "arm64")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL 14.0.0 OR
CMAKE_C_COMPILER_VERSION VERSION_GREATER 14.0.0)
set(DEFAULT_FLOATTEST12 fp-contract)
else()
set(DEFAULT_FLOATTEST12 no-fp-contract)
endif()
elseif(CMAKE_COMPILER_IS_GNUCC)
set(DEFAULT_FLOATTEST12 fp-contract)
endif()
# else we can't really set an intelligent default for FLOATTEST12. The
# appropriate value could be no-fp-contract, fp-contract, or something else,
# depending on the compiler and compiler options. We leave it to the user to
Expand Down

0 comments on commit 5b2beb4

Please sign in to comment.