lopsided98 / nix-ros-overlay

ROS overlay for the Nix package manager
Apache License 2.0
212 stars 83 forks source link

Have anyone tried to package the ros1 version of ouster-ros? #389

Open martiege opened 7 months ago

martiege commented 7 months ago

I tried to package ouster-ros, but end up with a pretty weird include-structure:

/nix/store/q0asldhswh6h2441kiv5zshryryx49m5-ouster-ros-0.10.0/include
/nix/store/q0asldhswh6h2441kiv5zshryryx49m5-ouster-ros-0.10.0/include
└── ouster_ros
   ├── GetConfig.h
   ├── GetConfigRequest.h
   ├── GetConfigResponse.h
   ├── GetMetadata.h
   ├── GetMetadataRequest.h
   ├── GetMetadataResponse.h
   ├── include
   │  ├── optional-lite
   │  │  └── nonstd
   │  │     └── optional.hpp
   │  ├── ouster
   │  │  ├── buffered_udp_source.h
   │  │  ├── client.h
   │  │  ├── defaults.h
   │  │  ├── image_processing.h
   │  │  ├── impl
   │  │  │  ├── cartesian.h
   │  │  │  ├── lidar_scan_impl.h
   │  │  │  ├── packet_writer.h
   │  │  │  └── profile_extension.h
   │  │  ├── lidar_scan.h
   │  │  ├── sensor_http.h
   │  │  ├── types.h
   │  │  ├── util.h
   │  │  └── version.h
   │  └── ouster_ros
   │     ├── os_point.h
   │     ├── os_ros.h
   │     └── os_sensor_nodelet_base.h
   ├── optional-lite
   │  └── nonstd
   │     └── optional.hpp
   ├── PacketMsg.h
   ├── SetConfig.h
   ├── SetConfigRequest.h
   └── SetConfigResponse.h

The headers I'm especially interested in are those in the ouster_ros/include/ouster_ros/* directory, and I'm trying to import them as #import <ouster_ros/os_point.h. This has worked before, when I've tried this without nix, though of course then I just had the ouster-ros repo in my catkin source folder, so I don't know why that worked.

{ lib, buildRosPackage, stdenv, cmake, ninja, wrapQtAppsHook, qtbase, eigen, jsoncpp, spdlog
, openssl, cppunit, pcl-ros, rviz, roscpp, message-runtime, std-msgs
, sensor-msgs, geometry-msgs, fetchFromGitHub, }:

buildRosPackage rec {
  pname = "ouster-ros";
  version = "0.10.0";

  src = fetchFromGitHub {
    owner = "ouster-lidar";
    repo = "ouster-ros";
    rev = "v${version}";
    sha256 = "sha256-0SnDs4JAZJZjjMlt5A10A9ql3be3ds8Xsp65Txy6/v4=";

    fetchSubmodules = true;
  };

  nativeBuildInputs = [ cmake ninja wrapQtAppsHook ];

  propagatedBuildInputs = [
    eigen
    jsoncpp
    spdlog
    openssl
    cppunit

    qtbase

    pcl-ros
    rviz
    roscpp
    message-runtime
    std-msgs
    sensor-msgs
    geometry-msgs
  ];

  cmakeFlags =
    [ "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_PCAP=OFF" "-DBUILD_VIZ=OFF" ];
  qtWrapperArgs = [
    # Let the gazebo binary see neighboring binaries.
    # It attempts to run gzclient from PATH.
    "--prefix PATH : ${placeholder "out"}/bin"

    # Prevent Gazebo from attempting to use Wayland.
    # As is the case with RViz2, OGRE does not yet support it.
    "--set WAYLAND_DISPLAY dummy" # "dummy" is arbitrary - it just doesn't exist.
  ];
}
martiege commented 7 months ago

I also think I don't really need the qt-wrapper stuff here, and could use dontWrapQtApps = true; instead, but this is just a wip