Skip to content

Commit

Permalink
Build updated
Browse files Browse the repository at this point in the history
- Removed deprecated CMake version setting
- Removed python2: out of life. Only supporting Python>=3.8
- Removed pybind11: should be installed directly with pip
- Added MacOSX build workflow: to be tested
  • Loading branch information
subhacom committed Apr 22, 2024
1 parent 44e8255 commit d91ca02
Show file tree
Hide file tree
Showing 287 changed files with 127 additions and 64,871 deletions.
3 changes: 1 addition & 2 deletions .ci/build_wheels_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export PATH=/usr/local/bin:$PATH
brew update || echo "Failed to update brew"
brew install gsl || brew upgrade gsl
brew upgrade python3 || echo "Failed to upgrade python3"
brew upgrade python2 || echo "Failed to upgrade python2"
brew upgrade python || echo "Failed to upgrade python"

# Following are to remove numpy; It is breaking the build on Xcode9.4.
Expand Down Expand Up @@ -48,7 +47,7 @@ for _py in 3 2; do
$PYTHON -m pip install numpy --upgrade --user
$PYTHON -m pip install twine --upgrade --user

PLATFORM=$($PYTHON -c "import distutils.util; print(distutils.util.get_platform())")
PLATFORM=$($PYTHON -c "import sysconfig; print(sysconfig.get_platform())")

(
cd $MOOSE_SOURCE_DIR
Expand Down
13 changes: 0 additions & 13 deletions .ci/travis_build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ set -x
BUILDDIR=_build_travis
mkdir -p $BUILDDIR

PYTHON2="/usr/bin/python2"
PYTHON3="/usr/bin/python3"

$PYTHON2 -m pip install pip --upgrade --user
$PYTHON2 -m pip install libNeuroML numpy==1.14 scipy==1.2 \
pyNeuroML python-libsbml --upgrade --user

$PYTHON3 -m pip install pip --upgrade --user
$PYTHON3 -m pip install libNeuroML pyNeuroML python-libsbml --upgrade --user
Expand All @@ -37,7 +33,6 @@ unset PYTHONPATH
# many not be available. Therefore, it is neccessary to use fixed path for
# python executable.

$PYTHON2 -m compileall -q .
$PYTHON3 -m compileall -q .

# Python3 with GSL in debug more.
Expand Down Expand Up @@ -68,13 +63,5 @@ $PYTHON3 -m compileall -q .
make coverage
)

# GSL and python2, failure is allowed
set +e
(
mkdir -p $BUILDDIR && cd $BUILDDIR && \
cmake -DPYTHON_EXECUTABLE=$PYTHON2 -DCMAKE_INSTALL_PREFIX=/usr ..
$MAKE && MOOSE_NUM_THREADS=$NPROC ctest -j$NPROC --output-on-failure
)
set -e

echo "All done"
31 changes: 28 additions & 3 deletions .github/workflows/pymoose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Python package
on: [push]

jobs:
build:
name : Python Package
build-ubuntu:
name: Ubuntu Package

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10',3.11,3.12]
python-version: [3.8, 3.9, 3.10, 3.11, 3.12]

steps:
- uses: actions/checkout@v2
Expand All @@ -29,3 +29,28 @@ jobs:
- name: Build
run: |
pip install .
build-mac:
name: MacOSX Package
runs-on: macos-14
strategy:
matrix:
python-version: [3.8, 3.9, 3.10, 3.11, 3.12]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install micromamba
micromamba self-update
micromamba create -n moose numpy matplotlib vpython python3-tk libhdf5 doxygen gsl
micromamba activate moose
- name: Build
run: |
pip install .
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2.3 FATAL_ERROR)
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

# Project to build MOOSE's python module.
project(PyMOOSE)
Expand Down Expand Up @@ -317,13 +317,18 @@ endif( WITH_BOOST )

######################### BUILD PYMOOSE ########################################

if(NOT WITH_LEGACY_BINDING)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/pybind11)
add_subdirectory(pybind11)
else()
message(STATUS "Building legacy python binding.")
add_subdirectory(pymoose)
endif()
# pybind11 should be installed as a dependency.
# It can be easily done with `pip install pybind11`
# See: https://pybind11.readthedocs.io/en/stable/installing.html
# - Subha, Mon Apr 22 14:26:58 IST 2024

