Unverified Commit 7781c1a9 authored by Someone's avatar Someone Committed by GitHub
Browse files

Merge pull request #303682 from SomeoneSerge/feat/imgui-cmake

imgui: ship vcpkg' (cmake) distribution info
parents b7f24021 c74ce248
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@

## Other Notable Changes {#sec-release-24.11-notable-changes}

- Create the first release note entry in this section!

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

- To facilitate dependency injection, the `imgui` package now builds a static archive using vcpkg' CMake rules.
  The derivation now installs "impl" headers selectively instead of by a wildcard.
  Use `imgui.src` if you just want to access the unpacked sources.
+56 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  imgui,
  SDL2,
  xorg,
  imnodes,
  withExamples ? false,
}:

stdenv.mkDerivation rec {
  pname = "imnodes";
  version = "unstable-2024-03-12";
  outputs = [
    "out"
    "dev"
  ];

  src = fetchFromGitHub {
    owner = "Nelarius";
    repo = "imnodes";
    rev = "8563e1655bd9bb1f249e6552cc6274d506ee788b";
    hash = "sha256-E7NNCxYq9dyVvutWbpl2a+D2Ap2ErvdYHBDqpX0kb0c=";
  };
  patches = [
    # CMake install rules
    (fetchpatch {
      url = "https://github.com/Nelarius/imnodes/commit/ff20336fcd82ce07c39fabd76d5bc9fa0a08b3bc.patch";
      hash = "sha256-JHOUjwMofDwt2kg6SLPFZmuQC4bOfjGa3qHFr5MdPIE=";
    })
  ];

  nativeBuildInputs = [ cmake ];
  buildInputs =
    [ imgui ]
    ++ lib.optionals withExamples [
      SDL2
      xorg.libXext
    ];

  cmakeFlags = [ (lib.cmakeBool "IMNODES_EXAMPLES" withExamples) ];

  passthru.tests.examples = imnodes.override { withExamples = true; };

  meta = {
    description = "A small, dependency-free node editor for dear imgui";
    homepage = "https://github.com/Nelarius/imnodes";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ SomeoneSerge ];
    mainProgram = "imnodes";
    platforms = lib.platforms.all;
  };
}
+81 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  pkg-config,
  darwin,
  fmt,
  gtk3,
  iir1,
  imgui,
  imnodes,
  implot,
  openssl,
  curl,
}:

stdenv.mkDerivation rec {
  pname = "implot-demos";
  version = "unstable-2023-08-20";

  src = fetchFromGitHub {
    owner = "epezent";
    repo = "implot_demos";
    rev = "f33219d3ade192a2333d4a32e749842010952a29";
    hash = "sha256-Xq0kVk8qncj/BzQyIX/l1OLvPSQJU8ckTxIIfLZdO/g=";
  };

  patches = [
    # Resolve "undefined symbols" (GetWindowContentRegionWidth &c)
    (fetchpatch {
      url = "https://github.com/epezent/implot_demos/commit/85a59612c102f8da97d6ead04f528f4c88f4ef9a.patch";
      hash = "sha256-HRhfC3TUwz9Mv+1ODabaDxTWUaj4Nx1iH7C6vjUPo2s=";
    })

    # CMake: make FetchContent optional, add install targets
    (fetchpatch {
      url = "https://github.com/epezent/implot_demos/commit/4add0433a46ed5e2099e1af1a77e8055e49230d0.patch";
      hash = "sha256-jYdM8NuwbZk7INKo2wqMAbjLMTPdrAdM4Kr3xmtquIY=";
    })

    # CMake: link libGL from the "app" target
    (fetchpatch {
      url = "https://github.com/epezent/implot_demos/commit/6742e4202858eb85bd0d67ca5fa15a7a07e6b618.patch";
      hash = "sha256-h4EJ9u1iHLYkGHgxSynskkuCGmY6mmvKdZSRwHJKerY=";
    })
  ];

  cmakeFlags = [ (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) ];

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs =
    [
      curl
      fmt
      iir1
      imgui
      imnodes
      implot
      openssl
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [ gtk3 ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.AppKit ];

  meta = {
    description = "Standalone ImPlot Demos";
    homepage = "https://github.com/epezent/implot_demos";
    broken =
      stdenv.hostPlatform.isAarch64 # Target "mandel" relies on AVX2
      || stdenv.isDarwin;
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ SomeoneSerge ];
    mainProgram = "implot-demos";
    platforms = lib.platforms.all;
  };
}
+41 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  callPackage,
  cmake,
  vcpkg,
  imgui,
}:

stdenv.mkDerivation rec {
  pname = "implot";
  version = "0.16";

  src = fetchFromGitHub {
    owner = "epezent";
    repo = "implot";
    rev = "v${version}";
    hash = "sha256-/wkVsgz3wiUVZBCgRl2iDD6GWb+AoHN+u0aeqHHgem0=";
  };

  cmakeRules = "${vcpkg.src}/ports/implot";
  postPatch = ''
    cp "$cmakeRules"/CMakeLists.txt ./
  '';

  buildInputs = [ imgui ];
  nativeBuildInputs = [ cmake ];

  passthru.tests = {
    implot-demos = callPackage ./demos { };
  };

  meta = {
    description = "Immediate Mode Plotting";
    homepage = "https://github.com/epezent/implot";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ SomeoneSerge ];
    platforms = lib.platforms.all;
  };
}
+5 −0
Original line number Diff line number Diff line
@@ -53,6 +53,11 @@ stdenv.mkDerivation rec {
      --replace "libxkbcommon.so.0" "${lib.getLib libxkbcommon}/lib/libxkbcommon.so.0"
  '';

  # glfw may dlopen libwayland-client.so:
  postFixup = lib.optionalString stdenv.isLinux ''
    patchelf ''${!outputLib}/lib/libglfw.so --add-rpath ${lib.getLib wayland}/lib
  '';

  meta = with lib; {
    description = "Multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time";
    homepage = "https://www.glfw.org/";
Loading