forked from Ultimaker/cura-binary-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (65 loc) · 2.55 KB
/
CMakeLists.txt
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
project(cura-binary-data)
cmake_minimum_required(VERSION 2.8.12)
include(GNUInstallDirs)
option(BUILD_MARLIN_FIRMWARES "Build Marlin Firmware" ON)
option(PACK_URANIUM "Pack Uranium binary files" ON)
option(PACK_CURA_I18N "Pack Cura i18n files" ON)
# unset(PACK_FIRMWARE CACHE)
if(DEFINED ENV{PACK_FIRMWARE})
set(PACK_FIRMWARE $ENV{PACK_FIRMWARE} CACHE STRING "Pack firmware for Lulzbot, Ultimaker or all" FORCE)
else()
set(PACK_FIRMWARE "ultimaker" CACHE STRING "Pack firmware for Lulzbot, Ultimaker or all")
endif()
message(STATUS "---> Packing firmware: ${PACK_FIRMWARE}")
set(MARLIN_BIN_OUT_DIR "${CMAKE_SOURCE_DIR}/build-marlin/out")
set(CURA_FIRMWARES_DIR "${CMAKE_INSTALL_DATADIR}/cura/resources/firmware")
if(BUILD_MARLIN_FIRMWARES)
add_custom_target(BuildMarlin ALL
DEPENDS ${MARLIN_BIN_OUT_DIR})
add_custom_command( PRE_BUILD
COMMAND /bin/bash ${CMAKE_SOURCE_DIR}/build-marlin-firmwares.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT ${MARLIN_BIN_OUT_DIR})
if(PACK_FIRMWARE STREQUAL "lulzbot")
install( DIRECTORY ${MARLIN_BIN_OUT_DIR}/
DESTINATION ${CURA_FIRMWARES_DIR}
FILES_MATCHING PATTERN "*"
REGEX ".*Ultimaker.*" EXCLUDE)
elseif(PACK_FIRMWARE STREQUAL "ultimaker")
install( DIRECTORY ${MARLIN_BIN_OUT_DIR}/
DESTINATION ${CURA_FIRMWARES_DIR}
FILES_MATCHING REGEX ".*Ultimaker.*")
else()
install( DIRECTORY ${MARLIN_BIN_OUT_DIR}/
DESTINATION ${CURA_FIRMWARES_DIR})
endif()
endif()
# Let's clear the old dir
add_custom_target( ClearOldDirs ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/${CURA_FIRMWARES_DIR}
COMMENT "Removing Files from ${CMAKE_INSTALL_PREFIX}/${CURA_FIRMWARES_DIR}"
)
if(PACK_FIRMWARE STREQUAL "lulzbot")
install(DIRECTORY cura/resources/firmware/
DESTINATION ${CURA_FIRMWARES_DIR}
FILES_MATCHING PATTERN "*"
REGEX ".*Ultimaker.*" EXCLUDE)
elseif(PACK_FIRMWARE STREQUAL "ultimaker")
install(DIRECTORY cura/resources/firmware/
DESTINATION ${CURA_FIRMWARES_DIR}
FILES_MATCHING REGEX ".*Ultimaker.*" )
else()
install(DIRECTORY cura/resources/firmware/ DESTINATION ${CURA_FIRMWARES_DIR})
endif()
if(PACK_CURA_I18N)
install(DIRECTORY cura/resources/i18n/ DESTINATION ${CMAKE_INSTALL_DATADIR}/cura/resources/i18n)
endif()
if(PACK_URANIUM)
install(DIRECTORY uranium DESTINATION ${CMAKE_INSTALL_DATADIR})
endif()
if(WIN32)
install(FILES windows/vcredist_x64.exe DESTINATION ".")
install(FILES windows/vcredist_x32.exe DESTINATION ".")
install(DIRECTORY windows/arduino DESTINATION ".")
endif()
include(CPackConfig.cmake)