forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
[libffi] Added Conan v2 support #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jellespijker
wants to merge
110
commits into
cura-dev
Choose a base branch
from
CURA-9628-libffi_conan_v2_ready
base: cura-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
110 commits
Select commit
Hold shift + click to select a range
95d6167
Added Conan v2 support
jellespijker 4dbe053
catch ValueError instead of broad Exception catch
496845c
Validating not needed in this recipe
jellespijker bff26d3
Clean-up various path references
jellespijker 3edbb9e
Merge branch 'conan-io:master' into CURA-9628-libffi_conan_v2_ready
jellespijker a496788
Use modern apple rpath fix
jellespijker 8949aba
Reapplied patches again
jellespijker a3ddea9
convert Path to str before passing to unix_path
601b6e0
Removed clang exception in generate
c42f0ed
Use user_info.ar_lib as a workaround
jellespijker 4dfc960
disable multi os directory when compiling with apple-clang
jellespijker 9f24b5b
(#12383) cocoyaxi: conan v2 support & update tarball url
SpaceIm 3d6939e
(#12704) docs: update documentation for handling recipe changes
b925049
(#12873) [docs] Regenerate tables of contents
github-actions[bot] a10e631
(#12861) [tomlplusplus] Cross compatibility for Conan 1.x and 2.x
uilianries 5213cc3
(#12865) cpp-peglib: add version 1.8.1
toge be3dcda
(#12795) fixes android-ndk regression with CMakeToolchain
AlexRamallo 0e3f2c5
(#12870) [bot] Add Access Request users (2022-09-08)
conan-center-bot c93e5d5
(#12003) opencore-amr/0.1.6: bump library version
YaZasnyal 82767ad
(#12386) [libpng] Conan v2 support
uilianries 24dd912
(#12479) cryptopp: update to 8.7.0
chausner f8181c5
(#12735) jwt-cpp: fix building without picojson
JorgenPo 0024a5a
(#12846) asio-grpc: update to v2.1.0
Tradias 24edc95
(#12855) coin-cgl: generate gcc11 binaries
ericLemanissier 8e5e72c
(#12875) roaring: add version 0.7.1
toge 8676a42
(#12876) ms-gsl: make sure it's declaring all the known settings
6e721f5
(#12878) [docs] source subfolder is no longer used
uilianries cf3936e
(#12882) xkbcommon: Small fixes
jwillikers d067ccb
(#12886) earcut: add version 2.2.4
toge 62df6e5
(#12894) magic_enum: conan v2 support
SpaceIm 9f56615
(#12895) lz4: Update to 1.9.4
chausner f4b4af5
(#12807) boost: Add 1.80.0
jwillikers 612824f
(#12897) msgpack-cxx: add version 4.1.2
toge 7cc71ef
(#12905) [docs] `config.yml` file is mandatory
jgsogo 4a586c4
(#12908) Use target_compile_features for package_templates/cmake_pack…
MartinDelille b5b2825
(#12912) Add libltc/1.3.2 version
MartinDelille 019ed27
(#12913) [docs] Clarify Unexpected error restarting
uilianries 16899ec
(#12914) etl: add version 20.34.0
toge 4de0e88
(#12917) voropp: conan v2 support + fix download of source code
SpaceIm 2128eb4
(#12918) ninja: conan v2 support & drop 1.9.0
SpaceIm a5fe347
(#12921) fast-cdr: conan v2 support
SpaceIm 28e2dd3
(#12925) add parson/1.4.0
SpaceIm 5c7f7a9
(#12926) aws-c-compression: conan v2 support
SpaceIm aed3a54
(#12927) aws-checksums: conan v2 support
SpaceIm 28bac59
(#12932) aws-c-cal: add 0.5.19 + conan v2 support + improve build on …
SpaceIm 8063e30
(#12934) docs: 2.0 migration guidance for subfolders
dc40846
(#12936) [xnnpack] Add cci.20220801
talyz aca8680
(#12937) [flatbuffers] Add 2.0.6
talyz 6cf1f95
(#12940) cpp-httplib: add version 0.11.2
chausner 03ee321
(#12945) [docs] Hotfix replace wrong cmake method in docs
uilianries 8081251
(#12920) wslay: conan v2 support
SpaceIm aa19207
(#12910) bump dependencies of vulkan-validationlayers; partial conan …
AndreyMlashkin 8a02499
(#12725) update drogon to 1.8.0
paulocoutinhox 4f9998a
(#12922) gemmlowp: conan v2 support
SpaceIm 9a5bb5e
(#12816) Add bandit
MartinDelille c3f7f5a
(#12959) [linter] Convert import ConanFile from conans into an error
danimtb baec342
(#12960) [bot] Add Access Request users (2022-09-15)
conan-center-bot bbe0878
(#12310) Update qxmpp to use Qt 6.2.4
jave27 5d82e07
(#11993) hazelcast-cpp-client: update dependencies and migration to C…
toge 328bff8
(#12847) fmt: conan v2 modernize
46baaae
(#12935) rapidjson: Conan 2.0 migration
a9dadfb
(#12949) luau: add version 0.544
toge 096faf0
(#12953) lz4: fix CMake imported targets
SpaceIm 53068aa
(#12909) glog: delete unneeded CMakeLists.txt
AndreyMlashkin c1bb3ed
(#12975) added new Version 7.85.0
SamsonBox c4b2a2c
(#12951) coin-cbc: generate gcc11 binaries
ericLemanissier 753c797
(#12978) [docs] package_templates/cmake_package : fix `cache_variable…
toge e8ec71c
(#12982) magic_enum: add version 0.8.1
toge 8d778ab
(#12984) libnghttp2: add version 1.49.0
toge d95490c
Use conf for AR variable
jellespijker b2a9040
(#12992) kuba-zip: add version 0.2.5
toge 8f1eb19
(#12034) dacap-clip: add recipe
toge 44c243c
(#12994) statslib: add version 3.2.0
toge f85db3e
(#12998) at-spi2-core: add version 2.46.0
ericLemanissier 1536fa7
(#12879) qt 5.15.6
ericLemanissier 7a2b1c9
(#13003) thrift: add version 0.17.0
toge 72aa361
(#13005) update sqlite 3.39.3
paulocoutinhox 7b0f5ab
(#12965) [docs] Safer autotools template
uilianries c7a95ad
(#12968) vulkan-validationlayers: add 1.3.224.1 & modernize more for …
SpaceIm 17c3d2e
(#12986) biflags: new recipe
robomics fd58bf6
(#12996) glib: add version 2.74.0
ericLemanissier af84dab
(#12952) wayland: fix native build when dependencies of wayland-scann…
SpaceIm 908b578
(#13014) [docs] Fix leftover dot for cache_variables
uilianries ce5ae1f
(#12215) [librdkafka] Adds code to test package to test rdkafka++ lib…
sourcedelica d3bfd95
(#13009) implot: add version 0.14
toge 1b7da89
(#12845) qwt: Use Cmake instead of qmake
EstebanDugueperoux2 398280f
(#13015) json-c: add version 0.16
toge 3411812
(#13018) harfbuzz 5.2.0
ericLemanissier 378f390
(#12195) libbigwig: new recipe
robomics a67028d
(#12425) imutils-cpp: add recipe
toge e205c46
(#12764) Add gc/8.2.2 recipe
ivmai 9382df5
(#12841) openal: conan v2 support
SpaceIm 570a2c3
(#12868) poco: conan v2 support
SpaceIm 7ed7920
(#12944) libpfm4: Add version 4.8.0
elazarl e925af7
(#13019) [bot] Add Access Request users (2022-09-19)
conan-center-bot 6098bb6
(#13028) [docs] Remove how to disable pylint
uilianries 384b1a1
(#12955) [docs] Regenerate tables of contents
github-actions[bot] bdc4961
(#13039) Update changelog 20-September-2022
danimtb e93fecc
(#13040) [config] Update conan version to 1.52.0
danimtb 200cbc5
(#13004) update sqlitecpp to 3.2.0
paulocoutinhox 13aec6d
(#13044) sqlitecpp: more conan v2 stuff
SpaceIm 79d0cb5
(#12899) Add npcap package
kayoub5 e55155b
(#12928) unordered_dense: add recipe
toge 5592b28
(#12930) daw_header_libraries: conan v2 support and remove older vers…
toge f0a7b96
(#13011) pango 1.50.10
ericLemanissier d4c61a4
(#13029) optional-lite: conan v2 support
SpaceIm a4b7ebc
(#13026) libffi 3.4.3
ericLemanissier 924830c
(#13046) opentdf-client: add version 1.1.6
patmantru 383ed57
(#12281) docs: capture our policy for the options `shared` and `fPIC`
4c81e7e
Merge branch 'conan-io:master' into CURA-9628-libffi_conan_v2_ready
jellespijker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,185 +1,191 @@ | ||
| from conan.tools.microsoft import msvc_runtime_flag | ||
| from conans import ConanFile, tools, AutoToolsBuildEnvironment | ||
| import contextlib | ||
| import os | ||
| import shutil | ||
| from conan import ConanFile | ||
| from conan.tools.apple import fix_apple_shared_install_name, is_apple_os | ||
| from conan.tools.env import VirtualBuildEnv | ||
| from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rm, rmdir | ||
| from conan.tools.gnu import Autotools, AutotoolsToolchain | ||
| from conan.tools.layout import basic_layout | ||
| from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path | ||
| from conan.tools.scm import Version | ||
|
|
||
| required_conan_version = ">=1.36" | ||
| required_conan_version = ">=1.51.3" | ||
|
|
||
|
|
||
| class LibffiConan(ConanFile): | ||
| class PackageConan(ConanFile): | ||
| name = "libffi" | ||
| description = "A portable, high level programming interface to various calling conventions" | ||
| topics = ("libffi", "runtime", "foreign-function-interface", "runtime-library") | ||
| license = "MIT" | ||
| url = "https://github.com/conan-io/conan-center-index" | ||
| homepage = "https://sourceware.org/libffi/" | ||
| license = "MIT" | ||
|
|
||
| topics = ("libffi", "runtime", "foreign-function-interface", "runtime-library") | ||
| settings = "os", "arch", "compiler", "build_type" | ||
| options = { | ||
| "shared": [True, False], | ||
| "fPIC": [True, False], | ||
| } | ||
| default_options = { | ||
| "shared": False, | ||
| "shared": False | ||
| , | ||
| "fPIC": True, | ||
| } | ||
|
|
||
| _autotools = None | ||
|
|
||
| @property | ||
| def _source_subfolder(self): | ||
| return "source_subfolder" | ||
|
|
||
| @property | ||
| def _is_msvc(self): | ||
| return str(self.settings.compiler) in ["Visual Studio", "msvc"] | ||
|
|
||
| @property | ||
| def _settings_build(self): | ||
| # TODO: Remove for Conan v2 | ||
| return getattr(self, "settings_build", self.settings) | ||
|
|
||
| @property | ||
| def _user_info_build(self): | ||
| return getattr(self, "user_info_build", self.deps_user_info) | ||
| def win_bash(self): | ||
| return self._settings_build.os == "Windows" | ||
|
|
||
| def export_sources(self): | ||
| for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
| self.copy(patch["patch_file"]) | ||
| for p in self.conan_data.get("patches", {}).get(self.version, []): | ||
| copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) | ||
|
|
||
| def config_options(self): | ||
| if self.settings.os == "Windows": | ||
| del self.options.fPIC | ||
|
|
||
| def configure(self): | ||
| if self.options.shared: | ||
| del self.options.fPIC | ||
| del self.settings.compiler.libcxx | ||
| del self.settings.compiler.cppstd | ||
| try: | ||
| del self.options.fPIC | ||
| except ValueError: | ||
| pass | ||
| try: | ||
| del self.settings.compiler.libcxx | ||
| except ValueError: | ||
| pass | ||
| try: | ||
| del self.settings.compiler.cppstd | ||
| except ValueError: | ||
| pass | ||
|
|
||
| def layout(self): | ||
| basic_layout(self, src_folder="libffi") | ||
|
|
||
| def build_requirements(self): | ||
| if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): | ||
| self.build_requires("msys2/cci.latest") | ||
| self.build_requires("gnu-config/cci.20201022") | ||
| if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): | ||
| self.tool_requires("msys2/cci.latest") | ||
| self.tool_requires("automake/1.16.5") | ||
| self.tool_requires("libtool/2.4.7") | ||
|
|
||
| def source(self): | ||
| tools.get(**self.conan_data["sources"][self.version], | ||
| destination=self._source_subfolder, strip_root=True) | ||
|
|
||
| def _patch_sources(self): | ||
| for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
| tools.patch(**patch) | ||
| # Generate rpath friendly shared lib on macOS | ||
| configure_path = os.path.join(self._source_subfolder, "configure") | ||
| tools.replace_in_file(configure_path, "-install_name \\$rpath/", "-install_name @rpath/") | ||
|
|
||
| if tools.Version(self.version) < "3.3": | ||
| if self.settings.compiler == "clang" and tools.Version(str(self.settings.compiler.version)) >= 7.0: | ||
| # https://android.googlesource.com/platform/external/libffi/+/ca22c3cb49a8cca299828c5ffad6fcfa76fdfa77 | ||
| sysv_s_src = os.path.join(self._source_subfolder, "src", "arm", "sysv.S") | ||
| tools.replace_in_file(sysv_s_src, "fldmiad", "vldmia") | ||
| tools.replace_in_file(sysv_s_src, "fstmiad", "vstmia") | ||
| tools.replace_in_file(sysv_s_src, "fstmfdd\tsp!,", "vpush") | ||
|
|
||
| # https://android.googlesource.com/platform/external/libffi/+/7748bd0e4a8f7d7c67b2867a3afdd92420e95a9f | ||
| tools.replace_in_file(sysv_s_src, "stmeqia", "stmiaeq") | ||
| get(self, **self.conan_data["sources"][self.version], | ||
| destination=self.source_folder, strip_root=True) | ||
|
|
||
| @contextlib.contextmanager | ||
| def _build_context(self): | ||
| extra_env_vars = {} | ||
| if tools.os_info.is_windows and (self._is_msvc or self.settings.compiler == "clang") : | ||
| msvcc = tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "msvcc.sh")) | ||
| msvcc_args = [] | ||
| if self._is_msvc: | ||
| if self.settings.arch == "x86_64": | ||
| msvcc_args.append("-m64") | ||
| elif self.settings.arch == "x86": | ||
| msvcc_args.append("-m32") | ||
| elif self.settings.compiler == "clang": | ||
| msvcc_args.append("-clang-cl") | ||
|
|
||
| if msvcc_args: | ||
| msvcc = "{} {}".format(msvcc, " ".join(msvcc_args)) | ||
| extra_env_vars.update(tools.vcvars_dict(self.settings)) | ||
| extra_env_vars.update({ | ||
| "INSTALL": tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "install-sh")), | ||
| "LIBTOOL": tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "ltmain.sh")), | ||
| "CC": msvcc, | ||
| "CXX": msvcc, | ||
| "LD": "link", | ||
| "CPP": "cl -nologo -EP", | ||
| "CXXCPP": "cl -nologo -EP", | ||
| }) | ||
| with tools.environment_append(extra_env_vars): | ||
| yield | ||
|
|
||
| def _configure_autotools(self): | ||
| if self._autotools: | ||
| return self._autotools | ||
| self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) | ||
| def generate(self): | ||
| yes_no = lambda v: "yes" if v else "no" | ||
| config_args = [ | ||
| "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), | ||
| "--enable-shared={}".format(yes_no(self.options.shared)), | ||
| "--enable-static={}".format(yes_no(not self.options.shared)), | ||
| ] | ||
| self._autotools.defines.append("FFI_BUILDING") | ||
| if self.options.shared: | ||
| self._autotools.defines.append("FFI_BUILDING_DLL") | ||
| if self._is_msvc: | ||
| if "MT" in msvc_runtime_flag(self): | ||
| self._autotools.defines.append("USE_STATIC_RTL") | ||
| if "d" in msvc_runtime_flag(self): | ||
| self._autotools.defines.append("USE_DEBUG_RTL") | ||
| build = None | ||
| host = None | ||
| if self._is_msvc: | ||
| tc = AutotoolsToolchain(self) | ||
| tc.configure_args.extend([ | ||
| f"--enable-debug={yes_no(self.settings.build_type == 'Debug')}", | ||
| "--datarootdir=${prefix}/res", | ||
| "--enable-builddir=no", | ||
| "--enable-docs=no", | ||
| ]) | ||
|
|
||
| if is_msvc(self): | ||
| build = "{}-{}-{}".format( | ||
| "x86_64" if self._settings_build.arch == "x86_64" else "i686", | ||
| "pc" if self._settings_build.arch == "x86" else "w64", | ||
| "cygwin") | ||
| "pc" if self._settings_build.arch == "x86" else "win64", | ||
| "mingw64") | ||
| host = "{}-{}-{}".format( | ||
| "x86_64" if self.settings.arch == "x86_64" else "i686", | ||
| "pc" if self.settings.arch == "x86" else "w64", | ||
| "cygwin") | ||
| "pc" if self.settings.arch == "x86" else "win64", | ||
| "mingw64") | ||
| tc.configure_args.extend([ | ||
| f"--build={build}", | ||
| f"--host={host}", | ||
| ]) | ||
|
|
||
| if self._settings_build.compiler == "apple-clang": | ||
| tc.configure_args.extend([ | ||
| "--disable-multi-os-directory", | ||
| ]) | ||
|
|
||
| if is_msvc(self): | ||
| msvcc = unix_path(self, str(self.source_path.joinpath("msvcc.sh"))) | ||
| msvcc_args = [] | ||
| if self.settings.arch == "x86_64": | ||
| msvcc_args.append("-m64") | ||
| elif self.settings.arch == "x86": | ||
| msvcc_args.append("-m32") | ||
|
|
||
| if msvcc_args: | ||
| msvcc_args = " ".join(msvcc_args) | ||
| msvcc = f"{msvcc} {msvcc_args}" | ||
|
|
||
| if "MT" in msvc_runtime_flag(self): | ||
| tc.extra_defines.append("USE_STATIC_RTL") | ||
| if "d" in msvc_runtime_flag(self): | ||
| tc.extra_defines.append("d") | ||
|
|
||
| if self.options.shared: | ||
| tc.extra_defines.append("FFI_BUILDING_DLL") | ||
| else: | ||
| if self._autotools.host and "x86-" in self._autotools.host: | ||
| self._autotools.host = self._autotools.host.replace("x86", "i686") | ||
| self._autotools.configure(args=config_args, configure_dir=self._source_subfolder, build=build, host=host) | ||
| return self._autotools | ||
| tc.extra_defines.append("FFI_BUILDING") | ||
|
|
||
| if self.settings.build_type == "Debug": | ||
| tc.extra_defines.append("FFI_DEBUG") | ||
|
|
||
| env = tc.environment() | ||
| if is_msvc(self): | ||
| env.define("LD", "link") | ||
| env.define_path("CXX", msvcc) | ||
| env.define_path("CC", msvcc) | ||
| env.define("CXXCPP", "cl -nologo -EP") | ||
| env.define("CPP", "cl -nologo -EP") | ||
| # env.define("AR", f"{unix_path(self, self.conf.get('tools.automake:ar-lib'))} lib") FIXME: Use the conf once https://github.com/conan-io/conan-center-index/pull/12898 is merged | ||
| env.define("AR", f"{unix_path(self, self.deps_user_info['automake'].ar_lib)} lib") | ||
| env.define("LD", "link") | ||
| env.define("LIBTOOL", unix_path(self, str(self.source_path.joinpath("ltmain.sh")))) | ||
| env.define("INSTALL", unix_path(self, str(self.source_path.joinpath("install-sh")))) | ||
| env.define("NM", "dumpbin -symbols") | ||
| env.define("OBJDUMP", ":") | ||
| env.define("RANLIB", ":") | ||
| env.define("STRIP", ":") | ||
|
|
||
| tc.generate(env) | ||
|
|
||
| ms = VirtualBuildEnv(self) | ||
| ms.generate(scope="build") | ||
|
|
||
| def _patch_source(self): | ||
| apply_conandata_patches(self) | ||
|
|
||
| if Version(self.version) < "3.3": | ||
| if self.settings.compiler == "clang" and Version(str(self.settings.compiler.version)) >= 7.0: | ||
| # https://android.googlesource.com/platform/external/libffi/+/ca22c3cb49a8cca299828c5ffad6fcfa76fdfa77 | ||
| sysv_s_src = self.source_path.joinpath("src", "arm", "sysv.S") | ||
| replace_in_file(self, sysv_s_src, "fldmiad", "vldmia") | ||
| replace_in_file(self, sysv_s_src, "fstmiad", "vstmia") | ||
| replace_in_file(self, sysv_s_src, "fstmfdd\tsp!,", "vpush") | ||
|
|
||
| # https://android.googlesource.com/platform/external/libffi/+/7748bd0e4a8f7d7c67b2867a3afdd92420e95a9f | ||
| replace_in_file(self, sysv_s_src, "stmeqia", "stmiaeq") | ||
|
|
||
| def build(self): | ||
| self._patch_sources() | ||
| shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, | ||
| os.path.join(self._source_subfolder, "config.sub")) | ||
| shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, | ||
| os.path.join(self._source_subfolder, "config.guess")) | ||
|
|
||
| with self._build_context(): | ||
| autotools = self._configure_autotools() | ||
| autotools.make() | ||
| if tools.get_env("CONAN_RUN_TESTS", False): | ||
| autotools.make(target="check") | ||
| self._patch_source() | ||
|
|
||
| autotools = Autotools(self) | ||
| autotools.configure() | ||
| autotools.make() | ||
|
|
||
| def package(self): | ||
| self.copy("LICENSE", src=self._source_subfolder, dst="licenses") | ||
| if self._is_msvc: | ||
| if self.options.shared: | ||
| self.copy("libffi.dll", src=".libs", dst="bin") | ||
| self.copy("libffi.lib", src=".libs", dst="lib") | ||
| self.copy("*.h", src="include", dst="include") | ||
| else: | ||
| with self._build_context(): | ||
| autotools = self._configure_autotools() | ||
| autotools.install() | ||
| autotools = Autotools(self) | ||
| autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) # Need to specify the `DESTDIR` as a Unix path, aware of the subsystem | ||
|
|
||
| if is_apple_os(self): | ||
| fix_apple_shared_install_name(self) | ||
|
|
||
| tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
| tools.rmdir(os.path.join(self.package_folder, "share")) | ||
| tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") | ||
| copy(self, pattern="*.dll", dst=self.package_path.joinpath("bin"), src=self.package_path.joinpath("lib")) | ||
| copy(self, pattern="LICENSE", dst=self.package_path.joinpath("licenses"), src=self.source_folder) | ||
|
|
||
| rm(self, "*.la", self.package_path.joinpath("lib"), recursive=True) | ||
| rmdir(self, self.package_path.joinpath("lib", "pkgconfig")) | ||
| rmdir(self, self.package_path.joinpath("share")) | ||
|
|
||
| def package_info(self): | ||
| self.cpp_info.libs = ["{}ffi".format("lib" if is_msvc(self) else "")] | ||
| self.cpp_info.set_property("pkg_config_name", "libffi") | ||
| self.cpp_info.libs = ["{}ffi".format("lib" if self._is_msvc else "")] | ||
| if not self.options.shared: | ||
| self.cpp_info.defines = ["FFI_BUILDING"] | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| cmake_minimum_required(VERSION 3.1) | ||
| project(test_package C) | ||
| cmake_minimum_required(VERSION 3.8) | ||
|
|
||
| include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
| conan_basic_setup() | ||
| if(CONAN_SETTINGS_COMPILER_RUNTIME MATCHES ".*d") | ||
| add_compile_definitions(DISABLE_FFI_CALL) | ||
| endif() | ||
| project(test_package C) # if the project is pure C | ||
| # project(test_package CXX) # if the project uses c++ | ||
|
|
||
| find_package(libffi REQUIRED CONFIG) | ||
|
|
||
| add_executable(${PROJECT_NAME} test_package.c) | ||
| target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
| # don't link to ${CONAN_LIBS} or CONAN_PKG::package | ||
| target_link_libraries(${PROJECT_NAME} PRIVATE libffi::libffi) | ||
| # In case the target project need a specific C++ standard | ||
| # target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.