From 9d2711535b107e0a2684b1f618a2c75eaa77f7e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Sun, 8 Nov 2015 11:30:32 +0100
Subject: [PATCH] Added files for pkg-config

---
 tools/share/CMakeLists.txt             |  4 +++-
 tools/share/pkgconfig/CMakeLists.txt   | 17 +++++++++++++++++
 tools/share/pkgconfig/cuda.pc.in       | 11 +++++++++++
 tools/share/pkgconfig/tnl-cuda.pc.in   |  9 +++++++++
 tools/share/pkgconfig/tnl-openmp.pc.in |  9 +++++++++
 tools/share/pkgconfig/tnl.pc.in        | 11 +++++++++++
 6 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 tools/share/pkgconfig/CMakeLists.txt
 create mode 100644 tools/share/pkgconfig/cuda.pc.in
 create mode 100644 tools/share/pkgconfig/tnl-cuda.pc.in
 create mode 100644 tools/share/pkgconfig/tnl-openmp.pc.in
 create mode 100644 tools/share/pkgconfig/tnl.pc.in

diff --git a/tools/share/CMakeLists.txt b/tools/share/CMakeLists.txt
index 0f11c087e7..ecb1ae470f 100755
--- a/tools/share/CMakeLists.txt
+++ b/tools/share/CMakeLists.txt
@@ -1,3 +1,5 @@
+add_subdirectory (pkgconfig)
+
 INSTALL( FILES tnl-matrix-convert.cfg.desc               
                tnlcurve2gnuplot.cfg.desc               
-         DESTINATION share/tnl-${tnlVersion} )
\ No newline at end of file
+         DESTINATION share/tnl-${tnlVersion} )
diff --git a/tools/share/pkgconfig/CMakeLists.txt b/tools/share/pkgconfig/CMakeLists.txt
new file mode 100644
index 0000000000..1de0c9439f
--- /dev/null
+++ b/tools/share/pkgconfig/CMakeLists.txt
@@ -0,0 +1,17 @@
+CONFIGURE_FILE( "tnl.pc.in" "${PROJECT_TOOLS_PATH}/share/pkgconfig/tnl.pc" @ONLY )
+INSTALL( FILES ${PROJECT_TOOLS_PATH}/share/pkgconfig/tnl.pc
+         DESTINATION share/pkgconfig )
+
+if( CUDA_FOUND )
+    CONFIGURE_FILE( "cuda.pc.in" "${PROJECT_TOOLS_PATH}/share/pkgconfig/cuda.pc" @ONLY )
+    CONFIGURE_FILE( "tnl-cuda.pc.in" "${PROJECT_TOOLS_PATH}/share/pkgconfig/tnl-cuda.pc" @ONLY )
+    INSTALL( FILES ${PROJECT_TOOLS_PATH}/share/pkgconfig/cuda.pc
+                   ${PROJECT_TOOLS_PATH}/share/pkgconfig/tnl-cuda.pc
+             DESTINATION share/pkgconfig )
+endif()
+
+if( OPENMP_FOUND )
+    CONFIGURE_FILE( "tnl-openmp.pc.in" "${PROJECT_TOOLS_PATH}/share/pkgconfig/tnl-openmp.pc" @ONLY )
+    INSTALL( FILES ${PROJECT_TOOLS_PATH}/share/pkgconfig/tnl-openmp.pc
+             DESTINATION share/pkgconfig )
+endif()
diff --git a/tools/share/pkgconfig/cuda.pc.in b/tools/share/pkgconfig/cuda.pc.in
new file mode 100644
index 0000000000..268e2a927f
--- /dev/null
+++ b/tools/share/pkgconfig/cuda.pc.in
@@ -0,0 +1,11 @@
+prefix=@CUDA_TOOLKIT_ROOT_DIR@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+version=@CUDA_VERSION_STRING@
+
+Name: CUDA
+Description: A parallel programming framework by Nvidia
+URL: https://www.nvidia.com/object/cuda_home_new.html
+Version: ${version}
+Libs:
+Cflags: -I${includedir}
diff --git a/tools/share/pkgconfig/tnl-cuda.pc.in b/tools/share/pkgconfig/tnl-cuda.pc.in
new file mode 100644
index 0000000000..bc3d5f50f9
--- /dev/null
+++ b/tools/share/pkgconfig/tnl-cuda.pc.in
@@ -0,0 +1,9 @@
+version=@tnlVersion@
+
+Name: TNL (with CUDA support)
+Description: Template Numerical Library (with CUDA support)
+URL:
+Version: ${version}
+Libs:
+Cflags: -DHAVE_CUDA -DHAVE_NOT_CXX11
+Requires: cuda, tnl = ${version}
diff --git a/tools/share/pkgconfig/tnl-openmp.pc.in b/tools/share/pkgconfig/tnl-openmp.pc.in
new file mode 100644
index 0000000000..cb00b5c5fe
--- /dev/null
+++ b/tools/share/pkgconfig/tnl-openmp.pc.in
@@ -0,0 +1,9 @@
+version=@tnlVersion@
+
+Name: TNL (with OpenMP support)
+Description: Template Numerical Library (with OpenMP support)
+URL:
+Version: ${version}
+Libs: -lgomp
+Cflags: -DHAVE_OPENMP -fopenmp
+Requires: tnl = ${version}
diff --git a/tools/share/pkgconfig/tnl.pc.in b/tools/share/pkgconfig/tnl.pc.in
new file mode 100644
index 0000000000..0c5e5d8f0b
--- /dev/null
+++ b/tools/share/pkgconfig/tnl.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+version=@tnlVersion@
+
+Name: TNL
+Description: Template Numerical Library
+URL:
+Version: ${version}
+Libs: -L${libdir} -ltnl-${version}
+Cflags: -I${includedir}/tnl-${version}
-- 
GitLab