Commit 58ffbe37 authored by Philipp  Trunschke's avatar Philipp Trunschke

simplify build.sh & add support for build variants

parent 14d78400
Pipeline #2025 failed with stages
in 13 minutes and 12 seconds
#!/bin/bash
cp conda/xerus-dev/config.mk .
make install
CXX = g++
COMPATIBILITY = -std=c++17
COMPILE_THREADS = 8 # Number of threads to use during link time optimization.
HIGH_OPTIMIZATION = TRUE # Activates -O3 -march=native and some others
OTHER += -fopenmp
PYTHON3_CONFIG = python3-config
PYTEST3 = /usr/local/bin/py.test
LOGGING += -D XERUS_LOG_INFO # Information that is not linked to any unexpected behaviour but might nevertheless be of interest.
LOGGING += -D XERUS_LOGFILE # Use `error.log` file instead of cerr
LOGGING += -D XERUS_LOG_ABSOLUTE_TIME # Print absolute times instead of relative to program time
INSTALL_LIB_PATH = ${PREFIX}/lib # Path where to install the libxerus.so shared library.
INSTALL_HEADER_PATH = ${PREFIX}/include # Path where to install the xerus header files.
INSTALL_PYTHON3_PATH = ${HOME}/.local/lib/python3.5/site-packages/ # Path for the installation of the python3 bindings.
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
BOOST_PYTHON3 = -lboost_python # -py35
package:
name: xerus
version: "4.0.1"
source:
git_url: https://github.com/libxerus/xerus.git
git_tag: conda
requirements:
build:
- openblas
- suitesparse
- lapack
- boost
- binutils
- openmp
run:
- openblas
- suitesparse
- lapack
- boost
- binutils
- openmp
build:
# already linked relative to $ORIGIN, so we need to turn
# off conda's relocation mechanism because it screws it up
binary_relocation: false
about:
home: https://git.hemio.de/xerus/xerus.git
license: AGPL v3.0
.PHONY: test
TEST_NAME = XerusTest
TEST_SOURCES = $(wildcard src/xerus/test/*.cpp)
UNIT_TEST_SOURCES = $(wildcard src/unitTests/*.cxx)
TEST_OBJECTS = $(TEST_SOURCES:%.cpp=build/.testObjects/%.o)
TEST_DEPS = $(TEST_SOURCES:%.cpp=build/.testObjects/%.d)
UNIT_TEST_OBJECTS = $(UNIT_TEST_SOURCES:%.cxx=build/.unitTestObjects/%.o)
UNIT_TEST_DEPS = $(UNIT_TEST_SOURCES:%.cxx=build/.unitTestObjects/%.d)
# ------------------------------------------------------------------------------------------------------
# Load the configurations provided by the user and set up general options
# ------------------------------------------------------------------------------------------------------
include config.mk
include makeIncludes/general.mk
include makeIncludes/warnings.mk
include makeIncludes/optimization.mk
FLAGS = $(strip $(COMPATIBILITY) $(WARNINGS) $(OPTIMIZE) $(LOGGING) $(DEBUG) $(ADDITIONAL_INCLUDE) $(OTHER))
# ------------------------------------------------------------------------------------------------------
# Load dependency files
# ------------------------------------------------------------------------------------------------------
-include $(TEST_DEPS)
-include $(UNIT_TEST_DEPS)
-include build/.preCompileHeaders/xerus.h.d
# Fake rule to create arbitary headers, to prevent errors if files are moved/renamed
%.h:
test: $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS)
$(CXX) -D XERUS_UNITTEST $(FLAGS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) -lxerus -lxerus_misc $(SUITESPARSE) $(LAPACK_LIBRARIES) $(ARPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -o $(TEST_NAME)
$(TEST_NAME) all
pytest src/pyTests
#bash bootstrap.sh --with-libraries=system,filesystem,math --prefix=${PREFIX}
#./b2 -q --build-type=minimal --layout=system variant=release debug-symbols=off threading=multi runtime-link=shared link=shared install
#!/bin/bash
set -e # exit when any command fails
set -x -e
cd xerus
cat <<EOF >config.mk
CXX = ${CXX}
......@@ -9,42 +11,34 @@ COMPILE_THREADS = 8 # Number of threads to use during link
HIGH_OPTIMIZATION = TRUE # Activates -O3 -march=native and some others
OTHER += -fopenmp
PYTHON3_CONFIG = `python3-config --cflags`
PYTHON3_CONFIG += `python3-config --ldflags`
PYTHON3_CONFIG = \`python3-config --cflags --ldflags\`
LOGGING += -D XERUS_LOG_INFO # Information that is not linked to any unexpected behaviour but might nevertheless be of interest.
LOGGING += -D XERUS_LOGFILE # Use 'error.log' file instead of cerr
LOGGING += -D XERUS_LOG_ABSOLUTE_TIME # Print absolute times instead of relative to program time
XERUS_NO_FANCY_CALLSTACK = TRUE # Show simple callstacks only
INSTALL_LIB_PATH = ${PREFIX}/lib # Path where to install the libxerus.so shared library.
INSTALL_HEADER_PATH = ${PREFIX}/include # Path where to install the xerus header files.
INSTALL_PYTHON3_PATH = ${PREFIX}/lib/python${PY_VER}
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
BOOST_LIBS = -lboost_filesystem
BOOST_PYTHON3 = -lboost_python${CONDA_PY}
OTHER+= -L${BUILD_PREFIX}/lib
OTHER += -I${CONDA_PREFIX}/include -I${CONDA_PREFIX}/lib/python${PY_VER}/site-packages/numpy/core/include/
OTHER += -L${CONDA_PREFIX}/lib
EOF
test ${CONDA_PY} = ${PY_VER//./} # this should always be the case
printenv
export CPP_INCLUDE_PATH=${BUILD_PREFIX}/include:${BUILD_PREFIX}/lib/python${PY_VER}/site-packages/numpy/core/include/
export CPLUS_INCLUDE_PATH=${BUILD_PREFIX}/include:${BUILD_PREFIX}/lib/python${PY_VER}/site-packages/numpy/core/include/
export CXX_INCLUDE_PATH=${BUILD_PREFIX}/include:${BUILD_PREFIX}/lib/python${PY_VER}/site-packages/numpy/core/include/
export LIBRARY_PATH=${BUILD_PREFIX}/lib
ln -s ${CONDA_PREFIX}/include/ ${CONDA_PREFIX}/include/suitesparse
make python3
python3 setup.py install --prefix=${PREFIX}
ln -sfn ${BUILD_PREFIX}/include/ ${BUILD_PREFIX}/include/suitesparse # overwrite existing symbolic links
mkdir -p ${PREFIX}/lib/python${PY_VER}
mkdir -p ${PREFIX}/include/
# INCLUDE_PATH="${PREFIX}/include"
# mkdir -p ${INCLUDE_PATH}
# cp include/xerus.h ${INCLUDE_PATH}
# cp -r include/xerus ${INCLUDE_PATH}
make test -j$((${CPU_COUNT}-1))
# LIBRARY_PATH="${PREFIX}/lib"
# mkdir -p ${LIBRARY_PATH}
# cp build/libxerus.so ${LIBRARY_PATH}
# cp build/libxerus_misc.so ${LIBRARY_PATH}
make install
rm config.mk
{% set name = "Xerus" %}
{% set version = "4.0.1" %}
{% set branch = "pybind11" %}
package:
name: xerus
version: "4.0.1"
name: {{ name|lower }}
version: {{ version }}
source:
git_url: https://github.com/libxerus/xerus.git
git_tag: development
- git_url: https://github.com/libxerus/xerus.git
git_tag: {{ branch }}
# git_depth: 1 # perform shallow clone
folder: xerus
build:
skip: true # [py<34 or win]
requirements:
build:
- make
- {{ compiler('cxx') }}
- make
- openblas
- suitesparse
- lapack
- boost=1.69.0
- python=3.7
- numpy>=1.16
#- binutils # former source of bfd
- openmp
- boost >=1.69.0
- python
- numpy {{ numpy }}
#- gdb # bfd
#- backward-cpp # option for better python-like backtraces
- openmp
run:
- openblas
- suitesparse
- lapack
- boost=1.69.0
- python=3.7
- numpy>=1.16
#- binutils # former source of bfd
- openmp
- boost >=1.69.0
- python
- numpy {{ numpy }}
#- gdb # bfd
#- backward-cpp # option for better python-like backtraces
- openmp
#test:
# files:
# - Makefile
#
# source_files:
# - makeIncludes
# - src/xerus/test
# - src/unitTests
# - src/pyTests
#
# requires:
# - make
# - {{ compiler('cxx') }}
# - pytest
build:
# already linked relative to $ORIGIN, so we need to turn
# off conda's relocation mechanism because it screws it up
binary_relocation: true
about:
home: https://git.hemio.de/xerus/xerus.git
license: AGPL v3.0
license: "AGPL 3.0"
license_file: LICENSE
summary: "A c++ library for numerical calculations with higher order tensors"
description: |
The Xerus library is a general purpose library for numerical calculations with higher order tensors, Tensor-Train Decompositions / Matrix Product States and other Tensor Networks.
The focus of development was the simple usability and adaptibility to any setting that requires higher order tensors or decompositions thereof.
doc_url: https://www.libxerus.org/
dev_url: https://git.hemio.de/xerus/xerus
extra:
recipe-maintainers:
- trunschk
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