diff --git a/configure.py b/configure.py index 2b404bd77c..cf87c9d21e 100755 --- a/configure.py +++ b/configure.py @@ -203,6 +203,8 @@ def _run_command(self, cmdline: str) -> None: print('when running: ', cmdline) raise +def is_clang_cl(cxx: str) -> bool: + return cxx.endswith('clang-cl.exe') or cxx.endswith('clang-cl') parser = OptionParser() profilers = ['gmon', 'pprof'] @@ -282,7 +284,8 @@ def _run_command(self, cmdline: str) -> None: CXX = configure_env.get('CXX', 'c++') objext = '.o' if platform.is_msvc(): - CXX = 'cl' + if not is_clang_cl(CXX): + CXX = 'cl' objext = '.obj' def src(filename: str) -> str: @@ -355,6 +358,11 @@ def search_system_path(file_name: str) -> Optional[str]: # type: ignore # Missi if not options.debug: cflags += ['/Ox', '/DNDEBUG', '/GL'] ldflags += ['/LTCG', '/OPT:REF', '/OPT:ICF'] + if is_clang_cl(CXX): + # argument unused during compilation: '/GL' + cflags.remove('/GL') + # /LTCG specified but no code generation required + ldflags.remove('/LTCG') else: cflags = ['-g', '-Wall', '-Wextra', '-Wno-deprecated', @@ -745,7 +753,7 @@ def has_re2c() -> bool: implicit=mainpage) n.newline() -if not host.is_mingw(): +if not host.is_windows() or not configure_env: n.comment('Regenerate build files if build script changes.') n.rule('configure', command='${configure_env}%s $root/configure.py $configure_args' %