Skip to content

Commit f057d15

Browse files
committed
Correct pkgconfig
1 parent 7fca771 commit f057d15

File tree

2 files changed

+49
-6
lines changed

2 files changed

+49
-6
lines changed

Blosc2Config.cmake.in

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,48 @@ foreach(comp ${Blosc2_FIND_COMPONENTS})
8686
endif()
8787
endforeach()
8888

89+
# Defines imported targets for Blosc2 inside a Python wheel
90+
91+
# ------------------------------
92+
# Shared library target
93+
# ------------------------------
94+
if(NOT TARGET Blosc2::blosc2_shared)
95+
add_library(Blosc2::blosc2_shared SHARED IMPORTED GLOBAL)
96+
97+
if(WIN32)
98+
# MSVC: import library (.lib) + runtime DLL (.dll)
99+
set_target_properties(Blosc2::blosc2_shared PROPERTIES
100+
IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/../blosc2_shared.lib"
101+
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_shared.dll"
102+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
103+
)
104+
else()
105+
# Linux/macOS
106+
set_target_properties(Blosc2::blosc2_shared PROPERTIES
107+
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_shared.so"
108+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
109+
)
110+
endif()
111+
endif()
112+
113+
# ------------------------------
114+
# Static library target
115+
# ------------------------------
116+
if(NOT TARGET Blosc2::blosc2_static)
117+
add_library(Blosc2::blosc2_static STATIC IMPORTED GLOBAL)
118+
119+
if(MSVC)
120+
# Windows static library uses .lib
121+
set_target_properties(Blosc2::blosc2_static PROPERTIES
122+
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_static.lib"
123+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
124+
)
125+
else()
126+
# Linux/macOS static library uses .a
127+
set_target_properties(Blosc2::blosc2_static PROPERTIES
128+
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_static.a"
129+
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
130+
)
131+
endif()
132+
endif()
133+

blosc2.pc.in

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
prefix=@CMAKE_INSTALL_PREFIX@
2-
exec_prefix=${prefix}
3-
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
4-
sharedlibdir=${libdir}
5-
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
1+
prefix=${pcfiledir}/../.. # directory containing blosc2.pc
2+
libdir=${prefix}/lib
3+
includedir=${prefix}/include
64

75
Name: blosc2
86
Description: A blocking, shuffling and lossless compression library
97
URL: https://blosc.org/
108
Version: @BLOSC2_VERSION_STRING@
119

1210
Requires:
13-
Libs: -L${libdir} -L${sharedlibdir} -lblosc2
11+
Libs: -L${libdir} -lblosc2
1412
Cflags: -I${includedir}

0 commit comments

Comments
 (0)