arduino-cmake / Arduino-CMake-NG

CMake-Based framework for Arduino platforms
MIT License
138 stars 39 forks source link

Arduino SDK not automatically detected on OSX #29

Closed masha256 closed 6 years ago

masha256 commented 6 years ago
CMake Error at cmake/Platform/Other/ArduinoSDKSeeker.cmake:32 (message):
  Couldn't find Arduino SDK path - Is it in a non-standard location?

  If so, please set the ARDUINO_SDK_PATH CMake-Variable
Call Stack (most recent call first):
  cmake/Arduino-Toolchain.cmake:66 (find_arduino_sdk)
  /Applications/CMake.app/Contents/share/cmake-3.12/Modules/CMakeDetermineSystem.cmake:91 (include)
  CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/machado/tmp/MyProject/CMakeFiles/CMakeOutput.log".

When I set the system environment variable ARDUINO_SDK_PATH to /Applications/Arduino.app/Contents/Java it is able to finish cmake, but there is some strange output:

-- Arduino SDK version 1.8.3: ARDUINO_SDK_PATH-NOTFOUND
-- Determined Platform Header: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h
-- Arduino SDK version 1.8.3: ARDUINO_SDK_PATH-NOTFOUND
-- Determined Platform Header: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h
-- Arduino SDK version 1.8.3: ARDUINO_SDK_PATH-NOTFOUND
-- Determined Platform Header: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/machado/tmp/MyProject
taoyuan commented 6 years ago

The Arduino SDK on OSX should be in subdirectory Arduino.app/Contents/Java of parent folder Applications.

I have create a PR #30 to fix this.

The strange output caused by the environment variable ARDUINO_SDK_PATH really needs to review the code.

MrPointer commented 6 years ago

@machadolab @taoyuan I'll have to check that output, although I have a theory on why it happens - the new Find-SDK module looks for the lib/version.txt file and stores the found path in a variable named ARDUINO_SDK_PATH. If it hasn't found anything, this variable will be set to ARDUINO_SDK_PATH-NOTFOUND (this how all CMake's find_xxx functions work). However, even when the variable is set manually on the command-line, the Find module overrides this value, according to CMake's variable scoping rules, and that's how you get that strange output. The reason I chose to set it to a variable with the same name is to avoid declaring more variables which don't actually have any meaning, but apparently now they do...

masha256 commented 6 years ago

The arduino sdk is now being detected automatically, and there is no strange output. Thanks!!

MrPointer commented 6 years ago

Ummm this kind of bothers me because I did NOTHING since the last comment, just shared my thoughts... I still need to investigate this one further, but I'll open a separate issue for this