File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,20 @@ if (${ENZYME_EXTERNAL_SHARED_LIB})
145
145
add_dependencies (Enzyme-${LLVM_VERSION_MAJOR} BlasDeclarationsIncGen)
146
146
add_dependencies (Enzyme-${LLVM_VERSION_MAJOR} BlasTAIncGen)
147
147
add_dependencies (Enzyme-${LLVM_VERSION_MAJOR} BlasDiffUseIncGen)
148
- target_link_libraries (Enzyme-${LLVM_VERSION_MAJOR} LLVM)
148
+
149
+ # This would be the desired way to link against LLVM components,
150
+ # however this function is bugged and does not work with `all`, see:
151
+ # https://github.com/llvm/llvm-project/issues/46347
152
+ #llvm_map_components_to_libnames(llvm_libs all)
153
+ # Therefore, manually invoke llvm-config
154
+ execute_process (COMMAND ${LLVM_TOOLS_BINARY_DIR} /llvm-config --libs all
155
+ OUTPUT_VARIABLE llvm_libraries)
156
+ string (STRIP "${llvm_libraries} " llvm_libraries)
157
+ # In theory, adding --libs should also add all the -l flags,
158
+ # but it isn't picked up correctly by clang, so we call target_link_libraries
159
+ set_target_properties (Enzyme-${LLVM_VERSION_MAJOR} PROPERTIES
160
+ LINK_FLAGS "`${LLVM_TOOLS_BINARY_DIR} /llvm-config --ldflags`" )
161
+ target_link_libraries (Enzyme-${LLVM_VERSION_MAJOR} ${llvm_libraries} )
149
162
install (TARGETS Enzyme-${LLVM_VERSION_MAJOR}
150
163
EXPORT EnzymeTargets
151
164
LIBRARY DESTINATION lib COMPONENT shlib
You can’t perform that action at this time.
0 commit comments