Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/imgui/1.92.4/MODULE.bazel
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")
22 changes: 22 additions & 0 deletions modules/imgui/1.92.4/overlay/BUILD.bazel
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"],
)
1 change: 1 addition & 0 deletions modules/imgui/1.92.4/overlay/MODULE.bazel
173 changes: 173 additions & 0 deletions modules/imgui/1.92.4/overlay/backends/BUILD.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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The use of hardcoded paths like copts = ["-I/usr/include/SDL2"] and linkopts = ["-lSDL2"] for system-provided libraries is strongly discouraged. This approach breaks build hermeticity and reproducibility, which are key goals of the Bazel Central Registry 1. It also goes against the principle of building from source whenever possible 2. While I understand your note about not wanting to fight SDL's build system, this build will fail on any system where SDL2 is not installed in this exact location. The same issue exists in the renderer-sdl2 target (lines 164-173). For a public module, a more robust solution is required. Please consider adding SDL2 as a proper BCR module or, failing that, using a repository rule that can discover the SDL2 installation (e.g., via pkg-config) to avoid hardcoding paths.

Style Guide References

Footnotes

  1. BCR PRs must ensure that modules are reproducible for downstream users.

  2. Modules should prefer building from source over using prebuilt or system binaries to ensure hermeticity and avoid reliance on system state.


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"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This hardcoded include path copts = ["-I/usr/include/SDL2"] makes the example non-portable and suffers from the same reproducibility and hermeticity issues as the backend targets 1. This should be resolved in conjunction with the backend library definitions.

Style Guide References

Footnotes

  1. BCR PRs must ensure that modules are reproducible for downstream users.

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",
],
)
31 changes: 31 additions & 0 deletions modules/imgui/1.92.4/presubmit.yml
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The presubmit configuration for Linux is missing the development package for SDL2. Since you are adding an SDL2 backend and example, libsdl2-dev needs to be installed for the presubmit build to pass. Without it, the build of @imgui//... will fail when it tries to compile the SDL2 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"
18 changes: 18 additions & 0 deletions modules/imgui/1.92.4/source.json
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="
}
}
7 changes: 4 additions & 3 deletions modules/imgui/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
"maintainers": [
{
"github": "phaedon",
"name": "Phaedon (F\u00e6don) Sinis",
"github_user_id": 1106027
"github_user_id": 1106027,
"name": "Phaedon (F\u00e6don) Sinis"
}
],
"repository": [
"github:ocornut/imgui"
],
"versions": [
"1.91.8",
"1.92.2"
"1.92.2",
"1.92.4"
],
"yanked_versions": {}
}