Blob Blame History Raw
From f3b0da9d64e0ad5e668abc97137635f3c5da2d8f Mon Sep 17 00:00:00 2001
From: Nicolas Chauvet <kwizart@gmail.com>
Date: Sat, 7 Apr 2018 14:33:30 +0200
Subject: [PATCH] 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 111d07c..86ced7d 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 4a891e1..2aeaf66 100644
--- a/wrapper/Makefile
+++ b/wrapper/Makefile
@@ -1,4 +1,4 @@
-LIBVMAF = libvmaf.a
+LIBVMAF = libvmaf.so
 
 .PHONY: all
 all: $(LIBVMAF) vmafossexec
@@ -159,7 +159,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.2