forked from prusa3d/Prusa-Firmware-Buddy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProjectOptions.cmake
771 lines (686 loc) · 22.7 KB
/
ProjectOptions.cmake
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
#
# Command Line Options
#
# You should specify those options when invoking CMake. Example:
# ~~~
# cmake .. <other options> -DPRINTER=MINI
# ~~~
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(PRINTER_VALID_OPTS "MINI" "MK4" "MK3.5" "XL" "iX" "XL_DEV_KIT")
set(BOARD_VALID_OPTS "BUDDY" "XBUDDY" "XLBUDDY" "DWARF" "MODULARBED" "XL_DEV_KIT_XLB")
set(MCU_VALID_OPTS "<default>" "STM32F407VG" "STM32F429VI" "STM32F427ZI" "STM32G070RBT6")
set(BOOTLOADER_VALID_OPTS "NO" "EMPTY" "YES")
set(TRANSLATIONS_ENABLED_VALID_OPTS "<default>" "NO" "YES")
set(TOUCH_ENABLED_VALID_OPTS "<default>" "NO" "YES")
set(PRINTER
"MINI"
CACHE
STRING
"Select the printer for which you want to compile the project (valid values are ${PRINTER_VALID_OPTS})."
)
set(BOOTLOADER
"NO"
CACHE STRING "Selects the bootloader mode (valid values are ${BOOTLOADER_VALID_OPTS})."
)
set(BOARD
"<invalid>"
CACHE
STRING
"Select the board for which you want to compile the project (valid values are ${BOARD_VALID_OPTS})."
)
set(BOARD_VERSION
"<invalid>"
CACHE STRING "Specify the version of the board to comiple the project for (e.g. 1.2.3)"
)
set(MCU
"<default>"
CACHE
STRING
"Select the MCU for which you want to compile the project (valid values are ${MCU_VALID_OPTS})."
)
set(GENERATE_BBF
"NO"
CACHE BOOL "Whether a .bbf version should be generated."
)
set(GENERATE_DFU
"NO"
CACHE BOOL "Whether a .dfu file should be generated. Implies GENERATE_BBF."
)
set(SIGNING_KEY
""
CACHE FILEPATH "Path to a PEM EC private key to be used to sign the firmware."
)
set(PROJECT_VERSION_SUFFIX
"<auto>"
CACHE
STRING
"Full version suffix to be shown on the info screen in settings (e.g. full_version=4.0.3-BETA+1035.PR111.B4, suffix=-BETA+1035.PR111.B4). Defaults to '+<commit sha>.<dirty?>.<debug?>' if set to '<auto>'."
)
set(PROJECT_VERSION_SUFFIX_SHORT
"<auto>"
CACHE
STRING
"Short version suffix to be shown on splash screen. Defaults to '+<BUILD_NUMBER>' if set to '<auto>'."
)
set(BUILD_NUMBER
""
CACHE STRING "Build number of the firmware. Resolved automatically if not specified."
)
set(CUSTOM_COMPILE_OPTIONS
""
CACHE STRING "Allows adding custom C/C++ flags"
)
if(${BOARD} STREQUAL "XL_DEV_KIT_XLB")
set(WUI
"NO"
CACHE BOOL "Enable Web User Interface"
)
else()
set(WUI
"YES"
CACHE BOOL "Enable Web User Interface"
)
endif()
define_boolean_option("BUDDY_ENABLE_WUI" ${WUI})
set(RESOURCES
"<auto>"
CACHE
STRING
"Enable resources (managed files on external flash). Set to '<auto>' to enable according to 'PRINTERS_WITH_RESOURCES'."
)
set(TRANSLATIONS_ENABLED
"<default>"
CACHE STRING "Enable languages (NO == English only)"
)
set(TRANSLATIONS_LIST
"<default>"
CACHE STRING "List of languages to enable"
)
set(TOUCH_ENABLED
"<default>"
CACHE STRING "Enable touch (valid values are ${TOUCH_ENABLED_VALID_OPTS})."
)
set(DEVELOPMENT_ITEMS_ENABLED
"YES"
CACHE BOOL "Show development (green) items in menus and enable other devel features"
)
define_boolean_option(DEVELOPMENT_ITEMS ${DEVELOPMENT_ITEMS_ENABLED})
set(IS_KNOBLET
"FALSE"
CACHE BOOL "Knoblet version of FW"
)
define_boolean_option(IS_KNOBLET ${IS_KNOBLET})
set(ENABLE_BURST
"NO"
CACHE BOOL "Enable BURST stepping on supported printers."
)
# Validate options
foreach(OPTION "PRINTER" "BOARD" "MCU" "BOOTLOADER" "TRANSLATIONS_ENABLED" "TOUCH_ENABLED")
if(NOT ${OPTION} IN_LIST ${OPTION}_VALID_OPTS)
message(FATAL_ERROR "Invalid ${OPTION} ${${OPTION}}: Valid values are ${${OPTION}_VALID_OPTS}")
endif()
endforeach()
# define simple options
define_boolean_option(BOOTLOADER ${BOOTLOADER})
# Set BOARD_IS_MASTER_BOARD - means main board of entire printer, non-main board are puppies
if(BOARD MATCHES ".*BUDDY" OR BOARD MATCHES "XL_DEV_KIT_XLB")
set(BOARD_IS_MASTER_BOARD true)
else()
set(BOARD_IS_MASTER_BOARD false)
endif()
# set MCU to its default if not specified
if(${MCU} STREQUAL "<default>")
if(${BOARD} STREQUAL "BUDDY")
if(${PRINTER} MATCHES "^(XL)$")
set(MCU "STM32F429VI")
else()
set(MCU "STM32F407VG")
endif()
elseif(${BOARD} STREQUAL "XBUDDY")
set(MCU "STM32F427ZI")
elseif(${BOARD} STREQUAL "XLBUDDY")
set(MCU "STM32F427ZI")
elseif(${BOARD} STREQUAL "XL_DEV_KIT_XLB")
set(MCU "STM32F427ZI") # todo
elseif(${BOARD} STREQUAL "DWARF")
set(MCU "STM32G070RBT6")
elseif(${BOARD} STREQUAL "MODULARBED")
set(MCU "STM32G070RBT6")
else()
message(FATAL_ERROR "Don't know what MCU to set as default for this board/version")
endif()
endif()
# define MCU option
list(REMOVE_ITEM MCU_VALID_OPTS "<default>")
define_enum_option(NAME MCU VALUE ${MCU} ALL_VALUES ${MCU_VALID_OPTS})
# Set connect status/availability
if(${BOARD} STREQUAL "DWARF"
OR ${BOARD} STREQUAL "MODULARBED"
OR ${BOARD} STREQUAL "XL_DEV_KIT_XLB"
)
set(CONNECT
"NO"
CACHE BOOL "Enable Connect client"
)
else()
set(CONNECT
"YES"
CACHE BOOL "Enable Connect client"
)
endif()
define_boolean_option(BUDDY_ENABLE_CONNECT ${CONNECT})
# parse board version into its components
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" BOARD_VERSION_MATCH ${BOARD_VERSION})
set(BOARD_VERSION_MAJOR ${CMAKE_MATCH_1})
set(BOARD_VERSION_MINOR ${CMAKE_MATCH_2})
set(BOARD_VERSION_PATCH ${CMAKE_MATCH_3})
# Resolve BUILD_NUMBER and PROJECT_VERSION_* variables
resolve_version_variables()
# Inform user about the resolved settings
message(STATUS "Project version: ${PROJECT_VERSION}")
message(STATUS "Project version with full suffix: ${PROJECT_VERSION_FULL}")
message(
STATUS "Project version with short suffix: ${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX_SHORT}"
)
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
message(STATUS "Bootloader: ${BOOTLOADER}")
message(STATUS "Printer: ${PRINTER}")
message(STATUS "Board: ${BOARD}")
message(
STATUS "Board Version: ${BOARD_VERSION_MAJOR}.${BOARD_VERSION_MINOR}.${BOARD_VERSION_PATCH}"
)
message(STATUS "MCU: ${MCU}")
message(STATUS "Custom Compile Options (C/C++ flags): ${CUSTOM_COMPILE_OPTIONS}")
message(STATUS "Web User Interface: ${WUI}")
message(STATUS "Connect client: ${CONNECT}")
message(STATUS "Resources: ${RESOURCES}")
# Set printer features
set(PRINTERS_WITH_FILAMENT_SENSOR_BINARY "MINI" "MK3.5")
set(PRINTERS_WITH_FILAMENT_SENSOR_ADC "MK4" "XL" "iX" "XL_DEV_KIT")
set(PRINTERS_WITH_INIT_TRINAMIC_FROM_MARLIN_ONLY "MINI" "MK4" "MK3.5" "XL" "iX")
set(PRINTERS_WITH_ADVANCED_PAUSE "MINI" "MK4" "MK3.5" "iX" "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_CRASH_DETECTION "MINI" "MK4" "MK3.5" "XL") # this does require selftest to work
set(PRINTERS_WITH_POWER_PANIC "MK4" "MK3.5" "XL") # this does require selftest and crash detection
# to work
set(PRINTERS_WITH_PRECISE_HOMING "MK4" "MK3.5")
set(PRINTERS_WITH_PRECISE_HOMING_COREXY "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_PHASE_STEPPING "XL")
set(PRINTERS_WITH_BURST_STEPPING "XL")
# MK3.5 disabled until we figure out how to handle cable switching
set(PRINTERS_WITH_INPUT_SHAPER_CALIBRATION "MK4" "XL" "XL_DEV_KIT")
# private MINI would not fit to 1MB so it has disabled selftest set(PRINTERS_WITH_SELFTEST "MINI"
# "MK4")
set(PRINTERS_WITH_SELFTEST "MK4" "MK3.5" "XL" "iX" "MINI")
set(PRINTERS_WITH_SELFTEST_SNAKE "XL" "MK4" "MINI" "MK3.5")
set(PRINTERS_WITH_HUMAN_INTERACTIONS "MINI" "MK4" "MK3.5" "XL")
set(PRINTERS_WITH_LOADCELL "MK4" "iX" "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_HEATBREAK_TEMP "MK4" "iX" "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_RESOURCES "MINI" "MK4" "MK3.5" "XL" "iX")
set(PRINTERS_WITH_BOWDEN_EXTRUDER "MINI")
set(PRINTERS_WITH_PUPPIES_BOOTLOADER "XL" "iX" "XL_DEV_KIT")
set(PRINTERS_WITH_DWARF "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_MODULARBED "iX" "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_TOOLCHANGER "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_SIDE_FSENSOR "iX" "XL")
set(PRINTERS_WITH_ESP_FLASH_TASK "MK4" "MK3.5" "XL" "MINI") # iX does not need ESP flashing
set(PRINTERS_WITH_EMBEDDED_ESP32 "XL")
set(PRINTERS_WITH_SIDE_LEDS "XL" "iX")
set(PRINTERS_WITH_TRANSLATIONS "MK4" "MK3.5" "XL" "MINI")
set(PRINTERS_WITH_EXTFLASH_TRANSLATIONS "MINI")
set(PRINTERS_WITH_LOVE_BOARD "MK4" "iX")
set(PRINTERS_WITH_XLCD "MK4" "MK3.5" "iX" "XL")
set(PRINTERS_WITH_MMU2 "MK4" "MK3.5")
set(PRINTERS_WITH_CONFIG_STORE_WITHOUT_BACKEND "XL_DEV_KIT")
# Set GUI settings
set(PRINTERS_WITH_GUI "MINI" "MK4" "MK3.5" "XL" "iX")
set(PRINTERS_WITH_GUI_W480H320 "MK4" "MK3.5" "XL" "iX")
set(PRINTERS_WITH_GUI_W240H320 "MINI")
set(PRINTERS_WITH_LEDS "MK4" "MK3.5" "XL" "iX")
# disable serial printing for MINI to save flash
set(PRINTERS_WITH_SERIAL_PRINTING "MK4" "MK3.5" "XL" "iX" "MINI")
set(PRINTERS_WITH_LOCAL_ACCELEROMETER "MK3.5" "MK4" "iX")
set(PRINTERS_WITH_REMOTE_ACCELEROMETER "XL" "XL_DEV_KIT")
set(PRINTERS_WITH_COLDPULL "MK4" "XL")
set(PRINTERS_WITH_BED_LEVEL_CORRECTION "MK3.5" "MINI")
set(PRINTERS_WITH_SHEET_SUPPORT "MINI" "MK3.5")
set(PRINTERS_WITH_NFC "MK4")
# Set printer board
set(BOARDS_WITH_ADVANCED_POWER "XBUDDY" "XLBUDDY" "DWARF")
set(BOARDS_WITH_ILI9488 "XBUDDY" "XLBUDDY")
set(BOARDS_WITH_ST7789V "BUDDY")
set(BOARDS_WITH_ACCELEROMETER "XBUDDY" "DWARF")
if(${TRANSLATIONS_ENABLED} STREQUAL "<default>")
if(${PRINTER} IN_LIST PRINTERS_WITH_TRANSLATIONS)
set(TRANSLATIONS_ENABLED YES)
if(${PRINTER} IN_LIST PRINTERS_WITH_EXTFLASH_TRANSLATIONS)
set(TRANSLATIONS_IN_EXTFLASH YES)
else()
set(TRANSLATIONS_IN_EXTFLASH NO)
endif()
define_boolean_option(TRANSLATIONS_IN_EXTFLASH ${TRANSLATIONS_IN_EXTFLASH})
else()
set(TRANSLATIONS_ENABLED NO)
endif()
endif()
define_boolean_option(HAS_TRANSLATIONS ${TRANSLATIONS_ENABLED})
# Set language options
set(LANGUAGES_AVAILABLE
CS
DE
ES
FR
IT
JP
PL
)
if("${TRANSLATIONS_LIST}" STREQUAL "<default>")
if(PRINTER STREQUAL "MINI"
OR (CMAKE_BUILD_TYPE STREQUAL "Debug" AND (NOT ${TRANSLATIONS_IN_EXTFLASH}))
)
# Do not include translations to some build - Mini has explicitly listed translations - Debug
# builds has translations disabled (due to FLASH space reasons), unless translations are in
# extflash than its fine
else()
# include all translations
foreach(LANG ${LANGUAGES_AVAILABLE})
define_boolean_option("ENABLE_TRANSLATION_${LANG}" yes)
endforeach()
endif()
else()
set(TRANSLATIONS_LIST_FOREACH ${TRANSLATIONS_LIST})
message(STATUS "Translation list: ${TRANSLATIONS_LIST}")
foreach(LANG ${TRANSLATIONS_LIST_FOREACH})
string(TOUPPER ${LANG} LANG)
define_boolean_option(ENABLE_TRANSLATION_${LANG} yes)
endforeach()
endif()
foreach(LANG ${LANGUAGES_AVAILABLE})
if(NOT DEFINED "ENABLE_TRANSLATION_${LANG}")
define_boolean_option("ENABLE_TRANSLATION_${LANG}" no)
endif()
endforeach()
if(${TOUCH_ENABLED} STREQUAL "<default>")
if(${PRINTER} MATCHES "^(iX)$")
set(TOUCH_ENABLED NO)
elseif((${BOARD} STREQUAL "XBUDDY") OR ${BOARD} STREQUAL "XLBUDDY")
set(TOUCH_ENABLED YES)
else()
set(TOUCH_ENABLED NO)
endif()
endif()
define_boolean_option(HAS_TOUCH ${TOUCH_ENABLED})
if(${PRINTER} IN_LIST PRINTERS_WITH_FILAMENT_SENSOR_BINARY AND BOARD_IS_MASTER_BOARD)
set(FILAMENT_SENSOR BINARY)
elseif(${PRINTER} IN_LIST PRINTERS_WITH_FILAMENT_SENSOR_ADC AND BOARD_IS_MASTER_BOARD)
set(FILAMENT_SENSOR ADC)
else()
set(FILAMENT_SENSOR NO)
endif()
define_enum_option(NAME FILAMENT_SENSOR VALUE "${FILAMENT_SENSOR}" ALL_VALUES "BINARY;ADC;NO")
if(${RESOURCES} STREQUAL "<auto>")
if(${PRINTER} IN_LIST PRINTERS_WITH_RESOURCES AND BOARD_IS_MASTER_BOARD)
set(RESOURCES "YES")
else()
set(RESOURCES "NO")
endif()
endif()
define_boolean_option(RESOURCES ${RESOURCES})
# in order to generate DFU file for bootloader, we need a BFU
if(GENERATE_DFU
AND BOOTLOADER
OR RESOURCES
)
set(GENERATE_BBF "YES")
elseif(NOT BOARD_IS_MASTER_BOARD)
set(GENERATE_BBF "NO")
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_GUI AND BOARD_IS_MASTER_BOARD)
set(GUI YES)
if(${PRINTER} IN_LIST PRINTERS_WITH_GUI_W480H320 AND ${PRINTER} IN_LIST
PRINTERS_WITH_GUI_W240H320
)
message(FATAL_ERROR "Printer can only have one GUI resolution")
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_GUI_W480H320)
set(RESOLUTION W480H320)
elseif(${PRINTER} IN_LIST PRINTERS_WITH_GUI_W240H320)
set(RESOLUTION W240H320)
elseif()
message(FATAL_ERROR "Printer with GUI must have resolution set")
endif()
message(STATUS "RESOLUTION: ${RESOLUTION}")
else()
set(GUI NO)
endif()
message(STATUS "Graphical User Interface: ${GUI}")
define_boolean_option(HAS_GUI ${GUI})
if(${PRINTER} IN_LIST PRINTERS_WITH_INIT_TRINAMIC_FROM_MARLIN_ONLY)
set(INIT_TRINAMIC_FROM_MARLIN_ONLY YES)
else()
set(INIT_TRINAMIC_FROM_MARLIN_ONLY NO)
endif()
define_boolean_option(INIT_TRINAMIC_FROM_MARLIN_ONLY ${INIT_TRINAMIC_FROM_MARLIN_ONLY})
if(${PRINTER} IN_LIST PRINTERS_WITH_SELFTEST)
set(HAS_SELFTEST YES)
else()
set(HAS_SELFTEST NO)
endif()
define_boolean_option(HAS_SELFTEST ${HAS_SELFTEST})
if(${PRINTER} IN_LIST PRINTERS_WITH_CONFIG_STORE_WITHOUT_BACKEND)
set(HAS_CONFIG_STORE_WO_BACKEND YES)
else()
set(HAS_CONFIG_STORE_WO_BACKEND NO)
endif()
define_boolean_option(HAS_CONFIG_STORE_WO_BACKEND ${HAS_CONFIG_STORE_WO_BACKEND})
if(${PRINTER} IN_LIST PRINTERS_WITH_HUMAN_INTERACTIONS)
define_boolean_option(HAS_HUMAN_INTERACTIONS YES)
else()
define_boolean_option(HAS_HUMAN_INTERACTIONS NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_PHASE_STEPPING AND BOARD_IS_MASTER_BOARD)
set(HAS_PHASE_STEPPING YES)
else()
set(HAS_PHASE_STEPPING NO)
endif()
define_boolean_option(HAS_PHASE_STEPPING ${HAS_PHASE_STEPPING})
if(ENABLE_BURST
AND ${PRINTER} IN_LIST PRINTERS_WITH_BURST_STEPPING
AND BOARD_IS_MASTER_BOARD
)
set(HAS_BURST_STEPPING YES)
else()
set(HAS_BURST_STEPPING NO)
endif()
define_boolean_option(HAS_BURST_STEPPING ${HAS_BURST_STEPPING})
if(${PRINTER} IN_LIST PRINTERS_WITH_INPUT_SHAPER_CALIBRATION AND BOARD_IS_MASTER_BOARD)
set(HAS_INPUT_SHAPER_CALIBRATION YES)
else()
set(HAS_INPUT_SHAPER_CALIBRATION NO)
endif()
define_boolean_option(HAS_INPUT_SHAPER_CALIBRATION ${HAS_INPUT_SHAPER_CALIBRATION})
if(${PRINTER} IN_LIST PRINTERS_WITH_LOADCELL AND BOARD_IS_MASTER_BOARD)
set(HAS_LOADCELL YES)
set(HAS_SHEET_PROFILES NO)
else()
set(HAS_LOADCELL NO)
set(HAS_SHEET_PROFILES YES)
endif()
define_boolean_option(HAS_LOADCELL ${HAS_LOADCELL})
define_boolean_option(HAS_SHEET_PROFILES ${HAS_SHEET_PROFILES})
if(${PRINTER} IN_LIST PRINTERS_WITH_HEATBREAK_TEMP AND BOARD_IS_MASTER_BOARD)
set(HAS_HEATBREAK_TEMP YES)
else()
set(HAS_HEATBREAK_TEMP NO)
endif()
define_boolean_option(HAS_HEATBREAK_TEMP ${HAS_HEATBREAK_TEMP})
if((${BOARD} STREQUAL "DWARF") OR (${BOARD} STREQUAL "XBUDDY" AND NOT PRINTER STREQUAL "MK3.5"))
set(HAS_LOADCELL_HX717 YES)
else()
set(HAS_LOADCELL_HX717 NO)
endif()
define_boolean_option(HAS_LOADCELL_HX717 ${HAS_LOADCELL_HX717})
if(${BOARD} IN_LIST BOARDS_WITH_ADVANCED_POWER)
set(HAS_ADVANCED_POWER YES)
else()
set(HAS_ADVANCED_POWER NO)
endif()
define_boolean_option(HAS_ADVANCED_POWER ${HAS_ADVANCED_POWER})
if(${BOARD} IN_LIST BOARDS_WITH_ACCELEROMETER)
set(HAS_ACCELEROMETER YES)
else()
set(HAS_ACCELEROMETER NO)
endif()
define_boolean_option(HAS_ACCELEROMETER ${HAS_ACCELEROMETER})
if(${PRINTER} IN_LIST PRINTERS_WITH_LOVE_BOARD)
set(HAS_LOVE_BOARD YES)
else()
set(HAS_LOVE_BOARD NO)
endif()
define_boolean_option(HAS_LOVE_BOARD ${HAS_LOVE_BOARD})
if(${PRINTER} IN_LIST PRINTERS_WITH_XLCD)
set(HAS_XLCD YES)
else()
set(HAS_XLCD NO)
endif()
define_boolean_option(HAS_XLCD ${HAS_XLCD})
if(${PRINTER} IN_LIST PRINTERS_WITH_MMU2)
set(HAS_MMU2 YES)
else()
set(HAS_MMU2 NO)
endif()
define_boolean_option(HAS_MMU2 ${HAS_MMU2})
message(STATUS "MMU2: ${HAS_MMU2}")
if(${TOUCH_ENABLED})
set(HAS_XLCD_TOUCH_DRIVER YES)
else()
set(HAS_XLCD_TOUCH_DRIVER NO)
endif()
message(STATUS "XLCD_TOUCH_DRIVER: ${HAS_XLCD_TOUCH_DRIVER}")
if(${PRINTER} IN_LIST PRINTERS_WITH_ADVANCED_PAUSE)
set(HAS_PAUSE YES)
else()
set(HAS_PAUSE NO)
endif()
message(STATUS "ADVANCED PAUSE: ${HAS_PAUSE}")
if(${PRINTER} IN_LIST PRINTERS_WITH_BOWDEN_EXTRUDER)
set(HAS_BOWDEN YES)
else()
set(HAS_BOWDEN NO)
endif()
define_boolean_option(HAS_BOWDEN ${HAS_BOWDEN})
if(${PRINTER} IN_LIST PRINTERS_WITH_SERIAL_PRINTING)
set(HAS_SERIAL_PRINT YES)
else()
set(HAS_SERIAL_PRINT NO)
endif()
define_boolean_option(HAS_SERIAL_PRINT ${HAS_SERIAL_PRINT})
if(${PRINTER} IN_LIST PRINTERS_WITH_DWARF
OR ${PRINTER} IN_LIST PRINTERS_WITH_MODULARBED
AND BOARD_IS_MASTER_BOARD
)
set(HAS_PUPPIES YES)
else()
set(HAS_PUPPIES NO)
endif()
define_boolean_option(HAS_PUPPIES ${HAS_PUPPIES})
if(${PRINTER} IN_LIST PRINTERS_WITH_DWARF AND BOARD_IS_MASTER_BOARD)
set(HAS_DWARF YES)
else()
set(HAS_DWARF NO)
endif()
define_boolean_option(HAS_DWARF ${HAS_DWARF})
if(${PRINTER} IN_LIST PRINTERS_WITH_MODULARBED AND BOARD_IS_MASTER_BOARD)
set(HAS_MODULARBED YES)
else()
set(HAS_MODULARBED NO)
endif()
define_boolean_option(HAS_MODULARBED ${HAS_MODULARBED})
if(${PRINTER} IN_LIST PRINTERS_WITH_LEDS)
set(HAS_LEDS YES)
else()
set(HAS_LEDS NO)
endif()
define_boolean_option(HAS_LEDS ${HAS_LEDS})
if(HAS_PUPPIES)
set(ENABLE_PUPPY_BOOTLOAD
"YES"
CACHE
BOOL
"Pack puppy firmwares into resources and bootload them on startup of the printer with puppies"
)
endif()
if(ENABLE_PUPPY_BOOTLOAD)
set(DWARF_BINARY_PATH
""
CACHE PATH
"Where to get the Dwarf's binary from. If set, the project won't try to build anything."
)
if(NOT DWARF_BINARY_PATH)
set(DWARF_SOURCE_DIR
"${CMAKE_SOURCE_DIR}"
CACHE PATH "From which source directory to build the dwarf firmware."
)
set(DWARF_BINARY_DIR
"${CMAKE_BINARY_DIR}/dwarf-build"
CACHE PATH "Where to have build directory for the dwarf firmware."
)
endif()
set(MODULARBED_BINARY_PATH
""
CACHE
PATH
"Where to get the Modularbed's binary from. If set, the project won't try to build anything."
)
if(NOT MODULARBED_BINARY_PATH)
set(MODULARBED_SOURCE_DIR
"${CMAKE_SOURCE_DIR}"
CACHE PATH "From which source directory to build the modular bed firmware."
)
set(MODULARBED_BINARY_DIR
"${CMAKE_BINARY_DIR}/modularbed-build"
CACHE PATH "Where to have build directory for the modular bed firmware."
)
endif()
# A BBF is required to update puppies
set(GENERATE_BBF "YES")
endif()
if(BOARD MATCHES "XL_DEV_KIT_XLB")
set(PUPPY_SKIP_FLASH_FW
"ON"
CACHE BOOL "Disable flashing puppies to debug puppy with bootloader."
)
else()
set(PUPPY_SKIP_FLASH_FW
"OFF"
CACHE BOOL "Disable flashing puppies to debug puppy with bootloader."
)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_PUPPIES_BOOTLOADER
AND BOARD_IS_MASTER_BOARD
AND (RESOURCES OR PUPPY_SKIP_FLASH_FW)
AND ENABLE_PUPPY_BOOTLOAD
)
set(HAS_PUPPIES_BOOTLOADER YES)
else()
set(HAS_PUPPIES_BOOTLOADER NO)
endif()
define_boolean_option(HAS_PUPPIES_BOOTLOADER ${HAS_PUPPIES_BOOTLOADER})
if(${HAS_PUPPIES_BOOTLOADER} AND NOT ${PUPPY_SKIP_FLASH_FW})
set(PUPPY_FLASH_FW YES)
else()
set(PUPPY_FLASH_FW NO)
endif()
define_boolean_option(PUPPY_FLASH_FW ${PUPPY_FLASH_FW})
if(${PRINTER} IN_LIST PRINTERS_WITH_TOOLCHANGER)
set(HAS_TOOLCHANGER YES)
else()
set(HAS_TOOLCHANGER NO)
endif()
define_boolean_option(HAS_TOOLCHANGER ${HAS_TOOLCHANGER})
if(${PRINTER} IN_LIST PRINTERS_WITH_SELFTEST_SNAKE)
set(HAS_SELFTEST_SNAKE YES)
else()
set(HAS_SELFTEST_SNAKE NO)
endif()
define_boolean_option(HAS_SELFTEST_SNAKE ${HAS_SELFTEST_SNAKE})
if(${PRINTER} IN_LIST PRINTERS_WITH_SIDE_FSENSOR)
set(HAS_SIDE_FSENSOR YES)
else()
set(HAS_SIDE_FSENSOR NO)
endif()
define_boolean_option(HAS_SIDE_FSENSOR ${HAS_SIDE_FSENSOR})
if(${PRINTER} IN_LIST PRINTERS_WITH_ESP_FLASH_TASK)
define_boolean_option(HAS_ESP_FLASH_TASK YES)
else()
define_boolean_option(HAS_ESP_FLASH_TASK NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_EMBEDDED_ESP32)
define_boolean_option(HAS_EMBEDDED_ESP32 YES)
else()
define_boolean_option(HAS_EMBEDDED_ESP32 NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_SIDE_LEDS AND NOT IS_KNOBLET)
define_boolean_option(HAS_SIDE_LEDS YES)
else()
define_boolean_option(HAS_SIDE_LEDS NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_LOCAL_ACCELEROMETER)
define_boolean_option(HAS_LOCAL_ACCELEROMETER YES)
else()
define_boolean_option(HAS_LOCAL_ACCELEROMETER NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_REMOTE_ACCELEROMETER)
define_boolean_option(HAS_REMOTE_ACCELEROMETER YES)
else()
define_boolean_option(HAS_REMOTE_ACCELEROMETER NO)
endif()
if(HAS_TOOLCHANGER)
set(HAS_FILAMENT_SENSORS_MENU YES)
else()
set(HAS_FILAMENT_SENSORS_MENU NO)
endif()
define_boolean_option(HAS_FILAMENT_SENSORS_MENU ${HAS_FILAMENT_SENSORS_MENU})
if(${PRINTER} IN_LIST PRINTERS_WITH_COLDPULL)
define_boolean_option(HAS_COLDPULL YES)
else()
define_boolean_option(HAS_COLDPULL NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_SHEET_SUPPORT)
define_boolean_option(HAS_SHEET_SUPPORT YES)
else()
define_boolean_option(HAS_SHEET_SUPPORT NO)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEBUG YES)
define_boolean_option(NETWORKING_BENCHMARK_ENABLED YES)
else()
set(DEBUG NO)
define_boolean_option(NETWORKING_BENCHMARK_ENABLED NO)
endif()
if(${PRINTER} IN_LIST PRINTERS_WITH_NFC)
define_boolean_option(HAS_NFC YES)
else()
define_boolean_option(HAS_NFC NO)
endif()
# define enabled features
if(BOOTLOADER STREQUAL "YES"
AND (PRINTER STREQUAL "MINI"
OR PRINTER STREQUAL "MK4"
OR PRINTER STREQUAL "MK3.5"
OR PRINTER STREQUAL "iX"
OR BOARD STREQUAL "XLBUDDY"
)
)
set(BOOTLOADER_UPDATE YES)
else()
set(BOOTLOADER_UPDATE NO)
endif()
define_boolean_option(BOOTLOADER_UPDATE ${BOOTLOADER_UPDATE})
set(DEVELOPER_MODE
"OFF"
CACHE BOOL "Disable wizards, prompts and user-friendliness. Developers like it rough!"
)
define_boolean_option(DEVELOPER_MODE ${DEVELOPER_MODE})
set(DEBUG_WITH_BEEPS
"OFF"
CACHE BOOL "Colleague annoyance: achievement unlocked"
)
define_boolean_option(DEBUG_WITH_BEEPS ${DEBUG_WITH_BEEPS})
# Use websocket to talk to Connect instead of many http requests.
#
# The server part is not ready and the protocol is in a flux too. For that reason, this is not
# enabled in "real builds", but we need to be able to have the code around and be able to turn it on
# for custom build - to allow debugging the server too.
#
# Eventually, this'll become the only used and supported way to talk to Connect. At that point, both
# this option and the "old" code will be removed.
set(WEBSOCKET
"OFF"
CACHE BOOL "Use websocket to talk to connect. In development"
)
define_boolean_option(WEBSOCKET ${WEBSOCKET})
set(MDNS
"ON"
CACHE BOOL "Enable MDNS responder"
)
define_boolean_option(MDNS ${MDNS})