Skip to content

Commit

Permalink
Addresses issues #1432 and #1433 (closes #1432) (closes #1433).
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 3, 2017
2 parents 5c88c98 + fef8160 commit be20677
Show file tree
Hide file tree
Showing 15 changed files with 472 additions and 38 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -18,6 +18,7 @@ OPTION(USE_PREBUILT_QTWEBKIT_PACKAGE "Use the pre-built version of the QtWebKit

OPTION(USE_PREBUILT_BIOSIGNALMLAPI_PACKAGE "Use the pre-built version of the BioSignalML API package" ON)
OPTION(USE_PREBUILT_CELLMLAPI_PACKAGE "Use the pre-built version of the CellML API package" ON)
OPTION(USE_PREBUILT_NUMLAPI_PACKAGE "Use the pre-built version of the NuML API package" ON)
OPTION(USE_PREBUILT_SBMLAPI_PACKAGE "Use the pre-built version of the SBML API package" ON)
OPTION(USE_PREBUILT_SEDMLAPI_PACKAGE "Use the pre-built version of the SED-ML API package" ON)

Expand Down Expand Up @@ -797,6 +798,7 @@ SET(PLUGINS
api/BioSignalMLAPI
api/CellMLAPI
api/SBMLAPI
api/NuMLAPI
api/SEDMLAPI

dataStore/BioSignalMLDataStore
Expand Down
9 changes: 8 additions & 1 deletion doc/developer/thirdPartyLibraries.html
Expand Up @@ -42,14 +42,21 @@
</ul>
</li>
<li>
 <a href="https://github.com/NuML/NuML/">libNuML</a> 1.1.1: a library for reading and writing <a href="https://github.com/NuML/NuML/">NuML</a> models.
<ul>
<li>Location: <a href="https://github.com/opencor/opencor/tree/master/src/plugins/api/NuMLAPI"><code>[OpenCOR]/src/plugins/api/NuMLAPI</code></a>.</li>
<li>Licensing: <a href="https://opensource.org/licenses/LGPL-2.1">LGPL v2.1</a> (or later).</li>
</ul>
</li>
<li>
 <a href="http://sbml.org/Software/libSBML/">libSBML</a> 5.15.0: a programming library to help you read, write, manipulate, translate and validate <a href="http://www.sbml.org/">SBML</a> files and data streams.
<ul>
<li>Location: <a href="https://github.com/opencor/opencor/tree/master/src/plugins/api/SBMLAPI"><code>[OpenCOR]/src/plugins/api/SBMLAPI</code></a>.</li>
<li>Licensing: <a href="https://opensource.org/licenses/LGPL-2.1">LGPL v2.1</a> (or later).</li>
</ul>
</li>
<li>
 <a href="https://github.com/fbergmann/libSEDML/">libSEDML</a> 0.3.1: a library for reading and writing <a href="http://www.sed-ml.org/">SED-ML</a> models.
 <a href="https://github.com/fbergmann/libSEDML/">libSEDML</a> 0.4.3: a library for reading and writing <a href="http://www.sed-ml.org/">SED-ML</a> models.
<ul>
<li>Location: <a href="https://github.com/opencor/opencor/tree/master/src/plugins/api/SEDMLAPI"><code>[OpenCOR]/src/plugins/api/SEDMLAPI</code></a>.</li>
<li>Licensing: <a href="https://opensource.org/licenses/BSD-2-Clause">BSD 2-Clause</a>.</li>
Expand Down
3 changes: 2 additions & 1 deletion doc/downloads/index.js
Expand Up @@ -37,7 +37,8 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>Graph Panel widget:</strong> can now export a graph panel to various formats (e.g. PDF, PNG, SVG) (see issue <a href=\"https://github.com/opencor/opencor/issues/1123\">#1123</a>)." },
{ "change": "<strong>APIs:</strong> have HAVE_IEEEFP_H properly set in the libSBML, libNuML and libSEDML packages under Windows (see issue <a href=\"https://github.com/opencor/opencor/issues/1432\">#1432</a>). Upgraded the libSEDML package to version 0.4.3 (see issue <a href=\"https://github.com/opencor/opencor/issues/1433\">#1433</a>)." },
{ "change": "<strong>Graph Panel widget:</strong> can now export a graph panel to various formats (e.g. PDF, PNG, SVG) (see issue <a href=\"https://github.com/opencor/opencor/issues/1123\">#1123</a>)." },
{ "change": "<strong>SimulationExperiment view:</strong> added support for the alpha channel in the colours used to customise a graph. Made sure that the GUI is properly initialised when (re)loading a SED-ML file." }
]
},
Expand Down
1 change: 1 addition & 0 deletions doc/user/whatIsNew.js
Expand Up @@ -14,6 +14,7 @@ var jsonData = { "versions": [
},
{ "name": "API",
"entries": [
{ "type": "Added", "description": "<a href=\"https://github.com/NuML/NuML/\">NuML</a> API (via <a href=\"https://github.com/NuML/NuML/\">libNuML</a>)." },
{ "type": "subCategory", "name": "CellML API",
"entries": [
{ "type": "Fixed", "description": "Memory access in the CUSES service." }
Expand Down
206 changes: 206 additions & 0 deletions src/plugins/api/NuMLAPI/CMakeLists.txt
@@ -0,0 +1,206 @@
PROJECT(NuMLAPIPlugin)

# Name and version of our package

SET(PACKAGE_NAME libNuML)
SET(PACKAGE_VERSION 1.1.1)

# Version of our package's libraries

SET(MAJOR_LIBRARY_VERSION 1)
SET(LIBRARY_VERSION ${MAJOR_LIBRARY_VERSION}.1.1)

# Git tag for our library

SET(GIT_TAG v1.1.1)

# Package repository

SET(PACKAGE_REPOSITORY NuML)

# Specify where our local package will be installed

SET(FULL_LOCAL_EXTERNAL_PACKAGE_DIR ${PROJECT_SOURCE_DIR}/${LOCAL_EXTERNAL_PACKAGE_DIR})

# Name of our package's shared library (and of its import library, if any)

IF(WIN32)
SET(SHARED_LIBRARY libnuml${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(IMPORT_LIBRARY libnuml${CMAKE_IMPORT_LIBRARY_SUFFIX})
ELSE()
SET(SHARED_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}numl${CMAKE_SHARED_LIBRARY_SUFFIX_PRE}.${MAJOR_LIBRARY_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX_POST})
SET(IMPORT_LIBRARY ${SHARED_LIBRARY})
ENDIF()

# Retrieve our package's binaries

SET(EXTERNAL_BINARIES_DIR ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/lib)

SET(EXTERNAL_BINARIES
${SHARED_LIBRARY}
)

# Specify the files that need to have their SHA-1 value checked

SET(SHA1_FILES
lib/${SHARED_LIBRARY}
)

IF(WIN32)
LIST(APPEND SHA1_FILES
lib/${IMPORT_LIBRARY}
)
ENDIF()

# Use the pre-built version of our package unless instructed otherwise

IF(USE_PREBUILT_NUMLAPI_PACKAGE)
# Retrieve the plugin's package

STRING(REPLACE "${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/" ""
RELATIVE_PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${REMOTE_EXTERNAL_PACKAGE_DIR}")

IF(WIN32)
IF(RELEASE_MODE)
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} a39db4db954fa9d7dc4ebe30d9bf3483d210cdc5
PACKAGE_REPOSITORY ${PACKAGE_REPOSITORY}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES d7fca96349c39fce1db4f0a87780d1b75014a624
119099b65ce3d3dfa7ad3cc419bf7a963d508420)
ELSE()
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} 987483fe81c3f16b6b05914a6a488c3e8d85e9a1
PACKAGE_REPOSITORY ${PACKAGE_REPOSITORY}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES 60783f45ecb6eac9938351d4793fba79ceb3283f
ce4925551c1759fa812b9441d37e4b331e2caf81)
ENDIF()
ELSEIF(APPLE)
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} ee9401bf34b1ce8dcdf95beca1a88dee3ab34a65
PACKAGE_REPOSITORY ${PACKAGE_REPOSITORY}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES e915e99c817217be7a2562c6bc3656cc42558d6c)
ELSE()
RETRIEVE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${RELATIVE_PROJECT_SOURCE_DIR} 5cdf38db5546509d211bcb964224c7490c9ff97a
PACKAGE_REPOSITORY ${PACKAGE_REPOSITORY}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES 3b179071772ed7820eb0bf4346ba3e75fe82ef27)
ENDIF()
ELSE()
# Build libNuML as an external project
# Note #1: we need libSBML to be built, so we can access it, as well as some
# of its dependencies...
# Note #2: we rely on CONFIGURE_COMMAND rather than CMAKE_GENERATOR and
# CMAKE_ARGS in our call to ExternalProject_Add() since the actual
# code is not under SOURCE_DIR, but under SOURCE_DIR/libnuml...

