[vlc-devel] [PATCH v2 1/3] Add CineForm SDK (v10.0.1) to VLC contribs

Emeric Grange egrange at gopro.com
Tue Nov 21 11:41:05 CET 2017


---
 contrib/src/cineformsdk/0001-no-cpp.patch      |  27 +++++
 contrib/src/cineformsdk/0002-buildsystem.patch | 154 +++++++++++++++++++++++++
 contrib/src/cineformsdk/SHA512SUMS             |   1 +
 contrib/src/cineformsdk/rules.mak              |  25 ++++
 4 files changed, 207 insertions(+)
 create mode 100644 contrib/src/cineformsdk/0001-no-cpp.patch
 create mode 100644 contrib/src/cineformsdk/0002-buildsystem.patch
 create mode 100644 contrib/src/cineformsdk/SHA512SUMS
 create mode 100644 contrib/src/cineformsdk/rules.mak

diff --git a/contrib/src/cineformsdk/0001-no-cpp.patch b/contrib/src/cineformsdk/0001-no-cpp.patch
new file mode 100644
index 0000000000..1f2af95208
--- /dev/null
+++ b/contrib/src/cineformsdk/0001-no-cpp.patch
@@ -0,0 +1,27 @@
+From 8fd4cb706d3ec8a313618ff8f83d824ea6f0d181 Mon Sep 17 00:00:00 2001
+From: Emeric Grange <egrange at gopro.com>
+Date: Fri, 17 Nov 2017 17:24:14 +0100
+Subject: [PATCH 1/2] no cpp
+
+---
+ Common/CFHDDecoder.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Common/CFHDDecoder.h b/Common/CFHDDecoder.h
+index fa0dc64..b238144 100644
+--- a/Common/CFHDDecoder.h
++++ b/Common/CFHDDecoder.h
+@@ -31,8 +31,10 @@
+ #include "CFHDMetadata.h"
+ #ifdef _QTZPATCH
+ #else
++#ifdef __cplusplus
+ #include "CFHDSampleHeader.h"
+ #endif
++#endif
+ 
+ #ifdef _WINDOWS
+ 	#ifndef DYNAMICLIB
+-- 
+2.15.0
+
diff --git a/contrib/src/cineformsdk/0002-buildsystem.patch b/contrib/src/cineformsdk/0002-buildsystem.patch
new file mode 100644
index 0000000000..bd2d4d1625
--- /dev/null
+++ b/contrib/src/cineformsdk/0002-buildsystem.patch
@@ -0,0 +1,154 @@
+From 29a524c45d74fc98a6c37455229c14dd4ee29920 Mon Sep 17 00:00:00 2001
+From: Emeric Grange <egrange at gopro.com>
+Date: Mon, 20 Nov 2017 11:05:24 +0100
+Subject: [PATCH 2/2] buildsystem
+
+---
+ CMakeLists.txt          | 99 ++++++++++++++++++++++---------------------------
+ libcineformsdk.pc.cmake | 11 ++++++
+ 2 files changed, 56 insertions(+), 54 deletions(-)
+ create mode 100644 libcineformsdk.pc.cmake
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a485363..869596d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,73 +1,64 @@
+-# CMakeLists.txt
+ cmake_minimum_required (VERSION 3.8.2)
+-project (CineFormSDK)
++project(CineFormSDK C CXX)
+ 
+-set(LINK_STATIC OFF)
++# Buid settings
++set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
++add_definitions(-D_ALLOCATOR=1 -DWARPSTUFF=1)
+ 
+ if (WIN32)
+-	include(ucm.cmake)
+-	ucm_set_runtime(STATIC)
+-	
+-	SET(COMPILER_FLAGS "")
+-	SET(COMPILER_FLAGS_W_OMP "/openmp" )
+-	SET(ADDITIONAL_LIBS "")
++  include(ucm.cmake)
++  ucm_set_runtime(STATIC)
++
++  SET(COMPILER_FLAGS "")
++  SET(COMPILER_FLAGS_W_OMP "/openmp")
++  SET(ADDITIONAL_LIBS "")
+ endif (WIN32)
+- 
++
+ if (UNIX)
+-	SET(COMPILER_FLAGS -fPIC -O3)
+-	SET(COMPILER_FLAGS_W_OMP -fopenmp -O3)
+-	SET(ADDITIONAL_LIBS "-luuid -lpthread -lgomp")
+-	SET(TOY_LIBS "-lm")
++  SET(COMPILER_FLAGS -fPIC -O3)
++  SET(COMPILER_FLAGS_W_OMP -fopenmp -O3)
++  SET(ADDITIONAL_LIBS "-luuid -lpthread -lgomp")
++  SET(TOY_LIBS "-lm")
+ endif (UNIX)
+ 
+ if (APPLE)
+-	SET(COMPILER_FLAGS -fvisibility=hidden -O3)
+-	SET(COMPILER_FLAGS_W_OMP -O3)
+-	SET(ADDITIONAL_LIBS "-lpthread")
++  SET(COMPILER_FLAGS -fvisibility=hidden -O3)
++  SET(COMPILER_FLAGS_W_OMP -O3)
++  SET(ADDITIONAL_LIBS "-lpthread")
+ endif (APPLE)
+ 
+-set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
+-
++# Sources
+ include_directories("Common" "Tables" "Codec" "ConvertLib" "WarpLib" "Example")
+ file(GLOB CODEC_SOURCES "Codec/*.c" "Codec/*.cpp" "WarpLib/*.c" "Common/Settings.cpp")
+ file(GLOB ENCODER_ALL_SOURCES "Codec/*.c" "Codec/*.cpp" "Common/Settings.cpp" "EncoderSDK/*.cpp")
+-file(GLOB DECODER_ALL_SOURCES "Codec/*.c" "Codec/*.cpp" "Common/Settings.cpp"  "ConvertLib/*.cpp" "WarpLib/*.c" "DecoderSDK/*.cpp")
++file(GLOB DECODER_ALL_SOURCES "Codec/*.c" "Codec/*.cpp" "Common/Settings.cpp" "ConvertLib/*.cpp" "WarpLib/*.c" "DecoderSDK/*.cpp")
+ file(GLOB ENCODER_SOURCES "EncoderSDK/*.cpp")
+-file(GLOB DECODER_SOURCES "DecoderSDK/*.cpp" "WarpLib/*.c" "ConvertLib/*.cpp" )
+-file(GLOB EXAMPLE_SOURCE "Example/*.cpp" )
+-file(GLOB WAVELETDEMO_SOURCE "Example/WaveletDemo/*.c" )
++file(GLOB DECODER_SOURCES "DecoderSDK/*.cpp" "WarpLib/*.c" "ConvertLib/*.cpp")
++file(GLOB EXAMPLE_SOURCE "Example/*.cpp")
++file(GLOB WAVELETDEMO_SOURCE "Example/WaveletDemo/*.c")
++set(SDK_HEADERS Common/CFHDAllocator.h Common/CFHDDecoder.h Common/CFHDEncoder.h Common/CFHDError.h Common/CFHDMetadata.h Common/CFHDSampleHeader.h Common/CFHDTypes.h)
+ 
+-add_definitions(-D_ALLOCATOR=1 -DWARPSTUFF=1)
++# Build
++add_library(CFHDEncoder ${ENCODER_ALL_SOURCES})
++add_library(CFHDDecoder ${DECODER_ALL_SOURCES})
+ 
+-add_library(CodecSDK ${CODEC_SOURCES})
+-add_library(CFHDEncoderStatic ${ENCODER_ALL_SOURCES})
+-add_library(CFHDDecoderStatic ${DECODER_ALL_SOURCES})
+-add_library(CFHDEncoder SHARED ${ENCODER_SOURCES})
+-add_library(CFHDDecoder SHARED ${DECODER_SOURCES})
++target_link_libraries(CFHDEncoder)
++target_link_libraries(CFHDDecoder)
+ 
+-set_target_properties(CodecSDK PROPERTIES POSITION_INDEPENDENT_CODE ON)
++# Generate libcineformsdk.pc
++set(PROJECT_VERSION "10.0.1")
++set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
++set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Installation prefix for executables and object code libraries" FORCE)
++set(BIN_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/bin CACHE PATH "Installation prefix for user executables" FORCE)
++set(LIB_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH  "Installation prefix for object code libraries" FORCE)
++set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/cineformsdk CACHE PATH "Installation prefix for C header files" FORCE)
++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libcineformsdk.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libcineformsdk.pc)
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcineformsdk.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+ 
+-target_compile_options(CodecSDK PUBLIC ${COMPILER_FLAGS})
+-target_compile_options(CFHDEncoder PUBLIC ${COMPILER_FLAGS})
+-target_compile_options(CFHDDecoder PUBLIC ${COMPILER_FLAGS})
+-target_compile_definitions(CFHDEncoder PUBLIC -DDYNAMICLIB=1)
+-target_compile_definitions(CFHDDecoder PUBLIC -DDYNAMICLIB=1)
+-
+-target_link_libraries (CFHDEncoder CodecSDK)
+-target_link_libraries (CFHDDecoder CodecSDK)
+-target_link_libraries (CFHDEncoderStatic)
+-target_link_libraries (CFHDDecoderStatic)
+-
+-add_executable (TestCFHD ${EXAMPLE_SOURCE})
+-target_compile_options(TestCFHD PRIVATE ${COMPILER_FLAGS_W_OMP})
+-
+-if (LINK_STATIC)
+-target_link_libraries (TestCFHD CFHDEncoderStatic CFHDDecoderStatic ${ADDITIONAL_LIBS})
+-target_link_libraries (TestCFHD CFHDEncoderStatic CFHDDecoderStatic ${ADDITIONAL_LIBS})
+-else (LINK_STATIC)
+-target_link_libraries (TestCFHD CFHDEncoder CFHDDecoder ${ADDITIONAL_LIBS})
+-target_link_libraries (TestCFHD CFHDEncoder CFHDDecoder ${ADDITIONAL_LIBS})
+-endif (LINK_STATIC)
+-
+-add_executable (WaveletDemo ${WAVELETDEMO_SOURCE})
+-target_link_libraries (WaveletDemo ${TOY_LIBS})
++# Installation
++if (UNIX)
++  install(TARGETS CFHDDecoder DESTINATION lib/)
++  install(TARGETS CFHDEncoder DESTINATION lib/)
++  install(FILES libcineformsdk.pc DESTINATION lib/pkgconfig/)
++  install(FILES ${SDK_HEADERS} DESTINATION include/cineformsdk/)
++endif (UNIX)
+diff --git a/libcineformsdk.pc.cmake b/libcineformsdk.pc.cmake
+new file mode 100644
+index 0000000..dd17884
+--- /dev/null
++++ b/libcineformsdk.pc.cmake
+@@ -0,0 +1,11 @@
++prefix=${CMAKE_INSTALL_PREFIX}
++exec_prefix=${EXEC_INSTALL_PREFIX}
++libdir=${LIB_INSTALL_DIR}
++includedir=${INCLUDE_INSTALL_DIR}
++
++Name: ${PROJECT_NAME}
++Description: CineForm SDK libraries
++URL: https://github.com/gopro/cineform-sdk
++Version: ${PROJECT_VERSION}
++Libs: -L${LIB_INSTALL_DIR} -lCFHDDecoder -lCFHDEncoder -lm
++Cflags: -I${INCLUDE_INSTALL_DIR}
+-- 
+2.15.0
+
diff --git a/contrib/src/cineformsdk/SHA512SUMS b/contrib/src/cineformsdk/SHA512SUMS
new file mode 100644
index 0000000000..e8b5c4de59
--- /dev/null
+++ b/contrib/src/cineformsdk/SHA512SUMS
@@ -0,0 +1 @@
+ae7821b2bfde922f509f3ad648df70d4f092a0bf71c3f8c425315a3d407ab9b9b0af789475c504d89e898c84a94a2dc0e7571a6bfe046b1a62a77cfa1ce0597f  cineform-sdk-10.0.1.tar.gz
diff --git a/contrib/src/cineformsdk/rules.mak b/contrib/src/cineformsdk/rules.mak
new file mode 100644
index 0000000000..031b61da83
--- /dev/null
+++ b/contrib/src/cineformsdk/rules.mak
@@ -0,0 +1,25 @@
+# cineform-sdk
+
+CINEFORM_SDK_VERSION := 10.0.1
+CINEFORM_SDK_URL := $(GITHUB)gopro/cineform-sdk/archive/v$(CINEFORM_SDK_VERSION).tar.gz
+
+PKGS += cineformsdk
+ifeq ($(call need_pkg,"libcineformsdk"),)
+PKGS_FOUND += cineformsdk
+endif
+
+$(TARBALLS)/cineform-sdk-$(CINEFORM_SDK_VERSION).tar.gz:
+	$(call download_pkg,$(CINEFORM_SDK_URL),cineformsdk)
+
+.sum-cineformsdk: cineform-sdk-$(CINEFORM_SDK_VERSION).tar.gz
+
+cineformsdk: cineform-sdk-$(CINEFORM_SDK_VERSION).tar.gz .sum-cineformsdk
+	$(UNPACK)
+	$(APPLY) $(SRC)/cineformsdk/0001-no-cpp.patch
+	$(APPLY) $(SRC)/cineformsdk/0002-buildsystem.patch
+	$(MOVE)
+
+.cineformsdk: cineformsdk toolchain.cmake
+	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DBUILD_SHARED_LIBS:BOOL=OFF .
+	cd $< && $(MAKE) install
+	touch $@
-- 
2.15.0



More information about the vlc-devel mailing list