From 34c0c109551c3a67bb89dcfbcd437a5ed812809f Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 3 Apr 2025 21:45:55 +0200 Subject: web: Add simple.css to website This uses meson to copy the simple.css file to the build dir and references the CSS file in the HTML code. --- web/layouts/baseof.html | 1 + 1 file changed, 1 insertion(+) (limited to 'web/layouts/baseof.html') diff --git a/web/layouts/baseof.html b/web/layouts/baseof.html index 983e6e1..b52d039 100644 --- a/web/layouts/baseof.html +++ b/web/layouts/baseof.html @@ -3,6 +3,7 @@ + {{ .Site.Title }} -- cgit v1.2.3-70-g09d2 From 00189e737517f4470336d819d52327a037509493 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 5 Apr 2025 15:28:04 +0200 Subject: web: Replace file copying by Meson installation This makes the build system code way less hacky and more modular. --- meson.build | 8 +++++++- pcb/meson.build | 12 ++++++------ web/content/copy.py | 9 --------- web/content/meson.build | 29 ----------------------------- web/layouts/baseof.html | 2 +- web/layouts/home.html | 4 ++-- web/meson.build | 13 ++++++------- 7 files changed, 22 insertions(+), 55 deletions(-) delete mode 100755 web/content/copy.py delete mode 100644 web/content/meson.build (limited to 'web/layouts/baseof.html') diff --git a/meson.build b/meson.build index a0e6468..73206f4 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,12 @@ project('iot-contact') -css = meson.current_source_dir() / 'simple.css' / 'simple.css' +fs = import('fs') +css = fs.copyfile( + meson.current_source_dir() / 'simple.css' / 'simple.css', + 'simple.css', + install: true, + install_dir: 'website/static', +) subdir('pcb') subdir('web') diff --git a/pcb/meson.build b/pcb/meson.build index d74f8c3..7f8b85f 100644 --- a/pcb/meson.build +++ b/pcb/meson.build @@ -7,7 +7,6 @@ schematic_files = [ 'processor.kicad_sch', ] -schematic_pdf = meson.current_build_dir() / 'schematic.pdf' schematic = custom_target('schematic', output: ['schematic.pdf'], command: [ @@ -15,14 +14,15 @@ schematic = custom_target('schematic', 'sch', 'export', 'pdf', - '--output', schematic_pdf, + '--output', meson.current_build_dir() / 'schematic.pdf', meson.current_source_dir() / 'iot-contact.kicad_sch', ], depend_files: schematic_files, build_by_default: true, + install: true, + install_dir: 'website/static', ) -bom_csv = meson.current_build_dir() / 'bill-of-materials.csv' bom = custom_target('bom', output: ['bill-of-materials.csv'], command: [ @@ -32,11 +32,11 @@ bom = custom_target('bom', 'bom', '--fields', 'Reference,Description,Value,Footprint,Manufacturer,MPN,Datasheet', - '--output', bom_csv, + '--output', meson.current_build_dir() / 'bill-of-materials.csv', meson.current_source_dir() / 'iot-contact.kicad_sch', ], depend_files: schematic_files, build_by_default: true, + install: true, + install_dir: 'website/static', ) - -pcb = meson.current_build_dir() diff --git a/web/content/copy.py b/web/content/copy.py deleted file mode 100755 index 0b06e6d..0000000 --- a/web/content/copy.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - - -import shutil -import sys - - -print(f"Copying {sys.argv[1]} to {sys.argv[2]}") -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/web/content/meson.build b/web/content/meson.build deleted file mode 100644 index 5046982..0000000 --- a/web/content/meson.build +++ /dev/null @@ -1,29 +0,0 @@ -configure_file( - input: css, - output: 'simple.css', - copy: true, -) - -schematic_web = custom_target('schematic_web', - output: ['schematic.pdf'], - command: [ - 'copy.py', - schematic_pdf, - meson.current_build_dir() / 'schematic.pdf' - ], - depends: [ - schematic, - ], -) - -bom_web = custom_target('bom_web', - output: ['bill-of-materials.csv'], - command: [ - 'copy.py', - bom_csv, - meson.current_build_dir() / 'bill-of-materials.csv' - ], - depends: [ - bom, - ], -) diff --git a/web/layouts/baseof.html b/web/layouts/baseof.html index b52d039..96d8e07 100644 --- a/web/layouts/baseof.html +++ b/web/layouts/baseof.html @@ -3,7 +3,7 @@ - + {{ .Site.Title }} diff --git a/web/layouts/home.html b/web/layouts/home.html index dcd4a66..bf534cf 100644 --- a/web/layouts/home.html +++ b/web/layouts/home.html @@ -1,7 +1,7 @@ {{- define "main" -}}

{{ .Site.Title }}

{{- end -}} diff --git a/web/meson.build b/web/meson.build index 1c64394..1526621 100644 --- a/web/meson.build +++ b/web/meson.build @@ -1,12 +1,9 @@ -subdir('content') - website = custom_target('website', - output: ['public'], + output: ['index.html'], command: [ 'hugo', '--source', meson.current_source_dir(), - '--destination', meson.current_build_dir() / 'public', - '--contentDir', meson.current_build_dir() / 'content', + '--destination', meson.current_build_dir(), ], depend_files: [ 'hugo.toml', @@ -14,8 +11,10 @@ website = custom_target('website', 'layouts/home.html', ], depends: [ - schematic_web, - bom_web, + schematic, + bom, ], build_by_default: true, + install: true, + install_dir: 'website', ) -- cgit v1.2.3-70-g09d2