Skip to content

Commit

Permalink
[CMake] Only specify ffp-contract=off for QuickJS
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Oct 15, 2023
1 parent cadedba commit 4c442a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
10 changes: 10 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/*/)
Expand Down

0 comments on commit 4c442a7

Please sign in to comment.