Skip to content

Commit

Permalink
build: correct the install rules for Darwin (tensorflow#1175)
Browse files Browse the repository at this point in the history
We were using the generator expression for the installation of the swift
modules on Darwin.  However, with swift-numerics, the Numerics module
has an implicit link against `_NumericsShims`.  This results in the
interface include directories having multiple values when computed late.
Use `get_target_property` to get the value prior to the additions,
allowing us to rename the file into place.

Thanks to @dan-zheng for reporting the issue!
  • Loading branch information
compnerd authored Jan 5, 2021
1 parent 5538f39 commit d2e3b0c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,17 @@ if(ENABLE_SWIFT_NUMERICS)
DESTINATION lib/swift/${swift_os})
endif()

get_target_property(${module}_INTERFACE_INCLUDE_DIRECTORIES ${module}
INTERFACE_INCLUDE_DIRECTORIES)

if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
install(FILES $<TARGET_PROPERTY:${module},INTERFACE_INCLUDE_DIRECTORIES>/${module}.swiftdoc
DESTINATION lib/swift/${swift_os}/${module}.swiftmodule
install(FILES ${${module}_INTERFACE_INCLUDE_DIRECTORIES}/${module}.swiftdoc
DESTINATION lib/swift/${swift_os}/${module}.swiftmodule/
RENAME ${swift_arch}.swiftdoc)
install(FILES $<TARGET_PROPERTY:${module},INTERFACE_INCLUDE_DIRECTORIES>/${module}.swiftmodule
DESTINATION lib/swift/${swift_os}/${module}.swiftmodule
install(FILES ${${module}_INTERFACE_INCLUDE_DIRECTORIES}/${module}.swiftmodule
DESTINATION lib/swift/${swift_os}/${module}.swiftmodule/
RENAME ${swift_arch}.swiftmodule)
else()
get_target_property(${module}_INTERFACE_INCLUDE_DIRECTORIES ${module}
INTERFACE_INCLUDE_DIRECTORIES)
install(FILES
${${module}_INTERFACE_INCLUDE_DIRECTORIES}/${module}.swiftdoc
${${module}_INTERFACE_INCLUDE_DIRECTORIES}/${module}.swiftmodule
Expand Down

0 comments on commit d2e3b0c

Please sign in to comment.