SET(PACKAGE_BUILD ${PACKAGE_NAME}Build)

IF(WIN32)
IF(RELEASE_MODE)
SET(MODE release)
ELSE()
SET(MODE debug)
ENDIF()
ENDIF()

SET(SBMLAPI_EXT_DIR ${CMAKE_SOURCE_DIR}/src/plugins/api/SBMLAPI/ext)

IF(WIN32)
SET(LIBSBML_INCLUDE_DIR ${SBMLAPI_EXT_DIR}/${MODE}/include)
SET(LIBSBML_LIBRARY ${SBMLAPI_EXT_DIR}/${MODE}/lib/libsbml${CMAKE_IMPORT_LIBRARY_SUFFIX})
ELSE()
SET(LIBSBML_INCLUDE_DIR ${SBMLAPI_EXT_DIR}/include)
SET(LIBSBML_LIBRARY ${SBMLAPI_EXT_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}sbml${CMAKE_SHARED_LIBRARY_SUFFIX_PRE}.5${CMAKE_SHARED_LIBRARY_SUFFIX_POST})
ENDIF()

ExternalProject_Add(${PACKAGE_BUILD}
SOURCE_DIR
${CMAKE_SOURCE_DIR}/ext/${PACKAGE_NAME}
INSTALL_DIR
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}
GIT_REPOSITORY
https://github.com/opencor/NuML
GIT_TAG
${GIT_TAG}
CONFIGURE_COMMAND
${CMAKE_COMMAND} -G ${CMAKE_GENERATOR}
${DEFINE_CMAKE_APPLE_OPTIONS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DLIBSBML_INCLUDE_DIR=${LIBSBML_INCLUDE_DIR}
-DLIBSBML_LIBRARY=${LIBSBML_LIBRARY}
-DWITH_CPP_NAMESPACE=ON
-DWITH_SWIG=OFF
<SOURCE_DIR>/libnuml
BUILD_BYPRODUCTS
<INSTALL_DIR>/lib/${IMPORT_LIBRARY}
DEPENDS
SBMLAPIPlugin
)

