CMake: Generate .prl files for plugins in static Qt builds
To successfully link plugins of a static Qt build into a Qt project we need to generate .prl files for the plugins. Task-number: QTBUG-84781 Change-Id: I1406052f2269050aa7cbe6aa2b546bece1c68467 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
bd793d3c46
commit
8c8c0f65e3
@ -2183,6 +2183,8 @@ function(qt_watch_current_list_dir variable access value current_list_file stack
|
|||||||
# Make finalizer known functions here:
|
# Make finalizer known functions here:
|
||||||
if(func STREQUAL "qt_finalize_module")
|
if(func STREQUAL "qt_finalize_module")
|
||||||
qt_finalize_module(${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
qt_finalize_module(${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
||||||
|
elseif(func STREQUAL "qt_finalize_plugin")
|
||||||
|
qt_finalize_plugin(${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "qt_watch_current_list_dir doesn't know about ${func}. Consider adding it.")
|
message(FATAL_ERROR "qt_watch_current_list_dir doesn't know about ${func}. Consider adding it.")
|
||||||
endif()
|
endif()
|
||||||
@ -2799,7 +2801,7 @@ function(qt_finalize_module target)
|
|||||||
if(QT_SUPERBUILD AND NOT BUILD_SHARED_LIBS)
|
if(QT_SUPERBUILD AND NOT BUILD_SHARED_LIBS)
|
||||||
# Do nothing.
|
# Do nothing.
|
||||||
else()
|
else()
|
||||||
qt_generate_prl_file(${target})
|
qt_generate_prl_file(${target} "${INSTALL_LIBDIR}")
|
||||||
endif()
|
endif()
|
||||||
qt_generate_module_pri_file("${target}" ${ARGN})
|
qt_generate_module_pri_file("${target}" ${ARGN})
|
||||||
endfunction()
|
endfunction()
|
||||||
@ -2906,8 +2908,9 @@ function(qt_collect_libs target out_var)
|
|||||||
set(${out_var} ${libs} PARENT_SCOPE)
|
set(${out_var} ${libs} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Generate a qmake .prl file for the given target
|
# Generate a qmake .prl file for the given target.
|
||||||
function(qt_generate_prl_file target)
|
# The install_dir argument is a relative path, for example "lib".
|
||||||
|
function(qt_generate_prl_file target install_dir)
|
||||||
get_target_property(target_type ${target} TYPE)
|
get_target_property(target_type ${target} TYPE)
|
||||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
return()
|
return()
|
||||||
@ -2944,7 +2947,7 @@ QMAKE_PRL_LIBS_FOR_CMAKE = ${prl_libs}
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Add a custom command that prepares the .prl file for installation
|
# Add a custom command that prepares the .prl file for installation
|
||||||
qt_path_join(qt_build_libdir ${QT_BUILD_DIR} ${INSTALL_LIBDIR})
|
qt_path_join(qt_build_libdir ${QT_BUILD_DIR} ${install_dir})
|
||||||
qt_path_join(prl_file_path "${qt_build_libdir}" "${prl_file_name}")
|
qt_path_join(prl_file_path "${qt_build_libdir}" "${prl_file_name}")
|
||||||
set(library_suffixes ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
set(library_suffixes ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
@ -2958,6 +2961,12 @@ QMAKE_PRL_LIBS_FOR_CMAKE = ${prl_libs}
|
|||||||
|
|
||||||
# Installation of the .prl file happens globally elsewhere,
|
# Installation of the .prl file happens globally elsewhere,
|
||||||
# because we have no clue here what the actual file name is.
|
# because we have no clue here what the actual file name is.
|
||||||
|
# What we know however, is the directory where the prl file is created.
|
||||||
|
# Save that for later, to install all prl files from that directory.
|
||||||
|
get_property(prl_install_dirs GLOBAL PROPERTY QT_PRL_INSTALL_DIRS)
|
||||||
|
if(NOT install_dir IN_LIST prl_install_dirs)
|
||||||
|
set_property(GLOBAL APPEND PROPERTY QT_PRL_INSTALL_DIRS "${install_dir}")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(qt_export_tools module_name)
|
function(qt_export_tools module_name)
|
||||||
@ -3412,6 +3421,21 @@ function(qt_internal_add_plugin target)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt_internal_add_linker_version_script(${target})
|
qt_internal_add_linker_version_script(${target})
|
||||||
|
qt_add_list_file_finalizer(qt_finalize_plugin ${target} "${install_directory}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(qt_finalize_plugin target install_directory)
|
||||||
|
# Generate .prl files for plugins of static Qt builds.
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
# Workaround to allow successful configuration of static top-level Qt builds.
|
||||||
|
# See QTBUG-84874.
|
||||||
|
if(QT_SUPERBUILD)
|
||||||
|
# Do nothing.
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
qt_generate_prl_file(${target} "${install_directory}")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(qt_install_qml_files target)
|
function(qt_install_qml_files target)
|
||||||
|
@ -528,7 +528,10 @@ if (ANDROID)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Install prl files
|
# Install prl files
|
||||||
qt_install(DIRECTORY "${PROJECT_BINARY_DIR}/${INSTALL_LIBDIR}/"
|
get_property(prl_install_dirs GLOBAL PROPERTY QT_PRL_INSTALL_DIRS)
|
||||||
DESTINATION ${INSTALL_LIBDIR}
|
foreach(prl_install_dir ${prl_install_dirs})
|
||||||
FILES_MATCHING PATTERN "*.prl"
|
qt_install(DIRECTORY "${PROJECT_BINARY_DIR}/${prl_install_dir}/"
|
||||||
)
|
DESTINATION ${prl_install_dir}
|
||||||
|
FILES_MATCHING PATTERN "*.prl"
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
Loading…
Reference in New Issue
Block a user