Skip to content

Commit

Permalink
Merge pull request #10 from sanjayankur31/enh/update-v2.1
Browse files Browse the repository at this point in the history
Update for NeuroML v2.1
  • Loading branch information
sanjayankur31 authored Mar 12, 2021
2 parents 7f9c99b + 8c06d12 commit ba7c849
Show file tree
Hide file tree
Showing 191 changed files with 9,580 additions and 56,195 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
working-directory: ${{github.workspace}}/NeuroML_API_build
shell: bash
run: |
cmake $GITHUB_WORKSPACE
cmake $GITHUB_WORKSPACE -DREGENERATE_BINDINGS=ON
- name: Build
working-directory: ${{github.workspace}}/NeuroML_API_build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
working-directory: ${{github.workspace}}/NeuroML_API_build
shell: bash
run: |
cmake $GITHUB_WORKSPACE
cmake $GITHUB_WORKSPACE -DREGENERATE_BINDINGS=ON
- name: Build
working-directory: ${{github.workspace}}/NeuroML_API_build
Expand Down
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ language: cpp

sudo: required

dist: trusty
dist: focal

compiler:
- gcc

install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq cmake libxerces-c-dev
script:
- sudo apt-get install wget libxerces-c-dev xsdcxx cmake -qq

script:
- ls -alt
- mkdir NeuroML_API_build
- cd NeuroML_API_build
- cmake ..
- cmake -DREGENERATE_BINDINGS=ON ..
- make
- ctest
- ./create_net network.nml
- ./example network.nml
- ls -alt

37 changes: 23 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
#
# CMake settings for building & installing the NeuroML2 C++ API

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.14)
cmake_policy(SET CMP0022 NEW) # Link interfaces for export
cmake_policy(SET CMP0028 NEW) # Strict use of :: in target names
cmake_policy(SET CMP0042 NEW) # Mac OS @rpath
cmake_policy(SET CMP0048 NEW) # VERSION option to project()

# Note: the version number uses Semantic Versioning http://semver.org/
project(NeuroML_API VERSION 0.1.0)
project(NeuroML_API
VERSION 2.1.0
DESCRIPTION "C++ API for NeuroML 2"
HOMEPAGE_URL "https://github.com/NeuroML/NeuroML_API"
)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules)

# Developer settable options
############################

