diff options
Diffstat (limited to 'src/implot/.github')
-rw-r--r-- | src/implot/.github/CMakeLists.txt | 95 | ||||
-rw-r--r-- | src/implot/.github/example_implot.cpp | 55 | ||||
-rw-r--r-- | src/implot/.github/workflows/build.yml | 144 |
3 files changed, 294 insertions, 0 deletions
diff --git a/src/implot/.github/CMakeLists.txt b/src/implot/.github/CMakeLists.txt new file mode 100644 index 0000000..118a26b --- /dev/null +++ b/src/implot/.github/CMakeLists.txt @@ -0,0 +1,95 @@ +# This build script is not meant for general use, it is for CI use only! +cmake_minimum_required(VERSION 3.0) +project(implot) + +# +# Global options +# + +# Same as Dear ImGui +set(CMAKE_CXX_STANDARD 11) + +# Arch option for linux +if (NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND DEFINED GCC_ARCH) + if ("${GCC_ARCH}" MATCHES "Win32|x86|32") + add_compile_options(-m32) + add_link_options(-m32) + elseif ("${GCC_ARCH}" MATCHES "Win64|x64|64") + add_compile_options(-m64) + add_link_options(-m64) + endif () +endif () + +# Arch option for Mac: arm64 for M1 or x86_64 for intel (32 bits build are deprecated on Mac) +if(APPLE AND DEFINED OSX_ARCH) + if ("${OSX_ARCH}" MATCHES "x86_64") + set(CMAKE_OSX_ARCHITECTURES "x86_64") + elseif ("${OSX_ARCH}" MATCHES "arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64") + else() + message(FATAL_ERROR "Unhandled OSX_ARCH=${OSX_ARCH}") + endif() +endif() + +# +# Dear ImGui library with no backend +# + +set(imgui_sources + ../imgui/imconfig.h + ../imgui/imgui.cpp + ../imgui/imgui.h + ../imgui/imgui_demo.cpp + ../imgui/imgui_draw.cpp + ../imgui/imgui_internal.h + ../imgui/imgui_tables.cpp + ../imgui/imgui_widgets.cpp + ../imgui/imstb_rectpack.h + ../imgui/imstb_textedit.h + ../imgui/imstb_truetype.h + ) +add_library(imgui ${imgui_sources}) +target_include_directories(imgui PUBLIC ../imgui) + +# +# ImPlot library +# + +file(GLOB SOURCE_CODE ../implot*.*) +add_library(implot STATIC ${SOURCE_CODE}) + +if(MSVC) + target_compile_options(implot PRIVATE /W4 /WX) +else() + target_compile_options(implot PRIVATE -Wall -Werror -pedantic) +endif() + +target_include_directories(implot PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..) +target_link_libraries(implot PUBLIC imgui) + +if (UNIX) + target_link_libraries(implot PUBLIC m stdc++) +endif() + +# Define supported types via command line: +# - With no choice all types are supported (so that the CI provides support for all known types) +# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="default" the default set defined in implot_items.cpp is used +# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="(int)(float)(double)" only int, float and double are supported +if (NOT DEFINED IMPLOT_CUSTOM_NUMERIC_TYPES) + set(IMPLOT_CUSTOM_NUMERIC_TYPES "all") +endif() +if ("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "default") + message("==== Compiling for default types ====") +elseif("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "all") + message("==== Compiling for all types ====") + target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=(signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)") +else() + message("==== Compiling for custom types: ${IMPLOT_CUSTOM_NUMERIC_TYPES} ====") + target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=${IMPLOT_CUSTOM_NUMERIC_TYPES}") +endif() + +# +# implot example binary application (with no backend) +# +add_executable(example_implot example_implot.cpp) +target_link_libraries(example_implot PRIVATE implot) diff --git a/src/implot/.github/example_implot.cpp b/src/implot/.github/example_implot.cpp new file mode 100644 index 0000000..9339bab --- /dev/null +++ b/src/implot/.github/example_implot.cpp @@ -0,0 +1,55 @@ +// Sample app built with Dear ImGui and ImPlot +// This app uses implot and imgui, but does not output to any backend! It only serves as a proof that an app can be built, linked, and run. + +#include "imgui.h" +#include "implot.h" +#include "stdio.h" + +int main(int, char**) +{ + printf("sample_implot: start\n"); + + IMGUI_CHECKVERSION(); + ImGui::CreateContext(); + ImPlot::CreateContext(); + + // Additional imgui initialization needed when no backend is present + ImGui::GetIO().DisplaySize = ImVec2(400.f, 400.f); + ImGui::GetIO().Fonts->Build(); + + // Render 500 frames + for(int counter = 0; counter < 500; ++counter) + { + ImGui::NewFrame(); + + if (ImGui::Begin("Hello, world!")) + { + ImGui::Text("Hello again"); + + if (ImPlot::BeginPlot("My Plot")) + { + static double values[] = {1., 3., 5.}; + ImPlot::PlotLine("Values", values, 3); + ImPlot::EndPlot(); + } + + #ifdef IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES + if (ImPlot::BeginPlot("My Plot (long double)")) + { + static long double values[] = {1., 3., 5.}; + ImPlot::PlotLine("Values", values, 3); + ImPlot::EndPlot(); + } + #endif + + ImGui::End(); + } + + ImGui::Render(); + } + + ImPlot::DestroyContext(); + ImGui::DestroyContext(); + printf("sample_implot: end\n"); + return 0; +} diff --git a/src/implot/.github/workflows/build.yml b/src/implot/.github/workflows/build.yml new file mode 100644 index 0000000..2f9388f --- /dev/null +++ b/src/implot/.github/workflows/build.yml @@ -0,0 +1,144 @@ +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 +
\ No newline at end of file |