fix: modules not finding each other when installed
This commit is contained in:
parent
3ac1a2b2f8
commit
87cecbded1
2 changed files with 24 additions and 2 deletions
|
|
@ -82,4 +82,9 @@ if("plugin" IN_LIST ENABLE_MODULES OR "shell" IN_LIST ENABLE_MODULES)
|
|||
)
|
||||
FetchContent_MakeAvailable(m3shapes_external)
|
||||
message(STATUS "Done fetching M3Shapes module")
|
||||
|
||||
# Fix m3shapes wrong rpath
|
||||
if(TARGET m3shapesplugin)
|
||||
set_target_properties(m3shapesplugin PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -25,11 +25,28 @@ function(qml_module arg_TARGET)
|
|||
|
||||
message(STATUS "Created QML module: ${module_uri}")
|
||||
|
||||
# Modules can't link together properly if the backing target and plugin target
|
||||
# are in the same dir (because diff modules can't access each other).
|
||||
# So install backing targets to QMLDIR/.../lib/ instead.
|
||||
string(REPLACE "/" ";" uri_parts "${module_target_path}")
|
||||
list(GET uri_parts 0 top_level)
|
||||
set(backing_lib_dir "${INSTALL_QMLDIR}/${top_level}/lib")
|
||||
set(module_dir "${INSTALL_QMLDIR}/${module_target_path}")
|
||||
install(TARGETS ${arg_TARGET} LIBRARY DESTINATION "${module_dir}" RUNTIME DESTINATION "${module_dir}")
|
||||
install(TARGETS "${module_plugin_target}" LIBRARY DESTINATION "${module_dir}" RUNTIME DESTINATION "${module_dir}")
|
||||
|
||||
install(TARGETS ${arg_TARGET}
|
||||
LIBRARY DESTINATION "${backing_lib_dir}"
|
||||
RUNTIME DESTINATION "${backing_lib_dir}"
|
||||
)
|
||||
install(TARGETS "${module_plugin_target}"
|
||||
LIBRARY DESTINATION "${module_dir}"
|
||||
RUNTIME DESTINATION "${module_dir}"
|
||||
)
|
||||
install(FILES "${module_qmldir}" DESTINATION "${module_dir}")
|
||||
install(FILES "${module_typeinfo}" DESTINATION "${module_dir}")
|
||||
|
||||
target_link_libraries(${arg_TARGET} PRIVATE caelestia-pch Qt::Core Qt::Qml ${arg_LIBRARIES})
|
||||
|
||||
# Add backing target dir to plugin rpath so it can find its backing target
|
||||
file(RELATIVE_PATH plugin_to_lib "/${module_target_path}" "/${top_level}/lib")
|
||||
set_property(TARGET ${module_plugin_target} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/${plugin_to_lib}")
|
||||
endfunction()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue