Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nix build system #174

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_nix
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
result
.DS_Store
/result
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
pkgs ? import <nixpkgs> { },
}:
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
'';
}
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
#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******/