-
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
fpng: add recipe #22823
base: master
Are you sure you want to change the base?
fpng: add recipe #22823
Conversation
This comment has been minimized.
This comment has been minimized.
#include "fpng.h" | ||
|
||
int main() { | ||
fpng::fpng_init(); |
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.
Inconsistent indentation.
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.
@valgur
Thanks a lot!
Fixed.
Co-authored-by: Martin Valgur <[email protected]>
Co-authored-by: Martin Valgur <[email protected]>
This comment has been minimized.
This comment has been minimized.
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["FPNG_SRC_DIR"] = self.source_folder.replace("\\", "/") |
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 worth changing it here, but I generally find it easier to
def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src"))
That way all of the CMakeLists.txt and source paths work without any prefixing.
The current approach is not wrong either, though, of course.
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.
@valgur
Sorry for my late response.
I tried your comment, but I failed.
Are there any misunderstandings in my modification?
Error message is following.
fpng/1.0.6: Running CMake.configure()
fpng/1.0.6: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/toge/.conan2/p/b/fpng8db6eab8b7baf/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/toge/.conan2/p/b/fpng8db6eab8b7baf/b/src"
CMake Warning:
Ignoring extra path from command line:
"/home/toge/.conan2/p/b/fpng8db6eab8b7baf/b/src"
CMake Error: The source directory "/home/toge/.conan2/p/b/fpng8db6eab8b7baf/b/src" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
modified conanfile.py
required_conan_version = ">=1.53.0"
class FpngConan(ConanFile):
name = "fpng"
description = "Super fast C++ .PNG writer/reader"
license = "Unlicense",
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/richgel999/fpng"
topics = ("png", "writer", "reader")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_sse": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_sse": True,
}
def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src"))
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
def validate(self):
check_min_cppstd(self, 11)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
# remove original CMakeLists.txt (which builds a test program only)
rm(self, "CMakeLists.txt", self.source_folder)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["FPNG_WITH_SSE"] = self.options.with_sse
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
filename = os.path.join(self.source_folder, "src", "fpng.cpp")
file_content = load(self, filename)
license_start = " This is free and unencumbered software"
license_end = "*/"
license_contents = file_content[file_content.find(license_start):file_content.find(license_end)]
save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents)
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["fpng"]
if self.settings.os in ("FreeBSD", "Linux"):
self.cpp_info.system_libs = ["m"]
</details>
Co-authored-by: Martin Valgur <[email protected]>
Conan v1 pipeline ✔️All green in build 4 (
Conan v2 pipeline ✔️
All green in build 4 (
|
Specify library name and version: fpng/*