forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 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,24 @@ | ||
sources: | ||
"0.10.4": | ||
Windows: | ||
url: "https://github.com/lu-zero/cargo-c/releases/download/v0.10.4/cargo-c-windows-msvc.zip" | ||
sha256: "516a5e4a2b3948cb20d83346a22b2ba154e15c960104704f8ddd4bb7dd462453" | ||
Linux: | ||
x86_64: | ||
url: "https://github.com/lu-zero/cargo-c/releases/download/v0.10.4/cargo-c-x86_64-unknown-linux-musl.tar.gz" | ||
sha256: "a370d24bfecab96f519010410b0a25c3052cae527cfe6772d1502c9bad53d246" | ||
x86: | ||
url: "https://github.com/lu-zero/cargo-c/releases/download/v0.10.4/cargo-c-i686-unknown-linux-musl.tar.gz" | ||
sha256: "a9636c8b415550232adadb52f0d38ef1ef037e09c1676723d380b7dc05ea96db" | ||
armv8: | ||
url: "https://github.com/lu-zero/cargo-c/releases/download/v0.10.4/cargo-c-aarch64-unknown-linux-musl.tar.gz" | ||
sha256: "5e535bd92685ec16eb78285f409df58d0ca8a51709243f51afba9f610613b78e" | ||
ppc64le: | ||
url: "https://github.com/lu-zero/cargo-c/releases/download/v0.10.4/cargo-c-powerpc64le-unknown-linux-gnu.tar.gz" | ||
sha256: "f2ebea76930864cdd73970cdd1eef53c2d4d75da298b7818a035d9b999d662f6" | ||
Macos: | ||
url: "https://github.com/lu-zero/cargo-c/releases/download/v0.10.4/cargo-c-macos.zip" | ||
sha256: "0e728a636b828677e66245c654cc5e101d2288241d2f9084713384344bc97ab1" | ||
license: | ||
url: "https://raw.githubusercontent.com/lu-zero/cargo-c/v0.10.4/LICENSE" | ||
sha256: "d69f24ad84ec2ade64c0b68bdb31b41170e997b158370342056918329cc9af1e" |
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,59 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.files import copy, get, download | ||
|
||
required_conan_version = ">=1.47.0" | ||
|
||
|
||
class CargoCBuildConan(ConanFile): | ||
name = "cargo-cbuild" | ||
description = "Cargo applet to build and install C-ABI compatible dynamic and static libraries." | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/lu-zero/cargo-c" | ||
topics = ("rust", "cargo", "pre-built") | ||
package_type = "application" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
def layout(self): | ||
pass | ||
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
del self.info.settings.build_type | ||
|
||
def validate(self): | ||
if self.settings.os == "Windows": | ||
if self.settings.arch != "x86_64": | ||
raise ConanInvalidConfiguration("cargo-cbuild is only available for x86_64 on Windows") | ||
if self.settings.os == "Macos": | ||
if self.settings.arch not in ["x86_64", "armv8"]: | ||
raise ConanInvalidConfiguration("cargo-cbuild is only available for x86_64 and armv8 on MacOS") | ||
if self.settings.os == "Linux": | ||
if str(self.settings.arch) not in self.conan_data["sources"][self.version][str(self.settings.os)]: | ||
raise ConanInvalidConfiguration(f"Unsupported arch: {self.settings.arch}") | ||
else: | ||
raise ConanInvalidConfiguration(f"Unsupported OS: {self.settings.os}") | ||
|
||
def build(self): | ||
info = self.conan_data["sources"][self.version][str(self.settings.os)] | ||
if self.settings.os == "Linux": | ||
info = info[str(self.settings.arch)] | ||
get(self, **info) | ||
download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") | ||
|
||
def package(self): | ||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
copy(self, "cargo-*", self.source_folder, os.path.join(self.package_folder, "bin")) | ||
|
||
def package_info(self): | ||
self.cpp_info.frameworkdirs = [] | ||
self.cpp_info.libdirs = [] | ||
self.cpp_info.resdirs = [] | ||
self.cpp_info.includedirs = [] | ||
|
||
# TODO: Legacy, to be removed on Conan 2.0 | ||
bin_folder = os.path.join(self.package_folder, "bin") | ||
self.env_info.PATH.append(bin_folder) |
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 conan import ConanFile | ||
from conan.tools.layout import basic_layout | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
basic_layout(self) | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
def test(self): | ||
self.run("cargo-cbuild --version") |
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 @@ | ||
versions: | ||
"0.10.4": | ||
folder: all | ||
|