Blob Blame History Raw
From 26c58a87b63742412f8845318dbd27585a734ed1 Mon Sep 17 00:00:00 2001
From: Nicolas Chauvet <kwizart@gmail.com>
Date: Sat, 7 Apr 2018 14:33:30 +0200
Subject: [PATCH 06/11] Switch to shared library for libvmaf

---
 feature/Makefile   | 2 +-
 wrapper/.gitignore | 1 +
 wrapper/Makefile   | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/feature/Makefile b/feature/Makefile
index c786a27..127faed 100644
--- a/feature/Makefile
+++ b/feature/Makefile
@@ -5,7 +5,7 @@ TOP = $(shell pwd)
 SRCDIR  = $(TOP)/src
 OBJDIR  = $(TOP)/obj
 TOOLDIR = $(TOP)/tool
-LIBVMAF = $(TOP)/../wrapper/libvmaf.a
+LIBVMAF = $(TOP)/../wrapper/libvmaf.so
 
 CFLAGS_COMMON = -g -O3 -fPIC -w -Wextra -pedantic
 # CFLAGS_COMMON = -g -O0 -fPIC -Wall -Wextra -pedantic
diff --git a/wrapper/.gitignore b/wrapper/.gitignore
index b721ec4..16e4e57 100644
--- a/wrapper/.gitignore
+++ b/wrapper/.gitignore
@@ -1,6 +1,7 @@
 *.o
 vmafossexec
 libvmaf.a
+libvmaf.so*
 testlib
 .cproject
 .project
diff --git a/wrapper/Makefile b/wrapper/Makefile
index 62bde27..8644c49 100644
--- a/wrapper/Makefile
+++ b/wrapper/Makefile
@@ -1,4 +1,4 @@
-LIBVMAF = libvmaf.a
+LIBVMAF = libvmaf.so
 
 .PHONY: all
 all: $(LIBVMAF) vmafossexec
@@ -172,7 +172,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.c
 	$(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -I $(FEATURESRCDIR) $<
 
 $(LIBVMAF): $(OBJS) $(wildcard ../ptools/*.o)
-	ar rcs $@ $^
+	$(CC) $(LDFLAGS) $^ -shared -Wl,-soname,libvmaf.so.0 -o $@
 
 vmafossexec: $(OBJDIR)/main.o $(LIBVMAF)
 	$(CXX) -s -o $@ $(LDFLAGS) $^ -pthread
-- 
2.17.1