1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-26 20:28:50 -05:00
implot/.github/workflows/build.yml
Pascal Thomet f719a180ff
Support custom numeric types (#399)
* implot_items.cpp: support types customization

You can customize the supported types in two ways:
  1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
  2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
        -DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"

Details:

- `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES`

- `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation

* CI: link example app, with null backend

Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend).
It serves as a proof that an app can be built, linked, and run, with type customization.

- .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot
  This app uses implot and imgui, but does not output to any backend!
  If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported.

- Corrected arch matrix options:
     32 bits or 64 bits for win and linux
     x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode)

- Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList
  This switch is currently not used in CI, but can be used during development.
  It could be later be used in the matrix options, at the cost of increasing the number of build
   per workflow.

Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
2022-09-13 20:39:29 -05:00

144 lines
3.2 KiB
YAML

name: build
on:
push:
pull_request:
jobs:
Linux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
build_type:
- debug
- release
compiler:
- gcc
- clang
arch:
- x86
- x64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: ocornut/imgui
path: imgui
- name: Dependencies
run: sudo apt-get install g++-multilib
- name: Configure
run: cmake -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_C_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DGCC_ARCH=${{ matrix.arch }} -B cmake-build -S .github
- name: Build
run: cmake --build cmake-build --parallel $(nproc)
- name: Run
run: |
file cmake-build/example_implot
cmake-build/example_implot
MacOS:
runs-on: macos-11
strategy:
fail-fast: false
matrix:
build_type:
- debug
- release
arch:
- x86_64
- arm64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: ocornut/imgui
path: imgui
- name: Configure
shell: bash
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DOSX_ARCH=${{ matrix.arch }} -B cmake-build -S .github
- name: Build
shell: bash
run: cmake --build cmake-build --parallel $(sysctl -n hw.ncpu)
- name: Run
if: matrix.arch == 'x86_64' # github's CI hosts seem to be running intel and can not run ARM
run: |
file cmake-build/example_implot
cmake-build/example_implot
Windows_MSVC:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
build_type:
- debug
- release
arch:
- Win32
- x64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: ocornut/imgui
path: imgui
- name: Configure
shell: bash
run: cmake -G 'Visual Studio 17 2022' -A ${{ matrix.arch }} -B cmake-build -S .github
- name: Build
shell: bash
run: cmake --build cmake-build -- -p:Configuration=${{ matrix.build_type }} -maxcpucount:$NUMBER_OF_PROCESSORS
- name: Run
run: .\cmake-build\${{matrix.build_type}}\example_implot.exe
Windows_MingW: # MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries.
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
build_type:
- debug
- release
arch:
- x64
# - Win32
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: ocornut/imgui
path: imgui
- name: Configure
shell: bash
run: cmake -G 'MinGW Makefiles' -DGCC_ARCH=${{ matrix.arch }} -B cmake-build -S .github
- name: Build
shell: bash
run: cmake --build cmake-build --parallel $NUMBER_OF_PROCESSORS
- name: Run (MingW)
run: .\cmake-build\example_implot.exe