Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set PROJECT_NAME and PROJECT_VER in IDF project #214

Closed
elosev opened this issue Jun 9, 2024 · 2 comments
Closed

Cannot set PROJECT_NAME and PROJECT_VER in IDF project #214

elosev opened this issue Jun 9, 2024 · 2 comments

Comments

@elosev
Copy link

elosev commented Jun 9, 2024

Bug description

Cannot set PROJECT_NAME and PROJECT_VER in project generated by the template. For an empty project PROJECT_NAME and PROJECT_VER are coming from esp-idf-sys and are hardcoded to 'libespidf' and version defined by 'git describe'. I found that as a work-around both can be changed by patching esp-idf-sys:

diff --git a/build/native/cargo_driver.rs b/build/native/cargo_driver.rs
index c263ba76..bd2f4234 100644
--- a/build/native/cargo_driver.rs
+++ b/build/native/cargo_driver.rs
@@ -531,9 +531,9 @@ pub fn build() -> Result<EspIdfBuildOutput> {
     let target = replies
         .get_codemodel()?
         .into_first_conf()
-        .get_target("libespidf.elf")
+        .get_target("unicorn.elf")
         .unwrap_or_else(|| {
-            bail!("Could not read build information from cmake: Target 'libespidf.elf' not found")
+            bail!("Could not read build information from cmake: Target 'unicorn.elf' not found")
         })?;
 
     let compiler = replies
diff --git a/resources/cmake_project/CMakeLists.txt b/resources/cmake_project/CMakeLists.txt
index 63da9f05..8890afda 100644
--- a/resources/cmake_project/CMakeLists.txt
+++ b/resources/cmake_project/CMakeLists.txt
@@ -25,7 +25,9 @@ else()
     endif()
 endif()
 
-project(libespidf)
+git_describe(_PROJECT_VER_GIT "${CMAKE_CURRENT_SOURCE_DIR}")
+set(PROJECT_VER "42.43.0-${_PROJECT_VER_GIT}")
+project(unicorn)
 
 # Copy the components.lock to the cargo project dir
 if(EXISTS ${dependencies_lock})
  • Would you like to work on a fix? [n]

To Reproduce

Steps to reproduce the behavior:

  1. Create a project cargo generate esp-rs/esp-idf-template cargo
  2. Build the project and check PROJECT_NAME and PROJECT_VER in the binary
  3. Observe that the PROJECT_NAME is 'libespidf'

Expected behavior

Configurable PROJECT_NAME and PROJECT_VER

Screenshots

Environment

  • OS: Ubuntu 20.04
  • How did you install the environment: espup

Additional context

@elosev elosev added the bug label Jun 9, 2024
@ivmarkov
Copy link
Collaborator

ivmarkov commented Jun 9, 2024

We do this using the app_desc! macro.

Please confirm if calling app_desc!() solves the problem for you, or else elaborate why you want these ESP IDF vars configured to something else in the first place.

@elosev
Copy link
Author

elosev commented Jun 9, 2024

Oh, it works perfectly! Thanks!

@elosev elosev closed this as completed Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants