Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add Meson support #7

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

build: add Meson support #7

wants to merge 1 commit into from

Conversation

Tachi107
Copy link
Contributor

I was trying to package Vixl, but the SCons build system does not provide an install target, so I would've had to add it. It seemed too difficult, so I directly created a quite basic Meson build script.

It provides most features of the SCons script, except for tests and benchmarks, while adding a rich install target, with library soname versioning and a pkg-config file.

Meson is a simple yet powerful build system, and you're interested in using it as your main build system I could add tests and benchmarks :)

@mmc28a
Copy link
Collaborator

mmc28a commented Oct 28, 2021

Thanks for the submission, and sorry for the delayed response - I received no notification. I'll check on the process to get this merged.

@Tachi107
Copy link
Contributor Author

Tachi107 commented Jan 3, 2022

Hey @mmc28a, pinging you just to let you know that the Vixl Debian package has been using Meson to build the project for a while, and everything works perfectly on 21 different architectures :)

@mmc28a
Copy link
Collaborator

mmc28a commented Jan 4, 2022

Hey @mmc28a, pinging you just to let you know that the Vixl Debian package has been using Meson to build the project for a while, and everything works perfectly on 21 different architectures :)

Great! My main worry with this is having two build systems, with the Meson one currently untested by the CI. An option is to switch from Scons to Meson, but that's still to be decided.

@Tachi107
Copy link
Contributor Author

Tachi107 commented Jan 4, 2022

I would be happy to help with switching to Meson, but I gave a look at your testing infrastructure and it is a bit... unusual 😅️.

If you could explain be a bit how tools/test.py works it would be great

Tachi107 added a commit to Tachi107/dynarmic that referenced this pull request Mar 13, 2022
As far as I know the only pkg-config file provided by Vixl is the one generated by Meson when applying my yet to be merged patch.

That extra include path was needed because I mistakenly thought that adding `vixl` as an include subdirectory was not necessary, but I fixed it in my latest revision - more details here: Linaro/vixl#7 (comment)

The fix already landed in Debian and Ubuntu, that as far as I know are the only Linux distros that ship my patch, so manually adding that include directory shouldn't be necessary anymore
@Tachi107
Copy link
Contributor Author

