Skip to content

Commit

Permalink
Merge pull request #916 from sys-bio/develop
Browse files Browse the repository at this point in the history
Merge latest updates for release.
  • Loading branch information
luciansmith authored Jan 7, 2022
2 parents 7a82066 + 6783798 commit d80a80e
Show file tree
Hide file tree
Showing 18,164 changed files with 293,455 additions and 1,222,485 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
85 changes: 85 additions & 0 deletions .azurepipelines/getLLVM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""
Get LLVM from url.
Usage:
python getLLVM.py <llvm_download_link> <llvm_install_prefix?
For example:
python getLLVM.py https://github.com/sys-bio/llvm-13.x/releases/download/llvmorg-13.0.0/llvm13-ubuntu-gcc10-rel.tar.gz /mnt/d/roadrunner/roadrunner/llvm-download-test/ubuntu
"""


import glob
import argparse
import os
from os.path import join, splitext, isdir, isfile
import zipfile
import tarfile
import requests
import io
import shutil

# command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("llvm_download_link", type=str, help="Url to compressed llvm-13.x link to download")
parser.add_argument("llvm_install_prefix", type=str, help="Where to install llvm (directory that will contain bin, include, lib etc")
args = parser.parse_args()

# filename of downloaded zip, llvm-13.x-Darwin-Release.zip
compressed_llvm_filename = args.llvm_download_link.split('/')[-1]

# absolute path to compressed_llvm_filename
abs_compressed_llvm_filename = join(args.llvm_install_prefix, compressed_llvm_filename)

# e.g. ('llvm-13.x-Darwin-Release', '.zip')
downloaded_llvm_folder, ext = splitext(compressed_llvm_filename)
# when link is tar.gz, get rid of extra .tar
if ".tar" in downloaded_llvm_folder:
downloaded_llvm_folder = downloaded_llvm_folder.replace(".tar", "")

# make install prefix if not exists
if not isdir(args.llvm_install_prefix):
os.makedirs(args.llvm_install_prefix)

print("compressed_llvm_filename".ljust(20), compressed_llvm_filename)
print("abs_compressed_llvm_filename".ljust(20), abs_compressed_llvm_filename)
print("downloaded_llvm_folder".ljust(20), downloaded_llvm_folder)
print("args.llvm_download_link".ljust(20), args.llvm_download_link)
print("downloaded_llvm_folder, ext".ljust(20), downloaded_llvm_folder, ext)

# we expect a folder called bin in
abs_downloaded_llvm_folder = join(args.llvm_install_prefix, downloaded_llvm_folder)

# Don't download if we already have it
if not isdir(join(abs_downloaded_llvm_folder, "bin")):
print("downloading llvm-13.x from {}".format(args.llvm_download_link))
r = requests.get(args.llvm_download_link, stream=True)
if ext == ".zip":
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall(args.llvm_install_prefix)
elif ext == ".gz":
z = tarfile.open(fileobj=r.raw, mode="r|gz")
z.extractall(args.llvm_install_prefix)
else:
raise ValueError("Unsupported extension")
else :
print("Found existing llvm, not downloading llvm")

# move from unzip dir to llvm_install_prefix
folders = glob.glob(join(abs_downloaded_llvm_folder, "*"))
print(folders)
for f in folders:
shutil.move(f, args.llvm_install_prefix)


if isfile(abs_compressed_llvm_filename):
os.remove(abs_compressed_llvm_filename)






13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,22 @@ cmake-*
build
out

#test output file(s?)
test/sbml-test-suite/stochastic/results.tsv

install-release
build-debug
build-release
install-debug
roadrunner-install-*

# temp.
sundials
sundials
test/PerformanceTests/biomodels
test/PerformanceTests/biomodels.zip
test/PerformanceTests/simulations
test/PerformanceTests/OldData
build-msvc

biomodels
biomodels.zip
49 changes: 31 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
cmake_minimum_required(VERSION 3.16)


# libRoadRunner semantic versioning (http://semver.org/) - used to generate
# source files expose library version information

#########################################################################
# Version information and include modules

set(ROADRUNNER_VERSION_MAJOR 2)
set(ROADRUNNER_VERSION_MINOR 1)
set(ROADRUNNER_VERSION_PATCH 3)
set(ROADRUNNER_VERSION_MINOR 2)
set(ROADRUNNER_VERSION_PATCH 0)

set(ROADRUNNER_VERSION "${ROADRUNNER_VERSION_MAJOR}.${ROADRUNNER_VERSION_MINOR}.${ROADRUNNER_VERSION_PATCH}")
project(
Expand Down Expand Up @@ -102,6 +103,9 @@ option(BUILD_LLVM "Build the LLVM back end" ON)
# note I've tried using the C backend and it no longer compiles. Could be useful to keep though
option(BUILD_LEGACY_C "Build the legacy C code generating backend (deprecated)" OFF)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "../roadrunner-${CMAKE_GENERATOR_PLATFORM}-${CMAKE_BUILD_TYPE}" CACHE PATH "..." FORCE)
endif()

# should we build the swig python wrapper?
option(BUILD_PYTHON "Build the SWIG generated python wrapper" OFF)
Expand All @@ -121,12 +125,12 @@ if (BUILD_PYTHON)
# build directories
set(PYTHON_PACKAGE_SITE_DIR_BUILD_TREE "${CMAKE_BINARY_DIR}/lib/site-packages" CACHE PATH "Path to Python site packages directory in the build tree")
set(PYTHON_PACKAGE_BUILD_PREFIX "${PYTHON_PACKAGE_SITE_DIR_BUILD_TREE}/roadrunner")
set(RR_PYTHON_TESTING_BUILD_PREFIX "${PYTHON_PACKAGE_BUILD_PREFIX}/testing")
set(RR_PYTHON_TESTING_BUILD_PREFIX "${PYTHON_PACKAGE_BUILD_PREFIX}/tests")

# install directories
set(PYTHON_PACKAGE_SITE_DIR "${CMAKE_INSTALL_PREFIX}/site-packages" CACHE PATH "Path to Python site packages directory in the install tree")
set(PYTHON_PACKAGE_INSTALL_PREFIX "${PYTHON_PACKAGE_SITE_DIR}/roadrunner")#CACHE PATH "Destination for roadrunner python bindings.")
set(RR_PYTHON_TESTING_INSTALL_PREFIX "${PYTHON_PACKAGE_INSTALL_PREFIX}/testing")
set(RR_PYTHON_TESTING_INSTALL_PREFIX "${PYTHON_PACKAGE_INSTALL_PREFIX}/tests")


# plugin directories
Expand Down Expand Up @@ -174,6 +178,8 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Asan")
# and they will only work if CMake can find address sanitizer
# executable.
#
# Only works on macos.
#
# The Asan build is based on the Debug build, but with a few extra flags
#
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
Expand All @@ -191,21 +197,25 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Asan")
endif ()
endif ()

set(WHICH_SANITIZER "address" CACHE STRING "which sanitizer to use. address, memory, thread, leak, undefined")
set(SANITIZER_OPTIONS "-fno-omit-frame-pointer" CACHE STRING "options to pass to command -fsanitize")

message(STATUS "WHICH_SANITIZER ${WHICH_SANITIZER}")

set(CMAKE_C_FLAGS_ASAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=${WHICH_SANITIZER} ${SANITIZER_OPTIONS}" CACHE STRING
"Flags used by the C compiler for Asan build type or configuration." FORCE)

set(CMAKE_CXX_FLAGS_ASAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=${WHICH_SANITIZER} ${SANITIZER_OPTIONS}" CACHE STRING
"Flags used by the C++ compiler for Asan build type or configuration." FORCE)

set(CMAKE_EXE_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=${WHICH_SANITIZER}" CACHE STRING
"Linker flags to be used to create executables for Asan build type." FORCE)

set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=${WHICH_SANITIZER}" CACHE STRING
"Linker lags to be used to create shared libraries for Asan build type." FORCE)
endif ()

Expand Down Expand Up @@ -388,6 +398,7 @@ find_package(PocoFoundation CONFIG REQUIRED)
find_package(PocoNet CONFIG REQUIRED)
find_package(PocoXML CONFIG REQUIRED)
find_package(LLVM REQUIRED)

find_package(SUNDIALS CONFIG REQUIRED)

# not for windows. So not required, but we throw error if not win and not found.
Expand All @@ -403,13 +414,15 @@ set(BUILD_STATIC_LIBS ON)

# install dependencies so clients can use roadrunner from c++/cmake
message(STATUS "CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}")
install(DIRECTORY ${RR_DEPENDENCIES_INSTALL_PREFIX}/lib DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${RR_DEPENDENCIES_INSTALL_PREFIX}/bin DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${RR_DEPENDENCIES_INSTALL_PREFIX}/include DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${RR_DEPENDENCIES_INSTALL_PREFIX}/share DESTINATION ${CMAKE_INSTALL_PREFIX})

install(DIRECTORY "${RR_DEPENDENCIES_INSTALL_PREFIX}/lib" DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(DIRECTORY "${RR_DEPENDENCIES_INSTALL_PREFIX}/bin" DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(DIRECTORY "${RR_DEPENDENCIES_INSTALL_PREFIX}/include" DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(DIRECTORY "${RR_DEPENDENCIES_INSTALL_PREFIX}/share" DESTINATION "${CMAKE_INSTALL_PREFIX}")
if (WIN32)
install(DIRECTORY "${RR_DEPENDENCIES_INSTALL_PREFIX}/cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
# install a cmake script for consumer libraries to easily import roadrunner targets
install(FILES cmake/ImportRoadrunnerAndDependencies.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")
install(FILES "cmake/ImportRoadrunnerAndDependencies.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")

if (${MINGW})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
Expand Down Expand Up @@ -495,7 +508,7 @@ if (BUILD_TESTS)

message(STATUS "building tests")

file(GLOB PYTHON_TEST_FILES "wrappers/Python/roadrunner/testing/*.*")
file(GLOB PYTHON_TEST_FILES "test/python/*.*")

file(GLOB PYTHON_TEST_DATA "${CMAKE_CURRENT_SOURCE_DIR}/test/rrtest_files/*.rrtest")

Expand All @@ -504,21 +517,21 @@ if (BUILD_TESTS)
foreach (f ${PYTHON_TEST_FILES})
if (NOT IS_DIRECTORY ${f})
get_filename_component(FILE_NAME ${f} NAME)
configure_file(${f} lib/site-packages/roadrunner/testing/${FILE_NAME} COPYONLY)
configure_file(${f} lib/site-packages/roadrunner/tests/${FILE_NAME} COPYONLY)
endif ()
endforeach ()

foreach (f ${PYTHON_TEST_DATA})
if (NOT IS_DIRECTORY ${f})
get_filename_component(FILE_NAME ${f} NAME)
configure_file(${f} lib/site-packages/roadrunner/testing/test_data/${FILE_NAME} COPYONLY)
configure_file(${f} lib/site-packages/roadrunner/tests/test_data/${FILE_NAME} COPYONLY)
endif ()
endforeach ()

foreach (f ${TEST_DATA_XML})
if (NOT IS_DIRECTORY ${f})
get_filename_component(FILE_NAME ${f} NAME)
configure_file(${f} lib/site-packages/roadrunner/testing/test_data/${FILE_NAME} COPYONLY)
configure_file(${f} lib/site-packages/roadrunner/tests/test_data/${FILE_NAME} COPYONLY)
endif ()
endforeach ()

Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ libroadrunner is a C/C++ library that supports simulation of SBML based models.

We provide C/C++, Python and Julia bindings.

Sometimes the link to the C API docs goes bad in the readthedocs. If this happens, here is a permanent link that should remain whatever happens:

# Installation
Python front end (stable):

Expand All @@ -37,7 +39,13 @@ Experimental front end:

`pip install libroadrunner-experimental`

# [Click here to get Documentation](http://sys-bio.github.io/roadrunner/)
# Documentation

[Python API Documentation](http://sys-bio.github.io/roadrunner/)

[C API Documention](https://sys-bio.github.io/roadrunner/OriginalDoxygenStyleDocs/html/index.html)

# Copyright

Copyright 2013-2021

Expand Down Expand Up @@ -84,19 +92,21 @@ downloaded from http://sourceforge.net/projects/libroadrunner/files and can be i
ready for use.

## Docker images
Currently we have a manylinux2014 "base" and "build" docker images. The
Currently we have a manylinux2014 [build](https://hub.docker.com/repository/docker/ciaranwelsh/roadrunner-manylinux2014-base) docker image. The
base provides the environment you need to be able to build roadrunner
yourself on manylinux2014 (centos 7). The "build" image, in constrast
is an image where roadrunner has already been built on top of the "base"
image.
yourself on manylinux2014 (centos 8).

There are two docker tags associated with roadrunner depending on which
version of llvm you want to build with. The options are llvm-13.x for newer
roadrunner versions (> v2.2.0) and llvm-6.x for older.

To get the base image:

`docker pull ciaranwelsh/roadrunner-manylinux2014-base:latest`
`docker pull ciaranwelsh/roadrunner-manylinux2014-base:llvm-13.x`

and the build image:

`docker pull ciaranwelsh/roadrunner-manylinux2014-build:latest`
`docker pull ciaranwelsh/roadrunner-manylinux2014-build:llvm-13.x`

Docker build scripts can be found under the `docker` directory from the roadrunner
root directory.
Expand Down
Loading

0 comments on commit d80a80e

Please sign in to comment.