Unverified Commit 46b2cb37 authored by Zaida Zhou's avatar Zaida Zhou Committed by GitHub
Browse files

[Fix] Fix the compiled error on windows due to the c++14 flag (#1526)

* [Fix] Fix the compiled error on windows due to the c++14 flag

* fix lint
parent d4d6ea09
import glob import glob
import os import os
import platform
import re import re
from pkg_resources import DistributionNotFound, get_distribution from pkg_resources import DistributionNotFound, get_distribution
from setuptools import find_packages, setup from setuptools import find_packages, setup
...@@ -223,7 +224,17 @@ def get_extensions(): ...@@ -223,7 +224,17 @@ def get_extensions():
os.environ.setdefault('MAX_JOBS', str(cpu_use)) os.environ.setdefault('MAX_JOBS', str(cpu_use))
define_macros = [] define_macros = []
extra_compile_args = {'cxx': ['-std=c++14']} extra_compile_args = {}
# Since the PR (https://github.com/open-mmlab/mmcv/pull/1463) uses
# c++14 features, the argument ['std=c++14'] must be added here.
# However, in the windows environment, some standard libraries
# will depend on c++17 or higher. In fact, for the windows
# environment, the compiler will choose the appropriate compiler
# to compile those cpp files, so there is no need to add the
# argument
if platform.system() != 'Windows':
extra_compile_args['cxx'] = ['-std=c++14']
include_dirs = [] include_dirs = []
is_rocm_pytorch = False is_rocm_pytorch = False
...@@ -271,7 +282,14 @@ def get_extensions(): ...@@ -271,7 +282,14 @@ def get_extensions():
extension = CppExtension extension = CppExtension
include_dirs.append(os.path.abspath('./mmcv/ops/csrc/common')) include_dirs.append(os.path.abspath('./mmcv/ops/csrc/common'))
if 'nvcc' in extra_compile_args: # Since the PR (https://github.com/open-mmlab/mmcv/pull/1463) uses
# c++14 features, the argument ['std=c++14'] must be added here.
# However, in the windows environment, some standard libraries
# will depend on c++17 or higher. In fact, for the windows
# environment, the compiler will choose the appropriate compiler
# to compile those cpp files, so there is no need to add the
# argument
if 'nvcc' in extra_compile_args and platform.system() != 'Windows':
extra_compile_args['nvcc'] += ['-std=c++14'] extra_compile_args['nvcc'] += ['-std=c++14']
ext_ops = extension( ext_ops = extension(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment