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 imagl/0.2.1 #4630

Merged
merged 29 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e9078dd
Adding imagl recipe
Woazim Jan 12, 2021
8376ef5
Adding configuration requirements in configure()
Woazim Jan 12, 2021
34a13cf
Prepare for CCI
uilianries Jan 14, 2021
e12e215
Merge pull request #1 from uilianries/imagl/0.1.0
Woazim Jan 15, 2021
109a45e
Update conanfile.py
Woazim Jan 19, 2021
a391575
Merge remote-tracking branch 'upstream/master'
Woazim Jan 20, 2021
906a478
Setting minimum Visual Studio to 16 to let CCI work.
Woazim Jan 20, 2021
a5c8d70
removing fPIC option for Windows config
Woazim Jan 20, 2021
37ea45e
Merge branch 'master' of https://github.com/conan-io/conan-center-index
Woazim Jan 29, 2021
4c90e58
Adding imaGL 0.1.1
Woazim Jan 29, 2021
1345d65
Merge branch 'master' of https://github.com/conan-io/conan-center-index
Woazim Feb 20, 2021
e2ad08a
Adding imagl 0.2.0
Woazim Feb 20, 2021
5028584
Deleting unsupported option in configure, adding _supports_jpeg prope…
Woazim Feb 26, 2021
065ea9b
Nicer way to get MSVC version.
Woazim Feb 26, 2021
4932cd9
maybe this one, which directly comes from other recipes. But it does …
Woazim Feb 26, 2021
12c9114
More checks on clang and Visual, according to last building failures.
Woazim Feb 26, 2021
e49ff9c
Add a check to VS version >= 16 before trying to run vswhere
Woazim Feb 26, 2021
eaa0681
When vswhere is not runnable, raise a ConanInvalidConfiguration.
Woazim Feb 26, 2021
376bd3e
Workaround to check libc++ version.
Woazim Mar 9, 2021
da8f340
Using CXX environment variable to run clang++
Woazim Mar 10, 2021
055e6a9
Direct access to clang at /usr/bin/clang++
Woazim Mar 10, 2021
36707d3
Check for libc++ as stdlib before checking its version
Woazim Mar 10, 2021
ae26a9a
Avoid to build imaGL in CCI with clang 11. Adding some Visual Studio …
Woazim Mar 17, 2021
0fd9fe3
Removed unused import subprocess
Woazim Mar 17, 2021
e2bcef8
Better looking with imports and "allow_clang_11" option
Woazim Mar 28, 2021
a416447
Remove fPIC option for shared option
Woazim Mar 29, 2021
0dcdf20
Code formatting correction, warning when using allow_clang_11 & comme…
Woazim Apr 28, 2021
3476bcb
Removing vswhere in validate() and affectation to settings.compiler.c…
Woazim May 11, 2021
0aab732
Removing Ninja generator forcing which is no more needed since CCI us…
Woazim May 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions recipes/imagl/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ sources:
"0.1.1":
url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.1/imagl-v0.1.1.tar.gz"
sha256: "4a7502cc733431af6423246fe5144e2eddb984454a66cca51742c852980ac862"
"0.1.2":
url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.2/imagl-v0.1.2.tar.gz"
sha256: "d1edf74e00f969a47dc56e4400b805600d6997270339d49e91b7c6112a2cb37e"
"0.2.1":
url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.2.1/imagl-v0.2.1.tar.gz"
sha256: "5a68cdeff4338e411695cca16c4230567de298f8efee2a9fadcc6fa644a70248"
78 changes: 65 additions & 13 deletions recipes/imagl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
from conans.errors import ConanInvalidConfiguration, ConanException
import os


required_conan_version = ">=1.32.0"


Expand All @@ -14,8 +13,20 @@ class ImaglConan(ConanFile):
description = "A lightweight library to load image for OpenGL application."
topics = ("opengl", "texture", "image")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False], "with_png": [True, False]}
default_options = {"shared": False, "fPIC": True, "with_png": True}
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_png": [True, False],
"with_jpeg": [True, False],
"allow_clang_11": [None, True, False]
}
default_options = {
"shared": False,
"fPIC": True,
"with_png": True,
"with_jpeg": True,
"allow_clang_11": None
}
generators = "cmake"
exports_sources = "CMakeLists.txt"
_cmake = None
Expand All @@ -30,12 +41,21 @@ def _build_subfolder(self):

@property
def _compilers_minimum_version(self):
return {
"gcc": "9",
"Visual Studio": "16",
"clang": "10",
"apple-clang": "11"
minimum_versions = {
"gcc": "9",
"Visual Studio": "16.2",
"msvc": "19.22",
"clang": "10",
"apple-clang": "11"
}
if tools.Version(self.version) <= "0.1.1" or tools.Version(self.version) == "0.2.0":
Copy link
Contributor

Choose a reason for hiding this comment

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

Version 0.2.0 is not listed in config.yml... is this a typo?

minimum_versions["Visual Studio"] = "16.5"
minimum_versions["msvc"] = "19.25"
return minimum_versions

@property
def _supports_jpeg(self):
return tools.Version(self.version) >= "0.2.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Version 0.2.0 is not listed in config.yml... is this a typo?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's fine for me, I guess that jpeg support was added in 0.2.0, so it doesn't matter that exact 0.2.0 version was not in CCI, it makes the recipe more robust if for any reason 0.2.0 is added later.

Copy link
Contributor

Choose a reason for hiding this comment

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

We started by adding 0.2.0 but there was a new point release since then


def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand All @@ -44,27 +64,59 @@ def source(self):
def validate(self):
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, 20)

def lazy_lt_semver(v1, v2):
lv1 = [int(v) for v in v1.split(".")]
lv2 = [int(v) for v in v2.split(".")]
min_length = min(len(lv1), len(lv2))
return lv1[:min_length] < lv2[:min_length]

#Special check for clang that can only be linked to libc++
if self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libc++":
raise ConanInvalidConfiguration("imagl requires some C++20 features, which are available in libc++ for clang compiler.")

compiler_version = str(self.settings.compiler.version)

minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version:
if tools.Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration("imagl requires C++20, which your compiler does not fully support.")
if not minimum_version:
self.output.warn("imaGL requires C++20. Your compiler is unknown. Assuming it supports C++20.")
elif lazy_lt_semver(compiler_version, minimum_version):
raise ConanInvalidConfiguration("imaGL requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), compiler_version))
elif str(self.settings.compiler) == "clang" and compiler_version == "11" and not self.options.allow_clang_11:
raise ConanInvalidConfiguration("Clang 11 is not currently supported by conan center index. To build imaGL, append '-o imagl:allow_clang_11=True --build missing' to your 'conan install' command line.")
else:
self.output.warn("imagl requires C++20. Your compiler is unknown. Assuming it supports C++20.")
print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version))

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if not self._supports_jpeg:
del self.options.with_jpeg
if not str(self.settings.compiler) == "clang" or not str(self.settings.compiler.version) == "11":
del self.options.allow_clang_11
else:
self.output.warn("allow_clang_11 option will be removed in the future when conan center index will support clang 11.")

def configure(self):
if self.options.shared:
del self.options.fPIC

def requirements(self):
if self.options.with_png:
self.requires("libpng/1.6.37")
if self._supports_jpeg and self.options.with_jpeg:
self.requires("libjpeg/9d")

def _configure_cmake(self):
if self._cmake:
return self._cmake

self._cmake = CMake(self)

self._cmake.definitions["STATIC_LIB"] = not self.options.shared
self._cmake.definitions["SUPPORT_PNG"] = self.options.with_png
if self._supports_jpeg:
self._cmake.definitions["SUPPORT_JPEG"] = self.options.with_jpeg
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

Expand Down
4 changes: 4 additions & 0 deletions recipes/imagl/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ versions:
folder: all
"0.1.1":
folder: all
"0.1.2":
folder: all
"0.2.1":
folder: all