armadillo/armadillo-install-pkgconfig.patch
Ismail Dönmez 2c7c50b2c0 Accepting request 438732 from home:badshah400:branches:devel:libraries:c_c++
- Add armadillo-install-pkgconfig.patch: Generate and install a
  pkgconfig file (PATCH-FEATURE-OPENSUSE for now, but in
  discussions with upstream to have this included).
- Add armadillo-tests.patch: Generate tests/Makefile by
  configuring tests/Makefile.in using cmake so that the tests can
  be run before actually installing the library. Then, use a
  make check section to test the built library
  (PATCH-FEATURE-OPENSUSE for now, but in discussions with
  upstream to have this included).

OBS-URL: https://build.opensuse.org/request/show/438732
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/armadillo?expand=0&rev=196
2016-11-05 08:45:31 +00:00

67 lines
2.3 KiB
Diff

Index: armadillo-7.500.0/misc/armadillo.pc.in
===================================================================
--- /dev/null
+++ armadillo-7.500.0/misc/armadillo.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@INSTALL_LIB_DIR@
+includedir=@INSTALL_INCLUDE_DIR@
+
+Name: armadillo
+Description: A fast and user-friendly C++ linear algebra library
+URL: http://arma.sourceforge.net
+Version: @ARMA_VERSION_MAJOR@.@ARMA_VERSION_MINOR@.@ARMA_VERSION_PATCH@
+Cflags: -I${includedir}
+Libs: -L${libdir} -larmadillo
Index: armadillo-7.500.0/CMakeLists.txt
===================================================================
--- armadillo-7.500.0.orig/CMakeLists.txt
+++ armadillo-7.500.0/CMakeLists.txt
@@ -270,6 +269,11 @@ if(DETECT_HDF5)
endif()
endif()
+# Install pkgconfig file if pkg-config is found on system
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+ set(ARMA_INSTALL_PKGCONFIG true)
+endif()
include(ARMA_FindARPACK)
message(STATUS "ARPACK_FOUND = ${ARPACK_FOUND}")
@@ -403,6 +407,11 @@ if(NOT INSTALL_BIN_DIR)
set(INSTALL_BIN_DIR "bin")
endif()
+# pkgconfig install dir
+if(ARMA_INSTALL_PKGCONFIG)
+ set(PKGCONFIG_DIR ${INSTALL_LIB_DIR}/pkgconfig)
+endif()
+
# Make relative paths absolute so we can write them in Config.cmake files
foreach(p LIB INCLUDE DATA BIN)
set(var INSTALL_${p}_DIR)
@@ -452,6 +460,11 @@ message(STATUS "Generating '${PROJECT_BI
configure_file(${PROJECT_SOURCE_DIR}/cmake_aux/InstallFiles/ArmadilloConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/ArmadilloConfigVersion.cmake" @ONLY)
+if(ARMA_INSTALL_PKGCONFIG)
+ message(STATUS "Generating '${PROJECT_BINARY_DIR}/misc/armadillo.pc'")
+ configure_file(${PROJECT_SOURCE_DIR}/misc/armadillo.pc.in
+ "${PROJECT_SOURCE_DIR}/misc/armadillo.pc" @ONLY)
+endif()
# Install the export set for use with the install-tree
install(EXPORT ArmadilloLibraryDepends DESTINATION
@@ -481,3 +494,9 @@ install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake"
DESTINATION "${ARMADILLO_CMAKE_DIR}" COMPONENT dev)
+
+# Install pkgconfig file if wanted
+if(ARMA_INSTALL_PKGCONFIG)
+ install(FILES "${PROJECT_SOURCE_DIR}/misc/armadillo.pc"
+ DESTINATION "${PKGCONFIG_DIR}")
+endif()