# Which schema to provide the API for
set(NeuroML_SCHEMA_PATH "${PROJECT_SOURCE_DIR}/src/schema/NeuroML_v2beta4.xsd"
set(NeuroML_SCHEMA_PATH "${PROJECT_SOURCE_DIR}/src/schema/NeuroML_v2.1.xsd"
CACHE PATH
"Path to the schema file to base the API on.")

get_filename_component(NeuroML_SCHEMA_ABSPATH "${NeuroML_SCHEMA_PATH}" REALPATH)
get_filename_component(NeuroML_SCHEMA_NAME "${NeuroML_SCHEMA_PATH}" NAME_WE)
get_filename_component(NeuroML_SCHEMA_NAME "${NeuroML_SCHEMA_ABSPATH}" NAME_WLE)

# Default to shared libs
option(BUILD_SHARED_LIBS "Build NeuroML API as a shared library" ON)
Expand Down Expand Up @@ -52,7 +56,7 @@ configure_file(
"${PROJECT_SOURCE_DIR}/src/neuroml.hxx.in"
"${PROJECT_BINARY_DIR}/src/neuroml.hxx"
)

# Add the binary tree to the search path for include files
# so that we will find generated sources
include_directories("${PROJECT_BINARY_DIR}/src")
Expand All @@ -61,10 +65,15 @@ include_directories("${PROJECT_BINARY_DIR}/src")
find_package(XercesC REQUIRED)
list(APPEND NeuroML_INCLUDES "${XercesC_INCLUDE_DIRS}")

# Can we regenerate the schema wrapper?
find_package(XSD QUIET)
if (XSD_FOUND)
list(APPEND NeuroML_INCLUDES "${XSD_INCLUDE_DIRS}")
# XSD
find_package(XSD REQUIRED)
list(APPEND NeuroML_INCLUDES "${XSD_INCLUDE_DIRS}")

# Regenerate bindings?
set (REGENERATE_BINDINGS OFF CACHE BOOL "Regenerate the C++ bindings. [default: OFF]")

# Yes: and use newly generated copy
if (REGENERATE_BINDINGS)
file(GLOB _XSD_DEPS "src/schema/*.txt")
xsd_schema(NeuroML_SCHEMA_SRCS "${NeuroML_SCHEMA_PATH}" "${_XSD_DEPS}"
--options-file "${PROJECT_SOURCE_DIR}/src/schema/XsdOptions.txt")
Expand All @@ -74,12 +83,12 @@ if (XSD_FOUND)
${PROJECT_SOURCE_DIR}/src/schema
COMMENT "Copying new XSD wrappers to source tree"
VERBATIM)
else (XSD_FOUND)
# Use pre-generated sources & CodeSynthesis headers shipped with the project
set(XSD_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/libxsd")
list(APPEND NeuroML_INCLUDES "${XSD_INCLUDE_DIR}" "${PROJECT_SOURCE_DIR}/src/schema")
else (REGENERATE_BINDINGS)
# No: use pre-generated bindings
# Will fail if bindings cannot be found in the src/schema directory
list(APPEND NeuroML_INCLUDES "${PROJECT_SOURCE_DIR}/src/schema")
set(NeuroML_SCHEMA_SRCS "${PROJECT_SOURCE_DIR}/src/schema/${NeuroML_SCHEMA_NAME}.cxx")
endif (XSD_FOUND)
endif (REGENERATE_BINDINGS)

# The main API library
add_library(neuroml ${NeuroML_SCHEMA_SRCS} src/NeuroML_custom.cxx)
Expand Down
6 changes: 3 additions & 3 deletions Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ PROJECT_NAME = "NeuroML C++ API"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER =
PROJECT_NUMBER = "@CMAKE_PROJECT_VERSION@"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF =
PROJECT_BRIEF = "@CMAKE_PROJECT_DESCRIPTION@"

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.

PROJECT_LOGO =
PROJECT_LOGO = "@CMAKE_SOURCE_DIR@/neuroml_logo.png"

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
Expand Down
62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ C++ API for NeuroML 2.

[![Build Status](https://travis-ci.org/NeuroML/NeuroML_API.svg?branch=master)](https://travis-ci.org/NeuroML/NeuroML_API)
[![GitHub](https://img.shields.io/github/license/NeuroML/NeuroML_API)](https://github.com/NeuroML/NeuroML_API/blob/master/License.txt)
![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/NeuroML/NeuroML_API?include_prereleases)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/NeuroML/NeuroML_API)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/NeuroML/NeuroML_API)](https://github.com/NeuroML/NeuroML_API/pulls)
[![GitHub issues](https://img.shields.io/github/issues/NeuroML/NeuroML_API)](https://github.com/NeuroML/NeuroML_API/issues)
[![GitHub Org's stars](https://img.shields.io/github/stars/NeuroML?style=social)](https://github.com/NeuroML)
Expand All @@ -12,7 +14,7 @@ C++ API for NeuroML 2.

## Using the API

For more info on the generated C++ structure, see the [XSD user manual].
For more info on the generated C++ structure, see the [XSD user manual](https://www.codesynthesis.com/products/xsd/).
The sample programs in the test folder will also give you a reasonable
idea of how things work.

Expand All @@ -36,47 +38,67 @@ If you installed the NeuroML_API in a non-standard location, you may need
to set the `CMAKE_PREFIX_PATH` CMake variable to that location in order to
find the package.

## Building the API yourself
## Building the API

The NeuroML API is built using CMake, and the process works best with
'out of source' builds, where you build the API in a folder separate
from the source tree. Having cloned the repository, we therefore suggest
you create a separate 'NeuroML_API_build' folder adjacent to the source,
change into it, and run
The NeuroML API is built using CMake (versions >= 3.14), and the process works
best with 'out of source' builds, where you build the API in a folder separate
from the source tree. Having cloned the repository, we therefore suggest you
create a separate 'NeuroML_API_build' folder adjacent to the source, change
into it, and then run the build configuration commands:

```
mkdir NeuroML_API_build
cd NeuroML_API_build
cmake ../NeuroML_API
```

to configure the build. You may then run
You may then run

* `make` to build,
* `make doc` to build the HTML documentation using Doxygen (in a `docs`
subfolder of your build folder; only available if Doxygen installed),
* `ctest` (or `make test`) to run tests,
* `sudo make install` to install on your system, or
* `cpack` to generate an installable package (see [cpack documentation]).
* `cpack` to generate an installable package (see [cpack documentation](https://cmake.org/cmake/help/latest/manual/cpack.1.html)).

The default CMake options should be appropriate for most cases. The only
essential external dependency is [Xerces C++] which should be found
automatically if installed.
essential external dependencies are [Xerces
C++](http://xerces.apache.org/xerces-c/) and [CodeSynthesis
XSD](https://www.codesynthesis.com/products/xsd/).

On Ubuntu based systems, you can install Xerces and xsd from the standard
repositories using `apt`:

```
sudo apt-get install xsdcxx libxerces-c-dev
```

On Fedora and other RPM based distributions, you can install Xerces and xsd
from the standard repositories using `dnf` or `yum`:

```
sudo dnf install xsd xerces-c-devel
```

If you install xsd in a non-standard location, please set the `XSD_ROOT`
_environment_ variable to the root folder for the software (i.e. the folder
containing `bin` and `libxsd` folders).

You may wish to change the `CMAKE_INSTALL_PREFIX` to specify where the API
will be installed. The generated library will be placed in a `lib` subfolder,
and all necessary headers in an `include/neuroml` subfolder.

If you wish to regenerate the C++ bindings (because you have changed the
XML Schema or xsdcxx options) you will need CodeSynthesis XSD installed on
your system and findable by CMake. The build will search standard install
locations, but you can also set the `XSD_ROOT` _environment_ variable to the
root folder for the software (i.e. the folder containing `bin` and `libxsd`
folders). You can also change the schema file to use by setting the variable
XML Schema or xsdcxx options) you will need to pass `REGENERATE_BINDINGS=ON` to
the CMake command:

```
cmake -DREGENERATE_BINDINGS=ON ...
```

You can also change the path to the schema file to use by setting the variable
`NeuroML_SCHEMA_PATH` in CMake.

Once the bindings have been regenerated, you can run `make copy_wrappers`
to copy the new versions back into the source tree, for committing to the
repository.

[XSD user manual]: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/
[cpack documentation]: https://cmake.org/cmake/help/v3.5/manual/cpack.1.html
[Xerces C++]: http://xerces.apache.org/xerces-c/
2 changes: 1 addition & 1 deletion cmake/modules/FindXSD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ MACRO( XSD_SCHEMA NAME FILE EXTRA_DEPS)
# destination file path sans any extension and then build paths to the
# generated files.
#
GET_FILENAME_COMPONENT( xs_FILE "${FILE}" NAME_WE )
GET_FILENAME_COMPONENT( xs_FILE "${FILE}" NAME_WLE )
GET_FILENAME_COMPONENT( xs_FILE_DIR "${FILE}" DIRECTORY )
file(RELATIVE_PATH xs_FILE_REL "${CMAKE_SOURCE_DIR}" "${FILE}" )
# set(xs_OUT_TMP "${CMAKE_BINARY_DIR}/${xs_FILE_REL}")
Expand Down
89 changes: 0 additions & 89 deletions libxsd/FLOSSE

This file was deleted.

Loading

0 comments on commit ba7c849

Please sign in to comment.