forked from jenkie/Arduino-Pedelec-Controller
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
78 lines (59 loc) · 2.81 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
#=============================================================================#
# Author: Thomas Jarosch #
# Date: 24.04.2012 #
# #
# Description: Pedelec controller cmake project #
# #
#=============================================================================#
#set(CMAKE_TOOLCHAIN_FILE cmake/ArduinoToolchain.cmake) # Arduino Toolchain
cmake_minimum_required(VERSION 2.8)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/cmake/teensy-arm.toolchain.cmake")
project(Pedelec_Controller C CXX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(Teensy)
# "grep" for FC 2.0 hardware in config.h
#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(FC_PROCESSOR mega2560)
#else(config_h_lines)
# set(FC_PROCESSOR uno)
#endif(config_h_lines)
# 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 libraries to project
#link_directories(${ARDUINO_SDK}/libraries)
add_subdirectory(Arduino_Pedelec_Controller)
add_subdirectory(Hardware_Test)