This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Proposal: Prefer LLDB_VERSION over plist value in EmbedAppleVersion.cmake
AbandonedPublic

Authored by sgraenitz on Dec 5 2018, 5:58 AM.

Details

Reviewers
aprantl
friss
Summary

LLDB_VERSION works analogous to CLANG_VERSION, with the exception that it includes the optional LLDB_VERSION_SUFFIX. Thus it should be equal to LLDB_VERSION_STRING and we could use it instead of extracting the plist value.

My preference would be to streamline version handling completely, including the code using it:

if(APPLE)
  set(apple_version_inc "${CMAKE_CURRENT_BINARY_DIR}/AppleVersion.inc")
  set(apple_version_script "${LLDB_SOURCE_DIR}/cmake/modules/EmbedAppleVersion.cmake")
  set(info_plist ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist)

  # Create custom target to generate the VC revision include.
  add_custom_command(OUTPUT "${apple_version_inc}"
    DEPENDS "${apple_version_script}" "${info_plist}"
    COMMAND
    ${CMAKE_COMMAND} "-DLLDB_INFO_PLIST=${info_plist}"
                     "-DHEADER_FILE=${apple_version_inc}"
                     -P "${apple_version_script}")

  # Mark the generated header as being generated.
  set_source_files_properties("${apple_version_inc}"
    PROPERTIES GENERATED TRUE
               HEADER_FILE_ONLY TRUE)

  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
  set_property(SOURCE lldb.cpp APPEND PROPERTY 
               COMPILE_DEFINITIONS "HAVE_APPLE_VERSION_INC")
  list(APPEND lldbBase_SOURCES ${apple_version_inc})
else()

What do you think?

Event Timeline

sgraenitz created this revision.Dec 5 2018, 5:58 AM
friss added a comment.Dec 5 2018, 7:53 AM

Wouldn't it make even more sense to to inject LLDB_VERSION into the Info.plist? We will use the Info.plist afterwards, right?

In order to reduce the risk of breaking the Xcode build, I use a separate resources/LLDB-Info.plist.in (https://reviews.llvm.org/D55328#change-SBZDFQxftWtU) for the framework. I did not yet change which plist is used here, but yes writing the correct version would be ideal I belief.

sgraenitz abandoned this revision.Jul 30 2019, 7:59 AM

This was fixed quite some time ago.