Re: SDK install w/ CMake


Bach, Pascal <pascal.bach@...>
 

Hi Eric

I don't think your issue has something do to with CMake.

-----Original Message-----
From: yocto-bounces@yoctoproject.org <yocto-bounces@yoctoproject.org>
On Behalf Of Eric Schwarz
Sent: Freitag, 1. Februar 2019 09:51
To: yocto@yoctoproject.org
Subject: [yocto] SDK install w/ CMake

Hello,

we have got the problem that w/ the Yocto recipe and CMake install targets
as below always everything (headers and library or binary
respectively) is installed in the SDK.
The binary also goes into the SDK even though we just add it to
IMAGE_INSTALL based on a XILINX yocto build (rel-v2018.3).
I'm not sure I understand what you are trying to do. If you add something to IMAGE_INSTALL it gets installed to the target.
That usually includes binaries and libraries.

If you only want libraries but not binaries it's probably best to split them into multiple packages as described in https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#package-splitting-dev-environment

This way you can have the binaries in a different package like ${PN}-tools.

Pascal

For sure we only want headers to be installed when "<library_name>-dev"
is added to TOOLCHAIN_TARGET_TASK_append and the binary should not
be installed at all when it is just added to IMAGE_INSTALL.

For sure we studied Yocto and CMake recipes from other libraries where it
works like pugixml but weren't able to figure out what's going wrong.


Yocto recipe
============

DESCRIPTION = "C++ reflection library"
SECTION = "libs"
LICENSE = "CLOSED"

SRCREV = "${AUTOREV}"
SRCBRANCH = "next"
SRC_URI =
"git://gitlab.company.de/psg/${PN}.git;branch=${SRCBRANCH};protocol=ssh
"

DEPENDS = "catch2"

inherit cmake
S = "${WORKDIR}/git"
FILES_${PN}-dev += "${libdir}/cmake"

# The following are needed because the library is unversioned.
# See
https://wiki.yoctoproject.org/wiki/TipsAndTricks/Packaging_Prebuilt_Librari
es#Non-versioned_Libraries
SOLIBS = ".so"
FILES_SOLIBSDEV = ""


CMake library install part
==========================

# Shared client library target.
add_library(shared SHARED $<TARGET_OBJECTS:objects>)
target_include_directories(shared PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

set_target_properties(shared
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY lib/shared
LIBRARY_OUTPUT_DIRECTORY lib/shared
RUNTIME_OUTPUT_DIRECTORY lib/shared
OUTPUT_NAME ${LIBRARY_NAME}
)

# Install target.
install(TARGETS shared static
EXPORT ${LIBRARY_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY include/reflect DESTINATION
${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT ${LIBRARY_NAME}-config
NAMESPACE ${LIBRARY_NAME}-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIBRARY_NAME})


CMake binary install part
=========================

install(TARGETS ${EXECUTABLE_NAME} DESTINATION
${CMAKE_INSTALL_BINDIR})


Many thanks for any hints
Eric
--
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Join yocto@lists.yoctoproject.org to automatically receive all group messages.