Hi @mmc28a, sorry to ping you again. Are you interested in the possibility of switching from SCons to Meson? If so, I could look into porting the tests, benchmarks and examples too; if not, I'll keep updating this branch for as long as I'll need an install target that also generates pkg-config files (i.e. for as long as I'll maintain the vixl package in Debian)

@mmc28a
Copy link
Collaborator

mmc28a commented Apr 26, 2022

Sorry, I've been a bit busy with feature updates. I need to make some time to experiment with Meson before deciding. We don't have a strong desire to stick with Scons, though.

@Tachi107
Copy link
Contributor Author

Don't worry, I've seen that Vixl has seen two big releases recently. I'll patiently wait for your decision :)

@Tachi107
Copy link
Contributor Author

Converting to draft, as it seems that there isn't much interested in this patch set and I haven't updated it in almost a year.

Feel free to ping me when you're ready to consider the switch; if not, please consider adding an install target to the Scons build script :)

@Tachi107 Tachi107 marked this pull request as draft December 20, 2022 08:10
@mmc28a
Copy link
Collaborator

mmc28a commented Dec 20, 2022

Sorry, I've still not got to this. I appreciate the contribution, and it's still on my radar, but my radar's pretty full.
I tried this a few months ago, but found my Meson installation to be too old to work with your build changes, so I first need to bump my OS version.

@mmc28a
Copy link
Collaborator

mmc28a commented Feb 10, 2023

Finally tried this - looks good! I guess it just builds a .so library at the moment, so I'd like it to build others later, along with tests and examples. However, for now, I think we should take it and improve with later patches.

Regarding testing, we'd like to move away from the old Python version, and perhaps rewrite existing test scripts to use something like Parallel. The new scripts could then depend on Meson and Ninja for bulids, and will hopefully be much simpler.

One small request: could you add your name to the AUTHORS file in this patch, and replace it in the individual build files with "VIXL authors"?

@Tachi107
Copy link
Contributor Author

Tachi107 commented Feb 10, 2023

Finally tried this - looks good! I guess it just builds a .so library at the moment, so I'd like it to build others later, along with tests and examples. However, for now, I think we should take it and improve with later patches.

Meson builds .so libraries by default, but you can change that with the --default-library=shared|static|both flag. I think static libraries should work already too.

Regarding testing, we'd like to move away from the old Python version, and perhaps rewrite existing test scripts to use something like Parallel. The new scripts could then depend on Meson and Ninja for bulids, and will hopefully be much simpler.

Nice to hear! I don't know what you mean with "Parallel", though; it can refer to quite a lot of things :)

One small request: could you add your name to the AUTHORS file in this patch, and replace it in the individual build files with "VIXL authors"?

Sure, I'll do it as soon as possible.

@Mis012
Copy link

Mis012 commented Feb 1, 2024

any updates on this? I've updated the meson.build files for the latest master (vixl_meson.patch.gz), and I can compile an example, but only with manually defining VIXL_INCLUDE_TARGET_AARCH64: g++ -DVIXL_INCLUDE_TARGET_AARCH64 -I /usr/local/include/vixl/ examples/aarch64/getting-started.cc -lvixl
I assume this should be included in some header file, dependent on whether the corresponding .cc file was compiled

@PureTryOut
Copy link

PureTryOut commented Feb 20, 2024

Note that at least 7.0.0 requires C++17 but the current Meson files specify C++14.

I'd definitely prefer Meson over SCons for packaging in Alpine Linux, thanks for this PR!

@Mis012
Copy link

Mis012 commented Feb 20, 2024

oops, messed up the diff, attempt number 2:
vixl_meson.patch.gz

@mmc28a
Copy link
Collaborator

mmc28a commented Feb 20, 2024

I've got a large backlog of patches, so I've not been paying much attention to this. Basically, we'll accept Meson as an alternative build system, and eventually move to it if it's reliable.

@Tachi107
Copy link
Contributor Author

Tachi107 commented Aug 6, 2024

Hi @Mis012, I tried applying your patch onto my branch and here is the diff. Was your only change adding a file to the install_headers() call, or was some change of yours lost when attaching the patch?

diff --git a/meson.build b/meson.build
index 96d8165e..1f4e5646 100644
--- a/meson.build
+++ b/meson.build
@@ -6,10 +6,10 @@ project(
   'vixl',
   'cpp',
   default_options: [
-    'cpp_std=c++14',
+    'cpp_std=c++17',
     'buildtype=release',
     'warning_level=3',
-    'werror=true',
+    'werror=false',
     'd_ndebug=if-release',
     'b_lto=true'
   ],
diff --git a/src/aarch64/meson.build b/src/aarch64/meson.build
index 7cd353a3..9eaf0f9d 100644
--- a/src/aarch64/meson.build
+++ b/src/aarch64/meson.build
@@ -32,6 +32,7 @@ install_headers(
   'constants-aarch64.h',
   'cpu-aarch64.h',
   'cpu-features-auditor-aarch64.h',
+  'debugger-aarch64.h',
   'decoder-aarch64.h',
   'decoder-constants-aarch64.h',
   'decoder-visitor-map-aarch64.h',

I was trying to package Vixl, but the SCons build system does not
provide an install target, so I would've had to add it. It seemed too
difficult, so I directly created a quite basic Meson build script.

It provides most features of the SCons script, except for tests and
benchmarks, while adding a rich install target, with library soname
versioning and a pkg-config file.

Meson is a simple yet powerful build system, and you're interested in
using it as your main build system I could add tests and benchmarks :)
@Tachi107
Copy link
Contributor Author

Tachi107 commented Aug 6, 2024

Finally rebased and refreshed! Here's what changed:

diff --git a/AUTHORS b/AUTHORS
index 257ec9d3..13809d26 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -6,3 +6,4 @@
 ARM Ltd. <*@arm.com>
 Google Inc. <*@google.com>
 Linaro <*@linaro.org>
+Andrea Pappacoda <[email protected]>
diff --git a/doc/aarch32/meson.build b/doc/aarch32/meson.build
index 6baf8d57..e07fc46d 100644
--- a/doc/aarch32/meson.build
+++ b/doc/aarch32/meson.build
@@ -1,5 +1,4 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 custom_target(
diff --git a/doc/aarch64/meson.build b/doc/aarch64/meson.build
index d6fe068d..d25f8bfa 100644
--- a/doc/aarch64/meson.build
+++ b/doc/aarch64/meson.build
@@ -1,5 +1,4 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 doc_aarch64_files = [
diff --git a/doc/aarch64/topics/meson.build b/doc/aarch64/topics/meson.build
index 40a4f7df..c6e8542b 100644
--- a/doc/aarch64/topics/meson.build
+++ b/doc/aarch64/topics/meson.build
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: 2021 VIXL authors
+# SPDX-License-Identifier: BSD-3-Clause
+
 doc_aarch64_topics_files = [
   'extending-the-disassembler',
   'index',
diff --git a/doc/meson.build b/doc/meson.build
index f23f5c94..cbfe193d 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,5 +1,4 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 doc_dir = get_option('datadir')/'doc'/meson.project_name()
diff --git a/meson.build b/meson.build
index 96d8165e..427e3f9e 100644
--- a/meson.build
+++ b/meson.build
@@ -1,12 +1,11 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 project(
   'vixl',
   'cpp',
   default_options: [
-    'cpp_std=c++14',
+    'cpp_std=c++17',
     'buildtype=release',
     'warning_level=3',
     'werror=true',
@@ -14,8 +13,8 @@ project(
     'b_lto=true'
   ],
   license: 'BSD-3-Clause',
-  meson_version: '>=0.49.0',
-  version: '5.1.0',
+  meson_version: '>=0.50.0',
+  version: '7.0.0',
 )
 
 extra_args = []
diff --git a/meson_options.txt b/meson_options.txt
index 602d4c82..d436832a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,4 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 option(
diff --git a/src/aarch32/meson.build b/src/aarch32/meson.build
index f4997860..0b22336f 100644
--- a/src/aarch32/meson.build
+++ b/src/aarch32/meson.build
@@ -1,5 +1,4 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 # Need to wrap the filenames in files() otherwise this array would be treated
diff --git a/src/aarch64/meson.build b/src/aarch64/meson.build
index 7cd353a3..2898c8f6 100644
--- a/src/aarch64/meson.build
+++ b/src/aarch64/meson.build
@@ -1,5 +1,4 @@
-# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
-#
+# SPDX-FileCopyrightText: 2021 VIXL authors
 # SPDX-License-Identifier: BSD-3-Clause
 
 # Need to wrap the filenames in files() otherwise this array would be treated
@@ -14,6 +13,7 @@ target_sources += files(
   'assembler-sve-aarch64.cc',
   'cpu-aarch64.cc',
   'cpu-features-auditor-aarch64.cc',
+  'debugger-aarch64.cc',
   'decoder-aarch64.cc',
   'disasm-aarch64.cc',
   'instructions-aarch64.cc',
@@ -32,6 +32,7 @@ install_headers(
   'constants-aarch64.h',
   'cpu-aarch64.h',
   'cpu-features-auditor-aarch64.h',
+  'debugger-aarch64.h',
   'decoder-aarch64.h',
   'decoder-constants-aarch64.h',
   'decoder-visitor-map-aarch64.h',

@Mis012
Copy link

Mis012 commented Aug 9, 2024

hm, I thought there were more changes but I guess not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants