-
Notifications
You must be signed in to change notification settings - Fork 44
/
CMakeLists.txt
73 lines (60 loc) · 2.75 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
#=============================================================================#
# Author: Thomas Jarosch #
# Date: 24.04.2012 #
# #
# Description: Pedelec controller cmake project #
# #
#=============================================================================#
set(CMAKE_TOOLCHAIN_FILE cmake/Arduino-toolchain.cmake) # Arduino Toolchain
# "grep" for FC 2.0 hardware in config.h
# Do this before project() since it invokes toolchain detection
file(STRINGS Arduino_Pedelec_Controller/config.h config_h_lines REGEX "^#define HARDWARE_REV 2[0-9]")
if (config_h_lines)
message("Building firmware for FC 2.0 or higher")
set(ARDUINO_BOARD "Arduino Mega or Mega 2560 [avr.mega]")
set(ARDUINO_AVR_MEGA_MENU_CPU_ATMEGA2560 TRUE)
else(config_h_lines)
set(ARDUINO_BOARD "Arduino Nano [avr.nano]")
option(OLD_BOOTLOADER "Arduino Nano uses old bootloader (57600 baud)" OFF)
if (OLD_BOOTLOADER)
set(ARDUINO_AVR_NANO_MENU_CPU_ATMEGA328OLD TRUE)
else (OLD_BOOTLOADER)
set(ARDUINO_AVR_NANO_MENU_CPU_ATMEGA328 TRUE)
endif (OLD_BOOTLOADER)
endif(config_h_lines)
set(ARDUINO_PROGRAMMER "Arduino as ISP [avr.arduinoasisp]")
cmake_minimum_required(VERSION 3.7.0)
project(Pedelec_Controller C CXX)
# Documentation
option(DOCUMENTATION "Generate API documentation with Doxygen" OFF)
find_package(Doxygen)
if(DOCUMENTATION AND DOXYGEN_FOUND)
# Set variables
set(top_srcdir ${CMAKE_SOURCE_DIR})
# Find doxy config
message(STATUS "Doxygen found.")
set(DOXY_DIR "${CMAKE_SOURCE_DIR}/docs")
set(DOXY_CONFIG "${DOXY_DIR}/Doxyfile.in")
# Copy doxy.config.in
configure_file("${DOXY_CONFIG}" "${CMAKE_BINARY_DIR}/doxy.config")
# Create doc directory
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/doc
COMMAND rm -rf ${CMAKE_BINARY_DIR}/doc/{html,man}
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc
DEPENDS pcontroller
)
# Run doxygen
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/doc/html/index.html
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_BINARY_DIR}/doxy.config"
DEPENDS "${CMAKE_BINARY_DIR}/doxy.config" "${CMAKE_BINARY_DIR}/doc"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
)
add_custom_target(docs ALL DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html)
message(STATUS "Generating API documentation with Doxygen")
else(DOCUMENTATION AND DOXYGEN_FOUND)
message(STATUS "Not generating API documentation")
endif(DOCUMENTATION AND DOXYGEN_FOUND)
add_subdirectory(Arduino_Pedelec_Controller)
add_subdirectory(Hardware_Test)