Compare commits
10 Commits
ceffdfb561
...
ba238692a4
Author | SHA1 | Date | |
---|---|---|---|
|
ba238692a4 | ||
|
dc9a4d3f7c | ||
|
5f94ed3ba1 | ||
|
ee26652f4e | ||
|
596937a04a | ||
|
3605714c09 | ||
|
567fff7e75 | ||
|
291fa30351 | ||
|
7c891b99e8 | ||
|
2d29797403 |
28
README.md
Normal file
28
README.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
# example-projects
|
||||||
|
|
||||||
|
## Yocto
|
||||||
|
|
||||||
|
### Add layer in a Yocto project
|
||||||
|
|
||||||
|
```
|
||||||
|
bitbake-layers add-layer /path/to/meta-helloworld
|
||||||
|
```
|
||||||
|
|
||||||
|
Then add this to `build/conf/local.conf`:
|
||||||
|
```sh
|
||||||
|
IMAGE_INSTALL:append = " helloworld-c-make"
|
||||||
|
IMAGE_INSTALL:append = " helloworld-cpp-cmake"
|
||||||
|
IMAGE_INSTALL:append = " helloworld-rs"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Add/create recipes in a Yocto project
|
||||||
|
|
||||||
|
```
|
||||||
|
devtool add helloworld-c-make git@bitbucket.org:dol-sensors/example-projects.git --srcbranch main --src-subdir helloworld-c-make
|
||||||
|
|
||||||
|
devtool add helloworld-cpp-cmake git@bitbucket.org:dol-sensors/example-projects.git --srcbranch main --src-subdir helloworld-cpp-cmake
|
||||||
|
|
||||||
|
devtool add helloworld-rs git@bitbucket.org:dol-sensors/example-projects.git --srcbranch main --src-subdir helloworld-rs
|
||||||
|
```
|
||||||
|
|
14
helloworld-c-make/.clang-format
Normal file
14
helloworld-c-make/.clang-format
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
BasedOnStyle: WebKit
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 80
|
||||||
|
IndentCaseLabels: true
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterFunction: true
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
AlignAfterOpenBracket: BlockIndent
|
||||||
|
AlignOperands: AlignAfterOperator
|
||||||
|
BreakBeforeBinaryOperators: true
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
|
5
helloworld-c-make/.clangd
Normal file
5
helloworld-c-make/.clangd
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CompileFlags:
|
||||||
|
CompilationDatabase: build/compile_flags.txt
|
||||||
|
Remove:
|
||||||
|
- -Wempty-translation-unit
|
||||||
|
|
3
helloworld-c-make/.gitignore
vendored
Normal file
3
helloworld-c-make/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
build/
|
||||||
|
.cache/
|
||||||
|
|
32
helloworld-c-make/Makefile
Normal file
32
helloworld-c-make/Makefile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
EXECUTABLE = helloworld-c-make
|
||||||
|
|
||||||
|
CFLAGS = -std=c17 -Wall -Wextra -pedantic -pedantic-errors -O2
|
||||||
|
|
||||||
|
SOURCE_FILES = \
|
||||||
|
src/main.c
|
||||||
|
|
||||||
|
OBJECT_FILES = $(patsubst src/%.c, build/%.o, $(SOURCE_FILES))
|
||||||
|
|
||||||
|
HEADER_FILES = $(shell find src/ -name *.h)
|
||||||
|
|
||||||
|
all: build/$(EXECUTABLE) build/compile_flags.txt
|
||||||
|
|
||||||
|
build/$(EXECUTABLE): $(OBJECT_FILES)
|
||||||
|
$(CC) -o $@ $(LDFLAGS) $^
|
||||||
|
|
||||||
|
build/%.o: src/%.c $(HEADER_FILES) build-folder
|
||||||
|
$(CC) -c -o $@ $(CFLAGS) $<
|
||||||
|
|
||||||
|
build-folder:
|
||||||
|
mkdir -p build/
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build/
|
||||||
|
|
||||||
|
build/compile_flags.txt:
|
||||||
|
echo -xc $(CFLAGS) \
|
||||||
|
| tr ' ' '\n' \
|
||||||
|
> $@
|
||||||
|
|
||||||
|
|
16
helloworld-c-make/README.md
Normal file
16
helloworld-c-make/README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
# helloworld-c-make
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
./build/helloworld-c-make
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
|
||||||
|
sudo cp build/helloworld-c-make /usr/local/bin/
|
||||||
|
|
||||||
|
helloworld-c-make
|
||||||
|
```
|
||||||
|
|
3
helloworld-c-make/src/main.c
Normal file
3
helloworld-c-make/src/main.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) { printf("Hello, world!\n"); }
|
14
helloworld-cpp-cmake/.clang-format
Normal file
14
helloworld-cpp-cmake/.clang-format
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
BasedOnStyle: WebKit
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 80
|
||||||
|
IndentCaseLabels: true
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterFunction: true
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
AlignAfterOpenBracket: BlockIndent
|
||||||
|
AlignOperands: AlignAfterOperator
|
||||||
|
BreakBeforeBinaryOperators: true
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
|
3
helloworld-cpp-cmake/.gitignore
vendored
Normal file
3
helloworld-cpp-cmake/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
build/
|
||||||
|
.cache/
|
||||||
|
|
13
helloworld-cpp-cmake/CMakeLists.txt
Normal file
13
helloworld-cpp-cmake/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
project(MyProject VERSION 1.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
||||||
|
|
||||||
|
add_executable(
|
||||||
|
helloworld-cpp-cmake
|
||||||
|
src/main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS helloworld-cpp-cmake)
|
||||||
|
|
20
helloworld-cpp-cmake/README.md
Normal file
20
helloworld-cpp-cmake/README.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
# helloworld-cpp-cmake
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
|
./helloworld-cpp-cmake
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -CMAKE_BUILD_TYPE=Release
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
./helloworld-cpp-cmake
|
||||||
|
```
|
||||||
|
|
3
helloworld-cpp-cmake/src/main.cpp
Normal file
3
helloworld-cpp-cmake/src/main.cpp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() { std::cout << "Hello, world!\n"; }
|
@ -8,4 +8,8 @@ cargo run
|
|||||||
```sh
|
```sh
|
||||||
cargo build --release
|
cargo build --release
|
||||||
./target/release/helloworld-rs
|
./target/release/helloworld-rs
|
||||||
``´
|
|
||||||
|
cargo install --path .
|
||||||
|
|
||||||
|
cargo install --path . --root /usr/local
|
||||||
|
```
|
||||||
|
17
meta-helloworld/COPYING.MIT
Normal file
17
meta-helloworld/COPYING.MIT
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
41
meta-helloworld/README
Normal file
41
meta-helloworld/README
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
This README file contains information on the contents of the meta-helloworld layer.
|
||||||
|
|
||||||
|
Please see the corresponding sections below for details.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
============
|
||||||
|
|
||||||
|
URI: <first dependency>
|
||||||
|
branch: <branch name>
|
||||||
|
|
||||||
|
URI: <second dependency>
|
||||||
|
branch: <branch name>
|
||||||
|
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
|
||||||
|
Patches
|
||||||
|
=======
|
||||||
|
|
||||||
|
Please submit any patches against the meta-helloworld layer to the xxxx mailing list (xxxx@zzzz.org)
|
||||||
|
and cc: the maintainer:
|
||||||
|
|
||||||
|
Maintainer: XXX YYYYYY <xxx.yyyyyy@zzzzz.com>
|
||||||
|
|
||||||
|
Table of Contents
|
||||||
|
=================
|
||||||
|
|
||||||
|
I. Adding the meta-helloworld layer to your build
|
||||||
|
II. Misc
|
||||||
|
|
||||||
|
|
||||||
|
I. Adding the meta-helloworld layer to your build
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
Run 'bitbake-layers add-layer meta-helloworld'
|
||||||
|
|
||||||
|
II. Misc
|
||||||
|
========
|
||||||
|
|
||||||
|
--- replace with specific information about the meta-helloworld layer ---
|
13
meta-helloworld/conf/layer.conf
Normal file
13
meta-helloworld/conf/layer.conf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# We have a conf and classes directory, add to BBPATH
|
||||||
|
BBPATH .= ":${LAYERDIR}"
|
||||||
|
|
||||||
|
# We have recipes-* directories, add to BBFILES
|
||||||
|
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
|
||||||
|
${LAYERDIR}/recipes-*/*/*.bbappend"
|
||||||
|
|
||||||
|
BBFILE_COLLECTIONS += "helloworld"
|
||||||
|
BBFILE_PATTERN_helloworld = "^${LAYERDIR}/"
|
||||||
|
BBFILE_PRIORITY_helloworld = "6"
|
||||||
|
|
||||||
|
LAYERDEPENDS_helloworld = "core"
|
||||||
|
LAYERSERIES_COMPAT_helloworld = "kirkstone"
|
13
meta-helloworld/recipes-example/example/example_0.1.bb
Normal file
13
meta-helloworld/recipes-example/example/example_0.1.bb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
SUMMARY = "bitbake-layers recipe"
|
||||||
|
DESCRIPTION = "Recipe created by bitbake-layers"
|
||||||
|
LICENSE = "MIT"
|
||||||
|
|
||||||
|
python do_display_banner() {
|
||||||
|
bb.plain("***********************************************");
|
||||||
|
bb.plain("* *");
|
||||||
|
bb.plain("* Example recipe created by bitbake-layers *");
|
||||||
|
bb.plain("* *");
|
||||||
|
bb.plain("***********************************************");
|
||||||
|
}
|
||||||
|
|
||||||
|
addtask display_banner before do_build
|
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
|
||||||
|
# this is not accurate with respect to the licensing of the software being built (it
|
||||||
|
# will not be in most cases) you must specify the correct value before using this
|
||||||
|
# recipe for anything other than initial testing/development!
|
||||||
|
LICENSE = "CLOSED"
|
||||||
|
LIC_FILES_CHKSUM = ""
|
||||||
|
|
||||||
|
SRC_URI = "git://git@bitbucket.org/dol-sensors/example-projects.git;protocol=ssh;branch=main"
|
||||||
|
|
||||||
|
PV = "1.0+git${SRCPV}"
|
||||||
|
SRCREV = "5f94ed3ba1bff1c6631d0234c7dbe65c27c4791e"
|
||||||
|
|
||||||
|
S = "${WORKDIR}/git/${BPN}"
|
||||||
|
|
||||||
|
do_compile () {
|
||||||
|
oe_runmake
|
||||||
|
}
|
||||||
|
|
||||||
|
do_install () {
|
||||||
|
install -d ${D}${bindir}
|
||||||
|
install -m 0755 ${S}/build/helloworld-c-make ${D}${bindir}
|
||||||
|
}
|
||||||
|
|
||||||
|
FILES:${PN} += "${bindir}"
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
# Recipe created by recipetool
|
||||||
|
# This is the basis of a recipe and may need further editing in order to be fully functional.
|
||||||
|
# (Feel free to remove these comments when editing.)
|
||||||
|
|
||||||
|
# Unable to find any files that looked like license statements. Check the accompanying
|
||||||
|
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
|
||||||
|
#
|
||||||
|
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
|
||||||
|
# this is not accurate with respect to the licensing of the software being built (it
|
||||||
|
# will not be in most cases) you must specify the correct value before using this
|
||||||
|
# recipe for anything other than initial testing/development!
|
||||||
|
LICENSE = "CLOSED"
|
||||||
|
LIC_FILES_CHKSUM = ""
|
||||||
|
|
||||||
|
SRC_URI = "git://git@bitbucket.org/dol-sensors/example-projects.git;protocol=ssh;branch=main"
|
||||||
|
|
||||||
|
# Modify these as desired
|
||||||
|
PV = "1.0+git${SRCPV}"
|
||||||
|
SRCREV = "5f94ed3ba1bff1c6631d0234c7dbe65c27c4791e"
|
||||||
|
|
||||||
|
S = "${WORKDIR}/git/${BPN}"
|
||||||
|
|
||||||
|
inherit cmake
|
||||||
|
|
||||||
|
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
|
||||||
|
EXTRA_OECMAKE = ""
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
# Recipe created by recipetool
|
||||||
|
# This is the basis of a recipe and may need further editing in order to be fully functional.
|
||||||
|
# (Feel free to remove these comments when editing.)
|
||||||
|
|
||||||
|
# Unable to find any files that looked like license statements. Check the accompanying
|
||||||
|
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
|
||||||
|
#
|
||||||
|
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
|
||||||
|
# this is not accurate with respect to the licensing of the software being built (it
|
||||||
|
# will not be in most cases) you must specify the correct value before using this
|
||||||
|
# recipe for anything other than initial testing/development!
|
||||||
|
LICENSE = "CLOSED"
|
||||||
|
LIC_FILES_CHKSUM = ""
|
||||||
|
|
||||||
|
SRC_URI = "git://git@bitbucket.org/dol-sensors/example-projects.git;protocol=ssh;branch=main"
|
||||||
|
|
||||||
|
# Modify these as desired
|
||||||
|
PV = "1.0+git${SRCPV}"
|
||||||
|
SRCREV = "5f94ed3ba1bff1c6631d0234c7dbe65c27c4791e"
|
||||||
|
|
||||||
|
S = "${WORKDIR}/git/${BPN}"
|
||||||
|
|
||||||
|
inherit cargo
|
||||||
|
|
Loading…
Reference in New Issue
Block a user