From 51dc00321c088da09300367a82ae5660286a8cae Mon Sep 17 00:00:00 2001 From: Andy Alt Date: Wed, 20 Nov 2024 01:57:24 -0600 Subject: [PATCH] CI: Adding initial workflow (#4) * CI: Adding initial workflow * Add required meson version * Add temporary project version * Use gnu2x for c_std instead of gnu23 * build.yml: Add more deps * meson.build: Try to find installed sqlite{3,cpp} For #6 * Use clang, reset c_std=gnu23, install bun * Install clang-19 * Use "bun run meson-setup clang-release" * Revert "Use "bun run meson-setup clang-release"" This reverts commit 79c9e225b262bc135cd1164302e96ee96080511b. * Fix version * remove blank line * Add path filters * Update build.yml Attempt to add freeglut3-dev since this was also the issue when building the flatpak * Update build.yml Replaced vs.example with the actual meson command; otherwise, if successful, the machine would run the application without headless mode, and wait for user input. * Update .github/workflows/build.yml Co-authored-by: Andy Alt * Update build.yml * Try to install cmake 3.30.5 For https://github.com/mesonbuild/meson/issues/13888 * Install libpng-dev * Update build.yml Only keeping 24.04 for now, since the other versions ship with an older incompatible libc++ --------- Co-authored-by: KaruroChori --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++++++++ meson.build | 27 +++++++++++--- 2 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..c3129704 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: build and test +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +on: + push: + branches: [ master ] + paths: + - '**' + - '!**.yml' + - '!docs/**' + - '!**.md' + - '**/build.yml' + pull_request: + branches: [ master ] + paths: + - '**' + - '!**.yml' + - '!docs/**' + - '!**.md' + - '**/build.yml' + +jobs: + meson: + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04] + runs-on: ${{ matrix.os }} + env: + CC: clang-19 + CXX: clang++-19 + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + if [ "${{ contains(matrix.os, 'ubuntu') }}" = "true" ]; then + sudo apt update + curl -fsSL https://bun.sh/install | bash + echo "PATH=$HOME/.bun/bin:$PATH" >> $GITHUB_ENV + sudo apt update + sudo apt remove -y firefox + sudo apt upgrade -y + sudo apt install -y \ + freeglut3-dev \ + libpng-dev \ + libsqlite3-0 \ + python3-pip \ + python3-setuptools + python3 -m pip install meson ninja + python3 -m pip uninstall cmake + python3 -m pip install cmake==3.30.5 # workaround https://github.com/mesonbuild/meson/issues/13888 + # for clang + sudo apt install -y wget gpg gnupg software-properties-common + curl -LO https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 19 # install clang-19 + else + brew update + brew install meson ninja + fi + + - name: Configure and build + run: | + cmake --version + bun install + bun run codegen + bun run meson-setup.clang-release + meson compile -C build/ vs:executable diff --git a/meson.build b/meson.build index 897e291f..b9f3dfcc 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,14 @@ project( 'vs-fltk', ['c', 'cpp', 'swift'], + version: 'v0.1.1-alpha-dev', + meson_version: '>= 1.1', default_options: ['c_std=gnu23', 'cpp_std=gnu++23'], ) +cc = meson.get_compiler('c') +cxx = meson.get_compiler('cpp') + #Used by pugi to enable compact mode. I might want to disable execptions too. add_global_arguments(['-DPUGIXML_COMPACT'], language : ['cpp','c']) @@ -87,10 +92,24 @@ libtcc_dep = libtcc_proj.get_variable('libtcc_dep') mio_proj = cmake.subproject('mio') mio_dep = mio_proj.dependency('mio') -#TODO convert to internald dep -sqlitecpp_dep = subproject('sqlitecpp').get_variable('sqlitecpp_dep') +sqlitecpp_dep = dependency('sqlitecpp', required: false) +if not sqlitecpp_dep.found() + sqlitecpp_dep = cxx.find_library('SQLiteCpp', required: false) + if not sqlitecpp_dep.found() + sqlitecpp_dep = dependency( + 'sqlitecpp', + fallback: ['sqlitecpp', 'sqlitecpp_dep'], + default_options: 'default_library=static', + ) + endif +endif -sqlite_dep = subproject('sqlite3').get_variable('sqlite3_dep') +sqlite_dep = dependency( + 'sqlite3', + version: '>=3.0.0', + fallback: ['sqlite3', 'sqlite3_dep'], + default_options: 'default_library=static', +) #TODO handle the case in which libcurl does not exist. Missing is fine, just no https/http prefix for paths. curl = dependency('libcurl', required: false) @@ -259,4 +278,4 @@ pconf.generate( vs_fltk, description: 'VS fltk library (C interface only)', url: 'https://github.com/KaruroChori/vs-fltk/', -) \ No newline at end of file +)