From 4c442a7c896d85026fc367af34902a9db8205478 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:49:07 -0400 Subject: [PATCH] [CMake] Only specify ffp-contract=off for QuickJS --- 3rdparty/CMakeLists.txt | 10 ++++++++++ CMakeLists.txt | 20 -------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 2abaf2280d9..244f0758adb 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -69,6 +69,16 @@ add_subdirectory(optional-lite EXCLUDE_FROM_ALL) add_subdirectory(quickjs-wz EXCLUDE_FROM_ALL) set_property(TARGET quickjs PROPERTY FOLDER "3rdparty") +# QuickJS floating-point compiler settings +if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") + # Enable -ffp-contract=off (if supported) + check_c_compiler_flag(-ffp-contract=off HAS_CFLAG_FFP_CONTRACT_OFF) + if (HAS_CFLAG_FFP_CONTRACT_OFF) + target_compile_options(quickjs PRIVATE "-ffp-contract=off") + endif() +elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC") + # MSVC defaults to /fp:precise +endif() if (WZ_ENABLE_BASIS_UNIVERSAL AND NOT WZ_CI_DISABLE_BASIS_COMPRESS_TEXTURES) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9ec8bbbb7d..a57272e9d32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,26 +229,6 @@ if (HAS_CXXFLAG_FSTACK_CLASH_PROTECTION AND NOT (MINGW OR APPLE)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-clash-protection") endif() -# Global floating-point compiler settings -if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") - # Enable -ffp-contract=off (if supported) - check_c_compiler_flag(-ffp-contract=off HAS_CFLAG_FFP_CONTRACT_OFF) - if (HAS_CFLAG_FFP_CONTRACT_OFF) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffp-contract=off") - endif() -elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC") - # MSVC defaults to /fp:precise -endif() -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - check_cxx_compiler_flag(-ffp-contract=off HAS_CXXFLAG_FFP_CONTRACT_OFF) - if (HAS_CXXFLAG_FFP_CONTRACT_OFF) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffp-contract=off") - endif() -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # MSVC defaults to /fp:precise -endif() - - include(CheckCompilerFlagsOutput) set(WZ_TARGET_ADDITIONAL_PROPERTIES) # Set below to any additional properties that should be added to Warzone targets (src/, lib/*/)