Skip to content

Embed nrnunits.lib #3471

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Embed nrnunits.lib #3471

wants to merge 5 commits into from

Conversation

JCGoran
Copy link
Collaborator

@JCGoran JCGoran commented Jun 4, 2025

Fix #3470.

We now configure both nrnunits.lib and embedded_nrnunits.lib, and embed the latter directly as a string_view in units.cpp.
This is only used as a last resort (i.e. if all other methods of figuring out the path to a nrnunits.lib file fail).

The alternative would be to figure out the path of the binary executable at run-time, which would require too much platform-specific code.

Copy link
Contributor

github-actions bot commented Jun 4, 2025

✔️ 496a655 -> artifacts URL

Copy link

sonarqubecloud bot commented Jun 4, 2025

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was renamed because we use cpp_cc_build_time_copy on some of the directories, so nrnunits.lib was first set-up at configure time, but then cpp_cc_build_time_copy would clobber it at build-time, so to work around it, we just rename it.

Copy link
Contributor

github-actions bot commented Jun 4, 2025

✔️ 290387a -> artifacts URL

Copy link

✔️ 290387a -> Azure artifacts URL

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.40%. Comparing base (e560105) to head (290387a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3471   +/-   ##
=======================================
  Coverage   68.40%   68.40%           
=======================================
  Files         682      682           
  Lines      116565   116574    +9     
=======================================
+ Hits        79731    79747   +16     
+ Misses      36834    36827    -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JCGoran JCGoran marked this pull request as ready for review June 4, 2025 19:01
@JCGoran JCGoran requested a review from nrnhines June 4, 2025 19:02
Copy link
Member

@nrnhines nrnhines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solves a definite problem. There is a possibility of user confusion about where units are coming from, but that can be disambigutated if they use a MODLUNIT environment variable.

configure_file(${PROJECT_SOURCE_DIR}/share/lib/nrnunits.lib.in
${PROJECT_BINARY_DIR}/share/nrn/lib/nrnunits.lib @ONLY)

set(nrnunits_start "R\"qwerty(")
Copy link
Member

@nrnhines nrnhines Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional...Could use a comment. Took me a while (and looking at the constructed embedded_nrnunit.lib file) to realize the reason for the start/stop idiom. I'd never seen this C++ feature before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NOCMODL fails to run from build directory without setting MODLUNIT
2 participants