-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: Add libbasisu package 1.15.0 #6468
feat: Add libbasisu package 1.15.0 #6468
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
recipes/libbasisu/all/conanfile.py
Outdated
"sse": [True, False], | ||
"x64": [True, False], | ||
"zstd": [True, False], | ||
"no_iterator_debug_level": [True, False] |
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.
Please rename this option such no double negations are possible. e.g. iterator_debug_level
(and negate all tests, depending on it).
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.
Renamed to custom_iterator_debug_level, I believe it's more readable and understandable now.
recipes/libbasisu/all/conanfile.py
Outdated
"sse": [True, False], | ||
"x64": [True, False], | ||
"zstd": [True, False], | ||
"no_iterator_debug_level": [True, False] |
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.
I suppose this option sets _ITERATOR_DEBUG_LEVEL
.
This means that this option is only relevant for Visual Studio
.
So please remove this option in config_options
when self.settings.compiler != "Visual Studio"
.
recipes/libbasisu/all/conanfile.py
Outdated
self._cmake.definitions["BUILD_X64"] = self.options.x64 | ||
self._cmake.definitions["SSE"] = self.options.sse | ||
self._cmake.definitions["ZSTD"] = self.options.zstd | ||
self._cmake.definitions["BASISU_NO_ITERATOR_DEBUG_LEVEL"] = self.options.no_iterator_debug_level |
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.
When you apply https://github.com/conan-io/conan-center-index/pull/6468/files#r675570927, you need to use self.options.get_safe("no_iterator_debug_level")
.
self._cmake.definitions["BASISU_NO_ITERATOR_DEBUG_LEVEL"] = self.options.no_iterator_debug_level | |
self._cmake.definitions["BASISU_NO_ITERATOR_DEBUG_LEVEL"] = self.options.no_iterator_debug_level |
recipes/libbasisu/all/conanfile.py
Outdated
options = { | ||
"fPIC": [True, False], | ||
"shared": [True, False], | ||
"sse": [True, False], |
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.
What level of sse support is this?
x86_64 demands a minimum level of sse support.
Is this for x86 support? Or is this for x86_64 with extra sse? e.g. SSE4?
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.
It's support for SSE4.1, I renamed it to use_sse4
.
recipes/libbasisu/all/conanfile.py
Outdated
"fPIC": [True, False], | ||
"shared": [True, False], | ||
"sse": [True, False], | ||
"x64": [True, False], |
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.
Don't create an option for a settings.
You should remove this option and use self.settings.arch == "x86_64"
instead.
recipes/libbasisu/all/conanfile.py
Outdated
"shared": [True, False], | ||
"sse": [True, False], | ||
"x64": [True, False], | ||
"zstd": [True, False], |
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.
When it means that an option will add support for an extra dependency, we usually add the with_
prefix.
"zstd": [True, False], | |
"with_zstd": [True, False], |
recipes/libbasisu/all/conanfile.py
Outdated
"zstd": True, | ||
"no_iterator_debug_level": True | ||
} | ||
short_paths = True |
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.
Just checking, is this really required?
recipes/libbasisu/all/conanfile.py
Outdated
if not self._minimal_compiler_version(): | ||
raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 14 with shared:True".format(self.name, self.version)) |
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.
Please move this to a validate
method.
recipes/libbasisu/all/conanfile.py
Outdated
def build(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
tools.patch(**patch) | ||
self._clear_vs_project_files() |
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.
Is this clearing necessary? Does it bother the cmake build system?
If not, why remove it? I'ld just keep it.
self.copy("*.h", dst=os.path.join("include", self.name, "transcoder"), src=os.path.join(self._source_subfolder, "transcoder")) | ||
self.copy("*.h", dst=os.path.join("include", self.name, "encoder"), src=os.path.join(self._source_subfolder, "encoder")) |
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.
Since you're already patching the cmake script,
consider adding this instead of the call to self.copy("*.h")
.
install(DIRECTORY transcoder DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libbasisu" FILES_MATCHING "*.h")
install(DIRECTORY encoder DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libbasisu" FILES_MATCHING "*.h")
or the following, if I screwed up the folders.
install(DIRECTORY transcoder DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libbasisu/transcoder" FILES_MATCHING "*.h")
install(DIRECTORY encoder DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libbasisu/encoder" FILES_MATCHING "*.h")
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.
Since I only wanted to make necessary changes in the cmake script, I have moved all of the installation steps to the package method in conanfile.py. But the second proposal would be ok as well.
|
||
-if (NOT MSVC) | ||
- target_link_libraries(basisu m pthread) | ||
+if (MSVC) |
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.
I think you can change this to WIN32
. mingw also needs to export the symbols.
recipes/libbasisu/all/conanfile.py
Outdated
|
||
def _minimal_compiler_version(self) -> bool: | ||
version = tools.Version(self.settings.compiler.version.value) | ||
return (self.settings.compiler == "Visual Studio" and version >= "15") \ |
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.
Consider using a dict for this, it makes cleaner code. See other recipes on cci on how this can be done.
Also, unknown compiler should be allowed. A warning message can be printed then.
Resolve PR comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a4ad4aa
to
2396c31
Compare
This comment has been minimized.
This comment has been minimized.
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -1,14 +1,14 @@ | ||
-project(basisu) |
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.
As a general note, when you see a poor cmake script that needs to be patched (heavily).
It's always nice to also send the changes to the project itself. That way, upstream benefits too from your work.
recipes/libbasisu/all/conanfile.py
Outdated
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, 11) |
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.
if self.settings.compiler.get_safe("cppstd"): | |
tools.check_min_cppstd(self, 11) | |
if self.settings.compiler.get_safe("cppstd"): | |
tools.check_min_cppstd(self, 11) |
Move it to validate()
method, because it's validating the cppstd.
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.
I'm not going to argue, but in official documentation is check_min_cppstd
used in configure
.
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.
Thanks for pointing it. Indeed check_min_cppstd
is older than validate
and the documentation is outdated now. I'll open an PR updating it.
recipes/libbasisu/all/conanfile.py
Outdated
custom_iterator_debug_level = self.options.get_safe("custom_iterator_debug_level", default="False") | ||
self._cmake.definitions["BASISU_NO_ITERATOR_DEBUG_LEVEL"] = not custom_iterator_debug_level |
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.
custom_iterator_debug_level = self.options.get_safe("custom_iterator_debug_level", default="False") | |
self._cmake.definitions["BASISU_NO_ITERATOR_DEBUG_LEVEL"] = not custom_iterator_debug_level | |
self._cmake.definitions["BASISU_NO_ITERATOR_DEBUG_LEVEL"] = not self.options.get_safe("custom_iterator_debug_level", False) |
Default won't be converted from String to Boolean.
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.
May I ask you for any possible and correct solution for this? As I can see it's quite common in other recipes, e.g. self._autotools.fpic = self.options.get_safe("fPIC", True)
in the libpcap recipe and little bit lower in the documentation as well:
def build(self):
# Will return None if doesn't exist
fpic = self.options.get_safe("fPIC")
# Will return the default value if the return is None
shared = self.options.get_safe("shared", default=False)
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.
uilian suggested to change the argument of the default
argument from the string "False"
to the boolean False
.
.get_safe
tries to convert a value to the type of the default value.
Related to your question, I would do:
fpic = self.options.get_safe("fPIC", True) # Return True when fPIC is not available (it is often removed when built as a shared library)
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.
Correct. Thanks!
Use default value of custom_iterator_debug_level in get_safe
All green in build 6 (
|
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.
Why was this package named libbasisu
instead of basis_universal
?
This looks wrong to me. There is also a command line tool which we might want to add at some point to this package
https://github.com/BinomialLLC/basis_universal#command-line-compression-tool
This library has vendored some libraries, which are available in cci.
So in theory, lodepng and zstd should become requirements + libbasisu's build system modified to use these. |
I Agree with @Croydon, basis_univeral or basisu would have been more appropriate. Though, AFAIR, this project doesn't officially provide a lib anyway. |
-option(STATIC "static linking" FALSE) | ||
-option(SSE "SSE 4.1 support" FALSE) | ||
+ | ||
+project(libbasisu VERSION 1.15.0 LANGUAGES CXX) |
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.
Not a good idea to prefix project name with lib, then rely on it for library target.
Then you end up with ugly liblib file name:
libbasisu/1.15.0 package(): Packaged 1 '.a' file: liblibbasisu.a
We named this package as |
Specify library name and version: libbasisu/1.15.0
This is also a good place to share with all of us why you are submitting this PR (specially if it is a new addition to ConanCenter): is it a dependency of other libraries you want to package? Are you the author of the library? Thanks!
I'm not the author of this library, but it's is a dependency of for library we use and we would like to provide a Conan package for the simple use of anyone in the community.
conan-center hook activated.