summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-12-27 13:38:16 +0100
committerxengineering <me@xengineering.eu>2024-12-27 13:56:20 +0100
commite4150dd73aca09c6af37a21cabaaafab58bf8015 (patch)
tree2489a3efe708de6cdf0bad9bb7cf9edf17251881
parent63088edf667f49fa3f0eaf2f88074e671c5e0a6b (diff)
downloadsoundbox-e4150dd73aca09c6af37a21cabaaafab58bf8015.tar
soundbox-e4150dd73aca09c6af37a21cabaaafab58bf8015.tar.zst
soundbox-e4150dd73aca09c6af37a21cabaaafab58bf8015.zip
WIP: mech: Add CMake-based build systemcmake
-rw-r--r--CMakeLists.txt2
-rw-r--r--mech/CMakeLists.txt50
2 files changed, 52 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b266d6..83a9038 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(soundbox LANGUAGES NONE)
+
+add_subdirectory(mech)
diff --git a/mech/CMakeLists.txt b/mech/CMakeLists.txt
new file mode 100644
index 0000000..de24ff2
--- /dev/null
+++ b/mech/CMakeLists.txt
@@ -0,0 +1,50 @@
+set(parts
+ assembly
+ production
+ #pcb_case/tolerance_tests
+)
+
+foreach(part ${parts})
+ set(source "${CMAKE_CURRENT_SOURCE_DIR}/${part}.scad")
+ set(intermediate "${CMAKE_CURRENT_BINARY_DIR}/${part}.stl")
+ set(sink "${CMAKE_CURRENT_BINARY_DIR}/${part}.gcode")
+
+ add_custom_command(
+ OUTPUT
+ ${intermediate}
+ COMMAND
+ openscad
+ --hardwarnings
+ --export-format binstl
+ -o ${intermediate}
+ ${source}
+ DEPENDS
+ ${source}
+ )
+
+ set(printer_config "${CMAKE_CURRENT_SOURCE_DIR}/prusa-slicer/anycubic_i3_mega_s.ini")
+ add_custom_target(
+ "mech-stl-${part}"
+ ALL
+ DEPENDS
+ ${intermediate}
+ )
+
+ add_custom_command(
+ OUTPUT
+ ${sink}
+ COMMAND
+ prusa-slicer
+ --load ${printer_config}
+ --output ${sink}
+ --export-gcode ${intermediate}
+ DEPENDS
+ ${intermediate}
+ )
+ add_custom_target(
+ "mech-gcode-${part}"
+ ALL
+ DEPENDS
+ ${sink}
+ )
+endforeach()