forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#2303) add gstreamer/1.18.0
* add gstreamer/1.16.0 this is a port of https://github.com/bincrafters/conan-gstreamer * fix CMAKE VERSION hook * add required_conan_version * gstreamer: Update Conan conventions Automatically created by bincrafters-conventions 0.24.6 * Apply suggestions from code review Co-authored-by: Anonymous Maarten <[email protected]> * gstreamer 1.16.2 * remove gstreamer 1.16.0 * static by default * remove more pkg-config files * add missing import * Apply suggestions from code review Co-authored-by: Uilian Ries <[email protected]> * gstreamer: Update Conan conventions Automatically created by bincrafters-conventions 0.26.0 * use self.cpp_info.system_libs * Apply suggestions from code review Co-authored-by: Chris Mc <[email protected]> * gstreamer 1.18.0 * fix typo * remove upstreamed patch * use winflexbison on windows * gstreamer: Update Conan conventions Automatically created by bincrafters-conventions 0.28.0 * remove pdb files * cache meson * update bieson * use meson.options * add components * Apply suggestions from code review Co-authored-by: Uilian Ries <[email protected]> Co-authored-by: bincrafters-user <[email protected]> Co-authored-by: Anonymous Maarten <[email protected]> Co-authored-by: Uilian Ries <[email protected]> Co-authored-by: Chris Mc <[email protected]>
- Loading branch information
1 parent
9e867aa
commit 0436f6a
Showing
6 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sources: | ||
"1.16.2": | ||
sha256: "dac037ab84d557f5d4e6e66e833f6bf8cf4f84671a311e0b2df99f9b30a9d693" | ||
url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.16.2/gstreamer-1.16.2.tar.bz2" | ||
"1.18.0": | ||
sha256: "f072da67b6dad9b4aecf2cb594aaaa66f86c22af9ba80503b90f957d47015ef8" | ||
url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.18.0/gstreamer-1.18.0.tar.bz2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
from conans import ConanFile, tools, Meson, VisualStudioBuildEnvironment | ||
import glob | ||
import os | ||
import shutil | ||
|
||
required_conan_version = ">=1.29" | ||
|
||
class GStreamerConan(ConanFile): | ||
name = "gstreamer" | ||
description = "GStreamer is a development framework for creating applications like media players, video editors, streaming media broadcasters and so on" | ||
topics = ("conan", "gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://gstreamer.freedesktop.org/" | ||
license = "GPL-2.0-only" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = {"shared": [True, False], "fPIC": [True, False]} | ||
default_options = {"shared": False, "fPIC": True} | ||
generators = "pkg_config" | ||
_meson = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def requirements(self): | ||
self.requires("glib/2.66.2") | ||
|
||
@property | ||
def _is_msvc(self): | ||
return self.settings.compiler == "Visual Studio" | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
def config_options(self): | ||
if self.settings.os == 'Windows': | ||
del self.options.fPIC | ||
|
||
def build_requirements(self): | ||
self.build_requires("meson/0.54.2") | ||
self.build_requires("pkgconf/1.7.3") | ||
if self.settings.os == 'Windows': | ||
self.build_requires("winflexbison/2.5.22") | ||
else: | ||
self.build_requires("bison/3.7.1") | ||
self.build_requires("flex/2.6.4") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename("%s-%s" % (self.name, self.version), self._source_subfolder) | ||
|
||
def _configure_meson(self): | ||
if self._meson: | ||
return self._meson | ||
meson = Meson(self) | ||
if self._is_msvc: | ||
if tools.Version(self.settings.compiler.version) < "14": | ||
meson.options["c_args"] = " -Dsnprintf=_snprintf" | ||
meson.options["cpp_args"] = " -Dsnprintf=_snprintf" | ||
if self.settings.get_safe("compiler.runtime"): | ||
meson.options["b_vscrt"] = str(self.settings.compiler.runtime).lower() | ||
meson.options["tools"] = "disabled" | ||
meson.options["examples"] = "disabled" | ||
meson.options["benchmarks"] = "disabled" | ||
meson.options["tests"] = "disabled" | ||
meson.configure(build_folder=self._build_subfolder, | ||
source_folder=self._source_subfolder, | ||
args=['--wrap-mode=nofallback']) | ||
self._meson = meson | ||
return self._meson | ||
|
||
def build(self): | ||
with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op(): | ||
meson = self._configure_meson() | ||
meson.build() | ||
|
||
def _fix_library_names(self, path): | ||
# regression in 1.16 | ||
if self.settings.compiler == "Visual Studio": | ||
with tools.chdir(path): | ||
for filename_old in glob.glob("*.a"): | ||
filename_new = filename_old[3:-2] + ".lib" | ||
self.output.info("rename %s into %s" % (filename_old, filename_new)) | ||
shutil.move(filename_old, filename_new) | ||
|
||
def package(self): | ||
self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) | ||
with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op(): | ||
meson = self._configure_meson() | ||
meson.install() | ||
|
||
self._fix_library_names(os.path.join(self.package_folder, "lib")) | ||
self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
tools.remove_files_by_mask(self.package_folder, "*.pdb") | ||
|
||
def package_info(self): | ||
gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | ||
|
||
self.cpp_info.components["gstreamer-1.0"].names["pkg_config"] = "gstreamer-1.0" | ||
self.cpp_info.components["gstreamer-1.0"].requires = ["glib::glib-2.0", "glib::gobject-2.0"] | ||
if not self.options.shared: | ||
self.cpp_info.components["gstreamer-1.0"].requires.append("glib::gmodule-no-export-2.0") | ||
self.cpp_info.components["gstreamer-1.0"].defines.append("GST_STATIC_COMPILATION") | ||
self.cpp_info.components["gstreamer-1.0"].libs = ["gstreamer-1.0"] | ||
self.cpp_info.components["gstreamer-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstreamer-1.0"].libdirs = [gst_plugin_path] | ||
|
||
self.cpp_info.components["gstreamer-base-1.0"].names["pkg_config"] = "gstreamer-base-1.0" | ||
self.cpp_info.components["gstreamer-base-1.0"].requires = ["gstreamer-1.0"] | ||
self.cpp_info.components["gstreamer-base-1.0"].libs = ["gstbase-1.0"] | ||
self.cpp_info.components["gstreamer-base-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstreamer-base-1.0"].libdirs = [gst_plugin_path] | ||
|
||
self.cpp_info.components["gstreamer-controller-1.0"].names["pkg_config"] = "gstreamer-controller-1.0" | ||
self.cpp_info.components["gstreamer-controller-1.0"].requires = ["gstreamer-1.0"] | ||
self.cpp_info.components["gstreamer-controller-1.0"].libs = ["gstcontroller-1.0"] | ||
self.cpp_info.components["gstreamer-controller-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstreamer-controller-1.0"].libdirs = [gst_plugin_path] | ||
|
||
self.cpp_info.components["gstreamer-net-1.0"].names["pkg_config"] = "gstreamer-net-1.0" | ||
self.cpp_info.components["gstreamer-net-1.0"].requires = ["gstreamer-1.0", "glib::gio-2.0"] | ||
self.cpp_info.components["gstreamer-net-1.0"].libs = ["gstnet-1.0"] | ||
self.cpp_info.components["gstreamer-net-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstreamer-net-1.0"].libdirs = [gst_plugin_path] | ||
|
||
self.cpp_info.components["gstreamer-check-1.0"].names["pkg_config"] = "gstreamer-check-1.0" | ||
self.cpp_info.components["gstreamer-check-1.0"].requires = ["gstreamer-1.0"] | ||
self.cpp_info.components["gstreamer-check-1.0"].libs = ["gstcheck-1.0"] | ||
self.cpp_info.components["gstreamer-check-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstreamer-check-1.0"].libdirs = [gst_plugin_path] | ||
|
||
# gstcoreelements and gstcoretracers are plugins which should be loaded dynamicaly, and not linked to directly | ||
if not self.options.shared: | ||
self.cpp_info.components["gstcoreelements"].names["pkg_config"] = "gstcoreelements" | ||
self.cpp_info.components["gstcoreelements"].requires = ["glib::gobject-2.0", "glib::glib-2.0", "gstreamer-1.0", "gstreamer-base-1.0"] | ||
self.cpp_info.components["gstcoreelements"].libs = ["gstcoreelements"] | ||
self.cpp_info.components["gstcoreelements"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstcoreelements"].libdirs = [gst_plugin_path] | ||
|
||
self.cpp_info.components["gstcoretracers"].names["pkg_config"] = "gstcoretracers" | ||
self.cpp_info.components["gstcoretracers"].requires = ["gstreamer-1.0"] | ||
self.cpp_info.components["gstcoretracers"].libs = ["gstcoretracers"] | ||
self.cpp_info.components["gstcoretracers"].includedirs = [os.path.join("include", "gstreamer-1.0")] | ||
self.cpp_info.components["gstcoretracers"].libdirs = [gst_plugin_path] | ||
|
||
if self.options.shared: | ||
self.output.info("Appending GST_PLUGIN_PATH env var : %s" % gst_plugin_path) | ||
self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | ||
gstreamer_root = self.package_folder | ||
self.output.info("Creating GSTREAMER_ROOT env var : %s" % gstreamer_root) | ||
self.env_info.GSTREAMER_ROOT = gstreamer_root | ||
gst_plugin_scanner = "gst-plugin-scanner.exe" if self.settings.os == "Windows" else "gst-plugin-scanner" | ||
gst_plugin_scanner = os.path.join(self.package_folder, "bin", "gstreamer-1.0", gst_plugin_scanner) | ||
self.output.info("Creating GST_PLUGIN_SCANNER env var : %s" % gst_plugin_scanner) | ||
self.env_info.GST_PLUGIN_SCANNER = gst_plugin_scanner | ||
if self.settings.arch == "x86": | ||
self.output.info("Creating GSTREAMER_ROOT_X86 env var : %s" % gstreamer_root) | ||
self.env_info.GSTREAMER_ROOT_X86 = gstreamer_root | ||
elif self.settings.arch == "x86_64": | ||
self.output.info("Creating GSTREAMER_ROOT_X86_64 env var : %s" % gstreamer_root) | ||
self.env_info.GSTREAMER_ROOT_X86_64 = gstreamer_root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <iostream> | ||
#include <gst/gst.h> | ||
|
||
#ifdef GST_STATIC_COMPILATION | ||
|
||
extern "C" | ||
{ | ||
GST_PLUGIN_STATIC_DECLARE(coreelements); | ||
} | ||
|
||
#endif | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
gst_init(&argc, &argv); | ||
std::cout << "GStreamer version: " << gst_version_string() << std::endl; | ||
|
||
#ifdef GST_STATIC_COMPILATION | ||
|
||
GST_PLUGIN_STATIC_REGISTER(coreelements); | ||
|
||
#endif | ||
|
||
GstElement * fakesink = gst_element_factory_make("fakesink", NULL); | ||
if (!fakesink) { | ||
std::cerr << "failed to create fakesink element" << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "fakesink has been created successfully" << std::endl; | ||
} | ||
gst_object_unref(GST_OBJECT(fakesink)); | ||
GstElement * fakesrc = gst_element_factory_make("fakesrc", NULL); | ||
if (!fakesrc) { | ||
std::cerr << "failed to create fakesrc element" << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "fakesrc has been created successfully" << std::endl; | ||
} | ||
gst_object_unref(GST_OBJECT(fakesrc)); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
versions: | ||
"1.16.2": | ||
folder: all | ||
"1.18.0": | ||
folder: all |