From 1fb7beae5e97aadf8471ae7b6e07f5c2e5f33c78 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czarnowski Date: Mon, 14 Feb 2022 10:26:50 +0100 Subject: Switch the build system to meson Due to requirements from community, new projects have to be built with meson. To unify with other projects some additional warnings has been enabled, so appropriate code updates has been implemented. This commit makes both meson and CMake available to simplyfy transition in openbmc. CMake support will be removed after switching to meson in openbmc will be accepted. Tested: Compiled and smoke tested. Signed-off-by: Przemyslaw Czarnowski --- subprojects/boost.wrap | 7 +++++ subprojects/gtest.wrap | 3 ++ subprojects/nlohmann.wrap | 3 ++ subprojects/packagefiles/boost/meson.build | 44 ++++++++++++++++++++++++++++++ subprojects/sdbusplus.wrap | 3 ++ 5 files changed, 60 insertions(+) create mode 100644 subprojects/boost.wrap create mode 100644 subprojects/gtest.wrap create mode 100644 subprojects/nlohmann.wrap create mode 100644 subprojects/packagefiles/boost/meson.build create mode 100644 subprojects/sdbusplus.wrap (limited to 'subprojects') diff --git a/subprojects/boost.wrap b/subprojects/boost.wrap new file mode 100644 index 0000000..71e0382 --- /dev/null +++ b/subprojects/boost.wrap @@ -0,0 +1,7 @@ +[wrap-file] +source_url = https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz +source_hash = 5347464af5b14ac54bb945dc68f1dd7c56f0dad7262816b956138fc53bcc0131 +source_filename = boost_1_77_0.tar.gz + +directory = boost_1_77_0 +patch_directory = boost diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap new file mode 100644 index 0000000..0d37d2e --- /dev/null +++ b/subprojects/gtest.wrap @@ -0,0 +1,3 @@ +[wrap-git] +url = https://github.com/google/googletest +revision = HEAD \ No newline at end of file diff --git a/subprojects/nlohmann.wrap b/subprojects/nlohmann.wrap new file mode 100644 index 0000000..a77b7c9 --- /dev/null +++ b/subprojects/nlohmann.wrap @@ -0,0 +1,3 @@ +[wrap-git] +revision = b3e5cb7f20dcc5c806e418df34324eca60d17d4e +url = https://github.com/nlohmann/json.git diff --git a/subprojects/packagefiles/boost/meson.build b/subprojects/packagefiles/boost/meson.build new file mode 100644 index 0000000..f991d36 --- /dev/null +++ b/subprojects/packagefiles/boost/meson.build @@ -0,0 +1,44 @@ +project('boost', 'cpp', + version: '1.77', + meson_version: '>=0.56.0') + +cxx = meson.get_compiler('cpp') + +# Build if not available +build_dir = join_paths(meson.current_source_dir(), 'build') +r = run_command('[','!','-d', build_dir, ']') +if r.returncode() == 0 + r = run_command('./bootstrap.sh', '--with-libraries=coroutine,filesystem,iostreams,program_options,regex,system') + assert(r.returncode() == 0, + 'Bootstrap failed' + + '\nstdout: ' + r.stdout().strip() + + '\nstderr: ' + r.stderr().strip()) + + r = run_command('./b2', 'install','--prefix=build') + assert(r.returncode() == 0, + 'b2 failed' + + '\nstdout: ' + r.stdout().strip() + + '\nstderr: ' + r.stderr().strip()) +endif + +include_dir = join_paths('build', 'include') +lib_dir = join_paths(meson.current_source_dir(), 'build', 'lib') + +custom_dep = declare_dependency(link_args: ['-L' + lib_dir, + '-Wl,-rpath-link,' + lib_dir + ]) + +boost_inc = include_directories(include_dir, is_system:true) +boost_dep = declare_dependency( + include_directories : boost_inc, + dependencies : [cxx.find_library('boost_context', dirs: lib_dir, static: true), + cxx.find_library('boost_filesystem', dirs: lib_dir, static: true), + cxx.find_library('boost_regex', dirs: lib_dir, static: true), + cxx.find_library('boost_program_options', dirs: lib_dir, static: true), + cxx.find_library('boost_thread', dirs: lib_dir, static: true), + cxx.find_library('boost_coroutine', dirs: lib_dir, static: true), + cxx.find_library('boost_iostreams', dirs: lib_dir, static: true), + custom_dep + ]) + +meson.override_dependency('boost', boost_dep) diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap new file mode 100644 index 0000000..45ffabb --- /dev/null +++ b/subprojects/sdbusplus.wrap @@ -0,0 +1,3 @@ +[wrap-git] +url = https://github.com/openbmc/sdbusplus.git +revision = 95874d930f0bcc8390cd47ab3bb1e5e46db45278 -- cgit v1.2.3