Skip to content
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

Add soxr library #7728

Merged
merged 15 commits into from
Oct 25, 2021
Merged

Add soxr library #7728

merged 15 commits into from
Oct 25, 2021

Conversation

chausner
Copy link
Contributor

Specify library name and version: soxr/0.1.3

This adds the new library soxr.


@CLAassistant
Copy link

CLAassistant commented Oct 16, 2021

CLA assistant check
All committers have signed the CLA.

@conan-center-bot

This comment has been minimized.

@chausner
Copy link
Contributor Author

chausner commented Oct 16, 2021

[HOOK - conan-center.py] pre_export(): ERROR: [EXPORT LICENSE (KB-H023)] This recipe is exporting a license file. Remove licenses/** from exports_sources (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H023)

The license file that the recipe exports is not about the recipe's license but applies to one part of the library. To be exact, it has been taken from the file header in pffft.c because this file has a different license than the rest of the library. See also the note at the end in LICENCE:

  1. If building with pffft.c, see the licence embedded in that file.

How should I handle this case?

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can parse the file, take those lines and create the license file on the fly


if (WITH_OPENMP)
- find_package (OpenMP)
+ find_package (OpenMP REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required? It is an option in the recipe, what happens if soxr:with_openmp=False?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment at the top of recipes/soxr/all/patches/findpackage-openmp.patch. I am setting the "REQUIRED" flag because I want CMake to fail early if users set "with_openmp=True" and CMake cannot find the package. Otherwise, the build would succeed and later builds would fail when attempting to link to libsoxr because the compiler flags are still getting set for OpenMP in package_info.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be even better to check it on Conan side, the message to the user could be better and the check performed even before trying to build anything. Also, Conan can run the check even if the binary is already available, when a consumer tries to use this recipe (and the compiler flag is propagated), not just when it is being built.

Is this some library we can build from sources (we have llvm-openmp)? Is this one use-case for a openmp/system package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be even better to check it on Conan side,

Yes, I agree it would be better to check on the Conan side. But I don't think there is a reliable way to check for the presence of a CMake package from within Conan (without invoking CMake itself), is there? What do you suggest in this case?

Is this some library we can build from sources (we have llvm-openmp)? Is this one use-case for a openmp/system package?

Hmm, normally OpenMP is not built from sources. On Linux and macOS, it's commonly installed as a system package. On Windows, it comes with Visual Studio. I am not familiar with llvm-openmp but I doubt this would be the package you normally would want to use on Windows, for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be even better to check it on Conan side,

Yes, I agree it would be better to check on the Conan side. But I don't think there is a reliable way to check for the presence of a CMake package from within Conan (without invoking CMake itself), is there? What do you suggest in this case?

The build system should follow instructions from the package-manager. If the package manager is configured with with_openmp=True, it should pass the option to the build-system and this one should find and use it or fail (the REQUIRED is a good thing). We try to avoid auto-detection as much as possible, because it makes the process uncertain and not reproducible.

If OpenMP is expected to be in the system, then the best way to go is to create a system package, Conan will check if the package is available in the system (using some underlying tool like pkg_config) and generate the proper FindOpenMP.cmake to use it from system libraries.... or fail if the package is required and not available.

It would work like any other requirement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the REQUIRED is a good thing)

Okay, yes I agree and might have misunderstood you here.

If OpenMP is expected to be in the system, then the best way to go is to create a system package,

I see. Unfortunately, I will not be able to contribute that one. I am surprised it does not exist yet, as there should be more existing packages in Conan Center that depend on OpenMP in some way.

For now, I suggest to either go with the current solution in this PR, or if you prefer, I can also completely remove the with_openmp option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there are other packages in ConanCenter with a with_openmp option and all of them default to False, like yours, and it is ok. We can leave it as it is, probably it is something to be addressed in the future and, at that point, we can improve all the recipes.

My initial concern about this issue was if creating (and maintaining) a patch to add the REQUIRED keyword was worth it or not, because it is the only patch in this recipe and the only line changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks fine to me.

@chausner
Copy link
Contributor Author

You can parse the file, take those lines and create the license file on the fly

Done in 1181965.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@chausner
Copy link
Contributor Author

Not sure why but I had to set the fPIC option explicitly as done in some of the other ports, otherwise it would not apply the option:

self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True)

@conan-center-bot

This comment has been minimized.

@uilianries
Copy link
Member

Not sure why but I had to set the fPIC option explicitly as done in some of the other ports, otherwise it would not apply the option:

self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True)

Not needed if you are using CMake helper. It already manages fPIC automatically when the option fPIC is available.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No cmake wrapper? Please, use https://github.com/conan-io/conan-center-index/blob/master/recipes/szip/all/CMakeLists.txt as reference.

Thank you for your contribution!

recipes/soxr/all/conanfile.py Outdated Show resolved Hide resolved
cmake.build()

def _extract_pffft_license(self):
# extract license header from pffft.c and store it in the package folder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@chausner chausner Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer. I have rewritten it using conans.tools and regex: 5865a82

recipes/soxr/all/test_package/CMakeLists.txt Outdated Show resolved Hide resolved
recipes/soxr/all/test_package/conanfile.py Outdated Show resolved Hide resolved
chausner and others added 2 commits October 19, 2021 19:35
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add the cmake wrapper

@chausner
Copy link
Contributor Author

Please, add the cmake wrapper

I added the wrapper in 375aca0.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

recipes/soxr/all/conanfile.py Outdated Show resolved Hide resolved
recipes/soxr/all/conanfile.py Outdated Show resolved Hide resolved

if (WITH_OPENMP)
- find_package (OpenMP)
+ find_package (OpenMP REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks fine to me.

recipes/soxr/all/conanfile.py Show resolved Hide resolved
recipes/soxr/all/conanfile.py Outdated Show resolved Hide resolved
"shared": [True, False],
"fPIC": [True, False],
"with_openmp": [True, False],
"with_lsr_bindings": [True, False]
Copy link
Contributor

@madebr madebr Oct 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option will create a soxr-lsr library (see bottom of this cmake script)
It will also create a soxr-lsr.pc file.

So you will probably need to use modules in package_info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split it up into two components "core" and "lsr". Please have a look: fc13703

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution!

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

All green in build 15 (8b969f092c608db54a1088e4f9d42f3c59c887fb):

  • soxr/0.1.3@:
    All packages built successfully! (All logs)

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@conan-center-bot conan-center-bot merged commit d298dc7 into conan-io:master Oct 25, 2021
@chausner chausner deleted the soxr branch October 26, 2021 22:52
ivanvurbanov pushed a commit to ivanvurbanov/conan-center-index that referenced this pull request Dec 2, 2021
* Add soxr port

* Make config.yml end with a newline

* Extract pffft license header from source file

* Remove pkgconfig and share folders

* Add libm to package_info

* Fix fPIC option

* Use cmake_find_package_multi generator

Co-authored-by: Uilian Ries <uilianries@gmail.com>

* Simplify license header extraction

* Minor tweak

* Fix tools.save call

* Use CMake conan helper wrapper

* Fix missing newline at end-of-file

* Apply suggestions from code review

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* Add separate components for core and lsr

* Fix missing newline at end-of-file

Co-authored-by: chausner <chausner@users.noreply.github.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants