diff --git a/.circleci/NiceLinuxDockerfile b/.circleci/NiceLinuxDockerfile new file mode 100644 index 0000000..8ef5518 --- /dev/null +++ b/.circleci/NiceLinuxDockerfile @@ -0,0 +1,8 @@ +FROM debian:testing +RUN mkdir /work +WORKDIR /work +RUN \ + apt update && \ + apt install -y --no-install-recommends clang ssh git tar zip ca-certificates && \ + apt install -y cmake python-pip && \ + rm -rf /var/lib/apt/lists/* diff --git a/.circleci/__init__.cpp b/.circleci/__init__.cpp new file mode 100644 index 0000000..fa929b8 --- /dev/null +++ b/.circleci/__init__.cpp @@ -0,0 +1,78 @@ +#define NOCROSSCONSTRUCTORS + + +#include +#include +#include +#include + +#define assert(x) if(!x) {throw std::runtime_error("assertion failed");} + +#include + +#include + +#include "docstrings.hpp" +#include "operations/creation.hpp" +#include "types/bitvector.hpp" +#include "types/encodedvector.hpp" +#include "types/intvector.hpp" +#include "types/suffixarray.hpp" +#include "types/wavelet.hpp" + +namespace py = pybind11; + + +PYBIND11_MODULE(pysdsl, m) +{ + m.doc() = "sdsl-lite bindings for python"; + + auto iv_classes = add_int_vectors(m); + + py::class_>& bit_vector_cls = std::get<1>(iv_classes); + + auto bit_vector_classes = std::make_tuple(bit_vector_cls); + + // auto tmp = add_bitvectors(m, bit_vector_cls); + // auto compressed_bit_vector_classes = std::get<0>(tmp); + // auto cbv_propagate = std::get<1>(tmp); + + // auto enc_classes = add_encoded_vectors(m); + + // auto wavelet_classes = add_wavelet(m, cbv_propagate); + + // auto csa_classes = add_csa(m); + + for_each_in_tuple(iv_classes, make_inits_many_functor(iv_classes)); + // for_each_in_tuple(iv_classes, make_inits_many_functor(enc_classes)); + // for_each_in_tuple(iv_classes, + // make_inits_many_functor(compressed_bit_vector_classes)); + // for_each_in_tuple(iv_classes, make_inits_many_functor(wavelet_classes)); + + // for_each_in_tuple(enc_classes, make_inits_many_functor(iv_classes)); +// #ifndef NOCROSSCONSTRUCTORS + // for_each_in_tuple(enc_classes, make_inits_many_functor(enc_classes)); + //for_each_in_tuple(enc_classes, make_inits_many_functor(wavelet_classes)); +// #endif + + // for_each_in_tuple(compressed_bit_vector_classes, + // make_inits_many_functor(bit_vector_classes)); +// #ifndef NOCROSSCONSTRUCTORS + // for_each_in_tuple(compressed_bit_vector_classes, make_inits_many_functor(compressed_bit_vector_classes)); +// #endif + + // for_each_in_tuple(wavelet_classes, make_inits_many_functor(iv_classes)); +// #ifndef NOCROSSCONSTRUCTORS + // for_each_in_tuple(wavelet_classes, make_inits_many_functor(enc_classes)); + // for_each_in_tuple(wavelet_classes, + // make_inits_many_functor(wavelet_classes)); +// #endif + + for_each_in_tuple(iv_classes, make_pysequence_init_functor()); + // for_each_in_tuple(enc_classes, make_pysequence_init_functor()); + //for_each_in_tuple(compressed_bit_vector_classes, + // make_pysequence_init_functor()); + + // for_each_in_tuple(wavelet_classes, make_pysequence_init_functor()); + // for_each_in_tuple(csa_classes, make_pysequence_init_functor()); +} diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..ae5319b --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,53 @@ +version: 2 +jobs: + build: + docker: + - image: ivigns/nice-linux:debian-0.0.3 + resource_class: xlarge + working_directory: /work + steps: + - checkout + - run: + name: build + command: | + git submodule sync + git submodule update --init --recursive + cd /work/libdivsufsort + git pull origin master + cd /work/sdsl-lite + git pull origin master + cd /work/sdsl-lite/external/libdivsufsort + git pull origin master + cd /work/pybind11 + git pull origin master + cd /tmp + mkdir sdsl-lite-build + mkdir libdivsufsort-build + export CC=clang + export CXX=clang++ + export CFLAGS="-O3 -static -lc -fPIC -static-libgcc -pipe -fcolor-diagnostics -lpthread -Wl,-Bstatic" + cd /tmp/libdivsufsort-build + cmake -D BUILD_SHARED_LIBS=OFF /work/libdivsufsort + make install + export CXXFLAGS="-O3 -pipe -fcolor-diagnostics -static-libgcc -static-libstdc++ -fPIC -lpthread -Wl,-Bstatic -Wl,-Bdynamic" + cd /tmp/sdsl-lite-build + cmake /work/sdsl-lite + make install + export CXXFLAGS="-O3 -pipe -stdlib=libc++ -fcolor-diagnostics -fPIC -DNOCROSSCONSTRUCTORS" + export CFLAGS="-O3 -pipe -fcolor-diagnostics -fPIC" + cd /work/pybind11 + pip install --no-binary ':all:' --no-cache-dir . --verbose + cd /work + pip wheel --no-binary ':all:' --no-cache-dir -w dist . --verbose + - run: + name: show + command: cd /work && ls -aR + - run: + name: test wheel + command: | + apt-get update -qq + apt-get install -qqy python python-pip + pip install $(ls -d /work/dist/*) + mkdir /tmp/test + cd /tmp/test + python -c 'import pysdsl'