Skip to content

Commit 2a26bfb

Browse files
authored
Define _USE_MATH_DEFINES on Windows where needed (flutter#21166)
1 parent f0a622a commit 2a26bfb

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

flow/BUILD.gn

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ if (enable_unittests) {
174174
"//third_party/skia",
175175
]
176176

177+
if (!defined(defines)) {
178+
defines = []
179+
}
180+
if (is_win) {
181+
# Required for M_PI and others.
182+
defines += [ "_USE_MATH_DEFINES" ]
183+
}
184+
177185
if (is_fuchsia && flutter_enable_legacy_fuchsia_embedder) {
178186
sources += [ "layers/fuchsia_layer_unittests.cc" ]
179187

flow/matrix_decomposition_unittests.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#define _USE_MATH_DEFINES
6-
75
#include "flutter/flow/matrix_decomposition.h"
86

97
#include <cmath>

lib/ui/BUILD.gn

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,15 @@ source_set("ui") {
129129
"//third_party/skia",
130130
]
131131

132+
if (!defined(defines)) {
133+
defines = []
134+
}
132135
if (flutter_enable_skshaper) {
133-
defines = [ "FLUTTER_ENABLE_SKSHAPER" ]
136+
defines += [ "FLUTTER_ENABLE_SKSHAPER" ]
137+
}
138+
if (is_win) {
139+
# Required for M_PI and others.
140+
defines += [ "_USE_MATH_DEFINES" ]
134141
}
135142

136143
if (is_fuchsia && flutter_enable_legacy_fuchsia_embedder) {

lib/ui/painting/canvas.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#define _USE_MATH_DEFINES
6-
75
#include "flutter/lib/ui/painting/canvas.h"
86

97
#include <cmath>

lib/ui/painting/gradient.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#define _USE_MATH_DEFINES
6-
75
#include "flutter/lib/ui/painting/gradient.h"
86

97
#include "third_party/tonic/converter/dart_converter.h"

lib/ui/painting/path.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#define _USE_MATH_DEFINES
6-
75
#include "flutter/lib/ui/painting/path.h"
86

97
#include <cmath>

lib/ui/painting/path_measure.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#define _USE_MATH_DEFINES
6-
75
#include "flutter/lib/ui/painting/path_measure.h"
86

97
#include <cmath>

0 commit comments

Comments
 (0)