# if(NOT WITH_LEGACY_BINDING)
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/pybind11)
# add_subdirectory(pybind11)
# else()
# message(STATUS "Building legacy python binding.")
# add_subdirectory(pymoose)
# endif()


# always override debian default installation directory. It will be installed in
Expand Down
13 changes: 9 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
To contribute, fork this repo and submit your changes via a pull-request.
Before sending pull-request, check the following:
We use the `fork-and-pull` workflow for moose development.

- [ ] Software builds locally
- [ ] `ctest --output-on-failure` passes all tests.
To contribute:
1. Fork this repo on github
2. Make the changes you want to contribute
3. Check that moose builds locally on your version
4. Check all tests pass `ctest --output-on-failure` passes all tests (TODO: cleanup/fix/update the tests)
5. Submit your changes via a pull-request.

After this the repository admin will check your pull request and merge it to the main branch.
10 changes: 8 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Building MOOSE

To build `MOOSE` from source, you need `cmake` and `python-setuptools`. We
recommend to use Python 3.5 or higher. Python 2.7 is also supported.
recommend to use Python 3.8 or higher.

Before running the following command to build and install, make sure that
followings are installed.
Expand All @@ -15,7 +15,7 @@ On Ubuntu-16.04 or higher, these dependencies can be installed with:
sudo apt-get install python-pip python-numpy cmake libgsl-dev g++
```

Now use `pip` to download and install the `pymoose`.
Now use `pip` to download and install `pymoose` from the [github repository](https://github.com/BhallaLab/moose-core).

```
$ pip install git+https://github.com/BhallaLab/moose-core --user
Expand All @@ -41,6 +41,12 @@ from github.
This will build moose, `ctest` will run few tests to check if build process was
successful.

To rebuild, delete the `_build` directory and the generated `_temp__build/` directory and recreate the `_build` directory:

$ cd ..; rm -rf _build; rm -rf _temp__build

and continue the steps following that described above.

To make in debug mode use:
$ cmake -DCMAKE_BUILD_TYPE=Debug ..

Expand Down
2 changes: 1 addition & 1 deletion basecode/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake )
add_library(basecode
Element.cpp
Expand Down
2 changes: 1 addition & 1 deletion basecode/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ string moosePathToColumnName(const string& path, char delim, size_t maxParents)
string toString(double x)
{
char buffer[50];
sprintf(buffer, "%.17g", x);
snprintf(buffer, sizeof buffer, "%.17g", x);
return string(buffer);
}

Expand Down
2 changes: 1 addition & 1 deletion biophysics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake)

if(WITH_GSL)
Expand Down
2 changes: 1 addition & 1 deletion builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake )

# NSDF5 support. Disabled by default.
Expand Down
1 change: 0 additions & 1 deletion devel/docker/travis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ RUN apt update && apt install -y cmake gcc g++ make valgrind \
python-dev python3-dev \
&& rm -rf /var/lib/apt/lists/*

RUN python2 -m pip --no-cache-dir install pyneuroml python-libsbml
RUN python3 -m pip --no-cache-dir install pyneuroml python-libsbml
WORKDIR /root
RUN ls -ltrah
Expand Down
2 changes: 1 addition & 1 deletion device/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake)
add_library(device
PulseGen.cpp
Expand Down
2 changes: 1 addition & 1 deletion diffusion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake)

if(WITH_GSL)
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake)
ADD_LIBRARY(examples
Example.cpp
Expand Down
2 changes: 1 addition & 1 deletion external/fmt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

add_library(fmt STATIC src/format.cc src/os.cc)
target_include_directories(fmt PRIVATE include)
2 changes: 1 addition & 1 deletion external/libsoda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)

find_package(Threads REQUIRED)

Expand Down
35 changes: 0 additions & 35 deletions external/pybind11/.appveyor.yml

This file was deleted.

38 changes: 0 additions & 38 deletions external/pybind11/.clang-format

This file was deleted.

77 changes: 0 additions & 77 deletions external/pybind11/.clang-tidy

This file was deleted.

Loading

0 comments on commit d91ca02

Please sign in to comment.