diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-29 08:37:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-30 11:28:43 +0200 |
commit | 39e7a72b3e328e6b3d87479d693b01315610457b (patch) | |
tree | 2e07a1fe514a34fcca223a8e608c32a53ce475ad /config_host.mk.in | |
parent | 6a9d90fd4d89359ec11711e581010011fd25807b (diff) |
Support loplugin in clang-cl
This works at least with a recent Clang trunk (towards Clang 6.0).
In order for the plugin.dll to find the LLVM/Clang symbols, it needs to be
loaded into clang.exe not clang-cl.exe, so set CC/CXX to 'clang.exe
--driver-mode=cl ...'.
Buidling the plugin requires some linker flags that must go at the very end of
the COMPILER_PLUGINS_CXX command line, after a /link switch, so introduce
another COMPILER_PLUGINS_CXX_LINKFLAGS variable for that. Also, clang.lib is
not installed as part of LLVM's 'cmake --build ... --target install' step, so
is not available under CLANGDIR and needs to be taken from the build tree
instead, so introduce another CLANGLIBDIR variable for that. autogen.input
settings that work for me on Windows 8.1 with Microsoft Visual Studio 14.0 are:
> CLANGDIR=C:/llvm/inst
> CLANGLIBDIR=C:/llvm/build/lib
> COMPILER_PLUGINS_CXX=C:/PROGRA~2/MICROS~3.0/VC/bin/amd64/cl.exe /IC:\PROGRA~2\MICROS~3.0\VC\INCLUDE /IC:\PROGRA~2\MICROS~3.0\VC\ATLMFC\INCLUDE /IC:\PROGRA~2\WI3CF2~1\10\include\100102~1.0\ucrt /IC:\PROGRA~2\WI3CF2~1\NETFXSDK\46D346~1.1\include\um /IC:\PROGRA~2\WI3CF2~1\8.1\include\shared /IC:\PROGRA~2\WI3CF2~1\8.1\include\um /IC:\PROGRA~2\WI3CF2~1\8.1\include\winrt
> COMPILER_PLUGINS_CXX_LINKFLAGS=/LIBPATH:C:/PROGRA~2/MICROS~3.0/VC/LIB/amd64 /LIBPATH:C:/PROGRA~2/MICROS~3.0/VC/ATLMFC/LIB/amd64 /LIBPATH:C:/PROGRA~2/WI3CF2~1/10/lib/100102~1.0/ucrt/x64 /LIBPATH:C:/PROGRA~2/WI3CF2~1/NETFXSDK/46D346~1.1/lib/um/x64 /LIBPATH:C:/PROGRA~2/WI3CF2~1/8.1/lib/winv6.3/um/x64
(The last two are "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/
amd64/cl.exe" and translations of %INCLUDE% and %LIB% as set in the "VS2015 x64
Native Tools Command Prompt" shell.
AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h, ...) in configure.ac wouldn't
like CXX to start with INCLUDE=... LIB=... environment variable settings, so it
wouldn't work to instead pass %INCLUDE% and %LIB% to cl.exe that way. See
<https://wiki.documentfoundation.org/Development/clang-cl> for general
information about building with clang-cl on Windows.)
There's still some room for improvement marked "TODO". (And some of the unused*
plugins, which are not run by default anyway, use Unix-style functionality, so
have been disabled for now.)
Change-Id: I6c28bdeb801af39ce2bae03111f455e2338d66c9
Reviewed-on: https://gerrit.libreoffice.org/42931
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'config_host.mk.in')
-rw-r--r-- | config_host.mk.in | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index 1903d31c898c..eae6050bc262 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -60,6 +60,7 @@ export CDR_CFLAGS=$(gb_SPACE)@CDR_CFLAGS@ export CDR_LIBS=$(gb_SPACE)@CDR_LIBS@ @x_CFLAGS@ export CFLAGS=@CFLAGS@ export CLANGDIR=@CLANGDIR@ +export CLANGLIBDIR=@CLANGLIBDIR@ export CLUCENE_CFLAGS=$(gb_SPACE)@CLUCENE_CFLAGS@ export CLUCENE_LIBS=$(gb_SPACE)@CLUCENE_LIBS@ export LIBCMIS_CFLAGS=$(gb_SPACE)@LIBCMIS_CFLAGS@ @@ -72,6 +73,7 @@ export COMMONS_LOGGING_VERSION=@COMMONS_LOGGING_VERSION@ export COMPATH=@COMPATH@ export COMPILER_PLUGINS=@COMPILER_PLUGINS@ export COMPILER_PLUGINS_CXX=@COMPILER_PLUGINS_CXX@ +export COMPILER_PLUGINS_CXX_LINKFLAGS=@COMPILER_PLUGINS_CXX_LINKFLAGS@ export COM_IS_CLANG=@COM_IS_CLANG@ export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@ export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@ |