[vlc-devel] [PATCH 1/3] [RFC] Add CineForm SDK to VLC contribs

Emeric Grange egrange at gopro.com
Mon Nov 20 15:57:21 CET 2017


With the patch its always better...

---
 contrib/src/cineformsdk/SHA512SUMS        |   1 +
 contrib/src/cineformsdk/buildsystem.patch | 156 ++++++++++++++++++++++++++++++
 contrib/src/cineformsdk/nocpp.patch       |  26 +++++
 contrib/src/cineformsdk/rules.mak         |  26 +++++
 4 files changed, 209 insertions(+)
 create mode 100644 contrib/src/cineformsdk/SHA512SUMS
 create mode 100644 contrib/src/cineformsdk/buildsystem.patch
 create mode 100644 contrib/src/cineformsdk/nocpp.patch
 create mode 100644 contrib/src/cineformsdk/rules.mak

diff --git a/contrib/src/cineformsdk/SHA512SUMS b/contrib/src/cineformsdk/SHA512SUMS
new file mode 100644
index 0000000..e8b5c4d
--- /dev/null
+++ b/contrib/src/cineformsdk/SHA512SUMS
@@ -0,0 +1 @@
+ae7821b2bfde922f509f3ad648df70d4f092a0bf71c3f8c425315a3d407ab9b9b0af789475c504d89e898c84a94a2dc0e7571a6bfe046b1a62a77cfa1ce0597f  cineform-sdk-10.0.1.tar.gz
diff --git a/contrib/src/cineformsdk/buildsystem.patch b/contrib/src/cineformsdk/buildsystem.patch
new file mode 100644
index 0000000..8e75f2f
--- /dev/null
+++ b/contrib/src/cineformsdk/buildsystem.patch
@@ -0,0 +1,156 @@
+From 5e06d0ba89c37e0a20eecb382b641d06392fb232 Mon Sep 17 00:00:00 2001
+From: Emeric Grange <egrange at gopro.com>
+Date: Fri, 17 Nov 2017 17:24:37 +0100
+Subject: [PATCH] Buildsystem overhaul
+
+---
+ CMakeLists.txt          | 106 ++++++++++++++++++++++--------------------------
+ libcineformsdk.pc.cmake |  11 +++++
+ 2 files changed, 59 insertions(+), 58 deletions(-)
+ create mode 100644 libcineformsdk.pc.cmake
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a485363..08d0a44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,73 +1,63 @@
+-# 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" )
+-
+-add_definitions(-D_ALLOCATOR=1 -DWARPSTUFF=1)
+-
+-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})
+-
+-set_target_properties(CodecSDK PROPERTIES POSITION_INDEPENDENT_CODE ON)
+-
+-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})
++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/MetadataTags.h Common/CFHDSampleHeader.h Common/CFHDTypes.h)
++
++# Build
++add_library(CFHDEncoder ${ENCODER_ALL_SOURCES})
++add_library(CFHDDecoder ${DECODER_ALL_SOURCES})
++
++target_link_libraries(CFHDEncoder)
++target_link_libraries(CFHDDecoder)
++
++# 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)
++
++# Installation
++if (UNIX)
++  install(TARGETS CFHDDecoder DESTINATION lib/)
++  install(TARGETS CFHDEncoder DESTINATION lib/)
++  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.10.1
diff --git a/contrib/src/cineformsdk/nocpp.patch b/contrib/src/cineformsdk/nocpp.patch
new file mode 100644
index 0000000..3665c2f
--- /dev/null
+++ b/contrib/src/cineformsdk/nocpp.patch
@@ -0,0 +1,26 @@
+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] No cpp in public headers
+
+---
+ 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.10.1
diff --git a/contrib/src/cineformsdk/rules.mak b/contrib/src/cineformsdk/rules.mak
new file mode 100644
index 0000000..382d1b7
--- /dev/null
+++ b/contrib/src/cineformsdk/rules.mak
@@ -0,0 +1,26 @@
+# cineform-sdk
+
+CINEFORM_SDK_VERSION := 10.0.1
+CINEFORM_SDK_URL := $(GITHUB)gopro/cineform-sdk/archive/v$(CINEFORM_SDK_VERSION).tar.gz
+#CINEFORM_SDK_URL := $(GITHUB)gopro/cineform-sdk/releases/download/v$(CINEFORM_SDK_VERSION)/cineform-sdk-$(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/buildsystem.patch
+	$(APPLY) $(SRC)/cineformsdk/nocpp.patch
+	$(MOVE)
+
+.cineformsdk: cineformsdk toolchain.cmake
+	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DBUILD_SHARED_LIBS:BOOL=OFF .
+	cd $< && $(MAKE) install
+	touch $@
-- 
2.10.1




More information about the vlc-devel mailing list