Commit caf30b90 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

make the whole pipeline work

parent 030ac51c
......@@ -22,3 +22,10 @@ docs/site/
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
#vim
.*.swp
#BinaryBuilder
/build
/products
MIT License
Copyright (c) 2021 Luxembourg Centre for Systems Biomedicine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
libsbml-cxxwrapjl/LICENSE
\ No newline at end of file
......@@ -2,3 +2,7 @@ name = "SBML"
uuid = "e5567a89-2604-4b09-9718-f5f78e97c3bb"
authors = ["Mirek Kratochvil <exa.exa@gmail.com>"]
version = "0.1.0"
[deps]
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
SBML_jll = "bb12108a-f4ef-5f88-8ef3-0b33ff7017f1"
# SBML.jl
This is a simple wrap of some of the libSBML functionality.
Current status is "under development", something works, more wrapped stuff will
be added by need.
## How to use this
First, build the C++ library and a wrapper and register it in your julia
installation. You usually want to specify a single architecture to build, to
avoid building all of them.
```
./build_tarballs.jl x86_64-linux-gnu --deploy=local
```
After that, you should be able to load the SBML in Julia:
```
Pkg] dev --local .
julia> using SBML
julia> getLibSBMLDottedVersion()
"5.19.0"
```
#!/usr/bin/env julia
using BinaryBuilder, Pkg
# This needs unprivileged containers:
# sysctl kernel.unprivileged_userns_clone=1
julia_version = v"1.5.3"
name = "SBML"
version = v"5.19.0"
......@@ -14,25 +13,64 @@ sources = [
]
script = raw"""
find ${prefix}
cd ${WORKSPACE}/srcdir/libsbml-5.19.0
if [[ $target == i686-* ]] || [[ $target == arm-* ]]; then
export processor=pentium4
else
export processor=x86-64
fi
# first install SBML to a temp location
cd ${WORKSPACE}/srcdir
SBMLNAME=libsbml-*
cd ${WORKSPACE}/srcdir/${SBMLNAME}
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${WORKSPACE}/srcdir/libsbml-install -DCMAKE_INCLUDE_PATH="${prefix}/include/libxml2;${prefix}/include" -DCMAKE_LIBRARY_PATH=${prefix}/lib ..
cmake \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_LIBRARY_PATH=${prefix}/lib \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_INCLUDE_PATH="${prefix}/include/libxml2;${prefix}/include" \
..
make -j${nproc}
make install
# now the wrapper
cd ${WORKSPACE}/srcdir/wrapper
mkdir build
cd build
PKG_CONFIG_PATH=${WORKSPACE}/srcdir/libsbml-install/lib/pkgconfig cmake -DCMAKE_INSTALL_PREFIX=${prefix} ..
SBML_PC_DIR="${prefix}/lib/pkgconfig"
PKG_CONFIG_PATH=$SBML_PC_DIR pkg-config libsbml --cflags --libs
PKG_CONFIG_PATH=${SBML_PC_DIR} cmake \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_LIBRARY_PATH=${prefix}/lib \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DJulia_PREFIX=${prefix} \
..
make -j${nproc}
make install
# install licenses (note: using `cp` is not fine, but the build env lacks
# `install` version that could do this correctly)
LICENSEDIR=${prefix}/share/licenses/SBML
mkdir -p $LICENSEDIR
cp ${WORKSPACE}/srcdir/wrapper/LICENSE $LICENSEDIR/LICENSE-wrapper
cp ${WORKSPACE}/srcdir/${SBMLNAME}/LICENSE.txt $LICENSEDIR/LICENSE-libSBML
cp ${WORKSPACE}/srcdir/${SBMLNAME}/COPYING.txt $LICENSEDIR/COPYING-libSBML
"""
#platforms = supported_platforms()
platforms=[
Linux(:x86_64, libc=:glibc),
]
platforms = supported_platforms()
#platforms = [ Linux(:x86_64, libc=:glibc) ]
platforms = expand_cxxstring_abis(platforms)
products = [
LibraryProduct("libsbml-cxxwrapjl", :libsbml),
......@@ -40,9 +78,12 @@ products = [
dependencies = [
Dependency("libcxxwrap_julia_jll"),
BuildDependency(PackageSpec(name="Julia_jll")), #see ygdrassil/SDPA
Dependency("CompilerSupportLibraries_jll"),
BuildDependency(PackageSpec(name="libjulia_jll", version=julia_version)),
Dependency("XML2_jll"),
Dependency("Zlib_jll"),
]
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version=v"10",
julia_compat = "$(julia_version.major).$(julia_version.minor)")
......@@ -3,26 +3,35 @@ project(sbml-cxxwrapjl)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_MACOSX_RPATH 1)
#TODO why? set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_VERBOSE_MAKEFILE ON)
find_package(JlCxx REQUIRED)
get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")
message(STATUS "Found JlCxx at ${JlCxx_location}")
set(CMAKE_MACOSX_RPATH 0)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
find_package(JlCxx)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${Julia_LIBRARY_DIR}")
#get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
#get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
#set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")
#message(STATUS "Found JlCxx at ${JlCxx_location}")
include_directories(${Julia_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${INTERFACE_INCLUDE_DIRECTORIES})
find_package(PkgConfig)
pkg_check_modules(SBML libsbml REQUIRED)
message(STATUS "SBML includedir: ${SBML_INCLUDEDIR}")
add_library(sbml-cxxwrapjl SHARED
src/cxxwrap.cpp
src/versions.cpp
)
target_include_directories(sbml-cxxwrapjl PUBLIC ${SBML_INCLUDEDIR})
target_include_directories(sbml-cxxwrapjl SYSTEM PUBLIC ${SBML_INCLUDEDIR})
target_link_directories(sbml-cxxwrapjl PUBLIC ${SBML_LIBDIR})
target_link_libraries(sbml-cxxwrapjl
${SBML_LIBRARIES}
JlCxx::cxxwrap_julia)
install(TARGETS sbml-cxxwrapjl)
MIT License
Copyright (c) 2021 Luxembourg Centre for Systems Biomedicine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
module SBML
using CxxWrap
using SBML_jll
# TODO: load the libsbml project from the BinaryBuilder destination
@wrapmodule("./libsbml-cxxwrapjl.so")
@wrapmodule(libsbml)
# version tools
export getLibSBMLDependencyVersionOf,
getLibSBMLDottedVersion,
getLibSBMLVersion,
getLibSBMLVersionString,
isLibSBMLCompiledWith
function __init__()
@initcxx
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment