imath: split PyImath CMake config

Fix build kio-extras
This commit is contained in:
Đoàn Trần Công Danh 2023-03-20 12:37:03 +07:00
parent 880209af2d
commit d005fdeda8
2 changed files with 43 additions and 4 deletions

View File

@ -0,0 +1,39 @@
--- a/config/ImathConfig.cmake.in
+++ b/config/ImathConfig.cmake.in
@@ -4,4 +4,7 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/PyImathTargets.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/PyImathTargets.cmake")
+endif()
check_required_components("@PROJECT_NAME@")
--- a/src/python/config/ModuleDefine.cmake
+++ b/src/python/config/ModuleDefine.cmake
@@ -52,7 +52,7 @@ function(PYIMATH_ADD_LIBRARY_PRIV libnam
add_library(${PROJECT_NAME}::${libname} ALIAS ${libname})
install(TARGETS ${libname}
- EXPORT ${PROJECT_NAME}
+ EXPORT PyImath
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
--- a/src/python/config/CMakeLists.txt
+++ b/src/python/config/CMakeLists.txt
@@ -7,8 +7,14 @@
add_library(PyImathConfig INTERFACE)
target_include_directories(PyImathConfig INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
-install(TARGETS PyImathConfig EXPORT ${PROJECT_NAME})
+install(TARGETS PyImathConfig EXPORT PyImath)
add_library(PyImath::Config ALIAS PyImathConfig)
+install(EXPORT PyImath
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PyImath
+ FILE PyImathTargets.cmake
+ NAMESPACE Imath::
+ EXPORT_LINK_INTERFACE_LIBRARIES
+)
if(IMATH_INSTALL_PKG_CONFIG)
# use a helper function to avoid variable pollution, but pretty simple

View File

@ -1,7 +1,7 @@
# Template file for 'imath'
pkgname=imath
version=3.1.6
revision=2
revision=3
build_style=cmake
configure_args="-DPYTHON=ON"
hostmakedepends="python3-numpy"
@ -28,8 +28,7 @@ imath-python3_package() {
short_desc+=" - Python module"
pkg_install() {
vmove "usr/lib/libPyImath*.so.*"
vmove "${py3_sitelib}/imath.so"
vmove "${py3_sitelib}/imathnumpy.so"
vmove "${py3_sitelib}"
}
}
@ -39,6 +38,7 @@ imath-python3-devel_package() {
short_desc+=" - Python module - development files"
pkg_install() {
vmove "usr/include/Imath/Py*"
vmove "usr/lib/cmake/PyImath*"
vmove usr/lib/pkgconfig/PyImath.pc
vmove "usr/lib/libPyImath*.so"
}
@ -51,7 +51,7 @@ imath-devel_package() {
pkg_install() {
vmove "usr/include/Imath/half*"
vmove "usr/include/Imath/Imath*"
vmove usr/lib/cmake
vmove "usr/lib/cmake/Imath*"
vmove usr/lib/pkgconfig/Imath.pc
vmove "usr/lib/libImath*.so"
}