mirror of
https://github.com/json-c/json-c.git
synced 2026-03-23 23:19:06 +08:00
Merge pull request #903 from neheb/1
Some checks failed
meson / Linux-GCC (13) (push) Has been cancelled
meson / Linux-GCC (9) (push) Has been cancelled
meson / Linux-Clang (22) (push) Has been cancelled
meson / Linux-Clang (9) (push) Has been cancelled
meson / VisualStudio (x64) (push) Has been cancelled
meson / VisualStudio (x86) (push) Has been cancelled
meson / VisualStudio-clang-cl (push) Has been cancelled
meson / MSYS2 (CLANG64) (push) Has been cancelled
meson / MSYS2 (UCRT64) (push) Has been cancelled
meson / Cygwin (push) Has been cancelled
meson / MacOS (push) Has been cancelled
meson / DragonflyBSD (push) Has been cancelled
meson / FreeBSD (push) Has been cancelled
meson / NetBSD (push) Has been cancelled
meson / OmniOS (push) Has been cancelled
meson / OpenBSD (push) Has been cancelled
meson / Alpine (aarch64) (push) Has been cancelled
meson / Alpine (armhf) (push) Has been cancelled
meson / Alpine (armv7) (push) Has been cancelled
meson / Alpine (ppc64le) (push) Has been cancelled
meson / Alpine (riscv64) (push) Has been cancelled
meson / Alpine (s390x) (push) Has been cancelled
meson / Alpine (x86) (push) Has been cancelled
meson / Alpine (x86_64) (push) Has been cancelled
Some checks failed
meson / Linux-GCC (13) (push) Has been cancelled
meson / Linux-GCC (9) (push) Has been cancelled
meson / Linux-Clang (22) (push) Has been cancelled
meson / Linux-Clang (9) (push) Has been cancelled
meson / VisualStudio (x64) (push) Has been cancelled
meson / VisualStudio (x86) (push) Has been cancelled
meson / VisualStudio-clang-cl (push) Has been cancelled
meson / MSYS2 (CLANG64) (push) Has been cancelled
meson / MSYS2 (UCRT64) (push) Has been cancelled
meson / Cygwin (push) Has been cancelled
meson / MacOS (push) Has been cancelled
meson / DragonflyBSD (push) Has been cancelled
meson / FreeBSD (push) Has been cancelled
meson / NetBSD (push) Has been cancelled
meson / OmniOS (push) Has been cancelled
meson / OpenBSD (push) Has been cancelled
meson / Alpine (aarch64) (push) Has been cancelled
meson / Alpine (armhf) (push) Has been cancelled
meson / Alpine (armv7) (push) Has been cancelled
meson / Alpine (ppc64le) (push) Has been cancelled
meson / Alpine (riscv64) (push) Has been cancelled
meson / Alpine (s390x) (push) Has been cancelled
meson / Alpine (x86) (push) Has been cancelled
meson / Alpine (x86_64) (push) Has been cancelled
meson: use override_dependency
This commit is contained in:
228
.github/workflows/meson.yml
vendored
Normal file
228
.github/workflows/meson.yml
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
name: meson
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{github.workflow}}-${{github.head_ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
Linux-GCC:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
cc: ['9', '13']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: egor-tensin/setup-gcc@v1
|
||||
with:
|
||||
version: ${{matrix.cc}}
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
python3 -m pip install meson ninja
|
||||
|
||||
- name: Compile and Test
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
Linux-Clang:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
cc: ['9', '22']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: egor-tensin/setup-clang@v1
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
python3 -m pip install meson ninja
|
||||
|
||||
- name: Compile and Test
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
VisualStudio:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: ['x64', 'x86']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
python -m pip install meson ninja
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{matrix.platform}}
|
||||
|
||||
- name: Compile and Test
|
||||
env:
|
||||
CFLAGS: '/analyze'
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" --wrap-mode=forcefallback -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
VisualStudio-clang-cl:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
python -m pip install meson ninja
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Compile and Test
|
||||
env:
|
||||
CC: clang-cl
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
MSYS2:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: ['UCRT64', 'CLANG64']
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{matrix.platform}}
|
||||
pacboy: >-
|
||||
cc:p
|
||||
cmake:p
|
||||
meson:p
|
||||
ninja:p
|
||||
pkgconf:p
|
||||
|
||||
- name: Compile and Test
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
Cygwin:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: 'MSYS'
|
||||
install: >-
|
||||
gcc
|
||||
meson
|
||||
ninja
|
||||
- name: Compile and Test
|
||||
run: |
|
||||
meson setup build -Dwarning_level=3 -Dcpp_std=gnu++20 -Dbuildtype=debug
|
||||
meson compile -C build --verbose
|
||||
meson test -C build --verbose
|
||||
MacOS:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
brew install meson
|
||||
|
||||
- name: Compile and Test
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
DragonflyBSD:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: vmactions/dragonflybsd-vm@v1
|
||||
with:
|
||||
prepare: |
|
||||
pkg install -y ninja meson pkgconf
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
FreeBSD:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: vmactions/freebsd-vm@v1
|
||||
with:
|
||||
prepare: |
|
||||
pkg install -y ninja meson pkgconf
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
NetBSD:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: vmactions/netbsd-vm@v1
|
||||
with:
|
||||
prepare: |
|
||||
/usr/sbin/pkg_add meson pkgconf
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
OmniOS:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: vmactions/omnios-vm@v1
|
||||
with:
|
||||
prepare: |
|
||||
pkg install gcc14 meson-313 ninja pkg-config python-313
|
||||
run: |
|
||||
/usr/lib/python3.13/bin/meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
/usr/lib/python3.13/bin/meson compile -C "${{github.workspace}}/build" --verbose
|
||||
/usr/lib/python3.13/bin/meson test -C "${{github.workspace}}/build" --verbose
|
||||
OpenBSD:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: vmactions/openbsd-vm@v1
|
||||
with:
|
||||
prepare: |
|
||||
pkg_add ninja meson pkgconf
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
Alpine:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: ['x86_64', 'x86', 'armhf', 'armv7', 'aarch64', 'ppc64le', 'riscv64', 's390x']
|
||||
defaults:
|
||||
run:
|
||||
shell: alpine.sh {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: jirutka/setup-alpine@v1
|
||||
with:
|
||||
branch: edge
|
||||
arch: ${{matrix.platform}}
|
||||
packages: >
|
||||
build-base pkgconf meson samurai
|
||||
- name: Compile and Test
|
||||
run: |
|
||||
meson setup "${{github.workspace}}/build" -Dwarning_level=3 -Dbuildtype=debug
|
||||
meson compile -C "${{github.workspace}}/build" --verbose
|
||||
meson test -C "${{github.workspace}}/build" --verbose
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x)&7) + 9)
|
||||
|
||||
#if !HAVE_STRNCASECMP && defined(_MSC_VER)
|
||||
#if !HAVE_STRNCASECMP && defined(_WIN32)
|
||||
/* MSC has the version as _strnicmp */
|
||||
#define strncasecmp _strnicmp
|
||||
#elif !HAVE_STRNCASECMP
|
||||
|
||||
25
meson.build
25
meson.build
@@ -1,5 +1,7 @@
|
||||
|
||||
project('json-c', 'c', version: '0.18.99',
|
||||
meson_version: '>=0.54.0',
|
||||
license: 'MIT',
|
||||
default_options: ['buildtype=release', 'warning_level=2'])
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
@@ -72,14 +74,16 @@ funcs = [
|
||||
'vsyslog',
|
||||
'getrandom',
|
||||
'getrusage',
|
||||
'strcasecmp',
|
||||
'strncasecmp',
|
||||
'strtoll',
|
||||
'strtoull',
|
||||
'arc4random',
|
||||
'vasprintf',
|
||||
]
|
||||
|
||||
if conf_data.has('HAVE_STRINGS_H')
|
||||
funcs += ['strcasecmp', 'strncasecmp']
|
||||
endif
|
||||
|
||||
foreach f : funcs
|
||||
if cc.has_function(f)
|
||||
conf_data.set('HAVE_@0@'.format(f.to_upper()), 1, description : 'Define to 1 if you have the `@0@` function.'.format(f))
|
||||
@@ -123,16 +127,12 @@ foreach d, h : decls
|
||||
endif
|
||||
endforeach
|
||||
|
||||
check_thread = cc.compiles('''
|
||||
__thread int x = 0;
|
||||
int main() { return x; }
|
||||
''',
|
||||
name: 'Check for __thread support')
|
||||
check_thread = cc.compiles('__thread int x;', name: 'Check for __thread support')
|
||||
|
||||
if check_thread
|
||||
conf_data.set('HAVE___THREAD', 1)
|
||||
conf_data.set('SPEC___THREAD', '__thread')
|
||||
elif cc.get_id().contains('msvc')
|
||||
elif cc.get_argument_syntax() == 'msvc'
|
||||
conf_data.set('SPEC___THREAD', '__declspec(thread)')
|
||||
endif
|
||||
|
||||
@@ -211,7 +211,6 @@ json_header = configure_file(
|
||||
configuration: jhconf_data
|
||||
)
|
||||
|
||||
|
||||
# Platform-specific flags
|
||||
add_project_arguments('-D_GNU_SOURCE', language: 'c')
|
||||
|
||||
@@ -228,6 +227,12 @@ endif
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments('-Wno-unused-parameter'), language : 'c')
|
||||
|
||||
sym = cc.get_supported_link_arguments(
|
||||
'-Wl,--version-script,@0@/json-c.sym'.format(
|
||||
meson.current_source_dir(),
|
||||
),
|
||||
)
|
||||
|
||||
# Source files
|
||||
sources = files(
|
||||
'arraylist.c', 'debug.c', 'json_c_version.c', 'json_object.c',
|
||||
@@ -252,11 +257,13 @@ libjson = library('json-c',
|
||||
include_directories: inc,
|
||||
dependencies: bsd_dep,
|
||||
install: true,
|
||||
link_args: sym,
|
||||
version: '5.4.0',
|
||||
soversion: '5',
|
||||
)
|
||||
|
||||
jsonc_dep = declare_dependency(link_with: libjson, include_directories: inc)
|
||||
meson.override_dependency('json-c', jsonc_dep)
|
||||
|
||||
# Install headers
|
||||
install_headers(
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
test_includes = include_directories('.')
|
||||
test_deps = [jsonc_dep]
|
||||
#This hack is needed for Windows tests
|
||||
test_lib = static_library(
|
||||
'jsonctest',
|
||||
objects: libjson.extract_all_objects(
|
||||
recursive: false,
|
||||
),
|
||||
install: false,
|
||||
)
|
||||
|
||||
test_deps = declare_dependency(
|
||||
include_directories: '..',
|
||||
link_with: test_lib,
|
||||
)
|
||||
|
||||
# List of test sources and expected output files
|
||||
test_cases = [
|
||||
@@ -53,7 +64,6 @@ foreach t : test_cases
|
||||
name = t[0]
|
||||
expected = t[1]
|
||||
exe = executable(name, name + '.c',
|
||||
include_directories: test_includes,
|
||||
dependencies: test_deps
|
||||
)
|
||||
|
||||
@@ -62,4 +72,4 @@ foreach t : test_cases
|
||||
env: ['EXPECTED_FILE=' + meson.current_build_dir() / expected],
|
||||
workdir: testdir
|
||||
)
|
||||
endforeach
|
||||
endforeach
|
||||
|
||||
Reference in New Issue
Block a user