mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:07:45 +00:00
Meta: Add a CPack installation target for js(1)
This adds a CPack configuration to generate a release package for js(1). Our current CMake requirement is 3.16, which doesn't have a great story for automatically installing a binary target's library dependencies. If we eventually require CMake 3.21 or above, we can remove the helper .cmake file added here in lieu of RUNTIME_DEPENDENCIES.
This commit is contained in:
parent
a05d25d4e5
commit
636a6a2fb8
2 changed files with 51 additions and 3 deletions
|
@ -658,6 +658,20 @@ if (BUILD_LAGOM)
|
|||
PASS_REGULAR_EXPRESSION "PASS"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# FIXME: When we are using CMake >= 3.21, the library installations can be replaced with RUNTIME_DEPENDENCIES.
|
||||
# https://cmake.org/cmake/help/latest/command/install.html
|
||||
include(get_linked_lagom_libraries.cmake)
|
||||
get_linked_lagom_libraries(js_lagom js_lagom_libraries)
|
||||
|
||||
install(TARGETS js_lagom ${js_lagom_libraries} COMPONENT js)
|
||||
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
set(CPACK_STRIP_FILES TRUE)
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
|
||||
set(CPACK_COMPONENTS_ALL js)
|
||||
set(CPACK_PACKAGE_FILE_NAME serenity-js)
|
||||
include(CPack)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
34
Meta/Lagom/get_linked_lagom_libraries.cmake
Normal file
34
Meta/Lagom/get_linked_lagom_libraries.cmake
Normal file
|
@ -0,0 +1,34 @@
|
|||
function(add_lagom_library list item)
|
||||
list(FIND "${list}" "${item}" item_is_present)
|
||||
|
||||
if (item_is_present EQUAL -1)
|
||||
set("${list}" "${${list}}" "${item}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(get_linked_lagom_libraries_impl target output)
|
||||
if (NOT TARGET "${target}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(target_type "${target}" TYPE)
|
||||
|
||||
if ("${target_type}" STREQUAL "SHARED_LIBRARY")
|
||||
add_lagom_library("${output}" "${target}")
|
||||
elseif ("${target_type}" STREQUAL "INTERFACE_LIBRARY")
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(target_libraries "${target}" LINK_LIBRARIES)
|
||||
|
||||
foreach(target_library IN LISTS target_libraries)
|
||||
get_linked_lagom_libraries_impl("${target_library}" "${output}")
|
||||
endforeach()
|
||||
|
||||
set("${output}" "${${output}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_linked_lagom_libraries target output)
|
||||
get_linked_lagom_libraries_impl(${target} ${output})
|
||||
set("${output}" "${${output}}" PARENT_SCOPE)
|
||||
endfunction()
|
Loading…
Add table
Add a link
Reference in a new issue