Spaces:
Sleeping
Sleeping
File size: 6,048 Bytes
31726e5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
ifeq ($(OS),$(filter $(OS),Linux Darwin))
ifndef USEPGCXX
CUDACC_FLAGS += -Xcompiler "-Wall -Wextra -Werror"
ifdef USEXLC
CXX_STD := c++14
# GCC does not warn about unused parameters in uninstantiated
# template functions, but xlC does. This causes xlC to choke on the
# OMP backend, which is mostly #ifdef'd out when you aren't using it.
CUDACC_FLAGS += -Xcompiler "-Wno-unused-parameter"
# xlC is unreasonable about unused functions in a translation unit
# when this warning is enabled; this includes warning on most functions
# that are defined as static inline in cuda_fp16.h. Disable this warning
# entirely under xlC.
CUDACC_FLAGS += -Xcompiler "-Wno-unused-function"
else # GCC, ICC or Clang AKA the sane ones.
# XXX Enable -Wcast-align.
CUDACC_FLAGS += -Xcompiler "-Winit-self -Woverloaded-virtual -Wno-cast-align -Wcast-qual -Wno-long-long -Wno-variadic-macros -Wno-unused-function"
ifdef USE_CLANGLLVM
IS_CLANG := 1
endif
ifeq ($(ABITYPE), androideabi)
ifneq ($(findstring clang, $(BASE_COMPILER)),)
IS_CLANG := 1
endif
endif
ifeq ($(OS), Darwin)
IS_CLANG := 1
endif
ifdef IS_CLANG
CXX_STD := c++14
ifdef USE_CLANGLLVM
CLANG_VERSION = $(shell $(USE_CLANGLLVM) --version 2>/dev/null | head -1 | sed -e 's/.*\([0-9]\)\.\([0-9]\)\(\.[0-9]\).*/\1\2/g')
else
CLANG_VERSION = $(shell $(CCBIN) --version 2>/dev/null | head -1 | sed -e 's/.*\([0-9]\)\.\([0-9]\)\(\.[0-9]\).*/\1\2/g')
endif
# GCC does not warn about unused parameters in uninstantiated
# template functions, but Clang does. This causes Clang to choke on the
# OMP backend, which is mostly #ifdef'd out when you aren't using it.
CUDACC_FLAGS += -Xcompiler "-Wno-unused-parameter"
# -Wunneeded-internal-declaration misfires in the unit test framework
# on older versions of Clang.
CUDACC_FLAGS += -Xcompiler "-Wno-unneeded-internal-declaration"
ifeq ($(shell if test $(CLANG_VERSION) -ge 60; then echo true; fi),true)
# Clang complains about name mangling changes due to `noexcept`
# becoming part of the type system; we don't care.
CUDACC_FLAGS += -Xcompiler "-Wno-noexcept-type"
endif
else # GCC
ifdef CCBIN
CCBIN_ENVIRONMENT :=
ifeq ($(OS), QNX)
# QNX's GCC complains if QNX_HOST and QNX_TARGET aren't defined in the
# environment.
CCBIN_ENVIRONMENT := QNX_HOST=$(QNX_HOST) QNX_TARGET=$(QNX_TARGET)
endif
# Newer versions of GCC only print the major number with the
# -dumpversion flag, but they print all three with -dumpfullversion.
GCC_VERSION = $(shell $(CCBIN_ENVIRONMENT) $(CCBIN) -dumpfullversion 2>/dev/null | sed -e 's/\([0-9]\)\.\([0-9]\)\(\.[0-9]\)\?/\1\2/g')
ifeq ($(GCC_VERSION),)
# Older versions of GCC (~4.4 and older) seem to print three version
# numbers (major, minor and patch) with the -dumpversion flag; newer
# versions only print one or two numbers.
GCC_VERSION = $(shell $(CCBIN_ENVIRONMENT) $(CCBIN) -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\(\.[0-9]\)\?/\1\2/g')
endif
ifeq ($(shell if test $(GCC_VERSION) -ge 50; then echo true; fi),true)
CXX_STD := c++14
else
CUDACC_FLAGS += -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT
endif
ifeq ($(shell if test $(GCC_VERSION) -ge 73; then echo true; fi),true)
# GCC 7.3 complains about name mangling changes due to `noexcept`
# becoming part of the type system; we don't care.
CUDACC_FLAGS += -Xcompiler "-Wno-noexcept-type"
endif
ifeq ($(shell if test $(GCC_VERSION) -ge 80; then echo true; fi),true)
# GCC 8.x has a new warning that tries to diagnose technical misuses of
# memcpy and memmove. We need to resolve it better than this, but for the
# time being, we'll downgrade it from an error to a warning.
CUDACC_FLAGS += -Xcompiler "-Wno-error=class-memaccess"
endif
else
$(error CCBIN is not defined.)
endif
endif
endif
else
CXX_STD := c++14
endif
else ifeq ($(OS),win32)
CXX_STD := c++14
# XXX Enable /Wall
CUDACC_FLAGS += -Xcompiler "/WX"
# Disabled loss-of-data conversion warnings.
# XXX Re-enable.
CUDACC_FLAGS += -Xcompiler "/wd4244 /wd4267"
# Suppress numeric conversion-to-bool warnings.
# XXX Re-enable.
CUDACC_FLAGS += -Xcompiler "/wd4800"
# Disable warning about applying unary - to unsigned type.
CUDACC_FLAGS += -Xcompiler "/wd4146"
# Warning about declspec(allocator) on inappropriate function types
CUDACC_FLAGS += -Xcompiler "/wd4494"
# Allow tests to have lots and lots of sections in each translation unit:
CUDACC_FLAGS += -Xcompiler "/bigobj"
endif
# Promote all NVCC warnings into errors
CUDACC_FLAGS += -Werror all-warnings
# Print warning numbers with cudafe diagnostics
CUDACC_FLAGS += -Xcudafe --display_error_number
VERSION_FLAG :=
ifeq ($(OS),$(filter $(OS),Linux Darwin))
ifdef USEPGCXX # PGI
VERSION_FLAG := -V
else
ifdef USEXLC # XLC
VERSION_FLAG := -qversion
else # GCC, ICC or Clang AKA the sane ones.
VERSION_FLAG := --version
endif
endif
else ifeq ($(OS),win32) # MSVC
# cl.exe run without any options will print its version info and exit.
VERSION_FLAG :=
endif
CCBIN_ENVIRONMENT :=
ifeq ($(OS), QNX)
# QNX's GCC complains if QNX_HOST and QNX_TARGET aren't defined in the
# environment.
CCBIN_ENVIRONMENT := QNX_HOST=$(QNX_HOST) QNX_TARGET=$(QNX_TARGET)
endif
$(info #### CCBIN : $(CCBIN))
$(info #### CCBIN VERSION : $(shell $(CCBIN_ENVIRONMENT) $(CCBIN) $(VERSION_FLAG)))
$(info #### CXX_STD : $(CXX_STD))
|