mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-30 21:58:06 +00:00
🔨 Update CMakeLists.txt (#25983)
This commit is contained in:
parent
927b3cc41a
commit
dd1792bdfc
2 changed files with 60 additions and 13 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -132,7 +132,9 @@ spi_flash.bin
|
|||
fs.img
|
||||
|
||||
# CMake
|
||||
buildroot/share/cmake/*
|
||||
CMakeLists.txt
|
||||
!buildroot/share/cmake/CMakeLists.txt
|
||||
src/CMakeLists.txt
|
||||
CMakeListsPrivate.txt
|
||||
build/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
#====================================================================#
|
||||
# Usage under Linux: #
|
||||
# #
|
||||
|
@ -24,21 +24,67 @@ set(SCRIPT_BRANCH 1.0.2) #Set to wanted marlin-cmake release tag or branch
|
|||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake)
|
||||
|
||||
file(DOWNLOAD https://github.com/tohara/marlin-cmake/archive/${SCRIPT_BRANCH}.tar.gz
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-src.tar.gz SHOW_PROGRESS)
|
||||
file(DOWNLOAD https://github.com/tohara/marlin-cmake/archive/${SCRIPT_BRANCH}.tar.gz
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-src.tar.gz SHOW_PROGRESS)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xvf ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-src.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
file(RENAME ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-${SCRIPT_BRANCH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake)
|
||||
file(REMOVE ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-src.tar.gz)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xvf ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-src.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
file(RENAME ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-${SCRIPT_BRANCH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake)
|
||||
file(REMOVE ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake-src.tar.gz)
|
||||
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT EXISTS ${CMAKE_BINARY_DIR}/make.exe)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/resources/make.exe DESTINATION ${CMAKE_BINARY_DIR}/)
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules/Arduino_SDK.cmake)
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/tohara/marlin-cmake/master/modules/Arduino_SDK.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules/Arduino_SDK.cmake SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules/marlin_cmake_functions.cmake)
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/tohara/marlin-cmake/master/modules/marlin_cmake_functions.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules/marlin_cmake_functions.cmake SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake)
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/tohara/marlin-cmake/master/Platform/Arduino.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/settings/marlin_boards.txt)
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/tohara/marlin-cmake/master/settings/marlin_boards.txt
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/settings/marlin_boards.txt SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/toolchain/ArduinoToolchain.cmake)
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/tohara/marlin-cmake/master/toolchain/ArduinoToolchain.cmake
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/toolchain/ArduinoToolchain.cmake SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/resources/make.exe)
|
||||
file(DOWNLOAD https://raw.githubusercontent.com/tohara/marlin-cmake/master/resources/make.exe
|
||||
${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/resources/make.exe SHOW_PROGRESS)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19)
|
||||
|
||||
file(DOWNLOAD https://downloads.arduino.cc/arduino-1.8.19-windows.zip
|
||||
${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19-windows.zip SHOW_PROGRESS)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xvzf ${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19-windows.zip WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
file(REMOVE ${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19-windows.zip)
|
||||
|
||||
endif()
|
||||
|
||||
# Print CMake version
|
||||
message("-- Running CMake version: " ${CMAKE_VERSION})
|
||||
|
||||
# Replace the CMake Ver. in the Arduino.cmake
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" ORIGINAL_FILE_CONTENTS)
|
||||
string(REPLACE "cmake_minimum_required(VERSION 2.8.5)" "cmake_minimum_required(VERSION 2.8.12)" NEW_FILE_CONTENTS "${ORIGINAL_FILE_CONTENTS}")
|
||||
file(WRITE "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" "${NEW_FILE_CONTENTS}")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules)
|
||||
|
||||
#====================================================================#
|
||||
|
@ -46,7 +92,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cma
|
|||
# It can also be set from command line. eg.: #
|
||||
# cmake .. -DARDUINO_SDK_PATH="/path/to/arduino-1.x.x" #
|
||||
#====================================================================#
|
||||
#set(ARDUINO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/arduino-1.6.8)
|
||||
set(ARDUINO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/arduino-1.8.19)
|
||||
#set(ARDUINO_SDK_PATH /Applications/Arduino.app/Contents/Java)
|
||||
#set(ARDUINO_SDK_PATH $HOME/ArduinoAddons/Arduino_1.6.x)
|
||||
#====================================================================#
|
||||
|
@ -79,7 +125,6 @@ project(Marlin C CXX)
|
|||
print_board_list()
|
||||
print_programmer_list()
|
||||
|
||||
|
||||
#====================================================================#
|
||||
# Get motherboard settings from Configuration.h #
|
||||
# setup_motherboard(TARGET Marlin_src_folder) #
|
||||
|
@ -105,9 +150,9 @@ set(${PROJECT_NAME}_SRCS "${SOURCES};../../../Marlin/Marlin.ino")
|
|||
# cmake .. -DUPLOAD_PORT=/dev/ttyACM0 #
|
||||
#====================================================================#
|
||||
if(UPLOAD_PORT)
|
||||
set(${PROJECT_NAME}_PORT ${UPLOAD_PORT})
|
||||
set(${PROJECT_NAME}_PORT ${UPLOAD_PORT})
|
||||
else()
|
||||
set(${PROJECT_NAME}_PORT /dev/ttyACM0)
|
||||
set(${PROJECT_NAME}_PORT /dev/ttyACM0)
|
||||
endif()
|
||||
|
||||
#====================================================================#
|
||||
|
|
Loading…
Reference in a new issue