-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add libplist 2.6.0 * Cleanups, add missing m system lib * Cleanup * Cleanups * unused * Add C++ component * Cleanup
- Loading branch information
Showing
7 changed files
with
161 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,4 @@ | ||
sources: | ||
"2.6.0": | ||
url: "https://github.com/libimobiledevice/libplist/releases/download/2.6.0/libplist-2.6.0.tar.bz2" | ||
sha256: "67be9ee3169366589c92dc7c22809b90f51911dd9de22520c39c9a64fb047c9c" |
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,95 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.apple import fix_apple_shared_install_name | ||
from conan.tools.build import cross_building | ||
from conan.tools.env import VirtualRunEnv | ||
from conan.tools.files import copy, get, rm, rmdir | ||
from conan.tools.gnu import Autotools, AutotoolsToolchain | ||
from conan.tools.layout import basic_layout | ||
import os | ||
|
||
required_conan_version = ">=2.1" | ||
|
||
class PackageConan(ConanFile): | ||
name = "libplist" | ||
description = "A small portable C library to handle Apple Property List files in binary, XML, JSON, or OpenStep format." | ||
license = "LGPL-2.1" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/libimobiledevice/libplist" | ||
topics = ("plist", "apple", "property list", "binary", "xml", "json", "openstep") | ||
|
||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
} | ||
|
||
implements = ["auto_shared_fpic"] | ||
languages = ["C", "C++"] | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def validate(self): | ||
if self.settings.compiler == "msvc": | ||
raise ConanInvalidConfiguration("libplist does not support MSVC - use MinGW instead") | ||
|
||
def build_requirements(self): | ||
self.tool_requires("libtool/2.4.7") | ||
if self.settings_build.os == "Windows": | ||
self.win_bash = True | ||
if not self.conf.get("tools.microsoft.bash:path", check_type=str): | ||
self.tool_requires("msys2/cci.latest") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
if not cross_building(self): | ||
VirtualRunEnv(self).generate(scope="build") | ||
tc = AutotoolsToolchain(self) | ||
|
||
tc.configure_args.extend([ | ||
# No need for python bindings | ||
"--without-cython", | ||
]) | ||
tc.generate() | ||
|
||
def build(self): | ||
autotools = Autotools(self) | ||
autotools.configure() | ||
autotools.make() | ||
|
||
def package(self): | ||
copy(self, "COPYING.LESSER", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
autotools = Autotools(self) | ||
autotools.install() | ||
|
||
rm(self, "*.la", os.path.join(self.package_folder, "lib")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
|
||
fix_apple_shared_install_name(self) | ||
|
||
def package_info(self): | ||
self.cpp_info.components["plist"].libs = ["plist-2.0"] | ||
self.cpp_info.components["plist"].set_property("pkg_config_name", "plist-2.0") | ||
self.cpp_info.components["plist"].set_property("cmake_target_name", "libplist::libplist") | ||
|
||
self.cpp_info.components["plist++"].libs = ["plist++-2.0"] | ||
self.cpp_info.components["plist++"].requires = ["plist"] | ||
self.cpp_info.components["plist++"].set_property("pkg_config_name", "plist++-2.0") | ||
self.cpp_info.components["plist++"].set_property("cmake_target_name", "libplist::libplist++") | ||
|
||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.components["plist"].system_libs.extend(["m", "pthread"]) | ||
self.cpp_info.components["plist++"].system_libs.extend(["m", "pthread"]) | ||
|
||
if not self.options.shared: | ||
self.cpp_info.components["plist"].defines.append("LIBPLIST_STATIC") | ||
self.cpp_info.components["plist++"].defines.append("LIBPLIST_STATIC") |
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,10 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES C CXX) | ||
|
||
find_package(libplist REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE libplist::libplist) | ||
|
||
add_executable(${PROJECT_NAME}++ test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME}++ PRIVATE libplist::libplist++) |
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,28 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
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") | ||
|
||
bin_path_cxx = os.path.join(self.cpp.build.bindir, "test_package++") | ||
self.run(bin_path_cxx, env="conanrun") |
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,10 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <plist/plist.h> | ||
|
||
|
||
int main(void) { | ||
printf("plist version: %s\n", libplist_version()); | ||
|
||
return EXIT_SUCCESS; | ||
} |
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,11 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <plist/plist++.h> | ||
|
||
|
||
int main(void) { | ||
auto node = new PList::Boolean(true); | ||
printf("node value: %d\n", node->GetValue()); | ||
|
||
return EXIT_SUCCESS; | ||
} |
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,3 @@ | ||
versions: | ||
"2.6.0": | ||
folder: all |