Skip to content
sbYm edited this page Mar 21, 2019 · 1 revision

Content of kendryte-package.json

Initial content should be: (paste this into empty kendryte-package.json)

{
  "$schema": "vscode://schemas/CMakeLists"
}

Available fields:

Field Type Description
name String name of your project and exe/lib name, only allow to use alphanumeric, _, -
version String Your package version, like "1.2.3"
type Selection Set to excutable or library based on your project type
source String Set Array of file path globs, cmake will find source from these path
include String Set Array of folder path, add to global c/c++ include path. When your project is a library, your exported .h should be placed inside one of this folders
dependency String Map An ID to "download url" map, download url can be version number if download from package registry
definitions String(or Number) Map Key value pairs in this object will becomes #define during compile. When the key ends with :RAW, or the value is a number, the value will not wrapped with double quotes. The value can be overwrite from parent project
properties String Map Key value pairs in this object will add to CMake set_target_properties function
extraList String A file path, it's content will merge into generated cmakelists.txt file
c_flags String Set Flags pass to gcc
cpp_flags String Set Flags pass to g++
c_cpp_flags String Set Flags pass both to gcc and g++
link_flags String Set Flags pass to ld
ld_file String File path to a ld file
entry String Only used by example projects, this file will opened when example downloaded
exampleSource String Set No real effect, only a meta tag of library project

Note about dependencies

If a project's kendryte-package.json contains dependency field, IDE can download them from a registry (currentlly this function must trigger by click a menu item).

After installed library (eg. SDK) from package manager, IDE will modify your kendryte-package.json. It may cause wrong result if the JSON has any error.

All packages will store inside the "kendryte_libraries" folder, one package per folder.
The "dependencies of dependency" will be flatten, "kendryte_libraries" is not a tree structure.

If two of different package is required, only one will exists, if you want control it's version, please set it in your root kendryte-package.json file.

Set source file

You must set source filed in kendryte-package.json, or CMake will not found your source files.

Source file paths should relative to the kendryte-package.json file. NOT a absolute path like "~/project" or "C:\Project"
Path is case-sensitive. src/main.c and SRC/main.C is different.

You can use glob() to include many files, or write a full list to them.
Do not use something like "src/
" to "include all files" in a folder, It's dangerous!
At least set extension names like: "src/*.c"

definitions

This field is designed for library, let people pass options to your library. executable project can simple define anything in a .c file.

Examples:

  • "SOMETHING": "VALUE"#define SOMETHING "VALUE"
  • "SomeThing": 123#define SomeThing 123
  • "ADD(A,B):RAW": "A + B"#define ADD(A,B) A + B