From a65ac8f867838311f6b72d7f9fa80e8600207e6a Mon Sep 17 00:00:00 2001 From: DjLegolas Date: Sat, 17 Aug 2024 00:31:06 +0300 Subject: [PATCH] CI: add testing with GTK build for Windows (msvc) Closes: #265 --- .github/workflows/msvc-env.yml | 26 ++++++++++++++++++++++++++ meson.build | 13 ++++++++++--- src/meson.build | 10 +++++++++- tests/meson.build | 9 ++++++--- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/.github/workflows/msvc-env.yml b/.github/workflows/msvc-env.yml index 5cbe0dc..da32dc7 100644 --- a/.github/workflows/msvc-env.yml +++ b/.github/workflows/msvc-env.yml @@ -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" diff --git a/meson.build b/meson.build index eecd10a..3e964e1 100644 --- a/meson.build +++ b/meson.build @@ -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() @@ -277,6 +278,7 @@ graphene_conf = configuration_data() graphene_simd = [] # SSE intrinsics +message('get_option sse2') sse2_cflags = [] if get_option('sse2') sse_prog = ''' @@ -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 @@ -349,6 +352,7 @@ int main () { endif # ARM NEON intrinsics +message('get_option arm_neon') neon_cflags = [] if get_option('arm_neon') neon_prog = ''' @@ -427,15 +431,18 @@ 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.') @@ -443,7 +450,7 @@ if get_option('tests') endif subdir('tests') endif - +message('get_option gtk_doc') if get_option('gtk_doc') subdir('doc') endif diff --git a/src/meson.build b/src/meson.build index 383f437..d28414f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,4 @@ +message('in src/meson.build') sources = [ 'graphene-alloc.c', 'graphene-box.c', @@ -22,12 +23,13 @@ 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, @@ -35,10 +37,12 @@ configure_file( 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, @@ -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, @@ -78,6 +84,7 @@ pkgconfig.generate( ] + sse2_cflags + neon_cflags, ) +message('if build_gobject 3') if build_gobject pkgconfig.generate( name: 'Graphene-GObject', @@ -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' diff --git a/tests/meson.build b/tests/meson.build index 5ef8b75..d150bb4 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,3 +1,4 @@ +message('In tests/meson.build') unit_tests = [ 'box', 'box2d', @@ -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 @@ -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) @@ -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)