mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-14 15:46:32 +00:00
[Polly][CMake] Fix exports (#122123)
If Polly is built with LLVM_POLLY_LINK_INTO_TOOLS=ON (the default for monorepo builds), then Polly will become a dependency of the LLVMExtensions component, which is part of LLVMExports. As such, all the Polly libraries also have to be part of LLVMExports. However, if Polly is built with LLVM_POLLY_LINK_INTO_TOOLS=OFF, we also end up adding Polly libraries to LLVMExports. This is undesirable, as it adds a hard dependency from llvm on polly. Fix this by only exporting polly libraries from LLVMExports if LLVM_POLLY_LINK_INTO_TOOLS is enabled.
This commit is contained in:
parent
4d21096c20
commit
2d6d476ffb
@ -1220,9 +1220,9 @@ function(add_llvm_pass_plugin name)
|
||||
endif()
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_STATIC_EXTENSIONS ${name})
|
||||
elseif(NOT ARG_NO_MODULE)
|
||||
add_llvm_library(${name} MODULE ${ARG_UNPARSED_ARGUMENTS})
|
||||
add_llvm_library(${name} MODULE NO_EXPORT ${ARG_UNPARSED_ARGUMENTS})
|
||||
else()
|
||||
add_llvm_library(${name} OBJECT ${ARG_UNPARSED_ARGUMENTS})
|
||||
add_llvm_library(${name} OBJECT NO_EXPORT ${ARG_UNPARSED_ARGUMENTS})
|
||||
endif()
|
||||
message(STATUS "Registering ${name} as a pass plugin (static build: ${LLVM_${name_upper}_LINK_INTO_TOOLS})")
|
||||
|
||||
|
@ -112,6 +112,14 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
endif()
|
||||
|
||||
# add_llvm_pass_plugin() already declares the option, but we need access to
|
||||
# it earlier than that.
|
||||
set(link_into_tools_default OFF)
|
||||
if (LLVM_TOOL_POLLY_BUILD)
|
||||
set(link_into_tools_default ON)
|
||||
endif()
|
||||
option(LLVM_POLLY_LINK_INTO_TOOLS "Statically link Polly into tools (if available)" ${link_into_tools_default})
|
||||
|
||||
add_definitions( -D_GNU_SOURCE )
|
||||
|
||||
add_subdirectory(docs)
|
||||
|
@ -39,15 +39,21 @@ macro(add_polly_library name)
|
||||
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
|
||||
endif( LLVM_LINK_COMPONENTS )
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
|
||||
set(exports)
|
||||
if (LLVM_POLLY_LINK_INTO_TOOLS)
|
||||
set(exports EXPORT LLVMExports)
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
EXPORT LLVMExports
|
||||
${exports}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
add_llvm_install_targets(install-${name}
|
||||
COMPONENT ${name})
|
||||
endif()
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
|
||||
if (LLVM_POLLY_LINK_INTO_TOOLS)
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
|
||||
endif()
|
||||
endmacro(add_polly_library)
|
||||
|
||||
macro(add_polly_loadable_module name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user