summaryrefslogtreecommitdiff
path: root/mech/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'mech/CMakeLists.txt')
-rw-r--r--mech/CMakeLists.txt50
1 files changed, 50 insertions, 0 deletions
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()