blob: 2d2b9795dc00bc8735e33a0de09c4085e66495f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
function(openscad source_file)
if (NOT source_file)
message(FATAL_ERROR "Missing source_file argument in openscad function.")
endif()
get_filename_component(name "${source_file}" NAME_WE)
set(sink_file "${CMAKE_CURRENT_BINARY_DIR}/${name}.stl")
add_custom_command(
OUTPUT
${sink_file}
COMMAND
openscad
--hardwarnings
--export-format binstl
-o ${sink_file}
${source_file}
DEPENDS
${source_file}
)
add_custom_target(
"stl-${name}"
ALL
DEPENDS
${sink_file}
)
endfunction()
function(prusa_slicer source_file printer_config)
if (NOT source_file)
message(FATAL_ERROR "Missing source_file argument in prusa-slicer function.")
endif()
if (NOT printer_config)
message(FATAL_ERROR "Missing printer_config argument in prusa-slicer function.")
endif()
get_filename_component(name "${source_file}" NAME_WE)
set(stl_file "${CMAKE_CURRENT_BINARY_DIR}/${name}.stl")
set(sink_file "${CMAKE_CURRENT_BINARY_DIR}/${name}.gcode")
add_custom_command(
OUTPUT
${sink_file}
COMMAND
prusa-slicer
--load ${printer_config}
--output ${sink_file}
--export-gcode ${stl_file}
DEPENDS
${stl_file}
)
add_custom_target(
"gcode-${name}"
ALL
DEPENDS
${sink_file}
)
endfunction()
|