Initial Commit

This commit is contained in:
Yousef Khadadeh 2025-07-06 20:43:53 +03:00
commit 6088fc29ed
978 changed files with 353647 additions and 0 deletions

View file

@ -0,0 +1,7 @@
sources:
"1.6.1":
url: "https://github.com/paullouisageneau/libjuice/archive/refs/tags/v1.6.1.tar.gz"
sha256: "14d7cfc1a541843c1678828ad52d860d043bd82ed39ff076b260565796e4e4ee"
"1.5.7":
url: "https://github.com/paullouisageneau/libjuice/archive/refs/tags/v1.5.7.tar.gz"
sha256: "6385c574f3c33f766ed25cddf919625b0ae8ca0d76871f70301e5a0cf2c93dc8"

View file

@ -0,0 +1,80 @@
import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rm, rmdir
from conan.tools.microsoft import is_msvc
from conan.tools.apple import fix_apple_shared_install_name
required_conan_version = ">=2.4"
class libjuiceConan(ConanFile):
name = "libjuice"
description = "JUICE is a UDP Interactive Connectivity Establishment library."
license = "MPL-2.0"
topics = ("webrtc", "ice")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/paullouisageneau/libjuice"
settings = "os", "compiler", "build_type", "arch"
package_type = "library"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
languages = "C"
implements = ["auto_shared_fpic"]
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["NO_TESTS"] = True
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
fix_apple_shared_install_name(self)
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.libs = ["juice"]
self.cpp_info.set_property("cmake_file_name", "LibJuice")
if self.options.shared:
self.cpp_info.set_property("cmake_target_name", "LibJuice::LibJuice")
else:
self.cpp_info.set_property("cmake_target_name", "LibJuice::LibJuiceStatic")
self.cpp_info.defines.append("JUICE_STATIC")
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")
self.cpp_info.system_libs.append("pthread")
self.cpp_info.system_libs.append("dl")
if self.settings.os == "Windows":
self.cpp_info.system_libs.extend(["ws2_32", "bcrypt"])
if is_msvc(self):
self.cpp_info.cxxflags.append("/bigobj")

View file

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX) # if the project uses c++
find_package(LibJuice REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
if (BUILD_SHARED_LIBS)
target_link_libraries(${PROJECT_NAME} PRIVATE LibJuice::LibJuice)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE LibJuice::LibJuiceStatic)
endif()

View file

@ -0,0 +1,32 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
import os
# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def requirements(self):
self.requires(self.tested_reference_str)
def layout(self):
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_SHARED_LIBS"] = self.dependencies[self.tested_reference_str].options.shared
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

View file

@ -0,0 +1,8 @@
#include <cstdlib>
#include <juice/juice.h>
int main(void) {
juice_config config;
juice_set_log_level(JUICE_LOG_LEVEL_WARN);
return EXIT_SUCCESS;
}

View file

@ -0,0 +1,5 @@
versions:
"1.6.1":
folder: all
"1.5.7":
folder: all