Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed May 29, 2021
2 parents 5b138bc + b78a363 commit 87ed6a8
Show file tree
Hide file tree
Showing 975 changed files with 20,492 additions and 3,109 deletions.
23 changes: 22 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# Changelog

### 08-April-2021 - 17:01 CET
### 24-May-2021 - 15:59 CEST

- [feature] Start to crossbuild Apple M1 using two profiles approach (extra build).
- [feature] Detect and report when a PR has missing dependencies.
- [feature] Upgrade Conan version to 1.35.2.
- [feature] Use only one Artifactory repository per pull request.

### 13-May-2021 - 17:20 CEST

- [fix] Add `--dry-build` to `conan info` commands, it will expand also the build-requires that would have
failed during the build stage.
- [fix] Escape character comma when assigning properties to Artifactory.
- [fix] Add `--force` when adding remotes.

### 30-April-2021 - 13:52 CEST

- [feature] Add mark in logs to indicate output has been trimmed.
- [feature] Stop uploading packages to Bintray.
- [job] RequestReviews: Automatically request team reviews for PRs ready for review.
- [job] Add checks to validate infrastructure: MacOS version and AVX2 in CPU features.

### 08-April-2021 - 17:01 CEST

- [feature] Hide previous comments by the bot.
- [feature] Use Artifactory API to promote packages from one repository to another.
Expand Down
40 changes: 38 additions & 2 deletions docs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This section gathers the most common questions from the community related to pac
## Contents

