Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Asteborg <maastebo@microsoft.com>2020-04-14 02:14:49 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2020-04-21 05:47:57 +0300
commit7f035cc695247b7392990963a265d03f17791ab1 (patch)
treea5fb187d8c40d774bdce7f9a8c872bb71b2d2485 /CMakeLists.txt
parentc5c986a3a9d3035b4813998a5f903b6758c456c9 (diff)
cmake - add option for fast math
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 995109b8..b69aab29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,20 @@ cmake_dependent_option(OPUS_NONTHREADSAFE_PSEUDOSTACK
"NOT OPUS_VAR_ARRAYS; NOT OPUS_USE_ALLOCA"
OFF)
+cmake_dependent_option(OPUS_FAST_MATH
+ "Enable fast math"
+ ON
+ "OPUS_FLOAT_APPROX; OPUS_FAST_MATH"
+ OFF)
+
+if(OPUS_FAST_MATH)
+ if(MSVC)
+ check_and_set_flag(FAST_MATH /fp:fast)
+ else()
+ check_and_set_flag(FAST_MATH -ffast-math)
+ endif()
+endif()
+
if(OPUS_BUILD_SHARED_LIBRARY OR BUILD_SHARED_LIBS)
# Global flag to cause add_library() to create shared libraries if on.
set(BUILD_SHARED_LIBS ON)
@@ -176,6 +190,7 @@ add_feature_info(
"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_FAST_MATH FAST_MATH_SUPPORTED "Enable fast math, (depending on OPUS_FLOAT_APPROX to be enabled)")
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