Initial meson build support.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I700334cad9de1b633b3882fc8a2df6d7832832b2
diff --git a/.gitignore b/.gitignore
index 1ee84da..547b6ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
*.sw*
+/build
diff --git a/hei_isolator.cpp b/hei_isolator.cpp
index eb27f27..ff58877 100644
--- a/hei_isolator.cpp
+++ b/hei_isolator.cpp
@@ -1,5 +1,5 @@
-#include "hei_isolator.hpp";
+#include "hei_isolator.hpp"
namespace HEI
{
@@ -24,5 +24,4 @@
HEI_TRAC( "Isolator::isolate()" );
}
-}; // end namespace HEI
-
+} // end namespace HEI
diff --git a/hei_isolator.hpp b/hei_isolator.hpp
index a0dd6a7..09ed43e 100644
--- a/hei_isolator.hpp
+++ b/hei_isolator.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "hei_user_interface.hpp";
+#include "hei_user_interface.hpp"
namespace HEI
{
@@ -22,5 +22,4 @@
}; // end class Isolator
-}; // end namespace HEI
-
+} // end namespace HEI
diff --git a/hei_user_interface.hpp b/hei_user_interface.hpp
index 345c082..a853837 100644
--- a/hei_user_interface.hpp
+++ b/hei_user_interface.hpp
@@ -1,7 +1,7 @@
#pragma once
-// This header provides access to headers and marcros defined by the user
+// This header provides access to headers and macros defined by the user
// application.
#include <hei_user_defines.hpp>
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..802f682
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,15 @@
+project('openpower-libhei', 'cpp',
+ version: '0.1', meson_version: '>=0.49.0',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++11'
+ ])
+
+incdir = include_directories('./')
+
+build_simulator = get_option('tests')
+
+if not build_simulator.disabled()
+ subdir('sim')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..0fc2767
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('tests', type: 'feature', description: 'Build tests')
diff --git a/sim/hei_sim_main.cpp b/sim/hei_sim_main.cpp
index bfce2d0..b3f26d2 100644
--- a/sim/hei_sim_main.cpp
+++ b/sim/hei_sim_main.cpp
@@ -1,9 +1,6 @@
#include "../hei_isolator.hpp"
-namespace HEI_SIM
-{
-
int main()
{
HEI::Isolator iso;
@@ -14,5 +11,3 @@
return 0;
}
-
-}; // end namespace HEI_SIM
diff --git a/sim/hei_user_defines.hpp b/sim/hei_user_defines.hpp
new file mode 100644
index 0000000..ebb2a8e
--- /dev/null
+++ b/sim/hei_user_defines.hpp
@@ -0,0 +1,3 @@
+#include <stdio.h>
+
+#define HEI_TRAC(...) printf( __VA_ARGS__ ); printf( "\n" );
diff --git a/sim/meson.build b/sim/meson.build
new file mode 100644
index 0000000..3693e81
--- /dev/null
+++ b/sim/meson.build
@@ -0,0 +1,8 @@
+tests = ['openpower-libhei-sim']
+
+sim_sources = ['hei_sim_main.cpp',
+ '../hei_isolator.cpp']
+
+foreach t : tests
+ test(t, executable(t.underscorify(), sim_sources, include_directories : incdir))
+endforeach