Skip to content

Commit

Permalink
CI: add testing with GTK build for Windows (msvc)
Browse files Browse the repository at this point in the history
Closes: ebassi#265
  • Loading branch information
DjLegolas committed Jan 24, 2025
1 parent d402214 commit a65ac8f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/msvc-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,41 @@ on:
jobs:
build:
runs-on: windows-latest
name: Build with introspection=${{ matrix.build_introspection }}
env:
PYTHONIOENCODING: "utf-8"
GIR_BUILD: ""
strategy:
fail-fast: false
matrix:
build_introspection: [ true, false ]
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v1
with:
python-version: '3.12'
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- name: Install GTK
if: matrix.build_introspection
run: |
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://github.com/wingtk/gvsbuild/releases/download/2024.8.1/GTK4_Gvsbuild_2024.8.1_x64.zip","C:\GTK.zip")
7z x C:\GTK.zip -oC:\GTK
echo "C:\GTK\lib" | Out-File -FilePath $env:GITHUB_PATH -Append
echo "C:\GTK\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
echo "C:\GTK" | Out-File -FilePath $env:GITHUB_PATH -Append
echo "GIR_BUILD=-Dintrospection=enabled" >> $GITHUB_ENV
python -m pip install setuptools
python -m pip install C:\GTK\python\pycairo-1.26.1-cp312-cp312-win_amd64.whl C:\GTK\python\pygobject-3.48.2-cp312-cp312-win_amd64.whl
- name: Prebuild
run: |
echo %PATH%
python -m pip install meson==1.0.0
meson setup _build
- uses: BSFishy/meson-build@v1.0.3
with:
action: test
directory: _build
setup-options: ${{ env.GIR_BUILD }}
options: "--verbose"
meson-version: "1.0.0"
13 changes: 10 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ endif
# then we don't build introspection data either.
#
# We only build introspection if we can run binaries on the host.
message('find_program g-ir-scanner')
gir = find_program('g-ir-scanner', required: get_option('introspection'))
build_gir = get_option('introspection').allowed() and build_gobject and gir.found() and meson.can_run_host_binaries()

Expand Down Expand Up @@ -277,6 +278,7 @@ graphene_conf = configuration_data()
graphene_simd = []

# SSE intrinsics
message('get_option sse2')
sse2_cflags = []
if get_option('sse2')
sse_prog = '''
Expand Down Expand Up @@ -314,6 +316,7 @@ int main () {
endif

# GCC/Clang vector intrinsics
message('get_option gcc_vector')
if get_option('gcc_vector')
vector_intrin_prog = '''
#if defined(__GNUC__) // Clang advertises __GNUC__ too
Expand Down Expand Up @@ -349,6 +352,7 @@ int main () {
endif

# ARM NEON intrinsics
message('get_option arm_neon')
neon_cflags = []
if get_option('arm_neon')
neon_prog = '''
Expand Down Expand Up @@ -427,23 +431,26 @@ if graphene_build_static_only
graphene_conf.set('GRAPHENE_STATIC_COMPILATION', '1')
endif


message('importing python and gnome')
python = import('python')
gnome = import('gnome')

message('subdir include')
subdir('include')

message('include_directories src')
src_inc = include_directories('src')
message('subdir src')
subdir('src')

message('get_option tests')
if get_option('tests')
if cc.get_id() == 'msvc' and cc.version().version_compare('<19')
warning('Tests, specifically the mutest library, cannot be built for pre-2015 Visual Studio builds.')
warning('Use \'meson configure -Dtests=false\' if you are sure you want to proceed.')
endif
subdir('tests')
endif

message('get_option gtk_doc')
if get_option('gtk_doc')
subdir('doc')
endif
Expand Down
10 changes: 9 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
message('in src/meson.build')
sources = [
'graphene-alloc.c',
'graphene-box.c',
Expand All @@ -22,23 +23,26 @@ simd_sources = [
'graphene-simd4f.c',
'graphene-simd4x4f.c',
]

message('if build_gobject 1')
if build_gobject
sources += [ 'graphene-gobject.c' ]
endif

# Internal configuration header
message('configure_file')
configure_file(
output: 'config.h',
configuration: conf,
)

platform_deps = []

message('if build_gobject 2')
if build_gobject
platform_deps += gobject
endif

message('library libgraphene')
libgraphene = library(
graphene_api_path,
include_directories: graphene_inc,
Expand All @@ -55,10 +59,12 @@ libgraphene = library(
link_args: common_ldflags,
)

message('foreach simd')
foreach simd: [ 'sse2', 'gcc', 'neon', 'scalar', ]
set_variable('has_' + simd, graphene_simd.contains(simd) ? '1' : '0')
endforeach

message('import pkgconfig')
pkgconfig = import('pkgconfig')
pkgconfig.generate(
libgraphene,
Expand All @@ -78,6 +84,7 @@ pkgconfig.generate(
] + sse2_cflags + neon_cflags,
)

message('if build_gobject 3')
if build_gobject
pkgconfig.generate(
name: 'Graphene-GObject',
Expand All @@ -98,6 +105,7 @@ endif
graphene_dep_sources = []

# Introspection
message('if build_gir')
if build_gir
python = python.find_installation()
identfilter_py = meson.current_source_dir() / 'identfilter.py'
Expand Down
9 changes: 6 additions & 3 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
message('In tests/meson.build')
unit_tests = [
'box',
'box2d',
Expand All @@ -20,8 +21,10 @@ unit_tests = [
'vec4'
]

message('find "gen-installed-test.py"')
gen_installed_test = find_program('gen-installed-test.py')

message('build paths')
installed_test_datadir = get_option('prefix') / get_option('datadir') / 'installed-tests' / graphene_api_path
installed_test_bindir = get_option('prefix') / get_option('libexecdir') / 'installed-tests' / graphene_api_path

Expand All @@ -33,7 +36,7 @@ mutest_dep = dependency('mutest-1',
required: false,
disabler: true,
)

message('if mutest_dep.found')
if mutest_dep.found()
foreach unit: unit_tests
wrapper = '@0@.test'.format(unit)
Expand Down Expand Up @@ -65,8 +68,8 @@ if mutest_dep.found()
endif

src_build_path = meson.current_build_dir() / '../src'

if build_gir and host_system == 'linux' and not meson.is_cross_build()
message('if build_gir and not meson.is_cross_build')
if build_gir and not meson.is_cross_build()
foreach unit: ['introspection.py']
if get_option('installed_tests')
install_data(unit, install_dir: installed_test_bindir)
Expand Down

0 comments on commit a65ac8f

Please sign in to comment.