Skip to content

Commit e2489c9

Browse files
authored
Merge pull request #1096 from martin-frbg/pkg-config
Build only openblas.pc for pkg-config and install it from cmake as well
2 parents 1029dcd + c4ea9ee commit e2489c9

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,12 @@ install (FILES ${INCLUDE_FILES} DESTINATION include)
227227
if(NOT MSVC)
228228
install (TARGETS ${OpenBLAS_LIBNAME}_static DESTINATION lib)
229229
endif()
230+
231+
include(FindPkgConfig QUIET)
232+
if(PKG_CONFIG_FOUND)
233+
set(prefix ${CMAKE_INSTALL_PREFIX})
234+
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
235+
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
236+
configure_file(${PROJECT_SOURCE_DIR}/cmake/openblas.pc.in ${PROJECT_BINARY_DIR}/openblas.pc @ONLY)
237+
install (FILES ${PROJECT_BINARY_DIR}/openblas.pc DESTINATION lib/pkgconfig/)
238+
endif()

Makefile.install

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,14 @@ endif
9898
endif
9999

100100

101-
#Generating blas.pc
102-
@echo Generating blas.pc in $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)
103-
@echo 'libdir='$(OPENBLAS_LIBRARY_DIR) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc
104-
@echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc
105-
@echo 'version='$(VERSION) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc
106-
@echo 'extralib='$(EXTRALIB) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc
107-
@cat blas.pc.in >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc
101+
#Generating openblas.pc
102+
@echo Generating openblas.pc in $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)
103+
@echo 'libdir='$(OPENBLAS_LIBRARY_DIR) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc
104+
@echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc
105+
@echo 'version='$(VERSION) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc
106+
@echo 'extralib='$(EXTRALIB) >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc
107+
@cat openblas.pc.in >> $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc
108108

109-
ifndef NO_CBLAS
110-
@echo Generating cblas.pc in $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)
111-
@cp $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/cblas.pc
112-
endif
113-
114-
ifndef NO_LAPACKE
115-
@echo Generating lapack.pc in $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)
116-
@cp $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/blas.pc $(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/lapack.pc
117-
endif
118109

119110
#Generating OpenBLASConfig.cmake
120111
@echo Generating $(OPENBLAS_CMAKE_CONFIG) in $(DESTDIR)$(OPENBLAS_CMAKE_DIR)

cmake/openblas.pc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@prefix@
2+
libdir=@libdir@
3+
includedir=@includedir@
4+
5+
Name: OpenBLAS
6+
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
7+
Version: @OPENBLAS_VERSION@
8+
URL: https://github.com/xianyi/OpenBLAS
9+
Libs: -L${libdir} -lopenblas
10+
Cflags: -I${includedir}
File renamed without changes.

0 commit comments

Comments
 (0)