Provide package data dir for compiler option

This allows the code consuming data files to know where they are stored
instead of using hard coded values.

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I353128096103a5195df5ba05c02868517903813f
diff --git a/analyzer/meson.build b/analyzer/meson.build
index 909155d..5d0dabe 100644
--- a/analyzer/meson.build
+++ b/analyzer/meson.build
@@ -20,10 +20,10 @@
     analyzer_src,
     include_directories : incdir,
     dependencies : analyzer_deps,
-    cpp_args : test_arg,
+    cpp_args : [ package_args, test_arg ],
     install : false,
 )
 
-# Install the RAS data files
+# Install the RAS data files.
 subdir('ras-data')
 
diff --git a/analyzer/ras-data/meson.build b/analyzer/ras-data/meson.build
index 23644d5..2c40fbd 100644
--- a/analyzer/ras-data/meson.build
+++ b/analyzer/ras-data/meson.build
@@ -7,7 +7,5 @@
     explorer_data_files,
 ]
 
-install_data( data_files, install_dir : join_paths(get_option('prefix'),
-                                                   get_option('datadir'),
-                                                   meson.project_name()) )
+install_data( data_files, install_dir : package_dir )
 
diff --git a/meson.build b/meson.build
index 89ccf90..514e94c 100644
--- a/meson.build
+++ b/meson.build
@@ -7,6 +7,14 @@
           'cpp_std=c++17',
         ])
 
+# Package directory root, which will contain required data files.
+package_dir = join_paths( get_option('prefix'),
+                          get_option('datadir'),
+                          meson.project_name() )
+
+# Compiler option so that source knows the package directory.
+package_args = [ '-DPACKAGE_DIR="' + package_dir + '/"' ]
+
 #-------------------------------------------------------------------------------
 # Versioning
 #-------------------------------------------------------------------------------