summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-05-07 19:52:37 +0200
committerxengineering <me@xengineering.eu>2025-05-07 19:58:14 +0200
commit46b537fb86e029978d9a1f8aa5d07ec2949ea7a1 (patch)
tree71ef55ce4a9862d57bdc401c739363fb9f99894b
parenta5aafcbd0398ae3893a83827cf66d4352eaee8f0 (diff)
downloadiot-contact-improve-buildsystem.tar
iot-contact-improve-buildsystem.tar.zst
iot-contact-improve-buildsystem.zip
WIP: Remove installation stepimprove-buildsystem
TODO: Check if the bootloader install target is still usable. Using the installation step to copy selected artifacts into on folder was anyway a hack. This commit shows that the complexity can be reduced by adding copy targets. The `build/artifacts` folder contains the selected artifacts, they are always up to date, the user does not have to call the install step separately and the target definitions do not require install-related keyword arguments.
-rw-r--r--README.md8
-rw-r--r--artifacts/meson.build22
-rw-r--r--fw/app/meson.build4
-rw-r--r--fw/btl/meson.build4
-rw-r--r--fw/sim/meson.build3
-rw-r--r--meson.build19
-rw-r--r--pcb/meson.build8
-rw-r--r--web/meson.build7
8 files changed, 35 insertions, 40 deletions
diff --git a/README.md b/README.md
index 3d81e83..a6dfe0a 100644
--- a/README.md
+++ b/README.md
@@ -25,19 +25,17 @@ The project is built with the Meson build system.
```
meson setup build
-cd build
-ninja
-meson install --destdir artifacts
+ninja -C build
```
The resulting artifacts can be listed with `tree`.
```
-tree artifacts
+tree build/artifacts
```
These artifacts are organized as static website. It can be opened with Firefox.
```
-firefox artifacts/index.html
+firefox build/artifacts/index.html
```
diff --git a/artifacts/meson.build b/artifacts/meson.build
new file mode 100644
index 0000000..ea6fc39
--- /dev/null
+++ b/artifacts/meson.build
@@ -0,0 +1,22 @@
+artifacts = [
+ index_html,
+ css,
+ schematic,
+ bom,
+ simulation,
+ bootloader,
+ application_signed,
+]
+
+foreach artifact : artifacts
+ custom_target(
+ output: [fs.name(artifact.full_path())],
+ command: [
+ cp,
+ artifact.full_path(),
+ meson.current_build_dir(),
+ ],
+ depends: artifact,
+ build_by_default: true,
+ )
+endforeach
diff --git a/fw/app/meson.build b/fw/app/meson.build
index ddd5aa6..0aefcb3 100644
--- a/fw/app/meson.build
+++ b/fw/app/meson.build
@@ -15,7 +15,6 @@ external_project.add_project(
)
application = custom_target(
- 'application',
output: ['application.bin'],
command: [
build_zephyr,
@@ -26,7 +25,6 @@ application = custom_target(
)
application_signed = custom_target(
- 'application_signed',
output: ['application.signed.bin'],
command: [
imgtool,
@@ -40,8 +38,6 @@ application_signed = custom_target(
],
build_by_default: true,
depends: application,
- install: true,
- install_dir: '/',
)
flash_application = custom_target(
diff --git a/fw/btl/meson.build b/fw/btl/meson.build
index 8ca1eb3..b86c9c9 100644
--- a/fw/btl/meson.build
+++ b/fw/btl/meson.build
@@ -14,7 +14,7 @@ external_project.add_project(
verbose: true,
)
-bootloader = custom_target('bootloader',
+bootloader = custom_target(
output: ['bootloader.bin'],
command: [
build_zephyr,
@@ -23,8 +23,6 @@ bootloader = custom_target('bootloader',
'--target-name', 'bootloader.bin',
],
build_by_default: true,
- install: true,
- install_dir: '/',
)
flash_bootloader = custom_target(
diff --git a/fw/sim/meson.build b/fw/sim/meson.build
index 7667f9b..5edcad9 100644
--- a/fw/sim/meson.build
+++ b/fw/sim/meson.build
@@ -13,7 +13,6 @@ external_project.add_project(
)
simulation = custom_target(
- 'simulation',
output: ['simulation-linux-amd64.exe'],
command: [
build_zephyr,
@@ -22,6 +21,4 @@ simulation = custom_target(
'--target-name', 'simulation-linux-amd64.exe',
],
build_by_default: true,
- install: true,
- install_dir: '/',
)
diff --git a/meson.build b/meson.build
index eb7f9ad..9b7d7c1 100644
--- a/meson.build
+++ b/meson.build
@@ -1,20 +1,13 @@
-project(
- 'iot-contact',
- default_options: {
- 'prefix': '/',
- },
-)
+project('iot-contact')
-subdir('tools')
+cp = find_program('cp', required : true)
fs = import('fs')
-css = fs.copyfile(
- meson.current_source_dir() / 'simple.css' / 'simple.css',
- 'simple.css',
- install: true,
- install_dir: '/',
-)
+css = fs.copyfile(meson.current_source_dir() / 'simple.css' / 'simple.css')
+
+subdir('tools')
subdir('fw')
subdir('pcb')
subdir('web')
+subdir('artifacts')
diff --git a/pcb/meson.build b/pcb/meson.build
index f320aae..293b2a1 100644
--- a/pcb/meson.build
+++ b/pcb/meson.build
@@ -7,7 +7,7 @@ schematic_files = [
'processor.kicad_sch',
]
-schematic = custom_target('schematic',
+schematic = custom_target(
output: ['schematic.pdf'],
command: [
'kicad-cli',
@@ -19,11 +19,9 @@ schematic = custom_target('schematic',
],
depend_files: schematic_files,
build_by_default: true,
- install: true,
- install_dir: '/',
)
-bom = custom_target('bom',
+bom = custom_target(
output: ['bill-of-materials.csv'],
command: [
'kicad-cli',
@@ -37,6 +35,4 @@ bom = custom_target('bom',
],
depend_files: schematic_files,
build_by_default: true,
- install: true,
- install_dir: '/',
)
diff --git a/web/meson.build b/web/meson.build
index f8c2024..19551a5 100644
--- a/web/meson.build
+++ b/web/meson.build
@@ -1,6 +1 @@
-website = fs.copyfile(
- meson.current_source_dir() / 'index.html',
- 'index.html',
- install: true,
- install_dir: '/',
-)
+index_html = fs.copyfile(meson.current_source_dir() / 'index.html')