ref: c5c986a3a9d3035b4813998a5f903b6758c456c9
parent: a0e14e7117fbb05e0ebcfd891188746096531d02
author: Marcus Asteborg <maastebo@microsoft.com>
date: Mon Apr 13 11:59:50 EDT 2020
cmake - add option for float_approx for IEEE 754 compatible targets Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,9 @@
option(OPUS_ENABLE_FLOAT_API
"Compile with the floating point API (for machines with float library"
ON)
+option(OPUS_FLOAT_APPROX
+ "Enable floating point approximations (Ensure your platform supports IEEE 754 before enabling)"
+ OFF)
option(OPUS_INSTALL_PKG_CONFIG_MODULE "Install PkgConfig module" ON)
option(OPUS_INSTALL_CMAKE_CONFIG_MODULE "Install CMake package config module"
ON)
@@ -171,6 +174,8 @@
add_feature_info(
OPUS_FLOAT_API OPUS_ENABLE_FLOAT_API
"compile with the floating point API (for machines with float library)")
+add_feature_info(OPUS_FLOAT_APPROX OPUS_FLOAT_APPROX
+ "Enable floating point approximations (Ensure your platform supports IEEE 754 before enabling)")
add_feature_info(OPUS_INSTALL_PKG_CONFIG_MODULE OPUS_INSTALL_PKG_CONFIG_MODULE
"install PkgConfig module")
add_feature_info(OPUS_INSTALL_CMAKE_CONFIG_MODULE OPUS_INSTALL_CMAKE_CONFIG_MODULE
@@ -232,6 +237,10 @@
if(NOT MSVC)
target_compile_definitions(opus PRIVATE _FORTIFY_SOURCE=2)
+endif()
+
+if(OPUS_FLOAT_APPROX)
+ target_compile_definitions(opus PRIVATE FLOAT_APPROX)
endif()
if(OPUS_VAR_ARRAYS)