Closed kukuyok closed 6 years ago
@kukuyok Thanks for the feedback and contribution! I'll review this sometime soon, it seems really really strange that you get such behavior. BTW, could you attach your CMakeLists.txt file please?
Thanks! Sure:
cmake_minimum_required(VERSION 3.8)
set(project_name Cocktail)
## Команда для запуска CMake (run CMake in bash)
## cmake -DCMAKE_TOOLCHAIN_FILE=/home/petro/install/arduino-cmake/cmake/Arduino-Toolchain.cmake -DARDUINO_SDK_PATH=/home/petro/install/arduino-1.8.5 -Darduino_port=/dev/ttyUSB0 ..
## Команда для генерации файлов проекта Eclipse (Eclipse project files generator)
## cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 -DCMAKE_TOOLCHAIN_FILE=/home/petro/install/arduino-cmake/cmake/Arduino-Toolchain.cmake -DARDUINO_SDK_PATH=/home/petro/install/arduino-1.8.5 -Darduino_port=/dev/ttyUSB0 ../firmware-ecl
set(CMAKE_VERBOSE_MAKEFILE ON)
## Флаги, компенсирующие косяк в сборке C-файлов Arduino-CMake-NG (temporary cure)
#add_definitions(-DARDUINO_ARCH_AVR -DARDUINO_AVR_MEGA2560 -DARDUINO=10802 -DF_CPU=16000000L)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmcu=atmega2560")
#set(ARDUINO_CMAKE_SKETCHBOOK_PATH /home/petro/Arduino)
project(${project_name} LANGUAGES C CXX ASM)
set(arduino_board mega)
set(board_cpu atmega2560)
get_board_id(board_id ${arduino_board} ${board_cpu})
add_arduino_executable(${project_name} ${board_id} main.cpp)
find_arduino_library(timer_api_lib arduino-timer-api ${board_id})
link_arduino_library(${project_name} timer_api_lib ${board_id})
set(arduino_port /dev/ttyUSB0)
upload_arduino_target(${project_name} ${board_id} ${arduino_port})
I build it in two ways: with Eclipse project (outside project directory) and directly using bash (within project subdirectory) and have same result.
+1 more notice: I need to rename library directory from arduino-timer-api to Arduino-timer-api. Otherwise library can't be found.
CMake options:
I use arduino-timer-api library in my project, and its source-code is written in C, not in C++, as three libraries, which you use in arduino-library example. And there are some problems to build it. That's what I found:
architecutres=avr,pic32,sam
this flag is in place.Compiling C++
Compiling C
SuperThnx for your tool!