diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 63f1fe529108b..70544c675af91 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -174,6 +174,14 @@ if (enable_unittests) { "//third_party/skia", ] + if (!defined(defines)) { + defines = [] + } + if (is_win) { + # Required for M_PI and others. + defines += [ "_USE_MATH_DEFINES" ] + } + if (is_fuchsia && flutter_enable_legacy_fuchsia_embedder) { sources += [ "layers/fuchsia_layer_unittests.cc" ] diff --git a/flow/matrix_decomposition_unittests.cc b/flow/matrix_decomposition_unittests.cc index ab0adc172bb31..bf23937415fb4 100644 --- a/flow/matrix_decomposition_unittests.cc +++ b/flow/matrix_decomposition_unittests.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES - #include "flutter/flow/matrix_decomposition.h" #include diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index 6c72102c2d9b8..841a6afa9c766 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -129,8 +129,15 @@ source_set("ui") { "//third_party/skia", ] + if (!defined(defines)) { + defines = [] + } if (flutter_enable_skshaper) { - defines = [ "FLUTTER_ENABLE_SKSHAPER" ] + defines += [ "FLUTTER_ENABLE_SKSHAPER" ] + } + if (is_win) { + # Required for M_PI and others. + defines += [ "_USE_MATH_DEFINES" ] } if (is_fuchsia && flutter_enable_legacy_fuchsia_embedder) { diff --git a/lib/ui/painting/canvas.cc b/lib/ui/painting/canvas.cc index c066ee3cf772f..68ae4898c176a 100644 --- a/lib/ui/painting/canvas.cc +++ b/lib/ui/painting/canvas.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES - #include "flutter/lib/ui/painting/canvas.h" #include diff --git a/lib/ui/painting/gradient.cc b/lib/ui/painting/gradient.cc index e242258e4ddb7..d71e75a495f94 100644 --- a/lib/ui/painting/gradient.cc +++ b/lib/ui/painting/gradient.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES - #include "flutter/lib/ui/painting/gradient.h" #include "third_party/tonic/converter/dart_converter.h" diff --git a/lib/ui/painting/path.cc b/lib/ui/painting/path.cc index b4b7ab55af84b..d0898a4ca283c 100644 --- a/lib/ui/painting/path.cc +++ b/lib/ui/painting/path.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES - #include "flutter/lib/ui/painting/path.h" #include diff --git a/lib/ui/painting/path_measure.cc b/lib/ui/painting/path_measure.cc index 16d3de021906f..af9e0e9837e1d 100644 --- a/lib/ui/painting/path_measure.cc +++ b/lib/ui/painting/path_measure.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#define _USE_MATH_DEFINES - #include "flutter/lib/ui/painting/path_measure.h" #include