From e5663a9c893d7a738e31b85df075d206fef9ec44 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Tue, 28 Nov 2023 17:44:40 -0500 Subject: [PATCH] fix(ci): use a newer `fmt` --- .github/workflows/linux.yml | 50 ++++++++++++++++++++++++++++++------- install.rb | 6 ++++- meson.build | 21 +++++++++++----- meson.options | 1 + 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3fed40f2..5f493dce 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,9 +14,13 @@ defaults: run: shell: bash +env: + hipo_version: master + fmt_version: 9.1.0 + jobs: - # build + # dependencies ######################################################### build_hipo: @@ -27,6 +31,7 @@ jobs: uses: actions/checkout@v4 with: repository: gavalian/hipo + ref: ${{ env.hipo_version }} - name: build run: | cmake -S . -B build -DCMAKE_INSTALL_PREFIX=hipo @@ -41,14 +46,40 @@ jobs: retention-days: 1 path: hipo.tar.gz + build_fmt: + name: Build fmt + runs-on: ubuntu-latest + steps: + - name: checkout fmt + uses: actions/checkout@v4 + with: + repository: fmtlib/fmt + ref: ${{ env.fmt_version }} + - name: build + run: | + cmake -S . -B build -DCMAKE_INSTALL_PREFIX=fmt + cmake --build build -j2 + cmake --install build + - run: tree fmt + - name: tar + run: tar czvf fmt{.tar.gz,} + - uses: actions/upload-artifact@v3 + with: + name: build + retention-days: 1 + path: fmt.tar.gz + + # build + ######################################################### + build_iguana: name: Build Iguana - needs: [ build_hipo ] + needs: + - build_hipo + - build_fmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: setup fmt - run: sudo apt install -y libfmt-dev - name: setup meson run: python -m pip install meson ninja - name: summarize dependencies @@ -59,7 +90,8 @@ jobs: for dep in python ruby meson ninja ; do echo "| \`$dep\` | $($dep --version) |" >> $GITHUB_STEP_SUMMARY done - echo "| \`fmt\` | $(apt show libfmt-dev | grep -w Version) |" >> $GITHUB_STEP_SUMMARY + echo "| \`fmt\` | ${{ env.fmt_version }} |" >> $GITHUB_STEP_SUMMARY + echo "| \`hipo\` | ${{ env.hipo_version }} |" >> $GITHUB_STEP_SUMMARY - name: get build artifacts uses: actions/download-artifact@v3 with: @@ -67,7 +99,7 @@ jobs: - name: untar build run: ls *.tar.gz | xargs -I{} tar xzvf {} - name: build iguana - run: ./install.rb --hipo hipo + run: ./install.rb --hipo hipo --fmt fmt - name: dump build log if: always() run: cat build-iguana/meson-logs/meson-log.txt @@ -108,11 +140,11 @@ jobs: test_iguana: name: Test Iguana - needs: [ download_validation_files, build_iguana ] + needs: + - download_validation_files + - build_iguana runs-on: ubuntu-latest steps: - - name: install dependencies - run: sudo apt install -y libfmt-dev - name: get build artifacts uses: actions/download-artifact@v3 with: diff --git a/install.rb b/install.rb index 70fd2d17..91d0ee73 100755 --- a/install.rb +++ b/install.rb @@ -10,6 +10,7 @@ build: "#{Dir.pwd}/build-iguana", install: "#{Dir.pwd}/iguana", hipo: "#{Dir.pwd}/hipo", + fmt: nil, clean: false, purge: false, } @@ -22,7 +23,8 @@ parser.separator '' parser.on("-i", "--install [INSTALL DIR]", "Directory for installation", "Default: #{options[:install]}") parser.separator '' -parser.on("-h", "--hipo [HIPO DIR]", "Path to HIPO installation", "Default: #{options[:hipo]}", "if not found, tries env var $HIPO") +parser.on("--hipo [HIPO DIR]", "Path to HIPO installation", "Default: #{options[:hipo]}", "if not found, tries env var $HIPO") +parser.on("--fmt [FMT DIR]", "Path to fmt installation", "Default: assumes system installation" ) parser.separator 'TROUBLESHOOTING:' parser.on("--clean", "Remove the buildsystem at [BUILD DIR] beforehand") parser.on("--purge", "Remove the installation at [INSTALL DIR] beforehand") @@ -73,6 +75,7 @@ def buildOpt(key,val) 'meson setup', "--prefix #{prefix}", buildOpt('hipo', options[:hipo]), + buildOpt('fmt', options[:fmt]), options[:build], SourceDir, ], @@ -80,6 +83,7 @@ def buildOpt(key,val) 'meson configure', "--prefix #{prefix}", buildOpt('hipo', options[:hipo]), + buildOpt('fmt', options[:fmt]), options[:build], ], :install => [ diff --git a/meson.build b/meson.build index 6639e266..dd2214f7 100644 --- a/meson.build +++ b/meson.build @@ -11,14 +11,23 @@ project_inc = include_directories('src') project_lib_install_dir = 'lib' # to keep it the same for different Linux distributions project_bin_install_dir = 'bin' -project_lib_rpath = '$ORIGIN' -project_bin_rpath = ':'.join([ - '$ORIGIN/../' + project_lib_install_dir, +dep_lib_rpaths = [ get_option('hipo') + '/lib' -]) +] +if get_option('fmt') != '' + dep_lib_rpaths += get_option('fmt') + '/lib' +endif +project_lib_rpath = '$ORIGIN' +project_bin_rpath = ':'.join(['$ORIGIN/../' + project_lib_install_dir] + dep_lib_rpaths) -fmt_dep = dependency('fmt') -hipo_dep = dependency('hipo4', method: 'cmake', cmake_args: '-DCMAKE_PREFIX_PATH=' + get_option('hipo')) +fmt_dep = dependency( + 'fmt', + cmake_args: get_option('fmt')!='' ? '-DCMAKE_PREFIX_PATH='+get_option('fmt') : '', +) +hipo_dep = dependency( + 'hipo4', + cmake_args: '-DCMAKE_PREFIX_PATH='+get_option('hipo'), +) subdir('src/services') subdir('src/algorithms') diff --git a/meson.options b/meson.options index 845f473d..2ec55438 100644 --- a/meson.options +++ b/meson.options @@ -1 +1,2 @@ option('hipo', type: 'string', value: '/usr/local', description: 'HIPO installation location') +option('fmt', type: 'string', value: '', description: 'fmt installation location')