meson: Add meson build
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ia8cee859822246d7f763e5f797f984aceb0be71e
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6da54be
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build*/
+subprojects/*
+!subprojects/*.wrap
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..2a6a450
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,41 @@
+project(
+ 'phosphor-power-control', 'cpp',
+ version: '1.0.0',
+ meson_version: '>=0.58.0',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++20',
+ ]
+)
+
+phosphor_logging_dep = dependency('phosphor-logging')
+gpioplus_dep = dependency('gpioplus')
+
+cpp = meson.get_compiler('cpp')
+if cpp.has_header_symbol(
+ 'nlohmann/json.hpp',
+ 'nlohmann::json::string_t',
+ required:false)
+ nlohmann_json_dep = declare_dependency()
+else
+ nlohmann_json_dep = dependency('nlohmann-json')
+endif
+
+deps = [
+ phosphor_logging_dep,
+ nlohmann_json_dep,
+ gpioplus_dep,
+]
+
+sources = [
+ 'chassiskill.cpp',
+]
+
+executable(
+ 'chassiskill',
+ sources,
+ implicit_include_directories: false,
+ dependencies: deps,
+ install: true,
+ install_dir: get_option('libexecdir'))