[llvm] r288632 - [CMake] Refactor add_llvm_tool_symlink for reuse

Greg Bedwell via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 09:49:09 PST 2016


r288679 fixes it for the VS build here.  Thanks for the quick fix!

-Greg

On 5 December 2016 at 17:13, Chris Bieneman <beanz at apple.com> wrote:

> I think this is squared away with r288679. I tested with the Xcode
> generator, and it seems to be doing the right thing. Can you verify that it
> fixes VS as well?
>
> Thanks,
> -Chris
>
> On Dec 5, 2016, at 8:42 AM, Chris Bieneman via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> Looking into this now. Thanks for the heads up.
>
> -Chris
>
> On Dec 5, 2016, at 5:20 AM, Greg Bedwell <gregbedwell at gmail.com> wrote:
>
> Hi,
>
> Looks like this commit has caused new failures when using the
> multi-configuration Visual Studio CMake generators (e.g. "Visual Studio 14
> 2015 Win64".  All the regular executables are going to the expected place:
> "<build>/Release/bin", "<build>/Debug/bin", etc. but the "symlink" files
> (actually just copies on Windows) now get placed in "<build>/bin" instead:
>
>   Failing Tests (6):
>       LLVM :: LibDriver/infer-output-path.test
>       LLVM :: LibDriver/libpath.test
>       LLVM :: LibDriver/no-inputs.test
>       LLVM :: LibDriver/thin.test
>       LLVM :: Object/archive-symtab.test
>       LLVM :: Object/nm-archive.test
>
> The fails are all of this sort of form:
> "'C:/work/public-git/upstream-llvm/build-vs2015-ps4-master/Release/bin/llvm-lib':
> command not found"
>
> Cheers,
> Greg
>
>
>
> On 5 December 2016 at 03:28, Chris Bieneman via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: cbieneman
>> Date: Sun Dec  4 21:28:03 2016
>> New Revision: 288632
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=288632&view=rev
>> Log:
>> [CMake] Refactor add_llvm_tool_symlink for reuse
>>
>> The old implementation of add_llvm_tool_symlink could fail in odd ways
>> when building out of tree. This version solves that problem by not using
>> the LLVM_* variables, and instead reaeding the target's properties.
>>
>> Modified:
>>     llvm/trunk/cmake/modules/AddLLVM.cmake
>>
>> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules
>> /AddLLVM.cmake?rev=288632&r1=288631&r2=288632&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
>> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Sun Dec  4 21:28:03 2016
>> @@ -1288,43 +1288,54 @@ function(llvm_install_symlink name dest)
>>    endif()
>>  endfunction()
>>
>> -function(add_llvm_tool_symlink name dest)
>> -  cmake_parse_arguments(ARG "ALWAYS_GENERATE" "" "" ${ARGN})
>> +function(add_llvm_tool_symlink link_name target)
>> +  cmake_parse_arguments(ARG "ALWAYS_GENERATE" "OUTPUT_DIR" "" ${ARGN})
>> +  if(NOT ARG_OUTPUT_DIR)
>> +    get_target_property(target_type ${target} TYPE)
>> +    if(${target_type} STREQUAL "STATIC_LIBRARY")
>> +      get_target_property(ARG_OUTPUT_DIR ${target}
>> ARCHIVE_OUTPUT_DIRECTORY)
>> +    elseif(UNIX AND ${target_type} STREQUAL "SHARED_LIBRARY")
>> +      get_target_property(ARG_OUTPUT_DIR ${target}
>> LIBRARY_OUTPUT_DIRECTORY)
>> +    else()
>> +      get_target_property(ARG_OUTPUT_DIR ${target}
>> RUNTIME_OUTPUT_DIRECTORY)
>> +    endif()
>> +  endif()
>> +
>>    if(UNIX)
>>      set(LLVM_LINK_OR_COPY create_symlink)
>> -    set(dest_binary "${dest}${CMAKE_EXECUTABLE_SUFFIX}")
>> +    set(dest_binary "$<TARGET_FILE_NAME:${target}>")
>>    else()
>>      set(LLVM_LINK_OR_COPY copy)
>> -    set(dest_binary "${LLVM_RUNTIME_OUTPUT_INTDIR}
>> /${dest}${CMAKE_EXECUTABLE_SUFFIX}")
>> +    set(dest_binary "$<TARGET_FILE:${target}>")
>>    endif()
>>
>> -  set(output_path "${LLVM_RUNTIME_OUTPUT_INTDIR}
>> /${name}${CMAKE_EXECUTABLE_SUFFIX}")
>> +  set(output_path "${ARG_OUTPUT_DIR}/${link_name
>> }${CMAKE_EXECUTABLE_SUFFIX}")
>>
>> -  set(target_name ${name})
>> -  if(TARGET ${name})
>> -    set(target_name ${name}-link)
>> +  set(target_name ${link_name})
>> +  if(TARGET ${link_name})
>> +    set(target_name ${link_name}-link)
>>    endif()
>>
>>
>>    if(ARG_ALWAYS_GENERATE)
>>      set_property(DIRECTORY APPEND PROPERTY
>>        ADDITIONAL_MAKE_CLEAN_FILES ${dest_binary})
>> -    add_custom_command(TARGET ${dest} POST_BUILD
>> +    add_custom_command(TARGET ${target} POST_BUILD
>>        COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${dest_binary}"
>> "${output_path}")
>>    else()
>>      add_custom_command(OUTPUT ${output_path}
>>                       COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY}
>> "${dest_binary}" "${output_path}"
>> -                     DEPENDS ${dest})
>> -    add_custom_target(${target_name} ALL DEPENDS ${output_path})
>> +                     DEPENDS ${target})
>> +    add_custom_target(${target_name} ALL DEPENDS ${target}
>> ${output_path})
>>      set_target_properties(${target_name} PROPERTIES FOLDER Tools)
>>
>>      # Make sure both the link and target are toolchain tools
>> -    if (${name} IN_LIST LLVM_TOOLCHAIN_TOOLS AND ${dest} IN_LIST
>> LLVM_TOOLCHAIN_TOOLS)
>> +    if (${link_name} IN_LIST LLVM_TOOLCHAIN_TOOLS AND ${target} IN_LIST
>> LLVM_TOOLCHAIN_TOOLS)
>>        set(TOOL_IS_TOOLCHAIN ON)
>>      endif()
>>
>>      if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND
>> LLVM_BUILD_TOOLS)
>> -      llvm_install_symlink(${name} ${dest})
>> +      llvm_install_symlink(${link_name} ${target})
>>      endif()
>>    endif()
>>  endfunction()
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161205/f1f7cda9/attachment.html>


More information about the llvm-commits mailing list