Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit eaa1c8e

Browse files
authored
build: add _SwiftNumerics and link against it (#1128)
Use an interface link dependency on `_SwiftNumerics` to allow `Numerics` to implicitly load the necessary paths for the library.
1 parent c0d1520 commit eaa1c8e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,24 @@ if(ENABLE_SWIFT_NUMERICS)
7979
TRUE
8080
STEP_TARGETS
8181
build)
82+
ExternalProject_Get_Property(swift-numerics SOURCE_DIR)
8283
ExternalProject_Get_Property(swift-numerics BINARY_DIR)
8384

8485
import_module(Numerics ${BINARY_DIR} swift-numerics-build)
8586
import_module(ComplexModule ${BINARY_DIR} swift-numerics-build)
8687
import_module(RealModule ${BINARY_DIR} swift-numerics-build)
8788

8889
file(MAKE_DIRECTORY ${BINARY_DIR}/swift)
90+
91+
add_library(_NumericsShims IMPORTED INTERFACE)
92+
set_target_properties(_NumericsShims PROPERTIES
93+
INTERFACE_INCLUDE_DIRECTORIES ${SOURCE_DIR}/Sources/_NumericsShims/include)
94+
add_dependencies(_NumericsShims swift-numerics-build)
95+
96+
target_link_libraries(Numerics INTERFACE
97+
_NumericsShims)
98+
99+
file(MAKE_DIRECTORY ${SOURCE_DIR}/Sources/_NumericsShims/include)
89100
endif()
90101

91102
if(ENABLE_PYTHON_SUPPORT)
@@ -264,9 +275,11 @@ if(ENABLE_SWIFT_NUMERICS)
264275
DESTINATION lib/swift/${swift_os}/${module}.swiftmodule
265276
RENAME ${swift_arch}.swiftmodule)
266277
else()
278+
get_target_property(${module}_INTERFACE_INCLUDE_DIRECTORIES ${module}
279+
INTERFACE_INCLUDE_DIRECTORIES)
267280
install(FILES
268-
$<TARGET_PROPERTY:${module},INTERFACE_INCLUDE_DIRECTORIES>/${module}.swiftdoc
269-
$<TARGET_PROPERTY:${module},INTERFACE_INCLUDE_DIRECTORIES>/${module}.swiftmodule
281+
${${module}_INTERFACE_INCLUDE_DIRECTORIES}/${module}.swiftdoc
282+
${${module}_INTERFACE_INCLUDE_DIRECTORIES}/${module}.swiftmodule
270283
DESTINATION lib/swift/${swift_os}/${swift_arch})
271284
endif()
272285
endforeach()

0 commit comments

Comments
 (0)