diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/science/robotics')
12 files changed, 1385 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/robotics/apmplanner2/default.nix b/nixpkgs/pkgs/applications/science/robotics/apmplanner2/default.nix new file mode 100644 index 000000000000..34509f05daa3 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/apmplanner2/default.nix @@ -0,0 +1,43 @@ +{ lib, mkDerivation, fetchFromGitHub, qmake +, qtbase, qtscript, qtwebkit, qtserialport, qtsvg, qtdeclarative, qtquickcontrols2 +, alsa-lib, libsndfile, flite, openssl, udev, SDL2 +}: + +mkDerivation rec { + pname = "apmplanner2"; + version = "2.0.28"; + + src = fetchFromGitHub { + owner = "ArduPilot"; + repo = "apm_planner"; + rev = version; + sha256 = "0wvbfjnnf7sh6fpgw8gimh5hgzywj3nwrgr80r782f5gayd3v2l1"; + }; + + buildInputs = [ + alsa-lib libsndfile flite openssl udev SDL2 + qtbase qtscript qtwebkit qtserialport qtsvg qtdeclarative qtquickcontrols2 + ]; + + nativeBuildInputs = [ qmake ]; + + qmakeFlags = [ "apm_planner.pro" ]; + + # this ugly hack is necessary, as `bin/apmplanner2` needs the contents of `share/APMPlanner2` inside of `bin/` + preFixup = '' + ln --relative --symbolic $out/share/APMPlanner2/* $out/bin/ + substituteInPlace $out/share/applications/apmplanner2.desktop \ + --replace /usr $out + ''; + + meta = { + description = "Ground station software for autonomous vehicles"; + longDescription = '' + A GUI ground control station for autonomous vehicles using the MAVLink protocol. + Includes support for the APM and PX4 based controllers. + ''; + homepage = "https://ardupilot.org/planner2/"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ wucke13 ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/betaflight-configurator/default.nix b/nixpkgs/pkgs/applications/science/robotics/betaflight-configurator/default.nix new file mode 100644 index 000000000000..e8e5fbba4e49 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/betaflight-configurator/default.nix @@ -0,0 +1,57 @@ +{lib, stdenv, fetchurl, unzip, makeDesktopItem, nwjs, wrapGAppsHook, gsettings-desktop-schemas, gtk3 }: + +let + pname = "betaflight-configurator"; + desktopItem = makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + comment = "Betaflight configuration tool"; + desktopName = "Betaflight Configurator"; + genericName = "Flight controller configuration tool"; + }; +in +stdenv.mkDerivation rec { + inherit pname; + version = "10.9.0"; + src = fetchurl { + url = "https://github.com/betaflight/${pname}/releases/download/${version}/${pname}_${version}_linux64-portable.zip"; + sha256 = "sha256-9FzMyBIR2u1zXHtTWJABM6RF1+OyjYdEPlRwtig9blI="; + }; + + # remove large unneeded files + postUnpack = '' + find -name "lib*.so" -delete + ''; + + nativeBuildInputs = [ wrapGAppsHook unzip ]; + + buildInputs = [ gsettings-desktop-schemas gtk3 ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin \ + $out/opt/${pname} + + cp -r . $out/opt/${pname}/ + install -m 444 -D icon/bf_icon_128.png $out/share/icons/hicolor/128x128/apps/${pname}.png + cp -r ${desktopItem}/share/applications $out/share/ + + makeWrapper ${nwjs}/bin/nw $out/bin/${pname} --add-flags $out/opt/${pname} + runHook postInstall + ''; + + meta = with lib; { + description = "The Betaflight flight control system configuration tool"; + longDescription = '' + A crossplatform configuration tool for the Betaflight flight control system. + Various types of aircraft are supported by the tool and by Betaflight, e.g. + quadcopters, hexacopters, octocopters and fixed-wing aircraft. + ''; + homepage = "https://github.com/betaflight/betaflight/wiki"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.gpl3; + maintainers = with maintainers; [ wucke13 ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/emuflight-configurator/default.nix b/nixpkgs/pkgs/applications/science/robotics/emuflight-configurator/default.nix new file mode 100644 index 000000000000..0a733261ea2b --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/emuflight-configurator/default.nix @@ -0,0 +1,51 @@ +{lib, stdenv, fetchurl, unzip, makeDesktopItem, copyDesktopItems, nwjs +, wrapGAppsHook, gsettings-desktop-schemas, gtk3 }: + +stdenv.mkDerivation rec { + pname = "emuflight-configurator"; + version = "0.4.1"; + + src = fetchurl { + url = "https://github.com/emuflight/EmuConfigurator/releases/download/${version}/emuflight-configurator_${version}_linux64.zip"; + sha256 = "sha256-e4HNg5yr9V5LyT0hYP6gzw0tZm4dLidJg5MQtH3L3JI="; + }; + + nativeBuildInputs = [ wrapGAppsHook unzip copyDesktopItems ]; + + buildInputs = [ gsettings-desktop-schemas gtk3 ]; + + installPhase = '' + mkdir -p $out/bin $out/share/${pname} + + cp -r . $out/share/${pname}/ + install -m 444 -D icon/emu_icon_128.png $out/share/icons/hicolor/128x128/apps/${pname}.png + + makeWrapper ${nwjs}/bin/nw $out/bin/${pname} --add-flags $out/share/${pname} + ''; + + desktopItems = [ + (makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + comment = "Emuflight configuration tool"; + desktopName = "Emuflight Configurator"; + genericName = "Flight controller configuration tool"; + }) + ]; + + meta = with lib; { + description = "The Emuflight flight control system configuration tool"; + longDescription = '' + A crossplatform configuration tool for the Emuflight flight control system. + Various types of aircraft are supported by the tool and by Emuflight, e.g. + quadcopters, hexacopters, octocopters and fixed-wing aircraft. + The application allows you to configure the Emuflight software running on any supported Emuflight target. + ''; + homepage = "https://github.com/emuflight/EmuConfigurator"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.gpl3Only; + maintainers = with maintainers; [ beezow ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/inav-configurator/default.nix b/nixpkgs/pkgs/applications/science/robotics/inav-configurator/default.nix new file mode 100644 index 000000000000..9efb9163e5e0 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/inav-configurator/default.nix @@ -0,0 +1,58 @@ +{ lib, stdenv, fetchurl, makeDesktopItem, copyDesktopItems, nwjs, wrapGAppsHook, gsettings-desktop-schemas, gtk3 }: + +stdenv.mkDerivation rec { + pname = "inav-configurator"; + version = "5.1.0"; + + src = fetchurl { + url = "https://github.com/iNavFlight/inav-configurator/releases/download/${version}/INAV-Configurator_linux64_${version}.tar.gz"; + sha256 = "sha256-ZvZxQICa5fnJBTx0aW/hqQCuhQW9MkcVa2sOjPYaPXM="; + }; + + icon = fetchurl { + url = "https://raw.githubusercontent.com/iNavFlight/inav-configurator/bf3fc89e6df51ecb83a386cd000eebf16859879e/images/inav_icon_128.png"; + sha256 = "1i844dzzc5s5cr4vfpi6k2kdn8jiqq2n6c0fjqvsp4wdidwjahzw"; + }; + + nativeBuildInputs = [ copyDesktopItems wrapGAppsHook ]; + + buildInputs = [ gsettings-desktop-schemas gtk3 ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin \ + $out/opt/${pname} + + cp -r inav-configurator $out/opt/inav-configurator/ + install -m 444 -D $icon $out/share/icons/hicolor/128x128/apps/${pname}.png + + chmod +x $out/opt/inav-configurator/inav-configurator + makeWrapper ${nwjs}/bin/nw $out/bin/${pname} --add-flags $out/opt/inav-configurator/inav-configurator + + runHook postInstall + ''; + + desktopItems = makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + comment = "iNavFlight configuration tool"; + desktopName = "iNav Configurator"; + genericName = "Flight controller configuration tool"; + }; + + meta = with lib; { + description = "The iNav flight control system configuration tool"; + longDescription = '' + A crossplatform configuration tool for the iNav flight control system. + Various types of aircraft are supported by the tool and by iNav, e.g. + quadcopters, hexacopters, octocopters and fixed-wing aircraft. + ''; + homepage = "https://github.com/iNavFlight/inav/wiki"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.gpl3Only; + maintainers = with maintainers; [ tilcreator wucke13 ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/mavproxy/default.nix b/nixpkgs/pkgs/applications/science/robotics/mavproxy/default.nix new file mode 100644 index 000000000000..1252073fab18 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/mavproxy/default.nix @@ -0,0 +1,39 @@ +{ stdenv, lib, buildPythonApplication, fetchPypi, lxml, matplotlib, numpy +, opencv4, pymavlink, pyserial, setuptools, wxpython, billiard +, gnureadline }: + +buildPythonApplication rec { + pname = "MAVProxy"; + version = "1.8.66"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-tIwXiDHEmFHF5Jdv25hPkzEqAdig+i5h4fW6SGIrZDM="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace "opencv-python" "" + ''; + + propagatedBuildInputs = [ + lxml + matplotlib + numpy + opencv4 + pymavlink + pyserial + setuptools + wxpython + ] ++ lib.optionals stdenv.isDarwin [ billiard gnureadline ]; + + # No tests + doCheck = false; + + meta = with lib; { + description = "MAVLink proxy and command line ground station"; + homepage = "https://github.com/ArduPilot/MAVProxy"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ lopsided98 ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/mission-planner/default.nix b/nixpkgs/pkgs/applications/science/robotics/mission-planner/default.nix new file mode 100644 index 000000000000..856fdfec8235 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/mission-planner/default.nix @@ -0,0 +1,59 @@ +{ lib, stdenv, fetchurl, makeDesktopItem, makeWrapper, unzip, mono }: + +let + pname = "mission-planner"; + desktopItem = makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + comment = "MissionPlanner GCS & Ardupilot configuration tool"; + desktopName = "MissionPlanner"; + genericName = "Ground Control Station"; + }; +in stdenv.mkDerivation rec { + inherit pname; + version = "1.3.80"; + + src = fetchurl { + url = "https://firmware.ardupilot.org/Tools/MissionPlanner/MissionPlanner-${version}.zip"; + sha256 = "sha256-iivlaQWtOMJHchmR92FoqTaosGJ9F1AgFtuFgDE/9qQ="; + }; + + nativeBuildInputs = [ makeWrapper mono unzip ]; + sourceRoot = "."; + + AOT_FILES = [ "MissionPlanner.exe" "MissionPlanner.*.dll" ]; + + buildPhase = '' + runHook preBuild + for file in $AOT_FILES + do + mono --aot $file + done + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/{bin,opt/mission-planner} + install -m 444 -D mpdesktop150.png $out/share/icons/mission-planner.png + cp -r ${desktopItem}/share/applications $out/share/ + mv * $out/opt/mission-planner + makeWrapper ${mono}/bin/mono $out/bin/mission-planner \ + --add-flags $out/opt/mission-planner/MissionPlanner.exe + runHook postInstall + ''; + + meta = with lib; { + description = "An ArduPilot ground station"; + longDescription = '' + Full-featured ground station application for the ArduPilot open source + autopilot project. Lets you both flash, configure and control ArduPilot + Plane, Copter and Rover targets. + ''; + homepage = "https://ardupilot.org/planner/"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ wucke13 ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/mujoco/default.nix b/nixpkgs/pkgs/applications/science/robotics/mujoco/default.nix new file mode 100644 index 000000000000..95d3e1269350 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/mujoco/default.nix @@ -0,0 +1,186 @@ +{ cereal_1_3_2 +, cmake +, fetchFromGitHub +, fetchFromGitLab +, glfw +, glm +, lib +, spdlog +, stdenv +}: + +let + pin = { + + # See https://github.com/google-deepmind/mujoco/blob/3.0.0/cmake/MujocoDependencies.cmake#L17-L64 + abseil-cpp = fetchFromGitHub { + owner = "abseil"; + repo = "abseil-cpp"; + rev = "fb3621f4f897824c0dbe0615fa94543df6192f30"; + hash = "sha256-uNGrTNg5G5xFGtc+BSWE389x0tQ/KxJQLHfebNWas/k="; + }; + benchmark = fetchFromGitHub { + owner = "google"; + repo = "benchmark"; + rev = "e45585a4b8e75c28479fa4107182c28172799640"; + hash = "sha256-pgHvmRpPd99ePUVRsi7WXLVSZngZ5q6r1vWW4mdGvxY="; + }; + ccd = fetchFromGitHub { + owner = "danfis"; + repo = "libccd"; + rev = "7931e764a19ef6b21b443376c699bbc9c6d4fba8"; + hash = "sha256-TIZkmqQXa0+bSWpqffIgaBela0/INNsX9LPM026x1Wk="; + }; + eigen3 = fetchFromGitLab { + owner = "libeigen"; + repo = "eigen"; + rev = "454f89af9d6f3525b1df5f9ef9c86df58bf2d4d3"; + hash = "sha256-a9QAnv6vIM8a9Bn8ZmfeMT0+kbtb0QGxM0+m5xwIqm8="; + }; + googletest = fetchFromGitHub { + owner = "google"; + repo = "googletest"; + rev = "f8d7d77c06936315286eb55f8de22cd23c188571"; + hash = "sha256-t0RchAHTJbuI5YW4uyBPykTvcjy90JW9AOPNjIhwh6U="; + }; + lodepng = fetchFromGitHub { + owner = "lvandeve"; + repo = "lodepng"; + rev = "b4ed2cd7ecf61d29076169b49199371456d4f90b"; + hash = "sha256-5cCkdj/izP4e99BKfs/Mnwu9aatYXjlyxzzYiMD/y1M="; + }; + qhull = fetchFromGitHub { + owner = "qhull"; + repo = "qhull"; + rev = "0c8fc90d2037588024d9964515c1e684f6007ecc"; + hash = "sha256-Ptzxad3ewmKJbbcmrBT+os4b4SR976zlCG9F0nq0x94="; + }; + tinyobjloader = fetchFromGitHub { + owner = "tinyobjloader"; + repo = "tinyobjloader"; + rev = "1421a10d6ed9742f5b2c1766d22faa6cfbc56248"; + hash = "sha256-9z2Ne/WPCiXkQpT8Cun/pSGUwgClYH+kQ6Dx1JvW6w0="; + }; + tinyxml2 = fetchFromGitHub { + owner = "leethomason"; + repo = "tinyxml2"; + rev = "9a89766acc42ddfa9e7133c7d81a5bda108a0ade"; + hash = "sha256-YGAe4+Ttv/xeou+9FoJjmQCKgzupTYdDhd+gzvtz/88="; + }; + marchingcubecpp = fetchFromGitHub { + owner = "aparis69"; + repo = "MarchingCubeCpp"; + rev = "5b79e5d6bded086a0abe276a4b5a69fc17ae9bf1"; + hash = "sha256-L0DH1GJZ/3vatQAU/KZj/2xTKE6Fwcw9eQYzLdqX2N4="; + }; + + tmd = stdenv.mkDerivation rec { + name = "TriangleMeshDistance"; + + src = fetchFromGitHub { + owner = "InteractiveComputerGraphics"; + repo = name; + rev = "e55a15c20551f36242fd6368df099a99de71d43a"; + hash = "sha256-vj6TMMT8mp7ciLa5nzVAhMWPcAHXq+ZwHlWsRA3uCmg="; + }; + + installPhase = '' + mkdir -p $out/include/tmd + cp ${name}/include/tmd/${name}.h $out/include/tmd/ + ''; + }; + + sdflib = stdenv.mkDerivation rec { + name = "SdfLib"; + + src = fetchFromGitHub { + owner = "UPC-ViRVIG"; + repo = name; + rev = "7c49cfba9bbec763b5d0f7b90b26555f3dde8088"; + hash = "sha256-5bnQ3rHH9Pw1jRVpZpamFnhIJHWnGm6krgZgIBqNtVg="; + }; + + patches = [ ./sdflib-system-deps.patch ]; + + cmakeFlags = [ + "-DSDFLIB_USE_ASSIMP=OFF" + "-DSDFLIB_USE_OPENMP=OFF" + "-DSDFLIB_USE_ENOKI=OFF" + "-DSDFLIB_USE_SYSTEM_GLM=ON" + "-DSDFLIB_USE_SYSTEM_SPDLOG=ON" + "-DSDFLIB_USE_SYSTEM_CEREAL=ON" + "-DSDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE=ON" + ]; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ + pin.tmd + + # Mainline. The otherwise pinned glm realease from 2018 does + # not build due to test failures and missing files. + glm + + spdlog + cereal_1_3_2 + ]; + }; + + }; + +in stdenv.mkDerivation rec { + pname = "mujoco"; + version = "3.1.0"; + + # Bumping version? Make sure to look though the MuJoCo's commit + # history for bumped dependency pins! + src = fetchFromGitHub { + owner = "google-deepmind"; + repo = pname; + rev = version; + hash = "sha256-a8h30psoAlj9dI4j8IfY3WzWjY4MrRosGbvgt79s1BQ="; + }; + + patches = [ ./mujoco-system-deps-dont-fetch.patch ]; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ + pin.sdflib + glm + + # non-numerical + spdlog + cereal_1_3_2 + glfw + ]; + + cmakeFlags = [ + "-DMUJOCO_USE_SYSTEM_sdflib=ON" + "-DMUJOCO_SIMULATE_USE_SYSTEM_GLFW=ON" + "-DMUJOCO_SAMPLES_USE_SYSTEM_GLFW=ON" + ]; + + # Move things into place so that cmake doesn't try downloading dependencies. + preConfigure = '' + mkdir -p build/_deps + ln -s ${pin.abseil-cpp} build/_deps/abseil-cpp-src + ln -s ${pin.benchmark} build/_deps/benchmark-src + ln -s ${pin.ccd} build/_deps/ccd-src + ln -s ${pin.eigen3} build/_deps/eigen3-src + ln -s ${pin.googletest} build/_deps/googletest-src + ln -s ${pin.lodepng} build/_deps/lodepng-src + ln -s ${pin.qhull} build/_deps/qhull-src + ln -s ${pin.tinyobjloader} build/_deps/tinyobjloader-src + ln -s ${pin.tinyxml2} build/_deps/tinyxml2-src + ln -s ${pin.marchingcubecpp} build/_deps/marchingcubecpp-src + ''; + + passthru.pin = { inherit (pin) lodepng eigen3 abseil-cpp; }; + + meta = with lib; { + description = "Multi-Joint dynamics with Contact. A general purpose physics simulator."; + homepage = "https://mujoco.org/"; + license = licenses.asl20; + maintainers = with maintainers; [ samuela tmplt ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/mujoco/mujoco-system-deps-dont-fetch.patch b/nixpkgs/pkgs/applications/science/robotics/mujoco/mujoco-system-deps-dont-fetch.patch new file mode 100644 index 000000000000..15373eb0b60f --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/mujoco/mujoco-system-deps-dont-fetch.patch @@ -0,0 +1,538 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 285250b..32d03e3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -92,7 +92,7 @@ add_subdirectory(src/render) + add_subdirectory(src/thread) + add_subdirectory(src/ui) + +-target_compile_definitions(mujoco PRIVATE _GNU_SOURCE CCD_STATIC_DEFINE MUJOCO_DLL_EXPORTS -DMC_IMPLEM_ENABLE) ++target_compile_definitions(mujoco PRIVATE _GNU_SOURCE MUJOCO_DLL_EXPORTS -DMC_IMPLEM_ENABLE) + if(MUJOCO_ENABLE_AVX_INTRINSICS) + target_compile_definitions(mujoco PUBLIC mjUSEPLATFORMSIMD) + endif() +@@ -117,7 +117,7 @@ target_link_libraries( + lodepng + qhullstatic_r + tinyobjloader +- tinyxml2 ++ tinyxml2::tinyxml2 + ) + + set_target_properties( +diff --git a/cmake/MujocoDependencies.cmake b/cmake/MujocoDependencies.cmake +index 4e3e2c8..f6143d9 100644 +--- a/cmake/MujocoDependencies.cmake ++++ b/cmake/MujocoDependencies.cmake +@@ -90,153 +90,203 @@ set(BUILD_SHARED_LIBS + CACHE INTERNAL "Build SHARED libraries" + ) + ++ + if(NOT TARGET lodepng) +- FetchContent_Declare( ++ fetchcontent_declare( + lodepng +- GIT_REPOSITORY https://github.com/lvandeve/lodepng.git +- GIT_TAG ${MUJOCO_DEP_VERSION_lodepng} + ) ++endif() ++ ++if(NOT TARGET lodepng) ++ if(NOT MUJOCO_USE_SYSTEM_lodepng) ++ fetchcontent_declare( ++ lodepng ++ GIT_REPOSITORY https://github.com/lvandeve/lodepng.git ++ GIT_TAG ${MUJOCO_DEP_VERSION_lodepng} ++ ) + +- FetchContent_GetProperties(lodepng) +- if(NOT lodepng_POPULATED) +- FetchContent_Populate(lodepng) +- # This is not a CMake project. +- set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp) +- set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h) +- add_library(lodepng STATIC ${LODEPNG_HEADERS} ${LODEPNG_SRCS}) +- target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) +- target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) +- target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR}) ++ fetchcontent_getproperties(lodepng) ++ if(NOT lodepng_POPULATED) ++ fetchcontent_populate(lodepng) ++ # This is not a CMake project. ++ set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp) ++ set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h) ++ add_library(lodepng STATIC ${LODEPNG_HEADERS} ${LODEPNG_SRCS}) ++ target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) ++ target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++ target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR}) ++ endif() ++ else() ++ find_package(lodepng REQUIRED) + endif() + endif() + + if(NOT TARGET marchingcubecpp) +- FetchContent_Declare( ++ fetchcontent_declare( + marchingcubecpp +- GIT_REPOSITORY https://github.com/aparis69/MarchingCubeCpp.git +- GIT_TAG ${MUJOCO_DEP_VERSION_MarchingCubeCpp} + ) + +- FetchContent_GetProperties(marchingcubecpp) ++ fetchcontent_getproperties(marchingcubecpp) + if(NOT marchingcubecpp_POPULATED) +- FetchContent_Populate(marchingcubecpp) ++ fetchcontent_populate(marchingcubecpp) + include_directories(${marchingcubecpp_SOURCE_DIR}) + endif() + endif() + ++option(MUJOCO_USE_SYSTEM_qhull "Use installed qhull version." OFF) ++mark_as_advanced(MUJOCO_USE_SYSTEM_qhull) ++ + set(QHULL_ENABLE_TESTING OFF) + + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_qhull} + PACKAGE_NAME +- qhull ++ Qhull + LIBRARY_NAME + qhull +- GIT_REPO +- https://github.com/qhull/qhull.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_qhull} + TARGETS + qhull + EXCLUDE_FROM_ALL + ) +-# MuJoCo includes a file from libqhull_r which is not exported by the qhull include directories. +-# Add it to the target. +-target_include_directories( +- qhullstatic_r INTERFACE $<BUILD_INTERFACE:${qhull_SOURCE_DIR}/src/libqhull_r> +-) +-target_compile_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) +-target_link_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++ ++if(NOT MUJOCO_USE_SYSTEM_qhull) ++ # MuJoCo includes a file from libqhull_r which is not exported by the qhull include directories. ++ # Add it to the target. ++ target_include_directories( ++ qhullstatic_r INTERFACE $<BUILD_INTERFACE:${qhull_SOURCE_DIR}/src/libqhull_r> ++ ) ++ target_compile_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) ++ target_link_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++else() ++ if(NOT TARGET qhullstatic_r) ++ add_library(qhullstatic_r INTERFACE) ++ set_target_properties(qhullstatic_r PROPERTIES INTERFACE_LINK_LIBRARIES Qhull::qhull_r) ++ ++ # Workaround as headers are installed in <prefix>/include/libqhull_r/something.h ++ # but mujoco include them as #include <something.h> ++ get_property(qhull_include_dirs TARGET Qhull::qhull_r PROPERTY INTERFACE_INCLUDE_DIRECTORIES) ++ foreach(qhull_include_dir IN LISTS qhull_include_dirs) ++ target_include_directories(qhullstatic_r INTERFACE ${qhull_include_dirs}/libqhull_r) ++ endforeach() ++ target_include_directories(qhullstatic_r INTERFACE ) ++ endif() ++endif() ++ ++option(MUJOCO_USE_SYSTEM_tinyxml2 "Use installed tinyxml2 version." OFF) ++mark_as_advanced(MUJOCO_USE_SYSTEM_tinyxml2) + + set(tinyxml2_BUILD_TESTING OFF) + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_tinyxml2} + PACKAGE_NAME + tinyxml2 + LIBRARY_NAME + tinyxml2 +- GIT_REPO +- https://github.com/leethomason/tinyxml2.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_tinyxml2} + TARGETS +- tinyxml2 ++ tinyxml2::tinyxml2 + EXCLUDE_FROM_ALL + ) +-target_compile_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) +-target_link_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++ ++if(NOT MUJOCO_USE_SYSTEM_tinyxml2) ++ target_compile_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) ++ target_link_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++endif() ++ ++option(MUJOCO_USE_SYSTEM_tinyobjloader "Use installed tinyobjloader version." OFF) ++mark_as_advanced(MUJOCO_USE_SYSTEM_tinyobjloader) + + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_tinyobjloader} + PACKAGE_NAME + tinyobjloader + LIBRARY_NAME + tinyobjloader +- GIT_REPO +- https://github.com/tinyobjloader/tinyobjloader.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_tinyobjloader} + TARGETS + tinyobjloader + EXCLUDE_FROM_ALL + ) + ++if(MUJOCO_USE_SYSTEM_tinyobjloader) ++ # As of tinyobjloader v2.0.0rc10, the tinyobjloader target is named tinyobjloader in the build, ++ # but tinyobjloader::tinyobjloader when it is installed. To deal with this, if tinyobjloader is ++ # found in the system, we create an ALIAS ++ # The following is equivalent to add_library(tinyobjloader ALIAS tinyobjloader::tinyobjloader), ++ # but compatible with CMake 3.16 . Once the minimum CMake is bumped to CMake 3.18, we can use ++ # the simpler version ++ add_library(tinyobjloader INTERFACE IMPORTED) ++ set_target_properties(tinyobjloader PROPERTIES INTERFACE_LINK_LIBRARIES tinyobjloader::tinyobjloader) ++endif() ++ ++option(MUJOCO_USE_SYSTEM_sdflib "Use installed sdflib version." OFF) ++mark_as_advanced(MUJOCO_USE_SYSTEM_sdflib) ++ + option(SDFLIB_USE_ASSIMP OFF) + option(SDFLIB_USE_OPENMP OFF) + option(SDFLIB_USE_ENOKI OFF) ++ + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_sdflib} + PACKAGE_NAME +- sdflib ++ SdfLib + LIBRARY_NAME + sdflib +- GIT_REPO +- https://github.com/UPC-ViRVIG/SdfLib.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_sdflib} + TARGETS +- SdfLib ++ SdfLib::SdfLib + EXCLUDE_FROM_ALL + ) +-target_compile_options(SdfLib PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) +-target_link_options(SdfLib PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++ ++if(NOT MUJOCO_USE_SYSTEM_sdflib) ++ target_compile_options(SdfLib PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) ++ target_link_options(SdfLib PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++endif() ++ ++option(MUJOCO_USE_SYSTEM_ccd "Use installed ccd version." OFF) ++mark_as_advanced(MUJOCO_USE_SYSTEM_ccd) + + set(ENABLE_DOUBLE_PRECISION ON) + set(CCD_HIDE_ALL_SYMBOLS ON) + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_ccd} + PACKAGE_NAME + ccd + LIBRARY_NAME + ccd +- GIT_REPO +- https://github.com/danfis/libccd.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_ccd} + TARGETS + ccd + EXCLUDE_FROM_ALL + ) +-target_compile_options(ccd PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) +-target_link_options(ccd PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) +- +-# libCCD has an unconditional `#define _CRT_SECURE_NO_WARNINGS` on Windows. +-# TODO(stunya): Remove this after https://github.com/danfis/libccd/pull/77 is merged. +-if(WIN32) +- if(MSVC) +- # C4005 is the MSVC equivalent of -Wmacro-redefined. +- target_compile_options(ccd PRIVATE /wd4005) +- else() +- target_compile_options(ccd PRIVATE -Wno-macro-redefined) ++ ++if(NOT MUJOCO_USE_SYSTEM_ccd) ++ target_compile_options(ccd PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) ++ target_link_options(ccd PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) ++ # This is necessary to ensure that the any library that consumes the ccd ++ # compiled internally by MuJoCo (as static library) has CCD_EXPORT correctly ++ # defined as an empty string. For ccd itself, this is ensured by the variable ++ # CCD_HIDE_ALL_SYMBOLS set to ON before the call to findorfetch ++ # See https://github.com/danfis/libccd/pull/79 ++ target_compile_definitions(ccd INTERFACE CCD_STATIC_DEFINE) ++ ++ # libCCD has an unconditional `#define _CRT_SECURE_NO_WARNINGS` on Windows. ++ # TODO(stunya): Remove this after https://github.com/danfis/libccd/pull/77 is merged. ++ if(WIN32) ++ if(MSVC) ++ # C4005 is the MSVC equivalent of -Wmacro-redefined. ++ target_compile_options(ccd PRIVATE /wd4005) ++ else() ++ target_compile_options(ccd PRIVATE -Wno-macro-redefined) ++ endif() + endif() + endif() + + if(MUJOCO_BUILD_TESTS) ++ option(MUJOCO_USE_SYSTEM_abseil "Use installed abseil version." OFF) ++ mark_as_advanced(MUJOCO_USE_SYSTEM_abseil) ++ + set(ABSL_PROPAGATE_CXX_STD ON) + + # This specific version of Abseil does not have the following variable. We need to work with BUILD_TESTING +@@ -249,15 +299,11 @@ if(MUJOCO_BUILD_TESTS) + set(ABSL_BUILD_TESTING OFF) + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_abseil} + PACKAGE_NAME + absl + LIBRARY_NAME + abseil-cpp +- GIT_REPO +- https://github.com/abseil/abseil-cpp.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_abseil} + TARGETS + absl::core_headers + EXCLUDE_FROM_ALL +@@ -268,6 +314,9 @@ if(MUJOCO_BUILD_TESTS) + CACHE BOOL "Build tests." FORCE + ) + ++ option(MUJOCO_USE_SYSTEM_gtest "Use installed gtest version." OFF) ++ mark_as_advanced(MUJOCO_USE_SYSTEM_gtest) ++ + # Avoid linking errors on Windows by dynamically linking to the C runtime. + set(gtest_force_shared_crt + ON +@@ -276,22 +325,20 @@ if(MUJOCO_BUILD_TESTS) + + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_gtest} + PACKAGE_NAME + GTest + LIBRARY_NAME + googletest +- GIT_REPO +- https://github.com/google/googletest.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_gtest} + TARGETS +- gtest +- gmock +- gtest_main ++ GTest::gmock ++ GTest::gtest_main + EXCLUDE_FROM_ALL + ) + ++ option(MUJOCO_USE_SYSTEM_benchmark "Use installed benchmark version." OFF) ++ mark_as_advanced(MUJOCO_USE_SYSTEM_benchmark) ++ + set(BENCHMARK_EXTRA_FETCH_ARGS "") + if(WIN32 AND NOT MSVC) + set(BENCHMARK_EXTRA_FETCH_ARGS +@@ -310,15 +357,11 @@ if(MUJOCO_BUILD_TESTS) + + findorfetch( + USE_SYSTEM_PACKAGE +- OFF ++ ${MUJOCO_USE_SYSTEM_benchmark} + PACKAGE_NAME + benchmark + LIBRARY_NAME + benchmark +- GIT_REPO +- https://github.com/google/benchmark.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_benchmark} + TARGETS + benchmark::benchmark + benchmark::benchmark_main +@@ -328,26 +371,42 @@ if(MUJOCO_BUILD_TESTS) + endif() + + if(MUJOCO_TEST_PYTHON_UTIL) ++ option(MUJOCO_USE_SYSTEM_Eigen3 "Use installed Eigen3 version." OFF) ++ mark_as_advanced(MUJOCO_USE_SYSTEM_Eigen3) ++ + add_compile_definitions(EIGEN_MPL2_ONLY) +- if(NOT TARGET eigen) +- # Support new IN_LIST if() operator. +- set(CMAKE_POLICY_DEFAULT_CMP0057 NEW) ++ if(NOT TARGET Eigen3::Eigen) ++ if(NOT MUJOCO_USE_SYSTEM_Eigen3) ++ # Support new IN_LIST if() operator. ++ set(CMAKE_POLICY_DEFAULT_CMP0057 NEW) ++ endif() + +- FetchContent_Declare( ++ fetchcontent_declare( + Eigen3 +- GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git +- GIT_TAG ${MUJOCO_DEP_VERSION_Eigen3} + ) + +- FetchContent_GetProperties(Eigen3) ++ fetchcontent_getproperties(Eigen3) + if(NOT Eigen3_POPULATED) +- FetchContent_Populate(Eigen3) ++ fetchcontent_populate(Eigen3) + + # Mark the library as IMPORTED as a workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/15415 + add_library(Eigen3::Eigen INTERFACE IMPORTED) + set_target_properties( + Eigen3::Eigen PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${eigen3_SOURCE_DIR}" + ) ++ ++ fetchcontent_getproperties(Eigen3) ++ # if(NOT Eigen3_POPULATED) ++ # fetchcontent_populate(Eigen3) ++ ++ # # Mark the library as IMPORTED as a workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/15415 ++ # add_library(Eigen3::Eigen INTERFACE IMPORTED) ++ # set_target_properties( ++ # Eigen3::Eigen PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${eigen3_SOURCE_DIR}" ++ # ) ++ # endif() ++ else() ++ find_package(Eigen3 REQUIRED) + endif() + endif() + endif() +diff --git a/plugin/sdf/CMakeLists.txt b/plugin/sdf/CMakeLists.txt +index 3e216fc..e7e3a1e 100644 +--- a/plugin/sdf/CMakeLists.txt ++++ b/plugin/sdf/CMakeLists.txt +@@ -37,7 +37,7 @@ set(MUJOCO_SDF_SRCS + add_library(sdf SHARED) + target_sources(sdf PRIVATE ${MUJOCO_SDF_SRCS}) + target_include_directories(sdf PRIVATE ${MUJOCO_SDF_INCLUDE}) +-target_link_libraries(sdf PRIVATE mujoco SdfLib) ++target_link_libraries(sdf PRIVATE mujoco SdfLib::SdfLib) + target_compile_options( + sdf + PRIVATE ${AVX_COMPILE_OPTIONS} +diff --git a/python/mujoco/util/CMakeLists.txt b/python/mujoco/util/CMakeLists.txt +index 666a372..d89bb49 100644 +--- a/python/mujoco/util/CMakeLists.txt ++++ b/python/mujoco/util/CMakeLists.txt +@@ -63,8 +63,8 @@ if(BUILD_TESTING) + target_link_libraries( + array_traits_test + array_traits +- gmock +- gtest_main ++ GTest::gmock ++ GTest::gtest_main + ) + gtest_add_tests(TARGET array_traits_test SOURCES array_traits_test.cc) + +@@ -72,8 +72,8 @@ if(BUILD_TESTING) + target_link_libraries( + func_traits_test + func_traits +- gmock +- gtest_main ++ GTest::gmock ++ GTest::gtest_main + ) + gtest_add_tests(TARGET func_traits_test SOURCES func_traits_test.cc) + +@@ -81,8 +81,8 @@ if(BUILD_TESTING) + target_link_libraries( + func_wrap_test + func_wrap +- gmock +- gtest_main ++ GTest::gmock ++ GTest::gtest_main + ) + gtest_add_tests(TARGET func_wrap_test SOURCES func_wrap_test.cc) + +@@ -90,8 +90,8 @@ if(BUILD_TESTING) + target_link_libraries( + tuple_tools_test + func_wrap +- gmock +- gtest_main ++ GTest::gmock ++ GTest::gtest_main + ) + gtest_add_tests(TARGET tuple_tools_test SOURCES tuple_tools_test.cc) + endif() +diff --git a/simulate/cmake/SimulateDependencies.cmake b/simulate/cmake/SimulateDependencies.cmake +index 5141406..75ff788 100644 +--- a/simulate/cmake/SimulateDependencies.cmake ++++ b/simulate/cmake/SimulateDependencies.cmake +@@ -81,10 +81,6 @@ findorfetch( + glfw3 + LIBRARY_NAME + glfw3 +- GIT_REPO +- https://github.com/glfw/glfw.git +- GIT_TAG +- ${MUJOCO_DEP_VERSION_glfw3} + TARGETS + glfw + EXCLUDE_FROM_ALL +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 6bec911..2a16c21 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -30,7 +30,7 @@ macro(mujoco_test name) + ) + + add_executable(${name} ${name}.cc) +- target_link_libraries(${name} gtest_main mujoco) ++ target_link_libraries(${name} GTest::gtest_main mujoco) + target_include_directories(${name} PRIVATE ${MUJOCO_TEST_INCLUDE}) + set_target_properties(${name} PROPERTIES BUILD_RPATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + # gtest_discover_tests is recommended over gtest_add_tests, but has some issues in Windows. +@@ -59,20 +59,20 @@ target_link_libraries( + PUBLIC absl::core_headers + absl::strings + absl::synchronization +- gtest +- gmock ++ GTest::gtest ++ GTest::gmock + mujoco::mujoco + ) + target_include_directories(fixture PRIVATE ${mujoco_SOURCE_DIR}/include gmock) + + mujoco_test(fixture_test) +-target_link_libraries(fixture_test fixture gmock) ++target_link_libraries(fixture_test fixture GTest::gmock) + + mujoco_test(header_test) +-target_link_libraries(header_test fixture gmock) ++target_link_libraries(header_test fixture GTest::gmock) + + mujoco_test(pipeline_test) +-target_link_libraries(pipeline_test fixture gmock) ++target_link_libraries(pipeline_test fixture GTest::gmock) + + add_subdirectory(benchmark) + add_subdirectory(engine) diff --git a/nixpkgs/pkgs/applications/science/robotics/mujoco/sdflib-system-deps.patch b/nixpkgs/pkgs/applications/science/robotics/mujoco/sdflib-system-deps.patch new file mode 100644 index 000000000000..ca84c60a63df --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/mujoco/sdflib-system-deps.patch @@ -0,0 +1,192 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 251c456..3d30231 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,7 +27,7 @@ option(SDFLIB_USE_SYSTEM_GLM "Use glm library via find_package instead of downlo + option(SDFLIB_USE_SYSTEM_SPDLOG "Use spdlog library via find_package instead of downloading it" OFF) + option(SDFLIB_USE_SYSTEM_CEREAL "Use cereal library via find_package instead of downloading it" OFF) + option(SDFLIB_USE_SYSTEM_ASSIMP "Use assimp library via find_package instead of downloading it" OFF) +- ++option(SDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE "Use TriangleMeshDistance library via system includes instead of downloading it" OFF) + + if(SDFLIB_DEBUG_INFO) + add_compile_definitions(SDFLIB_PRINT_STATISTICS) +@@ -55,13 +55,52 @@ file(GLOB UTILS_SOURCE_FILES src/utils/*.cpp) + file(GLOB UTILS_HEADER_FILES src/utils/*.h) + + # Add libraries +-add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES} ${PUBLIC_HEADER_FILES} +- ${SDF_SOURCE_FILES} ${SDF_HEADER_FILES} +- ${UTILS_SOURCE_FILES} ${UTILS_HEADER_FILES}) +- +-target_include_directories(${PROJECT_NAME} PUBLIC include/) ++add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES} ${PUBLIC_HEADER_FILES} ++ ${SDF_SOURCE_FILES} ${SDF_HEADER_FILES} ++ ${UTILS_SOURCE_FILES} ${UTILS_HEADER_FILES}) ++add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) ++if(BUILD_SHARED_LIBS AND WIN32) ++ set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) ++endif() ++include(GNUInstallDirs) ++target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> ++ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + target_include_directories(${PROJECT_NAME} PRIVATE src/) + ++# Install library and CMake config files ++install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}) ++install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/SdfLib ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++ ++install(EXPORT ${PROJECT_NAME} ++ FILE ${PROJECT_NAME}Targets.cmake ++ DESTINATION lib/cmake/${PROJECT_NAME} ++ NAMESPACE ${PROJECT_NAME}:: ++) ++ ++include(CMakePackageConfigHelpers) ++set(PACKAGE_DEPENDENCIES "") ++if(SDFLIB_USE_SYSTEM_GLM) ++ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(glm)\n") ++endif() ++if(SDFLIB_USE_SYSTEM_SPDLOG) ++ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(spdlog)\n") ++endif() ++if(SDFLIB_USE_SYSTEM_CEREAL) ++ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(cereal)\n") ++endif() ++if(SDFLIB_USE_ASSIMP AND SDFLIB_USE_SYSTEM_ASSIMP) ++ string(APPEND PACKAGE_DEPENDENCIES "find_dependency(assimp)\n") ++endif() ++ ++configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" ++ INSTALL_DESTINATION "lib/cmake/${PROJECT_NAME}" ++ NO_SET_AND_CHECK_MACRO ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake ++ DESTINATION lib/cmake/${PROJECT_NAME}) ++ + # Add shaders + file(GLOB SHADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/render_engine/shaders + src/render_engine/shaders/*.frag +@@ -69,7 +108,7 @@ file(GLOB SHADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src/render_engine/sh + src/render_engine/shaders/*.comp) + + foreach(SHADER IN LISTS SHADER_FILES) +- add_custom_command(OUTPUT ${SHADER} ++add_custom_command(OUTPUT ${SHADER} + COMMAND cmake -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/src/render_engine/shaders/${SHADER} $<TARGET_FILE_DIR:${PROJECT_NAME}>/shaders/${SHADER} + DEPENDS src/render_engine/shaders/${SHADER} + ) +@@ -112,7 +151,10 @@ endif() + target_link_libraries(${PROJECT_NAME} PUBLIC ${SDFLIB_GLM_TARGET}) + target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog) + target_link_libraries(${PROJECT_NAME} PUBLIC cereal::cereal) +-target_link_libraries(${PROJECT_NAME} PUBLIC icg) ++ ++if(NOT SDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE) ++ target_link_libraries(${PROJECT_NAME} PUBLIC TriangleMeshDistance) ++endif() + + if(CMAKE_CXX_COMPILER_ID MATCHES GNU) + target_link_libraries(${PROJECT_NAME} PUBLIC -lstdc++fs) +diff --git a/SdfLibConfig.cmake.in b/SdfLibConfig.cmake.in +new file mode 100644 +index 0000000..9b8265c +--- /dev/null ++++ b/SdfLibConfig.cmake.in +@@ -0,0 +1,7 @@ ++@PACKAGE_INIT@ ++ ++include(CMakeFindDependencyMacro) ++ ++@PACKAGE_DEPENDENCIES@ ++ ++include("${CMAKE_CURRENT_LIST_DIR}/SdfLibTargets.cmake") +diff --git a/include/SdfLib/TrianglesInfluence.h b/include/SdfLib/TrianglesInfluence.h +index fc2ca52..b276f23 100644 +--- a/include/SdfLib/TrianglesInfluence.h ++++ b/include/SdfLib/TrianglesInfluence.h +@@ -11,7 +11,7 @@ + #include "InterpolationMethods.h" + #include "utils/Timer.h" + #include "utils/GJK.h" +-#include <InteractiveComputerGraphics/TriangleMeshDistance.h> ++#include <tmd/TriangleMeshDistance.h> + + #include <vector> + #include <array> +diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt +index 79f70c1..e2a4f10 100644 +--- a/libs/CMakeLists.txt ++++ b/libs/CMakeLists.txt +@@ -137,9 +137,10 @@ if(SDFLIB_BUILD_APPS OR SDFLIB_BUILD_DEBUG_APPS) + target_include_directories(stb_image INTERFACE stb) + endif() + +-# icg +-add_library(icg INTERFACE) +-target_include_directories(icg INTERFACE InteractiveComputerGraphics) ++if (NOT SDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE) ++ add_library(TriangleMeshDistance INTERFACE) ++ target_include_directories(TriangleMeshDistance INTERFACE InteractiveComputerGraphics) ++endif() + + if(SDFLIB_BUILD_APPS OR SDFLIB_BUILD_DEBUG_APPS) + # glfw +diff --git a/libs/InteractiveComputerGraphics/InteractiveComputerGraphics/TriangleMeshDistance.h b/libs/InteractiveComputerGraphics/tmd/TriangleMeshDistance.h +similarity index 100% +rename from libs/InteractiveComputerGraphics/InteractiveComputerGraphics/TriangleMeshDistance.h +rename to libs/InteractiveComputerGraphics/tmd/TriangleMeshDistance.h +diff --git a/src/tools/ImageQueryTime/main.cpp b/src/tools/ImageQueryTime/main.cpp +index 357a78b..f4fd9e7 100644 +--- a/src/tools/ImageQueryTime/main.cpp ++++ b/src/tools/ImageQueryTime/main.cpp +@@ -17,7 +17,7 @@ + + #define TEST_METHODS + #ifdef TEST_METHODS +-#include <InteractiveComputerGraphics/TriangleMeshDistance.h> ++#include <tmd/TriangleMeshDistance.h> + // #include <CGAL/Simple_cartesian.h> + // #include <CGAL/AABB_tree.h> + // #include <CGAL/AABB_traits.h> +diff --git a/src/tools/SdfErrorCompare/main.cpp b/src/tools/SdfErrorCompare/main.cpp +index deef25f..9e402c4 100644 +--- a/src/tools/SdfErrorCompare/main.cpp ++++ b/src/tools/SdfErrorCompare/main.cpp +@@ -23,7 +23,7 @@ using namespace sdflib; + // #define TEST_OPENVDB + + #ifdef TEST_ICG +-#include <InteractiveComputerGraphics/TriangleMeshDistance.h> ++#include <tmd/TriangleMeshDistance.h> + #endif + #ifdef TEST_CGAL + #include <CGAL/Simple_cartesian.h> +diff --git a/src/tools/SdfLibUnity/SdfExportFunc.cpp b/src/tools/SdfLibUnity/SdfExportFunc.cpp +index ff4e017..7e06ada 100644 +--- a/src/tools/SdfLibUnity/SdfExportFunc.cpp ++++ b/src/tools/SdfLibUnity/SdfExportFunc.cpp +@@ -1,7 +1,7 @@ + #include "SdfExportFunc.h" + #include "spdlog/sinks/rotating_file_sink.h" + +-#include <InteractiveComputerGraphics/TriangleMeshDistance.h> ++#include <tmd/TriangleMeshDistance.h> + + using namespace sdflib; + +diff --git a/src/tools/SdfOffsets/main.cpp b/src/tools/SdfOffsets/main.cpp +index b6769d7..07f137b 100644 +--- a/src/tools/SdfOffsets/main.cpp ++++ b/src/tools/SdfOffsets/main.cpp +@@ -9,7 +9,7 @@ + #include <glm/gtc/type_ptr.hpp> + #include <glm/gtc/matrix_transform.hpp> + +-#include <InteractiveComputerGraphics/TriangleMeshDistance.h> ++#include <tmd/TriangleMeshDistance.h> + #include <CGAL/Surface_mesh_default_triangulation_3.h> + #include <CGAL/Complex_2_in_triangulation_3.h> + #include <CGAL/make_surface_mesh.h> diff --git a/nixpkgs/pkgs/applications/science/robotics/qgroundcontrol/default.nix b/nixpkgs/pkgs/applications/science/robotics/qgroundcontrol/default.nix new file mode 100644 index 000000000000..25b1f4e5d5ce --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/qgroundcontrol/default.nix @@ -0,0 +1,82 @@ +{ lib, stdenv, fetchFromGitHub, SDL2, qtbase, qtcharts, qtlocation, qtserialport +, qtsvg, qtquickcontrols2, qtgraphicaleffects, qtspeech, qtx11extras, qmake +, qttools, gst_all_1, wayland, pkg-config, wrapQtAppsHook }: + +stdenv.mkDerivation rec { + pname = "qgroundcontrol"; + version = "4.3.0"; + + propagatedBuildInputs = [ + qtbase qtcharts qtlocation qtserialport qtsvg qtquickcontrols2 + qtgraphicaleffects qtspeech qtx11extras + ]; + + gstInputs = with gst_all_1; [ + gstreamer + gst-plugins-base + (gst-plugins-good.override { qt5Support = true; }) + gst-plugins-bad + gst-libav + wayland + ]; + + buildInputs = [ SDL2 ] ++ gstInputs ++ propagatedBuildInputs; + nativeBuildInputs = [ pkg-config qmake qttools wrapQtAppsHook ]; + + preConfigure = '' + mkdir build + cd build + ''; + + qmakeFlags = [ + "CONFIG+=StableBuild" + # Default install tries to copy Qt files into package + "CONFIG+=QGC_DISABLE_BUILD_SETUP" + # Tries to download x86_64-only prebuilt binaries + "DEFINES+=DISABLE_AIRMAP" + "../qgroundcontrol.pro" + ]; + + installPhase = '' + runHook preInstall + + cd .. + + mkdir -p $out/share/applications + sed 's/Exec=.*$/Exec=QGroundControl/g' --in-place deploy/qgroundcontrol.desktop + cp -v deploy/qgroundcontrol.desktop $out/share/applications + + mkdir -p $out/bin + cp -v build/staging/QGroundControl "$out/bin/" + + mkdir -p $out/share/qgroundcontrol + cp -rv resources/ $out/share/qgroundcontrol + + mkdir -p $out/share/pixmaps + cp -v resources/icons/qgroundcontrol.png $out/share/pixmaps + + runHook postInstall + ''; + + postInstall = '' + qtWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") + ''; + + # TODO: package mavlink so we can build from a normal source tarball + src = fetchFromGitHub { + owner = "mavlink"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-a0+cpT413qi88PvaWQPxKABHfK7vbPE7B42n84n/SAk="; + fetchSubmodules = true; + }; + + meta = with lib; { + description = "Provides full ground station support and configuration for the PX4 and APM Flight Stacks"; + homepage = "http://qgroundcontrol.com/"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ lopsided98 ]; + mainProgram = "QGroundControl"; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/sumorobot-manager/default.nix b/nixpkgs/pkgs/applications/science/robotics/sumorobot-manager/default.nix new file mode 100644 index 000000000000..343f9fad105b --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/sumorobot-manager/default.nix @@ -0,0 +1,44 @@ +{ lib, stdenv, python3, qt5, fetchFromGitHub, wrapPython, pyqt5, pyserial, dos2unix }: + +stdenv.mkDerivation rec { + pname = "sumorobot-manager"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "robokoding"; + repo = pname; + rev = "v${version}"; + sha256 = "07snhwmqqp52vdgr66vx50zxx0nmpmns5cdjgh50hzlhji2z1fl9"; + }; + + buildInputs = [ python3 ]; + pythonPath = [ + pyqt5.dev pyserial + ]; + + nativeBuildInputs = [ wrapPython qt5.wrapQtAppsHook dos2unix ]; + + buildPhase = "true"; + + installPhase = '' + mkdir -p $out/opt/sumorobot-manager + cp -r main.py lib res $out/opt/sumorobot-manager + chmod -R 644 $out/opt/sumorobot-manager/lib/* + mkdir $out/bin + dos2unix $out/opt/sumorobot-manager/main.py + makeQtWrapper $out/opt/sumorobot-manager/main.py $out/bin/sumorobot-manager \ + --chdir "$out/opt/sumorobot-manager" + ''; + + preFixup = '' + patchShebangs $out/opt/sumorobot-manager/main.py + wrapPythonProgramsIn "$out/opt" "$pythonPath" + ''; + + meta = with lib; { + description = "Desktop App for managing SumoRobots"; + homepage = "https://www.robokoding.com/kits/sumorobot/sumomanager/"; + license = licenses.mit; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/nixpkgs/pkgs/applications/science/robotics/yarp/default.nix b/nixpkgs/pkgs/applications/science/robotics/yarp/default.nix new file mode 100644 index 000000000000..3b33096dc683 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/robotics/yarp/default.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchFromGitHub, cmake, ace +}: + +stdenv.mkDerivation rec { + pname = "yarp"; + version = "2.3.70.2"; + src = fetchFromGitHub { + owner = "robotology"; + repo = "yarp"; + rev = "v${version}"; + sha256 = "0mphh899niy30xbjjwi9xpsliq8mladfldbbbjfngdrqfhiray1a"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ ace ]; + + cmakeFlags = [ + "-DYARP_COMPILE_UNMAINTAINED:BOOL=ON" + "-DCREATE_YARPC:BOOL=ON" + "-DCREATE_YARPCXX:BOOL=ON" + ]; + + # since we cant expand $out in cmakeFlags + preConfigure = ''cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_LIBDIR=$out/lib"''; + + postInstall = "mv ./$out/lib/*.so $out/lib/"; + + meta = { + description = "Yet Another Robot Platform"; + homepage = "http://yarp.it"; + license = lib.licenses.lgpl21; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.nico202 ]; + }; +} + |