From 255a4e2ee0ebb32ab267170f2574dd5a23351fc6 Mon Sep 17 00:00:00 2001 From: Dawn Magnet <61567130+DawnMagnet@users.noreply.github.com> Date: Sun, 9 Jun 2024 09:12:23 +0000 Subject: [PATCH 1/5] add nix build system --- README.md | 19 +++++++++++++++++++ flake.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 flake.nix diff --git a/README.md b/README.md index a31f112..482c46d 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,25 @@ section of the developer's website. Please visit the [Latest Version Information](https://developer.dji.com/doc/payload-sdk-tutorial/en/) to get the latest version information. +## Use Docker & Nix to build + + + +```bash +docker pull nixpkgs/nix-flakes:latest +docker run --name payload -it -v {SOMEWHERE}/Payload-SDK:/workspace docker.io/nixpkgs/nix-flakes:latest bash +``` +(inside docker) +```bash +cd /workspace +nix develop +mkdir build && cd build +cmake .. +make +``` + +then output will appears in `build/bin/dji_sdk_demo_linux` and `build/bin/dji_sdk_demo_linux_cxx` + ## Latest Release The latest release version of PSDK is 3.9.0. This version of Payload SDK mainly add some new features support and fixed some diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f34fa0f --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + description = "Build DJI Payload SDK From Nix-Shell(Suggect to use docker image nixpkgs/nix-flakes:latest for a clean environment, otherwise may failed)"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell.override { + # Override stdenv in order to change compiler: + # stdenv = pkgs.clangStdenv; + } + { + packages = with pkgs; [ + cmake + libusb1 + libopus + gcc + ffmpeg_4-full + opencv3 + ]; + }; + }); + }; +} + From f2a7b19b0071013ec58b4a2f322ab2ee00a1f3bb Mon Sep 17 00:00:00 2001 From: DawnMagnet Date: Thu, 18 Jul 2024 12:46:42 +0800 Subject: [PATCH 2/5] add nix-build support --- default.nix | 30 ++++++++++++++++++++++++++++++ flake.nix | 32 -------------------------------- result | 1 + 3 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 default.nix delete mode 100644 flake.nix create mode 120000 result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..2b53c30 --- /dev/null +++ b/default.nix @@ -0,0 +1,30 @@ +{ + pkgs ? import { }, +}: +pkgs.stdenv.mkDerivation rec { + pname = "dji-payload-sdk"; + version = "1.0"; + + src = ./.; + + enableParallelBuilding = true; + # 此选项禁用了对 CMake 软件包的一些自动修正 + # dontFixCmake = true; + + nativeBuildInputs = with pkgs; [ + cmake + libusb1 + libopus + gcc + ffmpeg_4-full + opencv3 + ]; + + # 传给 CMake 的配置参数,控制 liboqs 的功能 + cmakeFlags = [ ]; + + postInstall = '' + mkdir -p $out/bin + install -m755 bin/* $out/bin + ''; +} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index f34fa0f..0000000 --- a/flake.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - description = "Build DJI Payload SDK From Nix-Shell(Suggect to use docker image nixpkgs/nix-flakes:latest for a clean environment, otherwise may failed)"; - - inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; - - outputs = { self, nixpkgs }: - let - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit system; }; - }); - in - { - devShells = forEachSupportedSystem ({ pkgs }: { - default = pkgs.mkShell.override { - # Override stdenv in order to change compiler: - # stdenv = pkgs.clangStdenv; - } - { - packages = with pkgs; [ - cmake - libusb1 - libopus - gcc - ffmpeg_4-full - opencv3 - ]; - }; - }); - }; -} - diff --git a/result b/result new file mode 120000 index 0000000..7fbdce5 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/9i8q3c558mmjr5q5xsw1mamzg41cfqc5-dji-payload-sdk-1.0 \ No newline at end of file From bbcd721c4efa5be3fc4afb9e6eb818b32c77a042 Mon Sep 17 00:00:00 2001 From: DawnMagnet Date: Thu, 18 Jul 2024 14:21:00 +0800 Subject: [PATCH 3/5] empty --- .envrc | 1 + .gitignore | 1 + result | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 .gitignore diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4a4726a --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/result b/result index 7fbdce5..9f55add 120000 --- a/result +++ b/result @@ -1 +1 @@ -/nix/store/9i8q3c558mmjr5q5xsw1mamzg41cfqc5-dji-payload-sdk-1.0 \ No newline at end of file +/nix/store/341nq6ca8m6j5k1xxz6g5cm8njpvlzwz-dji-payload-sdk-1.0 \ No newline at end of file From a6df97c0ff8de1808e3ca244c8d6f2a84bd19c2c Mon Sep 17 00:00:00 2001 From: DawnMagnet Date: Mon, 9 Sep 2024 23:57:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20(result):=20remove?= =?UTF-8?q?=20obsolete=20symlink=20to=20dji-payload-sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The symlink to the dji-payload-sdk was no longer needed and has been removed to clean up the project structure. This helps maintain clarity and reduces potential confusion regarding unused or outdated references. --- result | 1 - 1 file changed, 1 deletion(-) delete mode 120000 result diff --git a/result b/result deleted file mode 120000 index 9f55add..0000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/341nq6ca8m6j5k1xxz6g5cm8njpvlzwz-dji-payload-sdk-1.0 \ No newline at end of file From ede9ceceb8033a2c43213d1f5da0c2520cf425c0 Mon Sep 17 00:00:00 2001 From: DawnMagnet Date: Mon, 9 Sep 2024 23:58:03 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=93=9D=20(.gitignore):=20add=20.DS=5F?= =?UTF-8?q?Store=20and=20result=20directory=20to=20ignore=20list=20?= =?UTF-8?q?=E2=9C=A8=20(dji=5Fsdk=5Fapp=5Finfo.h.bak):=20add=20backup=20he?= =?UTF-8?q?ader=20file=20for=20DJI=20SDK=20application=20info=20The=20.git?= =?UTF-8?q?ignore=20file=20is=20updated=20to=20exclude=20.DS=5FStore=20fil?= =?UTF-8?q?es=20and=20the=20result=20directory,=20preventing=20unnecessary?= =?UTF-8?q?=20files=20from=20being=20tracked=20in=20the=20repository.=20A?= =?UTF-8?q?=20new=20backup=20header=20file=20for=20the=20DJI=20SDK=20appli?= =?UTF-8?q?cation=20information=20is=20added=20to=20ensure=20that=20the=20?= =?UTF-8?q?structure=20and=20function=20prototypes=20are=20preserved=20for?= =?UTF-8?q?=20future=20reference=20and=20development.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + .../application/dji_sdk_app_info.h.bak | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 samples/sample_c++/platform/linux/manifold2/application/dji_sdk_app_info.h.bak diff --git a/.gitignore b/.gitignore index b2be92b..e80f146 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ result +.DS_Store +/result diff --git a/samples/sample_c++/platform/linux/manifold2/application/dji_sdk_app_info.h.bak b/samples/sample_c++/platform/linux/manifold2/application/dji_sdk_app_info.h.bak new file mode 100644 index 0000000..5267725 --- /dev/null +++ b/samples/sample_c++/platform/linux/manifold2/application/dji_sdk_app_info.h.bak @@ -0,0 +1,55 @@ +/** + ******************************************************************** + * @file dji_sdk_app_info.h + * @brief This is the header file for defining the structure and (exported) function prototypes. + * + * @copyright (c) 2018 DJI. All rights reserved. + * + * All information contained herein is, and remains, the property of DJI. + * The intellectual and technical concepts contained herein are proprietary + * to DJI and may be covered by U.S. and foreign patents, patents in process, + * and protected by trade secret or copyright law. Dissemination of this + * information, including but not limited to data and other proprietary + * material(s) incorporated within the information, in any form, is strictly + * prohibited without the express written consent of DJI. + * + * If you receive this source code without DJI’s authorization, you may not + * further disseminate the information, and you must immediately remove the + * source code and notify DJI of its removal. DJI reserves the right to pursue + * legal actions against you for any loss(es) or damage(s) caused by your + * failure to do so. + * + ********************************************************************* + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef DJI_SDK_APP_INFO_H +#define DJI_SDK_APP_INFO_H + +/* Includes ------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported constants --------------------------------------------------------*/ +// ATTENTION: User must goto https://developer.dji.com/user/apps/#all to create your own dji sdk application, get dji sdk application +// information then fill in the application information here. +#define USER_APP_NAME "Campus security" +#define USER_APP_ID "148693" +#define USER_APP_KEY "63dcfdc7dd50ada8821724aefc4b240" +#define USER_APP_LICENSE "iup9qipeflyvYzTWP6EYghlaODONDAqY4J7NwCSRXCqve3VHZ9HoQh7Ar85GCRaSEpDZ2H1Z9w54m65/K21EzwOsJvKZBmGPtL7xlzeP5iax+3wVqL7RmDYmZrPhLrONcGeHlRpls/HP+KzNMFsFvrIIKmsTFJywxaKloO2gd3K5iv2teltk3XjZJFTNKaLB1TX7aC9qf3/NZFES6z4rYDBsTHHAU+z9dz9beLGvf0YSLSZSIXhq2LPkw1cbC+o3KrbMDPRWzSD+oj8NsLmc9NJxydjhPehabt504I8itEIdFLfU/AYDLPAGLZzTt/mJRoDaDG/HcI0lGWAKPYI7/A==" +#define USER_DEVELOPER_ACCOUNT "axccjqh@qq.com" +#define USER_BAUD_RATE "460800" + +/* Exported types ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ + + +#ifdef __cplusplus +} +#endif + +#endif // DJI_SDK_APP_INFO_H +/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/