[llvm-commits] [PATCH][CMake] Connect llvmc tool to the build.

arrowdodger 6yearold at gmail.com
Mon Jul 25 08:00:30 PDT 2011


On Mon, Jul 25, 2011 at 6:10 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:

> > Index: tools/llvmc/src/CMakeLists.txt
> > ===================================================================
> > --- tools/llvmc/src/CMakeLists.txt    (revision 0)
> > +++ tools/llvmc/src/CMakeLists.txt    (revision 0)
> > @@ -0,0 +1,25 @@
> > +set(LLVMGCCCOMMAND ${CMAKE_BINARY_DIR}/bin/clang)
> > +set(LLVMGXXCOMMAND ${CMAKE_BINARY_DIR}/bin/clang++)
>
> The above will stop working once LLVM is installed and the build
> directory removed, or when clang is not included in the build.
>
> Maybe
>
> set(LLVMGCCCOMMAND "${CMAKE_C_COMPILER}")
> set(LLVMGCCCOMMAND "${CMAKE_CXX_COMPILER}")
>
> ?
>

CMAKE_C_COMPILER is not guaranteed to be able to -emit-llvm. As i've
understand, LLVM{GCC,GXX}COMMAND should point to clang, llvm-gcc or
dragonegg.
I've built LLVM with autotools and ran llvmc. It seems, LLVM{GCC,GXX}COMMAND
aren't contain absolute path, but just defaults to llvm-g{cc,++}. And there
is -clang option for llvmc, which changes llvm-g{cc,++} to clang{++}. So,
the soultion here is just

set(LLVMGCCCOMMAND llvm-gcc)
set(LLVMGCCCOMMAND llvm-g++)

But since llvm-gcc is almost dead, isn't it better to make clang default? Of
course, this would require changes in Makefiles for consistency and in llvmc
itself for option update.

> +set(LLVM_USED_LIBS CompilerDriver)
>
> Why do you neeed CompilerDriver ?
>

Because llvmc depends on it. In llvmc/src/Makefile there is line

LLVMC_BASED_DRIVER = llvmc

and in Makefile.rules there are following lines

ifdef LLVMC_BASED_DRIVER

LLVMLIBS = CompilerDriver.a

At last, removing set(LLVM_USED_LIBS CompilerDriver) causes linking
failures.

I've adressed your notes in updated patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110725/495f3089/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvmc.cmake.patch
Type: text/x-patch
Size: 3154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110725/495f3089/attachment.bin>


More information about the llvm-commits mailing list