[LLVMdev] Understanding some of the recent cmake build changes
NAKAMURA Takumi
geek4civic at gmail.com
Thu Feb 27 06:29:23 PST 2014
Rafael, thanks to explain with clear examples.
Although target_link_libraries(INTERFACE) can cut deps among
libraries, files in add_executable() will be still serialized.
For example,
build tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o:
CXX_COMPILER /home/chapuni/llvm-project/clang/utils/TableGen/TableGen.cpp
|| lib/libLLVMTableGen.a lib/libLLVMSupport.a
If TableGen.cpp would be made free from *.a, we should introduce
objlib stuff for add_executable().
See also my tddeps patch.
2014-02-27 10:08 GMT+09:00 Rafael EspĂndola <rafael.espindola at gmail.com>:
> I was a bit confused with what the difference was between the old
>
> target_link_libraries(foo bar)
>
> and the new
>
> target_link_libraries(foo INTERFACE|PRIVATE|PUBLIC bar)
>
> To try to find out, I decided to look at the generated build.ninja.
> The difference that shows up is far fewer order only dependencies. For
> example
>
> build lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o:
> CXX_COMPILER /home/espindola/llvm/llvm/lib/TableGen/Error.cpp ||
> lib/libLLVMSupport.a
>
> becomes just
>
> build lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o:
> CXX_COMPILER /home/espindola/llvm/llvm/lib/TableGen/Error.cpp
>
> The net result is that in the old system running
>
> ninja ./lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o
>
> on a tree just after running cmake would execute 91 commands to build
> lib/libLLVMSupport.a and then Error.cpp.o. On the new system only one
> command is executed :-)
>
> In a more realistic situation, Error.cpp.o will be compiled in
> parallel with the files needed to build lib/libLLVMSupport.a.
>
> Cheers,
> Rafael
More information about the llvm-dev
mailing list