-
Notifications
You must be signed in to change notification settings - Fork 603
Update imgui version to 1.92.4 and add more backends #6460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| module( | ||
| name = "imgui", | ||
| version = "1.92.4", | ||
| bazel_compatibility = [">=7.2.1"], | ||
| compatibility_level = 0, | ||
| ) | ||
|
|
||
| bazel_dep(name = "platforms", version = "0.0.11") | ||
| bazel_dep(name = "rules_cc", version = "0.1.1") | ||
| bazel_dep(name = "glfw", version = "3.3.9") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "imgui", | ||
| srcs = [ | ||
| "imgui.cpp", | ||
| "imgui_demo.cpp", | ||
| "imgui_draw.cpp", | ||
| "imgui_tables.cpp", | ||
| "imgui_widgets.cpp", | ||
| ], | ||
| hdrs = [ | ||
| "imconfig.h", | ||
| "imgui.h", | ||
| "imgui_internal.h", | ||
| "imstb_rectpack.h", | ||
| "imstb_textedit.h", | ||
| "imstb_truetype.h", | ||
| ], | ||
| include_prefix = "imgui", | ||
| visibility = ["//visibility:public"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../MODULE.bazel | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| cc_library( | ||
| name = "platform-glfw", | ||
| srcs = ["imgui_impl_glfw.cpp"], | ||
| hdrs = ["imgui_impl_glfw.h"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = select({ | ||
| "@platforms//os:linux": [ | ||
| "-lpthread", | ||
| ], | ||
| "//conditions:default": [], | ||
| }), | ||
| # TODO: Remove this section after adding Windows support to @glfw: | ||
| # https://registry.bazel.build/modules/glfw | ||
| target_compatible_with = select({ | ||
| "@platforms//os:osx": [], | ||
| "@platforms//os:linux": [], | ||
| "//conditions:default": ["@platforms//:incompatible"], | ||
| }), | ||
| deps = [ | ||
| "//:imgui", | ||
| "@glfw", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "platform-win32", | ||
| srcs = ["imgui_impl_win32.cpp"], | ||
| hdrs = ["imgui_impl_win32.h"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| target_compatible_with = [ | ||
| "@platforms//os:windows", | ||
| ], | ||
| deps = [ | ||
| "//:imgui", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "platform-sdl2", | ||
| srcs = ["imgui_impl_sdl2.cpp"], | ||
| hdrs = ["imgui_impl_sdl2.h"], | ||
| copts = ["-I/usr/include/SDL2"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = ["-lSDL2"], | ||
| deps = ["//:imgui"], | ||
| ) | ||
|
Comment on lines
+44
to
+53
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of hardcoded paths like Style Guide ReferencesFootnotes |
||
|
|
||
| cc_library( | ||
| name = "renderer-opengl3", | ||
| srcs = ["imgui_impl_opengl3.cpp"], | ||
| hdrs = [ | ||
| "imgui_impl_opengl3.h", | ||
| "imgui_impl_opengl3_loader.h", | ||
| ], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = select({ | ||
| "@rules_cc//cc/compiler:msvc-cl": [ | ||
| "/DEFAULTLIB:opengl32", | ||
| ], | ||
| "@rules_cc//cc/compiler:clang-cl": [ | ||
| "/DEFAULTLIB:opengl32", | ||
| ], | ||
| "@bazel_tools//src/conditions:linux_x86_64": [ | ||
| "-lGL", | ||
| "-ldl", | ||
| ], | ||
| "//conditions:default": [], | ||
| }), | ||
| deps = [ | ||
| "//:imgui", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "renderer-dx9", | ||
| srcs = ["imgui_impl_dx9.cpp"], | ||
| hdrs = ["imgui_impl_dx9.h"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = select({ | ||
| "@rules_cc//cc/compiler:msvc-cl": [ | ||
| "/DEFAULTLIB:D3D9", | ||
| ], | ||
| "@rules_cc//cc/compiler:clang-cl": [ | ||
| "/DEFAULTLIB:D3D9", | ||
| ], | ||
| }), | ||
| target_compatible_with = [ | ||
| "@platforms//os:windows", | ||
| ], | ||
| deps = ["//:imgui"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "renderer-dx10", | ||
| srcs = ["imgui_impl_dx10.cpp"], | ||
| hdrs = ["imgui_impl_dx10.h"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = select({ | ||
| "@rules_cc//cc/compiler:msvc-cl": [ | ||
| "/DEFAULTLIB:D3D10", | ||
| ], | ||
| "@rules_cc//cc/compiler:clang-cl": [ | ||
| "/DEFAULTLIB:D3D10", | ||
| ], | ||
| }), | ||
| target_compatible_with = [ | ||
| "@platforms//os:windows", | ||
| ], | ||
| deps = ["//:imgui"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "renderer-dx11", | ||
| srcs = ["imgui_impl_dx11.cpp"], | ||
| hdrs = ["imgui_impl_dx11.h"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = select({ | ||
| "@rules_cc//cc/compiler:msvc-cl": [ | ||
| "/DEFAULTLIB:D3D11", | ||
| ], | ||
| "@rules_cc//cc/compiler:clang-cl": [ | ||
| "/DEFAULTLIB:D3D11", | ||
| ], | ||
| }), | ||
| target_compatible_with = [ | ||
| "@platforms//os:windows", | ||
| ], | ||
| deps = ["//:imgui"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "renderer-dx12", | ||
| srcs = ["imgui_impl_dx12.cpp"], | ||
| hdrs = ["imgui_impl_dx12.h"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = select({ | ||
| "@rules_cc//cc/compiler:msvc-cl": [ | ||
| "/DEFAULTLIB:D3D12", | ||
| "/DEFAULTLIB:DXGI", | ||
| ], | ||
| "@rules_cc//cc/compiler:clang-cl": [ | ||
| "/DEFAULTLIB:D3D12", | ||
| "/DEFAULTLIB:DXGI", | ||
| ], | ||
| }), | ||
| target_compatible_with = [ | ||
| "@platforms//os:windows", | ||
| ], | ||
| deps = ["//:imgui"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "renderer-sdl2", | ||
| srcs = ["imgui_impl_sdlrenderer2.cpp"], | ||
| hdrs = ["imgui_impl_sdlrenderer2.h"], | ||
| copts = ["-I/usr/include/SDL2"], | ||
| include_prefix = "imgui", | ||
| includes = ["."], | ||
| linkopts = ["-lSDL2"], | ||
| deps = ["//:imgui"], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_glfw_opengl3", | ||
| srcs = ["main.cpp"], | ||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-glfw", | ||
| "//backends:renderer-opengl3", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_sdl2_sdlrenderer2", | ||
| srcs = ["main.cpp"], | ||
| copts = ["-I/usr/include/SDL2"], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hardcoded include path Style Guide ReferencesFootnotes
|
||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-sdl2", | ||
| "//backends:renderer-sdl2", | ||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_win32_directx10", | ||
| srcs = ["main.cpp"], | ||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-win32", | ||
| "//backends:renderer-dx10", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_win32_directx11", | ||
| srcs = ["main.cpp"], | ||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-win32", | ||
| "//backends:renderer-dx11", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_win32_directx12", | ||
| srcs = ["main.cpp"], | ||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-win32", | ||
| "//backends:renderer-dx12", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_win32_directx9", | ||
| srcs = ["main.cpp"], | ||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-win32", | ||
| "//backends:renderer-dx9", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
|
||
| cc_binary( | ||
| name = "example_win32_opengl3", | ||
| srcs = ["main.cpp"], | ||
| deps = [ | ||
| "//:imgui", | ||
| "//backends:platform-win32", | ||
| "//backends:renderer-opengl3", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| matrix: | ||
| linux_platform: ["ubuntu2004"] | ||
| osx_platform: ["macos", "macos_arm64"] | ||
| bazel: [7.x, 8.x] | ||
|
|
||
| tasks: | ||
| verify_windows_targets: | ||
| name: Verify windows build and test targets | ||
| platform: windows | ||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - '@imgui//...' | ||
| verify_linux_targets: | ||
| name: Verify linux build and test targets | ||
| platform: ${{ linux_platform }} | ||
| shell_commands: | ||
| # X11 requires libx11-dev and a few other system packages, all in xorg-dev. | ||
| # See https://www.glfw.org/docs/latest/compile.html#compile_deps | ||
| - sudo apt-get update | ||
| - sudo apt-get install xorg-dev libgl1-mesa-dev -y | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The presubmit configuration for Linux is missing the development package for SDL2. Since you are adding an SDL2 backend and example, - sudo apt-get install xorg-dev libgl1-mesa-dev libsdl2-dev -y |
||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - '@imgui//...' | ||
| verify_osx_targets: | ||
| name: Verify osx build and test targets | ||
| platform: ${{ osx_platform }} | ||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - '@imgui//...' | ||
| build_flags: | ||
| - "--repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "integrity": "sha256-DhddTZQRElMlSbQYztC9VGq+kCTsubX0MfimeiGXsLo=", | ||
| "strip_prefix": "imgui-1.92.4", | ||
| "url": "https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz", | ||
| "patch_strip": 1, | ||
| "overlay": { | ||
| "BUILD.bazel": "sha256-gZo/FwvLbNU6xL0XX61/Wbkx2BN5j1goWLLAyye5tQc=", | ||
| "MODULE.bazel": "sha256-Mq/j8eIq2bwk/eMnt+9Y5EtG4tmChoN4jiXcSzYFNPQ=", | ||
| "backends/BUILD.bazel": "sha256-wISTqVHxwvRmxGMxsDkcX8WSIRHV4mocK2xB4BtZ1l4=", | ||
| "examples/example_glfw_opengl3/BUILD.bazel": "sha256-wTdD4nkg3rvQmg3bPjU2GJTsw5Lry9GYN/mnxMzZe8E=", | ||
| "examples/example_sdl2_sdlrenderer2/BUILD.bazel": "sha256-m0crGOr4b/QeQVlTxXbcGR2jrZvI7N2iXtIFNS0XkRA=", | ||
| "examples/example_win32_directx10/BUILD.bazel": "sha256-DaG4vRl9qrZq4U4sWEUNM1fq6Ws4Ey8uBT/EyhlWDTE=", | ||
| "examples/example_win32_directx11/BUILD.bazel": "sha256-M9ws7BtFRjWtgJR9uc+stezYOqTNUhIWUUytUiEEAJQ=", | ||
| "examples/example_win32_directx12/BUILD.bazel": "sha256-Z+2SJGxHEVE78bdTh0FCAcdzr+42/hXzHev1WoBAVcs=", | ||
| "examples/example_win32_directx9/BUILD.bazel": "sha256-LzJiJDgzJFY/ZPQraDEo5es/w+zZW2Jwm7JgKBXOg2M=", | ||
| "examples/example_win32_opengl3/BUILD.bazel": "sha256-9tzKuBS9mclm/vZiJYesPmCt14lGIihD84lJVOm2QS8=" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symlinks are not allowed anymore - replace this with a copy of
MODULE.bazel