Skip to content

Commit

Permalink
Squashes all updates so far: NeuroML2 support, Windows Build, and git…
Browse files Browse the repository at this point in the history
…hub workflow to build on Windows, Linux and MacOS (#491)

* Fixed typo in macro check for BOOST

* Updates for Windows MSVC build

In setup.py and CMakeLists.txt for build

- Added switches for compiler flags for Windows/MSVC

- Removed possible override of version in CMakeLists.txt: setup.py
  should be the only source of version info

- Archive format set to zip for windows

- Using module name moose instead of _moose, the underscore is added
  as PREFIX

- Platform dependent shared lib file name extension

- Removed platform name CMAKE from cmake file

- Updated setup.py to allow release build on windows

In C++ code

- Switched all new style logical opeartors (and, or, not)to C
  style (&&, ||, !) - these are not recognized by MSVC compiler

- Added windows port of getopt in external

- Removed SocketStreamer conditionally for Win32 build.
  Win32 does not have socket library. TODO: look at ports.

- CylBase uses a constant PI which does not exist in win32 standard
  library. Replaced it with cmath's M_PI. Hope they are the same.

- Corrected cnpy function for checking numpy file header

- Minor correction on printf formatting to avoid warning for size_t
build updates for windows

- Undefine _DEBUG macro for release builds

Added build instructions for windows

* Squashed commit of the following:

commit fc5f053
Merge: 45f4341 71598d1
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 15:14:44 2024 +0530

    Merge branch 'master' of https://github.com/BhallaLab/moose-core into windows_build

commit 45f4341
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 15:02:51 2024 +0530

    github actions: try to fix gsl availability

commit 17f91bb
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 14:01:39 2024 +0530

    github action fixes

commit 9159696
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 13:59:08 2024 +0530

    github actions: Avoid pip upgared

commit 9537a5c
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 13:57:52 2024 +0530

    Further fix to github action: activateing mamba env

commit 7e67573
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 13:54:11 2024 +0530

    Fix github action

commit ab7d52a
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 13:53:05 2024 +0530

    Fixing automatic build

commit 6c4b99a
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:49:39 2024 +0530

    github actions: further fix for ubuntu

commit 1c143e6
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:41:58 2024 +0530

    github actions: fix ninja installation on ubuntu latest

commit cbba8a5
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:39:30 2024 +0530

    github actions: fix for meson installation on ubuntu-lates

commit 863d7f7
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:23:57 2024 +0530

    Fixing github actions to build

commit f1d9981
Merge: 65b8ea6 fa3b764
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:12:55 2024 +0530

    Merge branch 'windows_build' of https://github.com/subhacom/moose-core into windows_build

commit 65b8ea6
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:12:07 2024 +0530

    Another attempt at fixing github workflow

commit fa3b764
Author: subhacom <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:04:46 2024 +0530

    Update pymoose.yml: tab and space mixup in github editor

commit 3cd5d0e
Author: subhacom <ray.subhasis@gmail.com>
Date:   Sun Nov 10 01:03:41 2024 +0530

    Update pymoose.yml

commit ecfa505
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 00:58:37 2024 +0530

    Fixed tab issues in workflow

commit 15c8b44
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 00:56:49 2024 +0530

    attempt to fix workflow

commit bf294b8
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Nov 10 00:24:06 2024 +0530

    Updated exprtk and fixed some deprecation warnings from meson

commit 71598d1
Author: Anal Kumar <analkumar2@gmail.com>
Date:   Fri Nov 8 13:30:32 2024 +0530

    Execute the module to access the funtion in its namespace (#480)

commit 38fc00f
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Fri Nov 8 11:29:28 2024 +0530

    Added moose class/object check in moose.isinstance_ function

commit 7c82f69
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Oct 27 16:51:16 2024 +0530

    Minor update of build instructions.

commit 5c325c1
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Oct 27 12:26:55 2024 +0530

    Added instructions on build options

commit 575760e
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Fri Oct 18 15:39:07 2024 +0530

    neuroml2 reader: Added option to use interpolation by default

commit 3cc2291
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Thu Oct 3 12:20:43 2024 +0530

    Minor fix for non-conda build

commit 584394f
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Sep 3 22:02:57 2024 +0530

    HHChannel2D cleanup

    Addrsses issue #482

commit a20c95b
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Sep 3 19:09:38 2024 +0530

    Windows build working, HHChannel fixed, pymoose cleaned up

    This commit puts together several bug fixes and cleanups.

    Meson-based build functional now.
    - Windows MSVC Build works.
    - Tested on WSL-Ubuntu as well
    - Removed cmake build files (CMakeLists.txt)

    HHChannel class hierarchy
    - Original version of HHChannel was using the diamond of death
    multiple inheritance. While linux/gcc was forgiving of this, on
    Windows MSVC this was producing strange errors issue#483.
    - Turns out this design was not essential and single inheritance along
    the line ChanBase->ChanCommon->HHChannelBase->HHChannel sufficed.

    pybind11 based pymoose

    This code was quite dirty with static member functions under __Finfo__
    which had no relations with the class. Reorganized the code here.

commit 4c0b13c
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Sun Sep 1 02:58:37 2024 +0530

    Cleanup of build process.

    - cleanups to avoid multiple definitions: no more forcing linker to
      allow multiple definition
    - redifinition of doubleEq removed
    - some type-conversions made explicit to avoid warnings
    - set compiler to use c/c++-17
    - separate settings for MSVC and MS Windows: llvm-clang can also work

commit 9f85fe9
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Aug 28 16:53:30 2024 +0530

    Fixed small bug in neuroml2 reader

commit 5d58ac0
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Aug 27 13:08:58 2024 +0530

    Minor fix in neuroml2 reader

commit 8b9f01c
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Mon Aug 26 17:42:10 2024 +0530

    Further cleanup of neuroml2 reader

    The results can be sensitive to ranges and resolution used in gate
    tables.
    Made these parameters of the NML2Reader's read() method.
    Set defaults to create good fit for Granule 98 model.

commit f7dec7b
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Mon Aug 26 12:16:28 2024 +0530

    Got 2D channel to work when reading in NeuroML2

commit 717e0a9
Merge: 8cdacb7 da455e2
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Fri Aug 23 11:46:29 2024 +0530

    Merge branch 'windows_build'

commit 8cdacb7
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 30 15:26:51 2024 +0530

    Support for voltage and Ca dependent channel in NeuroML2 reader

    - array_eval_component() reimplements neuroml expression evaluation
                             using numpy vectorization. This adds
    			 dependency on pint for unit handling.
    - Numerous other fixes and cleanups.

commit da455e2
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 30 15:26:51 2024 +0530

    Removed optimization in favor of simplicity

    - The switch between Ca dependent and voltage dependent gates put
    inside for loop instead of having one loop under each condition.

commit 8c4db05
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 30 15:18:13 2024 +0530

    Fixes to NeuroML2 reader

    - Fixed the calculation of gate parameters for HH-type channels with
    non-standard formula
    - String formatting switched to f-strings
    - Refactored functions for updating gates/creating HHChannels
    - Added some function docstrings

commit c3534b5
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Fri Jul 19 18:54:25 2024 +0530

    Code cleanup of morphology reading

commit ce9cb73
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jul 17 10:14:17 2024 +0530

    Windows portability fix

    - Removed function filepath_exists to check existence of a
    file: now this is done portably with the `access` (unix) or
    `_access` (win) function call.

commit 629d00d
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 16 14:46:13 2024 +0530

    meson build updated for Ubuntu (tested on WSL)

    - Updated meson.build files to build on Ubuntu with gcc
    - Added instructions for Ubuntu build
    - Updated instructions for Windows build
    - Fixed minor issue with loading kkit file

commit 2aac80f
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Mon Jul 15 10:39:38 2024 +0530

    Some more cleanup in meson build

commit 6c1016f
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Mon Jul 15 10:38:03 2024 +0530

    Fixed typo.

commit 258424a
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Mon Jul 15 10:33:57 2024 +0530

    Minor fixes to meson build and pyproject

commit 52bf161
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jul 10 11:24:17 2024 +0530

    Windows MSVC build working with meson.

    - Updated guide to windows build

commit e4b7655
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 9 23:12:24 2024 +0530

    Finally, working windows build with meson

commit 0ca6b94
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Mon Jul 8 03:53:57 2024 +0530

    Added meson build files

commit c0e0229
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jul 3 08:54:05 2024 +0530

    Updated mac build/installation guide

commit 7e8427c
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jul 3 07:14:53 2024 +0530

    Added guide for mac build

commit f02bc6f
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 2 17:39:49 2024 +0530

    Added troubleshooting advice for WSL.

commit 130b674
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 2 12:35:56 2024 +0530

    Correction in wsl guide

commit caeeab5
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Tue Jul 2 12:30:25 2024 +0530

    Added a guide for setting up moose on WSL2

commit b8eb0ba
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Thu Jun 20 12:39:51 2024 +0530

    Try fixing apple build

commit e3d6607
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Thu Jun 20 12:20:29 2024 +0530

    Fixed cmake file to not include extern/getopt on non-win32

commit 7906424
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Thu Jun 20 10:20:37 2024 +0530

    Trying to fix syntax error from newer C++ standard

commit 0cd5950
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Thu Jun 20 09:23:20 2024 +0530

    Build updates for WIN32/MSVC

commit 5756e38
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jun 12 16:56:03 2024 +0530

    Fixed lib name for moose used in linking moose.bin

commit e71ce2f
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jun 12 16:49:13 2024 +0530

    Fixes to build configs

    - setup.py for two passes of cmake - first to create config, second to
    run build tool
    - pybind11/CMakeLists.txt - going back to no prefix, directly put
    `_moose` for target. Reverted pyd suffix to dll on windows

commit 965d1a1
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jun 12 16:16:00 2024 +0530

    Attempt to fix build

    - setup.py: use `cmake --build` for all systems
    - switch filename suffix pyd back to dll for windows

commit 035ee0e
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jun 12 15:09:48 2024 +0530

    Trying c++11 for mac build to fix syntax issue

commit 1d8de04
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jun 12 15:02:51 2024 +0530

    Fixup for getopt on Windows

commit d6bc7ff
Author: Subhasis Ray <ray.subhasis@gmail.com>
Date:   Wed Jun 12 14:47:32 2024 +0530

    Minor fixup for platform check with WIN32 macro
  • Loading branch information
subhacom authored Nov 11, 2024
1 parent 71598d1 commit 3c89fd1
Show file tree
Hide file tree
Showing 117 changed files with 12,492 additions and 7,000 deletions.
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: true
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 4
TabWidth: 4
UseTab: Never
Expand Down
37 changes: 29 additions & 8 deletions .github/workflows/pymoose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14]
os: [ubuntu-latest, macos-14, windows-latest]
build_type: [Release]
c_compiler: [clang]
python-version: ["3.12"]
Expand All @@ -16,6 +16,8 @@ jobs:
apt: 10
- os: macos-14
brew: 20
- os: windows-latest
winget: 30
steps:
- name: mamba-setup
uses: mamba-org/setup-micromamba@v1
Expand All @@ -25,7 +27,10 @@ jobs:
cache-downloads: true
create-args: >-
python=${{ matrix.python-version }}
pkg-config
clang
hdf5
pybind11[global]
graphviz
pytables
numpy
Expand All @@ -35,25 +40,41 @@ jobs:
doxygen
setuptools
wheel
meson
ninja
meson-python
gsl
post-cleanup: all
generate-run-shell: false
- name: Display Python version
run: |
python -c "import sys; print(sys.version)"
- if: ${{ matrix.apt }}
run: sudo apt-get install libhdf5-dev libgsl0-dev graphviz-dev python3-lxml cmake doxygen
run: |
sudo apt-get -y install libhdf5-dev libgsl0-dev graphviz-dev python3-lxml doxygen libgsl-dev
- if: ${{ matrix.brew }}
run: |
brew install gsl
brew install hdf5
brew install graphviz
brew install cmake
brew install doxygen
- name: install python module dependencies via pip
run: |
pip install pybind11[global]
pip install python-libsbml
- name: checkout
uses: actions/checkout@v4
- name: build and install
- name: build and install (non-windows)
if: runner.os != 'Windows'
run: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate moose
python -c "import sys; print('#' * 60, sys.version)"
pip install python-libsbml
pip install .
python -c "import moose; moose.le()"
- name: build and install (windows)
if: runner.os == 'Windows'
run: |
micromamba shell hook -s powershell | Out-String | Invoke-Expression
micromamba activate moose
python -c "import sys; print('#' * 60, sys.version)"
pip install python-libsbml
pip install .
python -c "import moose; moose.le()"
27 changes: 27 additions & 0 deletions AppleM1_Guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- Install homebrew: https://brew.sh/
- Set up required development environment
- Install command line tools for XCode
- Install build dependencies by running these commands in a terminal
```
brew install gsl
brew install hdf5
brew install graphviz
brew install cmake
brew install doxygen
```

- Install anaconda/miniconda/micromamba/miniforge. For example, for micromamba, run
```
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
```

in command line
- Update micromamba: `micromamba self-update`
- Restart terminal and create an environment with necessary packages:

```
micromamba create -n moose hdf5 graphviz pytables numpy matplotlib vpython lxml doxygen setuptools wheel pybind11[global]
```
- Activate the moose environment: `micromamba activate moose`
- Install libsbml: `pip install python-libsbml`
- Install moose from github: `pip install git+https://github.com/BhallaLab/moose-core.git`
Loading

0 comments on commit 3c89fd1

Please sign in to comment.