# Do some post-processing that is specific to each platform

IF(WIN32)
# We want both our shared and import libraries to be in the same place

ExternalProject_Add_Step(${PACKAGE_BUILD} CopyDLL
COMMAND ${CMAKE_COMMAND} -E copy bin/${SHARED_LIBRARY} lib
WORKING_DIRECTORY ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}
DEPENDEES install)
ELSE()
# Dereference the symbolic link to the libraries since CMake's tar can't
# do this

ExternalProject_Add_Step(${PACKAGE_BUILD} CopyLibrary
COMMAND ${CMAKE_COMMAND} -E remove -f ${SHARED_LIBRARY}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SHARED_LIBRARY_PREFIX}numl${CMAKE_SHARED_LIBRARY_SUFFIX_PRE}.${LIBRARY_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX_POST}
${SHARED_LIBRARY}
WORKING_DIRECTORY ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/lib
DEPENDEES install)
ENDIF()

# Package our external project

CREATE_PACKAGE_FILE(${PACKAGE_NAME} ${PACKAGE_VERSION}
${LOCAL_EXTERNAL_PACKAGE_DIR}
PACKAGE_REPOSITORY ${PACKAGE_REPOSITORY}
PACKAGED_FILES include ${SHA1_FILES}
SHA1_FILES ${SHA1_FILES}
TARGET ${PACKAGE_BUILD})

