libpldm: Migrate to subproject
Organize files in libpldm to make it a subproject
In the current state, libpldm is not readily consumable
as a subproject.This commit does all the necessary re-organisation
of the source code to make it work as a subproject.
There are no .c/.h files changes in this commit, only meson
changes and re-organising the code structure.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I20a71c0c972b1fd81fb359d604433618799102c6
diff --git a/subprojects/libpldm/meson.build b/subprojects/libpldm/meson.build
new file mode 100644
index 0000000..fe06a35
--- /dev/null
+++ b/subprojects/libpldm/meson.build
@@ -0,0 +1,50 @@
+project('libpldm', ['c','cpp'],
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++20',
+ 'c_std=c17',
+ 'tests=' + (meson.is_subproject() ? 'disabled' : 'enabled'),
+ ],
+ version: '0.1.0',
+ meson_version: '>=0.63.0',
+)
+
+add_project_arguments('-D_DEFAULT_SOURCE',language:['c'])
+
+libpldm_sources = files()
+subdir('src')
+
+libpldm_include_dir = ['include']
+libpldm_headers = files()
+
+subdir('include/libpldm')
+
+libpldm = library(
+ 'pldm',
+ libpldm_sources,
+ implicit_include_directories: false,
+ include_directories: libpldm_include_dir,
+ version: meson.project_version(),
+ install: true
+ )
+
+install_headers(
+ libpldm_headers,
+ subdir:'libpldm'
+ )
+
+libpldm_dep = declare_dependency(
+ include_directories: libpldm_include_dir,
+ link_with: libpldm)
+
+import('pkgconfig').generate(
+ name: 'libpldm',
+ description: 'PLDM protocol encode/decode C lib',
+ version: meson.project_version(),
+ libraries: libpldm)
+
+if get_option('tests').enabled()
+ subdir('tests')
+endif