Skip to content

Commit 9d298eb

Browse files
authored
Add meson build system support (#525)
1 parent bd73bc0 commit 9d298eb

File tree

13 files changed

+698
-10
lines changed

13 files changed

+698
-10
lines changed

.github/workflows/main.yml

+61-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ jobs:
1111
name: >-
1212
CMake build + tests (${{ matrix.image_name }} ${{ matrix.cmake_flags }})
1313
runs-on: ${{ matrix.image_name }}
14-
1514
strategy:
1615
fail-fast: false
1716
matrix:
1817
include:
1918
# Do a regular and a no-libc build for each platform.
20-
- image_name: macOS-latest
21-
- image_name: macOS-latest
19+
- image_name: macos-latest
20+
- image_name: macos-latest
2221
cmake_flags: -DZYAN_NO_LIBC=ON
2322
skip_tests: yes
2423
- image_name: windows-2022
@@ -39,7 +38,7 @@ jobs:
3938

4039
steps:
4140
- name: Checkout
42-
uses: actions/checkout@v2
41+
uses: actions/checkout@v4
4342
with: { submodules: recursive }
4443
- name: Configuring
4544
run: |
@@ -53,16 +52,70 @@ jobs:
5352
cd build
5453
ctest -C Release --output-on-failure
5554
55+
meson-build-and-tests:
56+
name: >-
57+
Meson build + tests (${{ matrix.platform }}, ${{ matrix.flavor }} ${{ matrix.mode.name }})
58+
runs-on: ${{ matrix.platform }}
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
flavor:
63+
- debug
64+
- release
65+
mode:
66+
- { name: default, args: -Dtests=enabled }
67+
- { name: NO_LIBC, args: -Dnolibc=true }
68+
platform:
69+
- macos-latest
70+
- windows-2022
71+
- ubuntu-22.04
72+
extra_envs:
73+
- {}
74+
include:
75+
# Do a few more specialized configurations.
76+
- platform: ubuntu-22.04
77+
mode:
78+
- name: minimal
79+
args: -Dminimal=enabled -Ddecoder=enabled -Davx512=enabled -Dknc=enabled -Dsegment=enabled -Dtests=enabled
80+
extra_envs: {}
81+
flavor: minsize
82+
exclude:
83+
- platform: macos-latest
84+
mode: { name: NO_LIBC, args: -Dnolibc=true }
85+
86+
steps:
87+
- name: Setup meson
88+
run: |
89+
pipx install meson ninja
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
with: { submodules: recursive }
93+
- name: Activate MSVC and Configure
94+
if: ${{ matrix.platform == 'windows-2022' }}
95+
env: ${{ matrix.extra_envs }}
96+
run: |
97+
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} --vsenv
98+
- name: Configuring
99+
if: ${{ matrix.platform != 'windows-2022' }}
100+
run: |
101+
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
102+
- name: Building
103+
run: |
104+
meson compile -C build-${{ matrix.flavor }}
105+
- name: Running tests
106+
run: |
107+
meson test -C build-${{ matrix.flavor }}
108+
56109
msbuild-build:
57110
name: MSBuild build (windows-2022)
58111
runs-on: windows-2022
59112
steps:
60113
- name: Checkout
61-
uses: actions/checkout@v2
114+
uses: actions/checkout@v4
62115
with: { submodules: recursive }
63116
- name: Add msbuild to PATH
64117
uses: microsoft/[email protected]
65-
with: { vs-version: '[17,]' }
118+
with: { vs-version: "[17,]" }
66119
- name: Build user-mode
67120
run: |
68121
cd msvc
@@ -77,7 +130,7 @@ jobs:
77130
runs-on: ubuntu-22.04
78131
steps:
79132
- name: Checkout
80-
uses: actions/checkout@v2
133+
uses: actions/checkout@v4
81134
with: { submodules: recursive }
82135
- name: Amalgamating sources
83136
run: |
@@ -109,7 +162,7 @@ jobs:
109162
dry-run: false
110163
sanitizer: ${{ matrix.sanitizer }}
111164
- name: Upload Crash
112-
uses: actions/upload-artifact@v1
165+
uses: actions/upload-artifact@v4
113166
if: failure() && steps.build.outcome == 'success'
114167
with:
115168
name: ${{ matrix.sanitizer }}-artifacts