* [What is the policy on recipe name collisions?](#what-is-the-policy-on-recipe-name-collisions)
* [What is the policy on creating packages from pre-compiled binaries?](#what-is-the-policy-on-creating-packages-from-pre-compiled-binaries)
* [Should reference names use `-` or `_`?](#should-reference-names-use---or-_)
* [Why are CMake find/config files and pkg-config files not packaged?](#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged)
* [Should recipes export a recipe's license?](#should-recipes-export-a-recipes-license)
Expand All @@ -18,7 +19,10 @@ This section gathers the most common questions from the community related to pac
* [Why PDB files are not allowed?](#why-pdb-files-are-not-allowed)
* [Why is there no option for PDB, as there is for fPIC?](#why-is-there-no-option-for-pdb-as-there-is-for-fpic)
* [Why _installer_ packages remove some settings from their package ID?](#why-_installer_-packages-remove-some-settings-from-their-package-id)
* [Can I remove an option from recipe](#can-i-remove-an-option-from-recipe)<!-- endToc -->
* [Can I remove an option from recipe](#can-i-remove-an-option-from-recipe)
* [Can I split a project into an installer and library package?](#can-i-split-a-project-into-an-installer-and-library-package)
* [What license should I use for Public Domain?](#what-license-should-i-use-for-public-domain)
* [Why is a `tools.check_min_cppstd` call not enough?](#why-is-a-toolscheck_min_cppstd-call-not-enough)<!-- endToc -->

## What is the policy on recipe name collisions?

Expand Down Expand Up @@ -120,7 +124,6 @@ However, there are ways to get around this, one of them is through the [/Z7](htt

Adding one more common option, it seems the most simple and obvious solution, but it contains a side effect already seen with fPIC. It is necessary to manage the entire recipe, it has become a Boilerplate. So, adding PDB would be one more point to be reviewed for each recipe. In addition, in the future new options could arise, such as sanity or benchmark, further inflating the recipes. For this reason, a new option will not be added. However, the inclusion of the PDB files is discussed in issue [#1982](https://github.com/conan-io/conan-center-index/issues/1982) and there are some ideas for making this possible through a new feature. If you want to comment on the subject, please visit issue.


## Why _installer_ packages remove some settings from their package ID?

There are some recipes in `conan-center-index` that provide packages that contain only executables (some examples are `b2`, `cmake` or `make`), these packages are used in
Expand Down Expand Up @@ -158,3 +161,36 @@ and [libcurl](https://github.com/conan-io/conan-center-index/blob/f834ee1c825641

However, if logic is too complex (this is subjective and depends on the Conan review team) then just remove the option.
After one month, we will welcome a PR removing the option that was deprecated.


## Can I split a project into an installer and library package?

No. Some projects provide more than a simple library, but also applications. For those projects, both libraries and executables should be kept together under the same Conan package. In the past, we tried to separate popular projects, like Protobuf, and it proved to be a complex and hard task to be maintained, requiring custom patches to disable parts of the building. Also, with the [context](https://docs.conan.io/en/latest/systems_cross_building/cross_building.html#conan-v1-24-and-newer) feature, we can use the same package as build requirement, for the same build platform, and as a regular requirement, for the host platform, when cross-building. It's recommended using 2 profiles in that case, one for build platform (where the compilation tools are being executed) and one for host platform (where the generated binaries will run).

## What license should I use for Public Domain?

[The Public Domain](https://fairuse.stanford.edu/overview/public-domain/welcome/) is not a license by itselt. Thus, we have [equivalent licenses](https://en.wikipedia.org/wiki/Public-domain-equivalent_license) to be used instead. By default, if a project uses Public Domain and there is no offcial license listed, you should use [Unlicense](https://spdx.org/licenses/Unlicense).

## Why is a `tools.check_min_cppstd` call not enough?

Very often C++ projects require a minimum standard version, such as 14 or 17, in order to compile. Conan offers tools which enable checking the relevant setting is enabled and above this support for a certain version is present. Otherwise, it uses the compiler's default.

```python
def configure(self):
tools.check_min_cppstd(self, 14) 👈 Wrong!
```

This fails to cover the waste number of use cases for the following reasons:

1. `cppstd` is not configured in the `--detect`ed profiles generated by Conan, the majority of users simply do not have this setting.
2. A shocking number of projects override this setting within their respective build scripts, this setting does not get applied in those cases.
3. Conan-Center-Index does **not** manage the `cppstd` setting for the compilers it supports to generate binaries.

```python
def validate(self):
# 👇 Correct
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 14)
```

As a result, all calls to `tools.check_min_cppstd` must be guarded by a check for the setting and the only way to ensure the C++ standard is to check the compiler's version to know if it offers sufficient support. An example of this can be found [here](https://github.com/conan-io/conan/issues/8002).
10 changes: 8 additions & 2 deletions docs/how_to_add_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,19 @@ If you are looking for header-only projects, you can take a look on [rapidjson](

For C/C++ projects which use CMake for building, you can take a look on [szip](https://github.com/conan-io/conan-center-index/blob/master/recipes/szip/all/conanfile.py) and [recastnavigation](https://github.com/conan-io/conan-center-index/blob/master/recipes/recastnavigation/all/conanfile.py).

Another common use case for CMake based projects, both header only and compiled, is _modeling components_ to match the `find_package` and export the correct targets from Conan's generators. A basic examples of this is [cpu_features](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpu_features/all/conanfile.py), a moderate/intermediate example is [cpprestsdk](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpprestsdk/all/conanfile.py), and a very complex example is [OpenCV](https://github.com/conan-io/conan-center-index/blob/master/recipes/opencv/4.x/conanfile.py).

However, if you need to use autotools for building, you can take a look on [mpc](https://github.com/conan-io/conan-center-index/blob/master/recipes/mpc/all/conanfile.py), [libatomic_ops](https://github.com/conan-io/conan-center-index/blob/master/recipes/libatomic_ops/all/conanfile.py), [libev](https://github.com/conan-io/conan-center-index/blob/master/recipes/libev/all/conanfile.py).

Many projects offer **pkg-config**'s `*.pc` files which need to be modeled using components. A prime example of this is [Wayland](https://github.com/conan-io/conan-center-index/blob/master/recipes/wayland/all/conanfile.py).

For cases where a project only offers source files, but not a build script, you can add CMake support, but first, contact the upstream and open a PR offering building support. If it's rejected because the author doesn't want any kind of build script, or the project is abandoned, CCI can accept your build script. Take a look at [Bzip2](https://github.com/conan-io/conan-center-index/blob/master/recipes/bzip2/all/CMakeLists.txt) and [DirectShowBaseClasses](https://github.com/conan-io/conan-center-index/blob/master/recipes/directshowbaseclasses/all/CMakeLists.txt) as examples.

Please be aware that ConanCenter only builds from sources and [pre-compiled binaries are not acceptable](https://github.com/conan-io/conan-center-index/blob/master/docs/packaging_policy.md)

### Test the recipe locally

The system will use the [conan-center hook](https://github.com/conan-io/hooks.git) to perform some quality checks. You can install the hook running:
The system will use the [conan-center hook](https://github.com/conan-io/hooks) to perform some quality checks. You can install the hook running:

```
$ conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks
Expand All @@ -184,7 +190,7 @@ Please be aware that ConanCenter only builds from sources and [pre-compiled bina
Call `conan create . lib/1.0@` in the folder of the recipe using the profile you want to test. For instance:

cd conan-center-index/recipes/boost/all
conan create . 1.74.0@
conan create . boost/1.74.0@

### Updating conan hooks on your machine

Expand Down
1 change: 1 addition & 0 deletions docs/review_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The list includes conan-center-index contributors who are very active and proven
- [@theirix](https://github.com/theirix)
- [@gocarlos](https://github.com/gocarlos)
- [@mathbunnyru](https://github.com/mathbunnyru)
- [@ericriff](https://github.com/ericriff)

The list is not constant and will change periodically based on contribution.
That also means you can be included in this list as well - submit PRs and provide reviews, and in time you may be added as a trusted contributor.
Expand Down
30 changes: 29 additions & 1 deletion docs/reviewing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The following policies are preferred during the review, but not mandatory:
* [CMake Configure Method](#cmake-configure-method)
* [Test Package](#test-package)
* [Minimalistic Source Code](#minimalistic-source-code)
* [Verifying Components](#verifying-components)<!-- endToc -->
* [Verifying Components](#verifying-components)
* [Recommended feature options names](#recommended-feature-options-names)<!-- endToc -->

## Trailing white-spaces

Expand Down Expand Up @@ -113,3 +114,30 @@ When components are defined in the `package_info` in `conanfile.py` the followin

- use the `cmake_find_package` or `cmake_find_package_multi` generators in `test_package/conanfile.py`
- corresponding call to `find_package()` with the components _explicitly_ used in `target_link_libraries`

### Recommended feature options names

It's often needed to add options to toggle specific library features on/off. Regardless of the default, there is a strong preference for using positive naming for options. In order to avoid the fragmentation, we recommend to use the following naming conventions for such options:

- enable_<feature> / disable_<feature>
- with_<dependency> / without_<dependency>
- use_<feature>

the actual recipe code then may look like:

```py
options = {"use_tzdb": [True, False]}
default_options = {"use_tzdb": True}
```

```py
options = {"enable_locales": [True, False]}
default_options = {"enable_locales": True}
```

```py
options = {"with_zlib": [True, False]}
default_options = {"with_zlib": True}
```

having the same naming conventions for the options may help consumers, e.g. they will be able to specify options with wildcards: `-o *:with_threads=True`, therefore, `with_threads` options will be enabled for all packages in the graph that support it.
6 changes: 6 additions & 0 deletions recipes/abseil/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ sources:
"20200923.3":
url: "https://github.com/abseil/abseil-cpp/archive/20200923.3.tar.gz"
sha256: "ebe2ad1480d27383e4bf4211e2ca2ef312d5e6a09eba869fd2e8a5c5d553ded2"
"20210324.0":
url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.0.tar.gz"
sha256: "dd7db6815204c2a62a2160e32c55e97113b0a0178b2f090d6bab5ce36111db4b"
"20210324.1":
url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.1.tar.gz"
sha256: "441db7c09a0565376ecacf0085b2d4c2bbedde6115d7773551bc116212c2a8d6"
patches:
"20200205":
- patch_file: "patches/cmake-install.patch"
Expand Down
45 changes: 22 additions & 23 deletions recipes/abseil/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import glob
from conans import ConanFile, CMake, tools
import json
import os
import re
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration, ConanException

required_conan_version = ">=1.33.0"


class ConanRecipe(ConanFile):
Expand Down Expand Up @@ -40,9 +40,8 @@ def configure(self):
tools.check_min_cppstd(self, 11)

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = glob.glob('abseil-cpp-*/')[0]
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def _configure_cmake(self):
if self._cmake:
Expand All @@ -65,6 +64,7 @@ def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
cmake_folder = os.path.join(self.package_folder, "lib", "cmake")
self._create_components_file_from_cmake_target_file(os.path.join(cmake_folder, "absl", "abslTargets.cmake"))
tools.rmdir(cmake_folder)
Expand Down Expand Up @@ -129,20 +129,19 @@ def _components_helper_filepath(self):
def package_info(self):
self.cpp_info.names["cmake_find_package"] = "absl"
self.cpp_info.names["cmake_find_package_multi"] = "absl"
self._register_components()

def _register_components(self):
with open(self._components_helper_filepath, "r") as components_json_file:
abseil_components = json.load(components_json_file)
for conan_name, values in abseil_components.items():
self._register_component(conan_name, values)

def _register_component(self, conan_name, values):
cmake_target = values["cmake_target"]
self.cpp_info.components[conan_name].names["cmake_find_package"] = cmake_target
self.cpp_info.components[conan_name].names["cmake_find_package_multi"] = cmake_target
self.cpp_info.components[conan_name].libs = values.get("libs", [])
self.cpp_info.components[conan_name].defines = values.get("defines", [])
self.cpp_info.components[conan_name].system_libs = values.get("system_libs", [])
self.cpp_info.components[conan_name].frameworks = values.get("frameworks", [])
self.cpp_info.components[conan_name].requires = values.get("requires", [])

def _register_components():
components_json_file = tools.load(self._components_helper_filepath)
abseil_components = json.loads(components_json_file)
for pkgconfig_name, values in abseil_components.items():
cmake_target = values["cmake_target"]
self.cpp_info.components[pkgconfig_name].names["cmake_find_package"] = cmake_target
self.cpp_info.components[pkgconfig_name].names["cmake_find_package_multi"] = cmake_target
self.cpp_info.components[pkgconfig_name].names["pkg_config"] = pkgconfig_name
self.cpp_info.components[pkgconfig_name].libs = values.get("libs", [])
self.cpp_info.components[pkgconfig_name].defines = values.get("defines", [])
self.cpp_info.components[pkgconfig_name].system_libs = values.get("system_libs", [])
self.cpp_info.components[pkgconfig_name].frameworks = values.get("frameworks", [])
self.cpp_info.components[pkgconfig_name].requires = values.get("requires", [])

_register_components()
4 changes: 4 additions & 0 deletions recipes/abseil/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ versions:
folder: all
"20200923.3":
folder: all
"20210324.0":
folder: all
"20210324.1":
folder: all
2 changes: 2 additions & 0 deletions recipes/acado/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ patches:
"1.2.2-beta":
- base_path: "source_subfolder"
patch_file: "patches/0001-binding-temp-object.patch"
- base_path: "source_subfolder"
patch_file: "patches/0002-read-template-path-from-env.patch"
4 changes: 4 additions & 0 deletions recipes/acado/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ def package(self):
tools.remove_files_by_mask(self.package_folder, "*.pdb")

def package_info(self):
acado_template_paths = os.path.join(self.package_folder, "include", "acado", "code_generation", "templates")
self.output.info("Setting ACADO_TEMPLATE_PATHS environment variable: {}".format(acado_template_paths))
self.env_info.ACADO_TEMPLATE_PATHS = acado_template_paths

if self.options.shared:
self.cpp_info.libs = ["acado_toolkit_s", "acado_casadi"]
else:
Expand Down
25 changes: 25 additions & 0 deletions recipes/acado/all/patches/0002-read-template-path-from-env.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/acado/code_generation/export_templated_file.cpp b/acado/code_generation/export_templated_file.cpp
index 76ec47a2..937a9c7b 100644
--- a/acado/code_generation/export_templated_file.cpp
+++ b/acado/code_generation/export_templated_file.cpp
@@ -34,6 +34,8 @@
#include <acado/code_generation/export_templated_file.hpp>
#include <acado/code_generation/templates/templates.hpp>

+#include <cstdlib>
+
using namespace std;

BEGIN_NAMESPACE_ACADO
@@ -66,7 +68,10 @@ returnValue ExportTemplatedFile::setup( const std::string& _templateName,
{
ExportFile::setup( _fileName, _commonHeaderName, _realString, _intString, _precision, _commentString );

- folders = TEMPLATE_PATHS;
+ if(const char* template_paths = std::getenv("ACADO_TEMPLATE_PATHS"))
+ {
+ folders = template_paths;
+ }
templateName = _templateName;

return SUCCESSFUL_RETURN;
2 changes: 2 additions & 0 deletions recipes/acado/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class TestPackageConan(ConanFile):

def build(self):
cmake = CMake(self)
# FIXME: CCI infrastructure should provide cpu count input to avoid errors
cmake.parallel = False
cmake.configure()
cmake.build()

Expand Down
7 changes: 7 additions & 0 deletions recipes/aeron/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 2.8.11)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()

add_subdirectory("source_subfolder")
4 changes: 4 additions & 0 deletions recipes/aeron/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.31.2":
url: https://github.com/real-logic/aeron/archive/refs/tags/1.31.2.tar.gz
sha256: "3edcf01415298aa053cd9e9637405cb8f7b940545bb52a563592dab2b35389ea"
Loading

0 comments on commit 87ed6a8

Please sign in to comment.