Repository navigation
84 lines (71 loc) · 3.19 KB
/
Copy pathcpp_install_package.yml
File metadata and controls
84 lines (71 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "CppInstallPackage"
# Builds and installs imgui_bundle as a C++ package (cmake --install), then builds
# _example_integration against the *installed* package (find_package(imgui_bundle)),
# on the three desktop platforms. Then tests/cpp_compat: the former markdown API still compiles.
#
# System dependencies (freetype, glfw, ...) are provided by the platform's package manager;
# on Windows, by the vcpkg preinstalled on the runner, used as a plain CMAKE_PREFIX_PATH
# (not as a toolchain), which mirrors how a package manager such as Conan would provide them.
on:
workflow_dispatch:
pull_request:
push:
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
# The token reads only; a job that publishes asks for more
permissions:
contents: read
jobs:
build:
name: CppInstallPackage
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive
- name: Install dependencies (ubuntu)
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install -y xorg-dev libgl1-mesa-dev libglfw3-dev libfreetype-dev libcurl4-openssl-dev
- name: Install dependencies (macos)
if: ${{ matrix.platform == 'macos-latest' }}
run: brew install glfw freetype
- name: Install dependencies (windows, via vcpkg)
if: ${{ matrix.platform == 'windows-latest' }}
shell: pwsh
run: |
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg" install freetype glfw3 --triplet x64-windows
$prefix = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows" -replace '\\', '/'
"DEPS_PREFIX=$prefix" >> $env:GITHUB_ENV
- name: Build and install imgui_bundle (cpp_package preset)
shell: bash
run: |
cmake --preset cpp_package -DCMAKE_PREFIX_PATH="$DEPS_PREFIX"
cmake --build builds/cpp_package/build --config Release -j 3
cmake --install builds/cpp_package/build --config Release
- name: Build _example_integration against the installed package
shell: bash
run: |
workspace="${GITHUB_WORKSPACE//\\//}"
cmake -S _example_integration -B build_example -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$workspace/builds/cpp_package/install;$DEPS_PREFIX" | tee configure_example.log
grep -q "Using installed imgui_bundle" configure_example.log
cmake --build build_example --config Release -j 3
- name: Build tests/cpp_compat (the markdown API of v1.92.900) against the installed package
shell: bash
run: |
workspace="${GITHUB_WORKSPACE//\\//}"
cmake -S tests/cpp_compat -B build_cpp_compat -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$workspace/builds/cpp_package/install;$DEPS_PREFIX"
cmake --build build_cpp_compat --config Release -j 3
- name: List the installed package
shell: bash
run: |
cd builds/cpp_package/install
echo "== lib/cmake/imgui_bundle"; ls lib/cmake/imgui_bundle
echo "== libs"; ls lib
echo "== include"; ls include