[llvm] r320413 - [cmake] Pass TARGETS_TO_BUILD through to host tools build

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 14:04:26 PST 2017


Alex Bradbury <asb at lowrisc.org> writes:
> On 12 December 2017 at 13:32, Don Hinton via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Yes, for this to work, we'd need to pass LLVM_EXPERIMENTAL_TARGETS_TO_BUILD
>> as well.
>>
>> However, since Native is the only target actually used, I'd lean toward
>> reverting this change and perhaps adding a comment.

This isn't true, Native is not used (in fact, most of my builds don't
have it or the equivalent, which is part of why I made this change). It
would make just as much sense to pass in an empty target list.

>>
>> hth...
>> don
>
> Many thanks Don. I hadn't spotted that experimental targets are
> tolerated in LLVM_TARGETS_TO_BUILD if they're listed in
> LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.
>
> Justin: which resolution would you prefer? Passing through an escaped
> LLVM_EXPERIMENTAL_TARGETS_TO_BUILD does fix the build for me. So does
> reverting of course :)

The way EXPERIMENTAL_TARGETS_TO_BUILD works is kind of insane. It really
doesn't make sense that saying TARGETS_TO_BUILD=RISCV doesn't just
work. I think the correct medium/long term solution is to rework
experimental targets so you can add them to the regular targets list,
but they just aren't included as part of the default "All". Maybe also
allow things like "All;RISCV", "Experimental", and "All;Experimental".

Of course, I'm not sure if you or I have the bandwidth to take on fixing
that right now, so the below seems fine as a short term solution. It
certainly can't hurt anything. Feel free to commit that.

> diff --git a/cmake/modules/CrossCompile.cmake b/cmake/modules/CrossCompile.cmake
> index 117eda7..0ec76ea 100644
> --- a/cmake/modules/CrossCompile.cmake
> +++ b/cmake/modules/CrossCompile.cmake
> @@ -40,12 +40,15 @@ function(llvm_create_cross_target_internal
> target_name toolchain buildtype)
>    # them to spaces.
>    string(REPLACE ";" "$<SEMICOLON>" targets_to_build_arg
>           "${LLVM_TARGETS_TO_BUILD}")
> +  string(REPLACE ";" "$<SEMICOLON>" experimental_targets_to_build_arg
> +         "${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}")
>
>    add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt
>      COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
>          ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
>          -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
>          -DLLVM_TARGETS_TO_BUILD="${targets_to_build_arg}"
> +        -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${experimental_targets_to_build_arg}"
>          ${build_type_flags} ${linker_flag} ${external_clang_dir}
>      WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
>      DEPENDS CREATE_LLVM_${target_name}
>
>
> Best,
>
> Alex


More information about the llvm-commits mailing list