Define _USE_MATH_DEFINES for windows builds.

PiperOrigin-RevId: 286642121
Change-Id: I8ec228fd768df5b20a11cdc63fcf219d6ab24de7
This commit is contained in:
Artem Belevich 2019-12-20 14:37:39 -08:00 committed by TensorFlower Gardener
parent 54041ccde5
commit 42f8dd1f35
7 changed files with 8 additions and 10 deletions

View File

@ -238,6 +238,10 @@ build:linux --copt=-w
build:macos --copt=-w
build:windows --copt=/w
# Tensorflow uses M_* math constants that only get defined by MSVC headers if
# _USE_MATH_DEFINES is defined.
build:windows --copt=/D_USE_MATH_DEFINES
# Default paths for TF_SYSTEM_LIBS
build:linux --define=PREFIX=/usr
build:linux --define=LIBDIR=$(PREFIX)/lib

View File

@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define _USE_MATH_DEFINES
#include <cmath>
#include "tensorflow/cc/ops/array_ops_internal.h"

View File

@ -15,9 +15,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/client/lib/math.h"
// This macro is required to make MSVC defines math constants in math.h
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
#include "tensorflow/compiler/xla/client/lib/arithmetic.h"
#include "tensorflow/compiler/xla/client/lib/constants.h"

View File

@ -18,10 +18,7 @@ limitations under the License.
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
#undef _USE_MATH_DEFINES
#include <algorithm>
#include <type_traits>

View File

@ -15,8 +15,8 @@ limitations under the License.
#include "tensorflow/core/lib/random/random_distributions.h"
#include <math.h>
#include <algorithm>
#include <cmath>
#include <functional>
#include <numeric>
#include <unordered_map>

View File

@ -14,8 +14,6 @@ limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
// This macro is required to make MSVC defines math constants in math.h
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -267,6 +267,8 @@ def get_win_copts(is_external = False):
# "/EHs-c-",
"/wd4577",
"/DNOGDI",
# Also see build:windows lines in tensorflow/opensource_only/.bazelrc
# where we set some other options globally.
]
if is_external:
return WINDOWS_COPTS + ["/UTF_COMPILE_LIBRARY"]