Doxyfile.meson.in

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@INCLUDE = "@TOP_SRCDIR@/Doxyfile"
2+
PROJECT_NUMBER = @VERSION@
3+
PROJECT_BRIEF = "Zyan Disassembler Library"
4+
OUTPUT_DIRECTORY = "@TOP_BUILDDIR@/doc"
5+
STRIP_FROM_PATH = "@TOP_SRCDIR@"
6+
STRIP_FROM_INC_PATH = "@ZYCORE_INCLUDE_PATH@"
7+
INPUT = "@TOP_SRCDIR@/include" \
8+
"@TOP_SRCDIR@/README.md" \
9+
"@TOP_SRCDIR@/files.dox"
10+
EXAMPLE_PATH = "@TOP_SRCDIR@/examples"
11+
USE_MDFILE_AS_MAINPAGE = "@TOP_SRCDIR@/README.md"
12+
MACRO_EXPANSION = YES
13+
EXPAND_ONLY_PREDEF = YES
14+
INCLUDE_PATH = "@ZYCORE_INCLUDE_PATH@"
15+
PREDEFINED = @PREDEFINED@
16+
EXPAND_AS_DEFINED = ZYAN_BITFIELD
17+
DOT_COMMON_ATTR = "fontname=\"sans-serif\",fontsize=10"
18+
DOT_EDGE_ATTR = "labelfontname=\"sans-serif\",labelfontsize=10"
19+
DOT_IMAGE_FORMAT = svg
20+
INTERACTIVE_SVG = YES
21+
HAVE_DOT = @HAVE_DOT@
22+
DOT_MULTI_TARGETS = @HAVE_DOT_1_8_10@
23+
DOT_PATH = "@DOT_PATH@"
24+
HTML_FORMULA_FORMAT = @HTML_FORMULA_FORMAT@
25+

assets/version-bump-checklist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
- resources/VersionInfo.rc (4 locations)
44
- include/Zydis/Zydis.h (ZYDIS_VERSION macro)
55
- create a tagged release of zycore
6+
- sync revision in dependencies/zycore.wrap
67
- create a tagged release of zydis

dependencies/zycore.wrap

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[wrap-git]
2+
# This is a fallback for plain clone (no submodules available).
3+
url = https://github.com/zyantific/zycore-c.git
4+
# Sync revision to `git submodule status zycore`.
5+
# If doing a release for Zydis, sync both to a tagged commit.
6+
revision = 38d4f0285e6157ee840ea82a9b90aba71c8a705d
7+
depth = 1
8+
9+
[provide]
10+
dependency_names = zycore

examples/meson.build

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
examples_req = examples.enabled()
2+
3+
if examples_req
4+
if decoder.enabled() and formatter.enabled()
5+
executable('DisassembleSimple', 'DisassembleSimple.c', dependencies: [zydis_dep])
6+
executable('Disassemble', 'Disassemble.c', dependencies: [zydis_dep])
7+
executable('Formatter01', 'Formatter01.c', dependencies: [zydis_dep])
8+
executable('Formatter02', 'Formatter02.c', dependencies: [zydis_dep])
9+
executable('Formatter03', 'Formatter03.c', dependencies: [zydis_dep])
10+
executable(
11+
'ZydisPerfTest',
12+
'ZydisPerfTest.c',
13+
c_args: host_machine.system() in ['linux', 'freebsd'] ? ['-D_GNU_SOURCE'] : [],
14+
dependencies: [zydis_dep],
15+
)
16+
endif
17+
18+
if encoder.enabled()
19+
executable('EncodeMov', 'EncodeMov.c', dependencies: [zydis_dep])
20+
executable('EncodeFromScratch', 'EncodeFromScratch.c', dependencies: [zydis_dep])
21+
executable('RewriteCode', 'RewriteCode.c', dependencies: [zydis_dep])
22+
endif
23+
endif
24+
25+
summary(
26+
{'examples': examples_req},
27+
section: 'Features',
28+
)

man/meson.build

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ronn_exe = find_program('ronn', required: man)
2+
man_req = ronn_exe.found()
3+
4+
if man_req
5+
man_names = [
6+
'ZydisDisasm.1',
7+
'ZydisInfo.1',
8+
]
9+
10+
foreach page : man_names
11+
custom_target(
12+
page,
13+
input: files(f'@[email protected]'),
14+
command: [ronn_exe, '--roff', '--output-dir', '@OUTDIR@', '@INPUT@'],
15+
output: page,
16+
install: true,
17+
install_dir: datadir / 'man' / 'man1',
18+
)
19+
endforeach
20+
endif
21+
22+
summary(
23+
{'man': man_req},
24+
section: 'Features',
25+
)

0 commit comments

Comments
 (0)