Skip to content

[Polly][CMake] Fix exports #122123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})")

Expand Down
8 changes: 8 additions & 0 deletions polly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions polly/cmake/polly_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading