Build openpower-libhei as a static library

Build a static library that can be linked to by other applications.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I4dec91928381712674e6621792830f811c44c30d
diff --git a/meson.build b/meson.build
index 68a303a..5359e97 100644
--- a/meson.build
+++ b/meson.build
@@ -7,10 +7,8 @@
             'cpp_args=-Wno-unused-parameter'
        ])
 
-incdir = [include_directories('src')]
+incdir = include_directories('src')
 
-# libhei_dep provides dependencies needed to build with libhei as a subproject
-# rather than a base project.
 libhei_src = ['src/isolator/hei_isolator.cpp',
               'src/isolator/hei_isolation_node.cpp',
               'src/register/hei_hardware_register.cpp',
@@ -19,9 +17,48 @@
 libhei_dep = declare_dependency(include_directories : incdir,
                                 sources : libhei_src)
 
+# build static library libhei.a (note that the libray name is hei, the
+# resulting filename will be libhei.a)
+libhei_static = static_library('hei',
+                                dependencies: libhei_dep,
+                                install: true)
+
+install_headers('src/hei_chip.hpp',
+                'src/hei_includes.hpp',
+                'src/hei_isolation_data.hpp',
+                'src/hei_macros.hpp',
+                'src/hei_main.hpp',
+                'src/hei_return_code.hpp',
+                'src/hei_types.hpp',
+                'src/hei_user_interface.hpp',
+                subdir : 'libhei')
+
+install_headers('src/isolator/hei_signature.hpp',
+                'src/isolator/hei_isolator.hpp',
+                'src/isolator/hei_isolation_node.hpp',
+                subdir : 'libhei/isolator')
+
+install_headers('src/register/hei_hardware_register.hpp',
+                'src/register/hei_operator_register.hpp',
+                'src/register/hei_scom_register.hpp',
+                'src/register/hei_register.hpp',
+                subdir : 'libhei/register')
+
+install_headers('src/util/hei_bit_string.hpp',
+                'src/util/hei_flyweight.hpp',
+                subdir : 'libhei/util')
+
+pkg_mod = import('pkgconfig')
+
+pkg_mod.generate(libraries : libhei_static,
+                 version : '0.1',
+                 name : 'libhei',
+                 subdirs: 'libhei',
+                 filebase : 'hei',
+                 description : 'Openpower Hardware Error Isolator')
+
 build_tests = get_option('tests')
 
 if not build_tests.disabled()
-  incdir += include_directories('test')
   subdir('test')
 endif