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 1 commit
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
45 changes: 41 additions & 4 deletions recipes/imagl/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,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], "with_jpeg": [True, False], "allow_clang_11": [True, False]}
default_options = {"shared": False, "fPIC": True, "with_png": True, "with_jpeg": True, "allow_clang_11": False}
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 Down Expand Up @@ -103,10 +115,14 @@ def config_options(self):
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
if not self.settings.compiler.cppstd:
self.settings.compiler.cppstd = "20"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not assign a value here, it is not going to work... and future versions of Conan will fail here.


def requirements(self):
if self.options.with_png:
Expand All @@ -117,10 +133,31 @@ def requirements(self):
def _configure_cmake(self):
if self._cmake:
return self._cmake

# CMake generator must be set to Ninja when using Visual Studio to let choose the right
# MSVC compiler version when multiple versions are installed on build machine. The problem
Copy link
Contributor

Choose a reason for hiding this comment

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

The lingo I am most familiar with is "MSVC toolsets" and yes CMake which takes "VS2019" as an arg always chooses the highest one installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, "MSVC toolset" is more often understood as the main version of toolset (140 for VS2013, 141 for VS2017 and 142 for VS2019). This is why I wanted to be explicit about the version of the compiler (the "142" toolset includes the 14.2x versions of the toolset, each version of which contains the MSVC compiler in version 19.2x ...).

# with default generator is that it will always choose the last MSVC version. It will
# generate Visual Studio solution and project files, and use MSBuild to build it. I think
# it's a "feature" of CMake / Visual Studio generator that does not use environment which
# is set by vcvars. So if you want to use a specific MSVC version, you have to use Ninja
# generator with CMake. You can find some side explanation here:
# https://devblogs.microsoft.com/cppblog/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2019/
#
# Building with specific MSVC version could be needed since imaGL requires some minimal
# version to be compiled according to its own version. Following table links imaGL version
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required for the build to pass on CCI?

In the Conan universe if you want to build an exact toolset you could use the new msvc compiler. (this is consistent with CMake)

Just as a sanity check,

Is this required ? Or is it an improvement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's not required to pass on CCI. By the way, CCI is not able to build imaGL since tools.vswhere does not work on CCI (see #4954) and I don't know how to test for minor version of MSVC without vswhere. It's done from line 89 to 95. Some imaGL versions could be built in CCI (CCI has Visual Studio 16.4, so imaGL 0.1.2 and 0.2.1 could be built), but I don't know how to be sure that the recipe is cooked on the CCI CI/CD machine.

I do this in the recipe to allow imaGL to be built locally in a Visual Studio command line environment with a specific version of the toolset (using VCVARS and company environment variables). So the recipe is compatible with "Visual Studio" compiler from the Conan universe.

Still in this universe, using the new msvc compiler is allowed thanks to lines 47 and 53. But CCI still uses "Visual Studio".

# to minimal MSVC version:
#
# | imaGL version | MSVC minimal version |
# |---------------|----------------------------|
# | 0.1.0 | 19.25 (default in VS 16.5) |
# | 0.1.1 | 19.25 (default in VS 16.5) |
# | 0.1.2 | 19.22 (default in VS 16.2) |
# | 0.2.0 | 19.25 (default in VS 16.5) |
# | 0.2.1 | 19.22 (default in VS 16.2) |
#
generator = "Ninja" if str(self.settings.compiler) == "Visual Studio" else None
self._cmake = CMake(self, generator=generator)
if not self.settings.compiler.cppstd:
self._cmake.definitions['CONAN_CMAKE_CXX_STANDARD'] = "20"

self._cmake.definitions["STATIC_LIB"] = not self.options.shared
self._cmake.definitions["SUPPORT_PNG"] = self.options.with_png
if self._supports_jpeg:
Expand Down
21 changes: 21 additions & 0 deletions recipes/imagl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ class ImaglTestConan(ConanFile):
generators = "cmake"

def build(self):
# CMake generator must be set to Ninja when using Visual Studio to let choose the right
# MSVC compiler version when multiple versions are installed on build machine. The problem
# with default generator is that it will always choose the last MSVC version. It will
# generate Visual Studio solution and project files, and use MSBuild to build it. I think
# it's a "feature" of CMake / Visual Studio generator that does not use environment which
# is set by vcvars. So if you want to use a specific MSVC version, you have to use Ninja
# generator with CMake. You can find some side explanation here:
# https://devblogs.microsoft.com/cppblog/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2019/
#
# Building with specific MSVC version could be needed since imaGL requires some minimal
# version to be compiled according to its own version. Following table links imaGL version
# to minimal MSVC version:
#
# | imaGL version | MSVC minimal version |
# |---------------|----------------------------|
# | 0.1.0 | 19.25 (default in VS 16.5) |
# | 0.1.1 | 19.25 (default in VS 16.5) |
# | 0.1.2 | 19.22 (default in VS 16.2) |
# | 0.2.0 | 19.25 (default in VS 16.5) |
# | 0.2.1 | 19.22 (default in VS 16.2) |
#
generator = "Ninja" if str(self.settings.compiler) == "Visual Studio" else None
cmake = CMake(self, generator=generator)
cmake.configure()
Expand Down