Eclipse build in subdirectory configuration

markjuggles
Posts: 16
Joined: Thu Dec 31, 2020 3:34 am

Eclipse build in subdirectory configuration

Postby markjuggles » Thu Dec 31, 2020 4:10 am

I am new to the ESP-IDF but have used Eclipse with NXP, TI, Silicon Labs, and ST.

The installation of ESP-IDF and Eclipse went pretty well after I ignored the "minimum version" requirements for Python and git and just installed the latest versions of those tools before installing ESP-IDF.

ESP-IDF Instructions:
https://docs.espressif.com/projects/esp ... t-started/

Eclipse Instructions:
https://github.com/espressif/idf-eclipse-plugin

Now it is possible to import an ESP-IDF example project, compile it in Eclipse, and resolve symbols just like a real IDE. Perfect.

But the example project that I want to use is not in the ESP-IDF examples. It is
https://github.com/espressif/esp-aws-iot

The difference seems to be that to manually build the ESP-IDF examples, you run idf.py build from the project directory. To build the esp-aws-iot examples, you have to run idf.py build from the subdirectories: examples/subscribe_publish or examples/thing_shadow.

In the Launch Configuration that I made when importing the project, I set the build directory to examples/subscribe_publish and the build command to idf.py build.

The build messages show that it is still attempting to build in the top project directory and getting confused with CMakeLists.txt.

Building manually in a CMD window would be tolerable but the project also does not resolve any of the ESP headers or functions which is the best part of Eclipse.

I realize that it would be possible to completely restructure the project to resemble the examples but that would impair the ability to get upstream changes via git.

Here is the command window output:


Building in: C:\Users\Mark\esp\projects\esp-aws-iot\build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=C:\Users\Mark\Desktop\esp-idf\tools\cmake\toolchain-esp32.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DIDF_TARGET=esp32 C:\Users\Mark\esp\projects\esp-aws-iot
CMake Error at CMakeLists.txt:26 (register_component):
Unknown CMake command "register_component".


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.13)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "C:/Users/Mark/esp/projects/esp-aws-iot/build/CMakeFiles/CMakeOutput.log".
idf.py build
Executing action: all (aliases: build)
CMakeLists.txt not found in project directory c:\users\mark\esp\projects\esp-aws-iot\build
Build complete (0 errors, 0 warnings): C:\Users\Mark\esp\projects\esp-aws-iot\build


What is the best way to get Eclipse working for this project??

Thank you,

Mark

Jamawa
Posts: 16
Joined: Sun Aug 16, 2020 10:46 am

Re: Eclipse build in subdirectory configuration

Postby Jamawa » Thu Dec 31, 2020 9:08 pm

I am not at my machine, so this is from memory. I think there is also a directory entry for the “start build in” or whatever it is called. That would (hopefully) be the directory eclipse would use to start the idfbuild.py command.

I have not compiled any examples like this, so I am not sure, but the idfbuild.py command is normally not used in a build configuration I think, so I would not want to enter it now. The only thing that needs to change is the directory from which it is being called. From the log that now seems to be the build directory of the root folder, which has no cmakelists.txt file, so that is reported as error.
Maybe you can find the directory used to “start the build” in, like I said above.

markjuggles
Posts: 16
Joined: Thu Dec 31, 2020 3:34 am

Re: Eclipse build in subdirectory configuration

Postby markjuggles » Fri Jan 01, 2021 5:15 pm

There is no "Start Build In" setting.

There is a "Working Directory" box under "Edit Configuration" in the "Main" tab but it has no effect. This dialog appears to be for configuring an external tool.

Jamawa
Posts: 16
Joined: Sun Aug 16, 2020 10:46 am

Re: Eclipse build in subdirectory configuration

Postby Jamawa » Sun Jan 03, 2021 1:19 am

Ah right, "Working Directory", that was the name. I remember now... :D
OK, pity that did not work, I hoped it would.

Two possible other options:
1 There is an option to add cmake arguments under the "Build Settings". Cmake documentation says that the source path can be specified using "-S <path-to-source>". So maybe if you enter "-S <path-to-example-root>" that will do the trick. I have no idea however if these are passed and if so at what stage of the process. Seems worth a try I'd say.
2 Another approach entirely: what if you place the eclipse project files in the root of the example? Or create a new project there, if only for test purposes.

Who is online

Users browsing this forum: No registered users and 18 guests