diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml new file mode 100644 index 0000000..7bb2884 --- /dev/null +++ b/.github/workflows/run_test.yml @@ -0,0 +1,76 @@ +name: ZMat CI + +on: [push, pull_request] + +jobs: + octave_test: + name: Octave tests + strategy: + # provided octave versions: ubuntu-20.04 = 5.2, ubuntu-22.04 = 6.4, macos-11 = 8.1, windows-2019 = 7.3 + matrix: + os: [ubuntu-20.04, ubuntu-22.04, macos-11, windows-2019] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Install dependencies + run: | + [[ "$RUNNER_OS" == "Linux" ]] && sudo apt-get update && sudo apt-get install -y octave + [[ "$RUNNER_OS" == "macOS" ]] && brew install octave + if [[ "$RUNNER_OS" == "Windows" ]]; then + curl --retry 3 -kL http://cdimage.debian.org/mirror/gnu.org/gnu/octave/windows/octave-7.3.0-w64-64.7z --output octave_7.3.0.7z + 7z x octave_7.3.0.7z -ooctave -y + echo "$PWD/octave/octave-7.3.0-w64-64/mingw64/bin" >> $GITHUB_PATH + fi + - name: Build static library + run: | + make -C src lib + make -C example/c all LIBTYPE= + if [ "$TRAVIS_OS_NAME" = "macOS" ]; then + DYLD_LIBRARY_PATH=lib example/c/testzmat; + else + LD_LIBRARY_PATH=lib example/c/testzmat; + fi + - name: Build dynamic library + run: | + make -C src dll + make -C example/c all LIBTYPE= + if [ "$RUNNER_OS" = "macOS" ]; then + DYLD_LIBRARY_PATH=lib example/c/testzmat; + else + LD_LIBRARY_PATH=lib example/c/testzmat; + fi + - name: Build octave mex + run: | + make -C src oct; + - name: Run octave test + run: | + octave-cli --version + octave-cli --eval "addpath(pwd);cd test;run_zmat_test"; + + matlab_test: + name: MATLAB test + strategy: + matrix: + os: [ubuntu-20.04, macos-11, windows-2019] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Set up MATLAB + uses: matlab-actions/setup-matlab@v1 + - name: Build octave mex + run: | + make -C src mex; + - name: Run MATLAB examples + uses: matlab-actions/run-command@v1 + with: + command: addpath(pwd);cd test;run_zmat_test diff --git a/src/Makefile b/src/Makefile index 865542d..b1e452d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,7 +11,6 @@ ZMATDIR ?=$(ROOTDIR) LIBDIR ?=$(ROOTDIR)/lib MKDIR :=mkdir -HAVE_MINIZ ?=no HAVE_LZMA ?=yes HAVE_LZ4 ?=yes HAVE_ZSTD ?=yes @@ -65,14 +64,6 @@ else endif endif -ifeq ($(HAVE_MINIZ),no) - CFLAGS+=-DNO_MINIZ - LINKOPT+=-lz -else - INCLUDEDIRS+=-Iminiz - FILES+=miniz/miniz -endif - ifeq ($(HAVE_LZMA),no) CFLAGS+=-DNO_LZMA else @@ -131,16 +122,15 @@ ifeq ($(MAKECMDGOALS),dll) OUTPUTFLAG :=-o BINARY :=libzmat.so.1 OUTPUT_DIR :=$(LIBDIR) + LINKOPT +=-lz ifeq ($(findstring Darwin,$(PLATFORM)), Darwin) - ARFLAGS :=-shared -Wl,-install_name,$(BINARY) + ARFLAGS :=-shared -Wl,-install_name,$(BINARY) -lz else - ARFLAGS :=-shared -Wl,-soname,$(BINARY) + ARFLAGS :=-shared -Wl,-soname,$(BINARY) -lz endif endif -export HAVE_MINIZ HAVE_LZ4 HAVE_ZSTD - dll: CPPOPT +=$(DLLFLAG) dll: ARFLAGS ?=-shared -Wl,-soname,$(BINARY).1 dll: LINKOPT +=$(LDFLAGS) @@ -156,7 +146,7 @@ oct: LINKOPT+=--mex $(INCLUDEDIRS) mex: CXX=$(MEX) mex: OUTPUTFLAG:=-output mex: AR=$(MEX) zmat.cpp $(INCLUDEDIRS) -mex: LINKOPT+= -cxx CXXLIBS='$$CXXLIBS -static-libgcc -static-libstdc++' -outdir $(ZMATDIR) +mex: LINKOPT+= -cxx CXXLIBS='$$CXXLIBS -lz -static-libgcc -static-libstdc++' -outdir $(ZMATDIR) mex: ARFLAGS := mex: OUTPUT_DIR=.. diff --git a/src/blosc2/blosc/Makefile b/src/blosc2/blosc/Makefile index bbe56c6..2a36fb3 100644 --- a/src/blosc2/blosc/Makefile +++ b/src/blosc2/blosc/Makefile @@ -19,10 +19,6 @@ ECHO := echo BINARY:=blosc2 OUTPUT_DIR=$(ZMATDIR) -HAVE_MINIZ ?=yes -HAVE_LZ4 ?=yes -HAVE_ZSTD ?=yes - DOXY := doxygen DOCDIR := $(ZMATDIR)/doc DOXYCFG=zmat.cfg @@ -36,22 +32,7 @@ PLATFORM = $(shell uname -s) DLLFLAG=-fPIC -CPPOPT=-g -Wall -Wextra -O3 -msse2 -DNDEBUG $(DLLFLAG) -std=gnu99 #-g -Wall -std=c99 # -DUSE_OS_TIMER - -ifeq ($(HAVE_MINIZ),yes) - CPPOPT+= -DHAVE_MINIZ -else - CPPOPT+= -DHAVE_ZLIB -endif - -ifeq ($(HAVE_LZ4),yes) - CPPOPT+= -DHAVE_LZ4 -endif - -ifeq ($(HAVE_ZSTD),yes) - CPPOPT+= -DHAVE_ZSTD -endif - +CPPOPT=-g -Wall -Wextra -O3 -msse2 -DHAVE_ZSTD -DHAVE_ZLIB -DHAVE_LZ4 -DNDEBUG $(DLLFLAG) -std=gnu99 #-g -Wall -std=c99 # -DUSE_OS_TIMER OUTPUTFLAG:=-o OBJSUFFIX=.o diff --git a/src/zmatlib.c b/src/zmatlib.c index bb9a8aa..ed66ec1 100644 --- a/src/zmatlib.c +++ b/src/zmatlib.c @@ -49,12 +49,7 @@ #include #include "zmatlib.h" - -#ifndef NO_MINIZ - #include "miniz.h" -#else - #include "zlib.h" -#endif +#include "zlib.h" #ifndef NO_LZMA #include "easylzma/compress.h"