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

v4: meson support, bump version to v4.1.1 #547

Open
wants to merge 5 commits into
base: maintenance/v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 63 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ name: CI
on:
pull_request:
push:
branches:
- master

jobs:
cmake-build-and-tests:
name: >-
CMake build + tests (${{ matrix.image_name }} ${{ matrix.cmake_flags }})
runs-on: ${{ matrix.image_name }}

strategy:
fail-fast: false
matrix:
include:
# Do a regular and a no-libc build for each platform.
- image_name: macOS-latest
- image_name: macOS-latest
- image_name: macos-latest
- image_name: macos-latest
cmake_flags: -DZYAN_NO_LIBC=ON
skip_tests: yes
- image_name: windows-2022
Expand All @@ -39,7 +36,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Configuring
run: |
Expand All @@ -53,31 +50,85 @@ jobs:
cd build
ctest -C Release --output-on-failure

meson-build-and-tests:
name: >-
Meson build + tests (${{ matrix.platform }}, ${{ matrix.flavor }} ${{ matrix.mode.name }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
flavor:
- debug
- release
mode:
- { name: default, args: -Dtests=enabled }
- { name: NO_LIBC, args: -Dnolibc=true }
platform:
- macos-latest
- windows-2022
- ubuntu-22.04
extra_envs:
- {}
include:
# Do a few more specialized configurations.
- platform: ubuntu-22.04
mode:
name: minimal
args: -Dminimal=enabled -Ddecoder=enabled -Davx512=enabled -Dknc=enabled -Dsegment=enabled -Dtests=enabled
extra_envs: {}
flavor: minsize
exclude:
- platform: macos-latest
mode: { name: NO_LIBC, args: -Dnolibc=true }

steps:
- name: Setup meson
run: |
pipx install meson ninja
- name: Checkout
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Activate MSVC and Configure
if: ${{ matrix.platform == 'windows-2022' }}
env: ${{ matrix.extra_envs }}
run: |
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} --vsenv
- name: Configuring
if: ${{ matrix.platform != 'windows-2022' }}
run: |
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
- name: Building
run: |
meson compile -C build-${{ matrix.flavor }}
- name: Running tests
run: |
meson test -C build-${{ matrix.flavor }}

msbuild-build:
name: MSBuild build (windows-2022)
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1.3
with: { vs-version: '[17,]' }
with: { vs-version: "[17,]" }
- name: Build user-mode
run: |
cd msvc
msbuild.exe Zydis.sln /m /t:Rebuild '/p:Configuration="Release MD";Platform=X64'
msbuild.exe Zydis.sln /m /t:Rebuild /p:Configuration="Release MD" /p:Platform=X64
- name: Build kernel-mode
run: |
cd msvc
msbuild.exe Zydis.sln /m /t:Rebuild '/p:Configuration="Release Kernel";Platform=X64'
msbuild.exe Zydis.sln /m /t:Rebuild /p:Configuration="Release Kernel" /p:Platform=X64

amalgamated:
name: Amalgamated build (Ubuntu 22.04)
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Amalgamating sources
run: |
Expand Down Expand Up @@ -109,7 +160,7 @@ jobs:
dry-run: false
sanitizer: ${{ matrix.sanitizer }}
- name: Upload Crash
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
cmake_policy(SET CMP0091 NEW)
endif ()

project(Zydis VERSION 4.1.0.0 LANGUAGES C)
project(Zydis VERSION 4.1.1.0 LANGUAGES C)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# per line (i.e. do not split long lines with '\'), and only use '=' to set values

PROJECT_NAME = Zydis
PROJECT_NUMBER = v4.1.0
PROJECT_NUMBER = v4.1.1
OUTPUT_DIRECTORY = ./doc
INPUT = ./include ./README.md ./files.dox
JAVADOC_AUTOBRIEF = YES
Expand Down
25 changes: 25 additions & 0 deletions Doxyfile.meson.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@INCLUDE = "@TOP_SRCDIR@/Doxyfile"
PROJECT_NUMBER = @VERSION@
PROJECT_BRIEF = "Zyan Disassembler Library"
OUTPUT_DIRECTORY = "@TOP_BUILDDIR@/doc"
STRIP_FROM_PATH = "@TOP_SRCDIR@"
STRIP_FROM_INC_PATH = "@ZYCORE_INCLUDE_PATH@"
INPUT = "@TOP_SRCDIR@/include" \
"@TOP_SRCDIR@/README.md" \
"@TOP_SRCDIR@/files.dox"
EXAMPLE_PATH = "@TOP_SRCDIR@/examples"
USE_MDFILE_AS_MAINPAGE = "@TOP_SRCDIR@/README.md"
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
INCLUDE_PATH = "@ZYCORE_INCLUDE_PATH@"
PREDEFINED = @PREDEFINED@
EXPAND_AS_DEFINED = ZYAN_BITFIELD
DOT_COMMON_ATTR = "fontname=\"sans-serif\",fontsize=10"
DOT_EDGE_ATTR = "labelfontname=\"sans-serif\",labelfontsize=10"
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
HAVE_DOT = @HAVE_DOT@
DOT_MULTI_TARGETS = @HAVE_DOT_1_8_10@
DOT_PATH = "@DOT_PATH@"
HTML_FORMULA_FORMAT = @HTML_FORMULA_FORMAT@

1 change: 1 addition & 0 deletions assets/version-bump-checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
- resources/VersionInfo.rc (4 locations)
- include/Zydis/Zydis.h (ZYDIS_VERSION macro)
- create a tagged release of zycore
- sync revision in dependencies/zycore.wrap
- create a tagged release of zydis
8 changes: 8 additions & 0 deletions dependencies/zycore.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[wrap-file]
directory = zycore-c-1.5.1
source_url = https://github.com/zyantific/zycore-c/archive/refs/tags/v1.5.1.tar.gz
source_filename = v1.5.1.tar.gz
source_hash = 292ec0b30a68a6be416119756238efb5ab34122de80cca884e269e28f6fc126b

[provide]
dependency_names = zycore
28 changes: 28 additions & 0 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
examples_req = examples.enabled()

if examples_req
if decoder.enabled() and formatter.enabled()
executable('DisassembleSimple', 'DisassembleSimple.c', dependencies: [zydis_dep])
executable('Disassemble', 'Disassemble.c', dependencies: [zydis_dep])
executable('Formatter01', 'Formatter01.c', dependencies: [zydis_dep])
executable('Formatter02', 'Formatter02.c', dependencies: [zydis_dep])
executable('Formatter03', 'Formatter03.c', dependencies: [zydis_dep])
executable(
'ZydisPerfTest',
'ZydisPerfTest.c',
c_args: host_machine.system() in ['linux', 'freebsd'] ? ['-D_GNU_SOURCE'] : [],
dependencies: [zydis_dep],
)
endif

if encoder.enabled()
executable('EncodeMov', 'EncodeMov.c', dependencies: [zydis_dep])
executable('EncodeFromScratch', 'EncodeFromScratch.c', dependencies: [zydis_dep])
executable('RewriteCode', 'RewriteCode.c', dependencies: [zydis_dep])
endif
endif

summary(
{'examples': examples_req},
section: 'Features',
)
10 changes: 5 additions & 5 deletions include/Zydis/Zydis.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extern "C" {
/**
* A macro that defines the zydis version.
*/
#define ZYDIS_VERSION (ZyanU64)0x0004000100000000
#define ZYDIS_VERSION 0x0004000100000000ULL

/* ---------------------------------------------------------------------------------------------- */
/* Helper macros */
Expand All @@ -97,28 +97,28 @@ extern "C" {
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_MAJOR(version) (ZyanU16)(((version) & 0xFFFF000000000000) >> 48)
#define ZYDIS_VERSION_MAJOR(version) (((version) & 0xFFFF000000000000) >> 48)

/**
* Extracts the minor-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_MINOR(version) (ZyanU16)(((version) & 0x0000FFFF00000000) >> 32)
#define ZYDIS_VERSION_MINOR(version) (((version) & 0x0000FFFF00000000) >> 32)

/**
* Extracts the patch-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_PATCH(version) (ZyanU16)(((version) & 0x00000000FFFF0000) >> 16)
#define ZYDIS_VERSION_PATCH(version) (((version) & 0x00000000FFFF0000) >> 16)

/**
* Extracts the build-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_BUILD(version) (ZyanU16)((version) & 0x000000000000FFFF)
#define ZYDIS_VERSION_BUILD(version) ((version) & 0x000000000000FFFF)

/* ---------------------------------------------------------------------------------------------- */

Expand Down
25 changes: 25 additions & 0 deletions man/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ronn_exe = find_program('ronn', required: man)
man_req = ronn_exe.found()

if man_req
man_names = [
'ZydisDisasm.1',
'ZydisInfo.1',
]

foreach page : man_names
custom_target(
page,
input: files(f'@page@.ronn'),
command: [ronn_exe, '--roff', '--output-dir', '@OUTDIR@', '@INPUT@'],
output: page,
install: true,
install_dir: datadir / 'man' / 'man1',
)
endforeach
endif

summary(
{'man': man_req},
section: 'Features',
)
Loading