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

cmake: export targets, allow to build models via CMake #2746

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

matz-e
Copy link
Contributor

@matz-e matz-e commented Feb 19, 2024

This PR aims to allow dependent projects to build their models via CMake
rather than a combination of shell scripts and Makefiles. In the long
term, this may help facilitate building natively on Windows.

To try:

git clone -b imported-main https://github.com/BlueBrain/neurodamus-models.git
cd neurodamus-models

Create a CMakeLists.txt with contents like:

cmake_minimum_required(VERSION 3.28)

project(newrodamus)

find_package(neuron REQUIRED)

create_nrnmech(
  CORENEURON  # Will enable a coreneuron build
  MOD_FILES
  neocortex/mod/v6/CaDynamics_DC0.mod
  neocortex/mod/v6/Ca_HVA2.mod
  neocortex/mod/v6/Ca_LVAst.mod
  neocortex/mod/v6/DetAMPANMDA.mod
  neocortex/mod/v6/DetGABAAB.mod
  neocortex/mod/v6/GluSynapse.mod
  neocortex/mod/v6/Ih.mod
  neocortex/mod/v6/K_Pst.mod
  neocortex/mod/v6/K_Tst.mod
  neocortex/mod/v6/KdShu2007.mod
  neocortex/mod/v6/NaTg.mod
  neocortex/mod/v6/Nap_Et2.mod
  neocortex/mod/v6/ProbAMPANMDA_EMS.mod
  neocortex/mod/v6/ProbGABAAB_EMS.mod
  neocortex/mod/v6/SK_E2.mod
  neocortex/mod/v6/SKv3_1.mod
  neocortex/mod/v6/StochKv3.mod
  neocortex/mod/v6/TTXDynamicsSwitch.mod
  neocortex/mod/v6/VecStim.mod
  neocortex/mod/v6/gap.mod
  neocortex/mod/v6/netstim_inhpoisson.mod
)

Then build and install:

cmake -B build -S . -GNinja -DCMAKE_INSTALL_PREFIX=x86_64
cmake --build build
cmake --install build

See BlueBrain/neurodamus-models#12 for an example use case.

To be continued‥

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ f182db7 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 596e09b -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.20%. Comparing base (30b42a1) to head (27e37cf).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2746      +/-   ##
==========================================
- Coverage   67.20%   67.20%   -0.01%     
==========================================
  Files         563      563              
  Lines      104246   104248       +2     
==========================================
- Hits        70057    70056       -1     
- Misses      34189    34192       +3     

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

@bbpbuildbot

This comment has been minimized.

Copy link

sonarcloud bot commented Feb 23, 2024

Please retry analysis of this Pull-Request directly on SonarCloud

Copy link

✔️ e75b5a0 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

This PR aims to allow dependent projects to build their models via CMake
rather than a combination of shell scripts and Makefiles.  In the long
term, this may help facilitate building natively on Windows.

To try:
```
git clone -b imported-main https://github.com/BlueBrain/neurodamus-models.git
cd neurodamus-models
```

Create a `CMakeLists.txt` with contents like:
```cmake
cmake_minimum_required(VERSION 3.28)

project(newrodamus)

find_package(neuron REQUIRED)

create_libnrnmech(MOD_FILES
  neocortex/mod/v6/CaDynamics_DC0.mod
  neocortex/mod/v6/Ca_HVA2.mod
  neocortex/mod/v6/Ca_LVAst.mod
  neocortex/mod/v6/DetAMPANMDA.mod
  neocortex/mod/v6/DetGABAAB.mod
  neocortex/mod/v6/GluSynapse.mod
  neocortex/mod/v6/Ih.mod
  neocortex/mod/v6/K_Pst.mod
  neocortex/mod/v6/K_Tst.mod
  neocortex/mod/v6/KdShu2007.mod
  neocortex/mod/v6/NaTg.mod
  neocortex/mod/v6/Nap_Et2.mod
  neocortex/mod/v6/ProbAMPANMDA_EMS.mod
  neocortex/mod/v6/ProbGABAAB_EMS.mod
  neocortex/mod/v6/SK_E2.mod
  neocortex/mod/v6/SKv3_1.mod
  neocortex/mod/v6/StochKv3.mod
  neocortex/mod/v6/TTXDynamicsSwitch.mod
  neocortex/mod/v6/VecStim.mod
  neocortex/mod/v6/gap.mod
  neocortex/mod/v6/netstim_inhpoisson.mod
)
```

Then build and install:
```
cmake -B build -S . -GNinja -DCMAKE_INSTALL_PREFIX=x86_64
cmake --build build
cmake --install build
```

To be continued‥
@bbpbuildbot

This comment has been minimized.

Copy link

✔️ ed29f50 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 9503627 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 1865875 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

matz-e added a commit to BlueBrain/neurodamus-models that referenced this pull request May 28, 2024
Requires neuronsimulator/nrn#2746

Will use the CMake glue installed by (hopefully) a future Neuron to
forego calling Bash & Make via `nrnivmodl`.  Allows to properly link
targets for additional libraries, and avoids passing around long strings
of include and link parameters.
Copy link

✔️ 9ac0537 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

sonarcloud bot commented May 29, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

✔️ 27e37cf -> Azure artifacts URL

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.

None yet

2 participants