SET(DEPENDS_ON ${PACKAGE_BUILD})
ENDIF()

# Allow other external projects to find our libNuML package

SET(NUMLAPI_ROOT_DIR ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR} PARENT_SCOPE)
SET(NUMLAPI_INCLUDE_DIR ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/include PARENT_SCOPE)
SET(NUMLAPI_LIBRARY ${FULL_LOCAL_EXTERNAL_PACKAGE_DIR}/lib/${IMPORT_LIBRARY} PARENT_SCOPE)

# Add the plugin
# Note: we would normally use '${PACKAGE_NAME}' rather than 'NuMLAPI', but it
# can't be done here since the name of our package is different from that
# of our plugin...

ADD_PLUGIN(NuMLAPI
SOURCES
../../plugininfo.cpp

src/numlapiplugin.cpp
HEADERS_MOC
src/numlapiplugin.h
QT_MODULES
Core
EXTERNAL_BINARIES_DIR
${EXTERNAL_BINARIES_DIR}
EXTERNAL_BINARIES
${EXTERNAL_BINARIES}
TESTS
tests
DEPENDS_ON
${DEPENDS_ON}
)
52 changes: 52 additions & 0 deletions src/plugins/api/NuMLAPI/src/numlapiplugin.cpp
@@ -0,0 +1,52 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// NuML API plugin
//==============================================================================

#include "numlapiplugin.h"

//==============================================================================

namespace OpenCOR {
namespace NuMLAPI {

//==============================================================================

PLUGININFO_FUNC NuMLAPIPluginInfo()
{
Descriptions descriptions;

descriptions.insert("en", QString::fromUtf8("a plugin to access <a href=\"https://github.com/NuML/NuML/\">libNuML</a>."));
descriptions.insert("fr", QString::fromUtf8("une extension pour accéder <a href=\"https://github.com/NuML/NuML/\">libNuML</a>."));

return new PluginInfo(PluginInfo::Api, false, false,
QStringList() << "SBMLAPI",
descriptions);
}

//==============================================================================

} // namespace NuMLAPI
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
55 changes: 55 additions & 0 deletions src/plugins/api/NuMLAPI/src/numlapiplugin.h
@@ -0,0 +1,55 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// NuML API plugin
//==============================================================================

#pragma once

//==============================================================================

#include "plugininfo.h"

//==============================================================================

namespace OpenCOR {
namespace NuMLAPI {

//==============================================================================

PLUGININFO_FUNC NuMLAPIPluginInfo();

//==============================================================================

class NuMLAPIPlugin : public QObject
{
Q_OBJECT

Q_PLUGIN_METADATA(IID "OpenCOR.NuMLAPIPlugin" FILE "numlapiplugin.json")
};

//==============================================================================

} // namespace NuMLAPI
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
3 changes: 3 additions & 0 deletions src/plugins/api/NuMLAPI/src/numlapiplugin.json
@@ -0,0 +1,3 @@
{
"Keys": [ "NuMLAPIPlugin" ]
}

0 comments on commit be20677

Please sign in to comment.