From e9078ddecfbfe8fc718f79e5fd426d6b8282501b Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Tue, 12 Jan 2021 14:07:58 +0100 Subject: [PATCH 01/25] Adding imagl recipe --- recipes/imagl/all/conandata.yml | 4 ++ recipes/imagl/all/conanfile.py | 53 +++++++++++++++++++ recipes/imagl/all/test_package/CMakeLists.txt | 21 ++++++++ recipes/imagl/all/test_package/conanfile.py | 22 ++++++++ recipes/imagl/all/test_package/example.cpp | 12 +++++ recipes/imagl/config.yml | 3 ++ 6 files changed, 115 insertions(+) create mode 100644 recipes/imagl/all/conandata.yml create mode 100644 recipes/imagl/all/conanfile.py create mode 100644 recipes/imagl/all/test_package/CMakeLists.txt create mode 100644 recipes/imagl/all/test_package/conanfile.py create mode 100644 recipes/imagl/all/test_package/example.cpp create mode 100644 recipes/imagl/config.yml diff --git a/recipes/imagl/all/conandata.yml b/recipes/imagl/all/conandata.yml new file mode 100644 index 0000000000000..f58cd0ea1c049 --- /dev/null +++ b/recipes/imagl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.0": + url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.0/imagl-v0.1.0.tar.gz" + sha256: "9dcfba4c2efa8d44bf4cc9edd324794865dd6d6331467d3c69f5c5574db3844e" diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py new file mode 100644 index 0000000000000..a75e7ec8b9326 --- /dev/null +++ b/recipes/imagl/all/conanfile.py @@ -0,0 +1,53 @@ +from conans import ConanFile, CMake, tools + + +class ImaglConan(ConanFile): + name = "imagl" + license = "GPL-3" + homepage = "https://github.com/Woazim/imaGL" + url = "https://github.com/conan-io/conan-center-index" + description = "A lightweight library to load image for OpenGL application. Directly compatible with glTexImage* functions. Tested on linux, macOS and Windows with gcc, clang and msvc." + topics = ("opengl", "texture", "image") + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False]} + default_options = {"shared": False} + generators = "cmake" + requires = [("libpng/1.6.37")] + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + # This small hack might be useful to guarantee proper /MT /MD linkage + # in MSVC if the packaged project doesn't have variables to set it + # properly + tools.replace_in_file(self.name + "-v" + self.version + "/CMakeLists.txt", "# conan insert", + '''include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup()''') + + def build(self): + cmake = CMake(self) + cmake.verbose = True + cmake.configure(source_folder=self.name + "-v" + self.version, defs={"STATIC_LIB": "OFF" if self.options.shared else "ON"}) + cmake.build() + cmake.install() + + # Explicit way: + # self.run('cmake %s/hello %s' + # % (self.source_folder, cmake.command_line)) + # self.run("cmake --build . %s" % cmake.build_config) + + def package(self): + self.copy("*.h", dst="include", src=self.package_folder + "include") + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.dll", dst="bin", keep_path=False) + self.copy("*.so", dst="lib", keep_path=False) + self.copy("*.dylib", dst="lib", keep_path=False) + self.copy("*.a", dst="lib", keep_path=False) + self.copy(self.name + "-v" + self.version + "/LICENSE", dst="licenses", keep_path=False) + + def package_info(self): + debug_suffix = "" + static_suffix = "" + if self.settings.build_type == "Debug": debug_suffix = "d" + if not(self.options.shared): static_suffix = "s" + self.cpp_info.libs = ["imaGL{debug}{static}".format(debug = debug_suffix, static = static_suffix)] + diff --git a/recipes/imagl/all/test_package/CMakeLists.txt b/recipes/imagl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4935b678899c5 --- /dev/null +++ b/recipes/imagl/all/test_package/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.1) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(example example.cpp) +target_link_libraries(example ${CONAN_LIBS}) + +if(STATIC_LIB) + add_compile_definitions(IMAGL_STATIC) +endif() + +set_property(TARGET example PROPERTY CXX_STANDARD 20) +set_property(TARGET example PROPERTY CXX_STANDARD_REQUIRED ON) + +# CTest is a testing tool that can be used to test your project. +# enable_testing() +# add_test(NAME example +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin +# COMMAND example) diff --git a/recipes/imagl/all/test_package/conanfile.py b/recipes/imagl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3bcb250c887e7 --- /dev/null +++ b/recipes/imagl/all/test_package/conanfile.py @@ -0,0 +1,22 @@ +import os + +from conans import ConanFile, CMake, tools + + +class ImaglTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False]} + default_options = {"shared": False} + generators = "cmake" + + def build(self): + cmake = CMake(self) + # Current dir is "test_package/build/" and CMakeLists.txt is + # in "test_package" + cmake.configure(defs={"STATIC_LIB": "OFF" if self.options.shared else "ON"}) + cmake.build() + + def test(self): + if not tools.cross_building(self): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/recipes/imagl/all/test_package/example.cpp b/recipes/imagl/all/test_package/example.cpp new file mode 100644 index 0000000000000..205dbf81d1b23 --- /dev/null +++ b/recipes/imagl/all/test_package/example.cpp @@ -0,0 +1,12 @@ +#include +#include + +int main() { + try { + imaGL::CImaGL img("notfound.png"); + } + catch(...) { + } + std::cout << "It works!\n"; + return 0; +} diff --git a/recipes/imagl/config.yml b/recipes/imagl/config.yml new file mode 100644 index 0000000000000..6c11a439d0bc2 --- /dev/null +++ b/recipes/imagl/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.0": + folder: all From 8376ef595f32b7f3ffa341a57729bfdc74ecd1b5 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Tue, 12 Jan 2021 15:36:06 +0100 Subject: [PATCH 02/25] Adding configuration requirements in configure() --- recipes/imagl/all/conanfile.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index a75e7ec8b9326..c895f1940c538 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,5 +1,4 @@ -from conans import ConanFile, CMake, tools - +from conans import ConanFile, CMake, tools, errors class ImaglConan(ConanFile): name = "imagl" @@ -51,3 +50,17 @@ def package_info(self): if not(self.options.shared): static_suffix = "s" self.cpp_info.libs = ["imaGL{debug}{static}".format(debug = debug_suffix, static = static_suffix)] + def configure(self): + if (self.settings.compiler == "clang" + and tools.Version(self.settings.compiler.version) < "10.0.0"): + raise errors.ConanInvalidConfiguration("Library imaGL need clang 10+") + if (self.settings.compiler == "gcc" + and tools.Version(self.settings.compiler.version) < "9.0.0"): + raise errors.ConanInvalidConfiguration("Library imaGL need gcc 9+") + if (self.settings.compiler == "apple-clang" + and tools.Version(self.settings.compiler.version) < "11.0.3"): + raise errors.ConanInvalidConfiguration("Library imaGL need apple-clang 11.0.3+") + if (self.settings.compiler == "Visual Studio" + and tools.Version(self.settings.compiler.version) < "16.5"): + raise errors.ConanInvalidConfiguration("Library imaGL need Visual Studio 16.5+") + From 34a13cfd5ed038cc4ea1b5652ff54ee11704bc9f Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 14 Jan 2021 11:46:29 -0300 Subject: [PATCH 03/25] Prepare for CCI Signed-off-by: Uilian Ries --- recipes/imagl/all/CMakeLists.txt | 7 ++ recipes/imagl/all/conanfile.py | 111 +++++++++++--------- recipes/imagl/all/test_package/conanfile.py | 11 +- 3 files changed, 73 insertions(+), 56 deletions(-) create mode 100644 recipes/imagl/all/CMakeLists.txt diff --git a/recipes/imagl/all/CMakeLists.txt b/recipes/imagl/all/CMakeLists.txt new file mode 100644 index 0000000000000..d32836cbae4aa --- /dev/null +++ b/recipes/imagl/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cmake_wrapper) + +include("conanbuildinfo.cmake") +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index c895f1940c538..dbdede121a38f 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,66 +1,81 @@ -from conans import ConanFile, CMake, tools, errors +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.32.0" + class ImaglConan(ConanFile): name = "imagl" - license = "GPL-3" + license = "GPL-3.0-or-later" homepage = "https://github.com/Woazim/imaGL" url = "https://github.com/conan-io/conan-center-index" - description = "A lightweight library to load image for OpenGL application. Directly compatible with glTexImage* functions. Tested on linux, macOS and Windows with gcc, clang and msvc." + description = "A lightweight library to load image for OpenGL application." topics = ("opengl", "texture", "image") settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False]} - default_options = {"shared": False} + options = {"shared": [True, False], "fPIC": [True, False], "with_png": [True, False]} + default_options = {"shared": False, "fPIC": True, "with_png": True} generators = "cmake" - requires = [("libpng/1.6.37")] + exports_sources = "CMakeLists.txt" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "Visual Studio": "16.5", + "clang": "10", + "apple-clang": "11" + } def source(self): tools.get(**self.conan_data["sources"][self.version]) - # This small hack might be useful to guarantee proper /MT /MD linkage - # in MSVC if the packaged project doesn't have variables to set it - # properly - tools.replace_in_file(self.name + "-v" + self.version + "/CMakeLists.txt", "# conan insert", - '''include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup()''') + os.rename(self.name + "-v" + self.version, self._source_subfolder) + + def validate(self): + if self.settings.compiler.cppstd: + tools.check_min_cppstd(self, 20) + 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.") + else: + self.output.warn("imagl requires C++20. Your compiler is unknown. Assuming it supports C++20.") + + def requirements(self): + if self.options.with_png: + self.requires("libpng/1.6.37") + + 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 + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake def build(self): - cmake = CMake(self) - cmake.verbose = True - cmake.configure(source_folder=self.name + "-v" + self.version, defs={"STATIC_LIB": "OFF" if self.options.shared else "ON"}) + cmake = self._configure_cmake() cmake.build() - cmake.install() - - # Explicit way: - # self.run('cmake %s/hello %s' - # % (self.source_folder, cmake.command_line)) - # self.run("cmake --build . %s" % cmake.build_config) def package(self): - self.copy("*.h", dst="include", src=self.package_folder + "include") - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.so", dst="lib", keep_path=False) - self.copy("*.dylib", dst="lib", keep_path=False) - self.copy("*.a", dst="lib", keep_path=False) - self.copy(self.name + "-v" + self.version + "/LICENSE", dst="licenses", keep_path=False) + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() def package_info(self): - debug_suffix = "" - static_suffix = "" - if self.settings.build_type == "Debug": debug_suffix = "d" - if not(self.options.shared): static_suffix = "s" - self.cpp_info.libs = ["imaGL{debug}{static}".format(debug = debug_suffix, static = static_suffix)] - - def configure(self): - if (self.settings.compiler == "clang" - and tools.Version(self.settings.compiler.version) < "10.0.0"): - raise errors.ConanInvalidConfiguration("Library imaGL need clang 10+") - if (self.settings.compiler == "gcc" - and tools.Version(self.settings.compiler.version) < "9.0.0"): - raise errors.ConanInvalidConfiguration("Library imaGL need gcc 9+") - if (self.settings.compiler == "apple-clang" - and tools.Version(self.settings.compiler.version) < "11.0.3"): - raise errors.ConanInvalidConfiguration("Library imaGL need apple-clang 11.0.3+") - if (self.settings.compiler == "Visual Studio" - and tools.Version(self.settings.compiler.version) < "16.5"): - raise errors.ConanInvalidConfiguration("Library imaGL need Visual Studio 16.5+") - + debug_suffix = "d" if self.settings.build_type == "Debug" else "" + static_suffix = "" if self.options.shared else "s" + self.cpp_info.libs = ["imaGL{}{}".format(debug_suffix, static_suffix)] + if not self.options.shared: + self.cpp_info.defines = ["IMAGL_STATIC=1"] diff --git a/recipes/imagl/all/test_package/conanfile.py b/recipes/imagl/all/test_package/conanfile.py index 3bcb250c887e7..156e2a8976e7c 100644 --- a/recipes/imagl/all/test_package/conanfile.py +++ b/recipes/imagl/all/test_package/conanfile.py @@ -1,22 +1,17 @@ import os - from conans import ConanFile, CMake, tools class ImaglTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False]} - default_options = {"shared": False} generators = "cmake" def build(self): cmake = CMake(self) - # Current dir is "test_package/build/" and CMakeLists.txt is - # in "test_package" - cmake.configure(defs={"STATIC_LIB": "OFF" if self.options.shared else "ON"}) + cmake.configure() cmake.build() def test(self): if not tools.cross_building(self): - os.chdir("bin") - self.run(".%sexample" % os.sep) + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) From 109a45e9d335ab8aa494cc8f943921aaf67dd40c Mon Sep 17 00:00:00 2001 From: Woazim <54191598+Woazim@users.noreply.github.com> Date: Tue, 19 Jan 2021 22:21:09 +0100 Subject: [PATCH 04/25] Update conanfile.py --- recipes/imagl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index dbdede121a38f..924cf38d91880 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -32,7 +32,7 @@ def _build_subfolder(self): def _compilers_minimum_version(self): return { "gcc": "9", - "Visual Studio": "16.5", + "Visual Studio": "16", "clang": "10", "apple-clang": "11" } From 906a4787de035376b142eb5d5453c929c715471c Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 20 Jan 2021 15:06:24 +0100 Subject: [PATCH 05/25] Setting minimum Visual Studio to 16 to let CCI work. --- recipes/imagl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index dbdede121a38f..924cf38d91880 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -32,7 +32,7 @@ def _build_subfolder(self): def _compilers_minimum_version(self): return { "gcc": "9", - "Visual Studio": "16.5", + "Visual Studio": "16", "clang": "10", "apple-clang": "11" } From a5c8d70c27ce186a071058658d16c45297254f44 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 20 Jan 2021 15:48:56 +0100 Subject: [PATCH 06/25] removing fPIC option for Windows config --- recipes/imagl/all/conanfile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 924cf38d91880..8f519e037c838 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -51,6 +51,10 @@ def validate(self): else: self.output.warn("imagl requires C++20. Your compiler is unknown. Assuming it supports C++20.") + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + def requirements(self): if self.options.with_png: self.requires("libpng/1.6.37") @@ -79,3 +83,4 @@ def package_info(self): self.cpp_info.libs = ["imaGL{}{}".format(debug_suffix, static_suffix)] if not self.options.shared: self.cpp_info.defines = ["IMAGL_STATIC=1"] + From 4c90e58cc5d1c8a14c7444cb9d595807b174baf2 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 29 Jan 2021 21:38:39 +0100 Subject: [PATCH 07/25] Adding imaGL 0.1.1 --- recipes/imagl/all/conandata.yml | 3 +++ recipes/imagl/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/imagl/all/conandata.yml b/recipes/imagl/all/conandata.yml index f58cd0ea1c049..ca1333637fa31 100644 --- a/recipes/imagl/all/conandata.yml +++ b/recipes/imagl/all/conandata.yml @@ -2,3 +2,6 @@ sources: "0.1.0": url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.0/imagl-v0.1.0.tar.gz" sha256: "9dcfba4c2efa8d44bf4cc9edd324794865dd6d6331467d3c69f5c5574db3844e" + "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" diff --git a/recipes/imagl/config.yml b/recipes/imagl/config.yml index 6c11a439d0bc2..bcd9c66c60e11 100644 --- a/recipes/imagl/config.yml +++ b/recipes/imagl/config.yml @@ -1,3 +1,5 @@ versions: "0.1.0": folder: all + "0.1.1": + folder: all From e2ad08ae668e3c0884d62b68bd012f090420d537 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Sun, 21 Feb 2021 00:38:50 +0100 Subject: [PATCH 08/25] Adding imagl 0.2.0 --- recipes/imagl/all/conandata.yml | 3 +++ recipes/imagl/all/conanfile.py | 8 ++++++-- recipes/imagl/config.yml | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/recipes/imagl/all/conandata.yml b/recipes/imagl/all/conandata.yml index ca1333637fa31..1f282c2462afd 100644 --- a/recipes/imagl/all/conandata.yml +++ b/recipes/imagl/all/conandata.yml @@ -5,3 +5,6 @@ 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.2.0": + url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.2.0/imagl-v0.2.0.tar.gz" + sha256: "12b165a7f94a970d01b312b1d08be65f10665d60794daf32fd38024f6edd34cc" diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 8f519e037c838..5d43027bc33cc 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -14,8 +14,8 @@ 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]} + default_options = {"shared": False, "fPIC": True, "with_png": True, "with_jpeg": True} generators = "cmake" exports_sources = "CMakeLists.txt" _cmake = None @@ -58,6 +58,8 @@ def config_options(self): def requirements(self): if self.options.with_png: self.requires("libpng/1.6.37") + if self.options.with_jpeg and tools.Version(self.version) >= "0.2.0": + self.requires("libjpeg/9d") def _configure_cmake(self): if self._cmake: @@ -65,6 +67,8 @@ def _configure_cmake(self): self._cmake = CMake(self) self._cmake.definitions["STATIC_LIB"] = not self.options.shared self._cmake.definitions["SUPPORT_PNG"] = self.options.with_png + if tools.Version(self.version) >= "0.2.0": + self._cmake.definitions["SUPPORT_JPEG"] = self.options.with_jpeg self._cmake.configure(build_folder=self._build_subfolder) return self._cmake diff --git a/recipes/imagl/config.yml b/recipes/imagl/config.yml index bcd9c66c60e11..b180a4bec96f9 100644 --- a/recipes/imagl/config.yml +++ b/recipes/imagl/config.yml @@ -3,3 +3,5 @@ versions: folder: all "0.1.1": folder: all + "0.2.0": + folder: all From 502858417a53b5e01aba6271e2d342632c1060b2 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 26 Feb 2021 01:29:43 +0100 Subject: [PATCH 09/25] Deleting unsupported option in configure, adding _supports_jpeg property, hardly detecting msvc compiler version --- recipes/imagl/all/conandata.yml | 6 ++++ recipes/imagl/all/conanfile.py | 52 ++++++++++++++++++++++++++------- recipes/imagl/config.yml | 4 +++ 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/recipes/imagl/all/conandata.yml b/recipes/imagl/all/conandata.yml index 1f282c2462afd..b755fa654d7c8 100644 --- a/recipes/imagl/all/conandata.yml +++ b/recipes/imagl/all/conandata.yml @@ -5,6 +5,12 @@ 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.0": url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.2.0/imagl-v0.2.0.tar.gz" sha256: "12b165a7f94a970d01b312b1d08be65f10665d60794daf32fd38024f6edd34cc" + "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" diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 5d43027bc33cc..74667740bc9a0 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,7 +1,7 @@ from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration import os - +import subprocess required_conan_version = ">=1.32.0" @@ -30,12 +30,20 @@ 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", + "VCToolsVersion": "14.22", + "clang": "10", + "apple-clang": "11" } + if tools.Version(self.version) <= "0.1.1" or tools.Version(self.version) == "0.2.0": + minimum_versions["VCToolsVersion"] = "14.25" + return minimum_versions + + @property + def _supports_jpeg(self): + return tools.Version(self.version) >= "0.2.0" def source(self): tools.get(**self.conan_data["sources"][self.version]) @@ -44,21 +52,45 @@ 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] + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + compiler_version = str(self.settings.compiler.version) 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 lazy_lt_semver(compiler_version, minimum_version): + raise ConanInvalidConfiguration("imagl requires some C++20 features, which your compiler does not support.") + #Special case for Visual Studio for which conan doesn't known its minor version + if str(self.settings.compiler) == "Visual Studio": + compiler_version = os.getenv("VCToolsVersion") + if compiler_version == None: + vs_install_dir = subprocess.run(["{}\\Microsoft Visual Studio\\Installer\\vswhere.exe".format(os.getenv("ProgramFiles(x86)")), + "-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + "-property", "installationPath", "-latest"], capture_output=True, text=True).stdout.strip() + compiler_version = subprocess.run(['cmd', '/c', '{}\\VC\\Auxiliary\\Build\\vcvarsall.bat'.format(vs_install_dir), 'x64', '>NUL', '&&', 'set', 'VCToolsVersion'], + capture_output=True, text=True).stdout.strip().split('=')[1] + minimum_version = self._compilers_minimum_version["VCToolsVersion"] + print("compiler version is {}".format(compiler_version)) + print("minimum version is {}".format(minimum_version)) + if lazy_lt_semver(compiler_version, minimum_version): + raise ConanInvalidConfiguration("imagl requires some C++20 features, which your compiler does not support.") else: self.output.warn("imagl requires C++20. Your compiler is unknown. Assuming it supports C++20.") def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if not self._supports_jpeg: + del self.options.with_jpeg def requirements(self): if self.options.with_png: self.requires("libpng/1.6.37") - if self.options.with_jpeg and tools.Version(self.version) >= "0.2.0": + if self._supports_jpeg and self.options.with_jpeg: self.requires("libjpeg/9d") def _configure_cmake(self): @@ -67,7 +99,7 @@ def _configure_cmake(self): self._cmake = CMake(self) self._cmake.definitions["STATIC_LIB"] = not self.options.shared self._cmake.definitions["SUPPORT_PNG"] = self.options.with_png - if tools.Version(self.version) >= "0.2.0": + if self._supports_jpeg: self._cmake.definitions["SUPPORT_JPEG"] = self.options.with_jpeg self._cmake.configure(build_folder=self._build_subfolder) return self._cmake diff --git a/recipes/imagl/config.yml b/recipes/imagl/config.yml index b180a4bec96f9..252f91c9946f5 100644 --- a/recipes/imagl/config.yml +++ b/recipes/imagl/config.yml @@ -3,5 +3,9 @@ versions: folder: all "0.1.1": folder: all + "0.1.2": + folder: all "0.2.0": folder: all + "0.2.1": + folder: all From 065ea9bb7ebe7ac3ebca17a12aaccf362ec43211 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 26 Feb 2021 02:12:15 +0100 Subject: [PATCH 10/25] Nicer way to get MSVC version. --- recipes/imagl/all/conanfile.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 74667740bc9a0..e2fec37eb9898 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -66,16 +66,9 @@ def lazy_lt_semver(v1, v2): raise ConanInvalidConfiguration("imagl requires some C++20 features, which your compiler does not support.") #Special case for Visual Studio for which conan doesn't known its minor version if str(self.settings.compiler) == "Visual Studio": - compiler_version = os.getenv("VCToolsVersion") - if compiler_version == None: - vs_install_dir = subprocess.run(["{}\\Microsoft Visual Studio\\Installer\\vswhere.exe".format(os.getenv("ProgramFiles(x86)")), - "-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - "-property", "installationPath", "-latest"], capture_output=True, text=True).stdout.strip() - compiler_version = subprocess.run(['cmd', '/c', '{}\\VC\\Auxiliary\\Build\\vcvarsall.bat'.format(vs_install_dir), 'x64', '>NUL', '&&', 'set', 'VCToolsVersion'], - capture_output=True, text=True).stdout.strip().split('=')[1] + env_vars = tools.vcvars_dict(self) + compiler_version = env_vars.get("VCToolsVersion", os.getenv("VCToolsVersion")) minimum_version = self._compilers_minimum_version["VCToolsVersion"] - print("compiler version is {}".format(compiler_version)) - print("minimum version is {}".format(minimum_version)) if lazy_lt_semver(compiler_version, minimum_version): raise ConanInvalidConfiguration("imagl requires some C++20 features, which your compiler does not support.") else: From 4932cd9c9da00fadd99d7a5e870d921f90db98ea Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 26 Feb 2021 10:15:32 +0100 Subject: [PATCH 11/25] maybe this one, which directly comes from other recipes. But it does not work on my computer... --- recipes/imagl/all/conanfile.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index e2fec37eb9898..a3ca9ca0ae951 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -32,13 +32,12 @@ def _build_subfolder(self): def _compilers_minimum_version(self): minimum_versions = { "gcc": "9", - "Visual Studio": "16", - "VCToolsVersion": "14.22", + "Visual Studio": "16.2", "clang": "10", "apple-clang": "11" } if tools.Version(self.version) <= "0.1.1" or tools.Version(self.version) == "0.2.0": - minimum_versions["VCToolsVersion"] = "14.25" + minimum_versions["Visual Studio"] = "16.5" return minimum_versions @property @@ -60,19 +59,10 @@ def lazy_lt_semver(v1, v2): return lv1[:min_length] < lv2[:min_length] minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - compiler_version = str(self.settings.compiler.version) - if minimum_version: - if lazy_lt_semver(compiler_version, minimum_version): - raise ConanInvalidConfiguration("imagl requires some C++20 features, which your compiler does not support.") - #Special case for Visual Studio for which conan doesn't known its minor version - if str(self.settings.compiler) == "Visual Studio": - env_vars = tools.vcvars_dict(self) - compiler_version = env_vars.get("VCToolsVersion", os.getenv("VCToolsVersion")) - minimum_version = self._compilers_minimum_version["VCToolsVersion"] - if lazy_lt_semver(compiler_version, minimum_version): - raise ConanInvalidConfiguration("imagl requires some C++20 features, which your compiler does not support.") - else: + if not minimum_version: self.output.warn("imagl requires C++20. Your compiler is unknown. Assuming it supports C++20.") + elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration("imagl requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), str(self.settings.compiler.version))) def config_options(self): if self.settings.os == "Windows": From 12c911452bc6d55de622bb51d65b62ec9445fba4 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 26 Feb 2021 16:15:54 +0100 Subject: [PATCH 12/25] More checks on clang and Visual, according to last building failures. --- recipes/imagl/all/conandata.yml | 3 --- recipes/imagl/all/conanfile.py | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/recipes/imagl/all/conandata.yml b/recipes/imagl/all/conandata.yml index b755fa654d7c8..244b85fa5bc24 100644 --- a/recipes/imagl/all/conandata.yml +++ b/recipes/imagl/all/conandata.yml @@ -8,9 +8,6 @@ sources: "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.0": - url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.2.0/imagl-v0.2.0.tar.gz" - sha256: "12b165a7f94a970d01b312b1d08be65f10665d60794daf32fd38024f6edd34cc" "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" diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index a3ca9ca0ae951..232c218be0a8d 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,7 +1,6 @@ from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration import os -import subprocess required_conan_version = ">=1.32.0" @@ -57,12 +56,22 @@ def lazy_lt_semver(v1, v2): lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] + + compiler_version = str(self.settings.compiler.version) + if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1: + compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], + version="[{}.0,{}.0)".format(str(self.settings.compiler.version), int(str(self.settings.compiler.version))+1), latest=True, property_="installationVersion")[0]["installationVersion"] minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn("imagl requires C++20. Your compiler is unknown. Assuming it supports C++20.") - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("imagl requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), str(self.settings.compiler.version))) + 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)) + else: + print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) + #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.") def config_options(self): if self.settings.os == "Windows": @@ -80,6 +89,8 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) + 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: From e49ff9c7d002b12754297653f88e831add0d6160 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 26 Feb 2021 16:49:15 +0100 Subject: [PATCH 13/25] Add a check to VS version >= 16 before trying to run vswhere --- recipes/imagl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 232c218be0a8d..eba7bff9181d5 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -58,7 +58,7 @@ def lazy_lt_semver(v1, v2): return lv1[:min_length] < lv2[:min_length] compiler_version = str(self.settings.compiler.version) - if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1: + if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1 and int(str(self.settings.compiler.version)) >= 16: compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], version="[{}.0,{}.0)".format(str(self.settings.compiler.version), int(str(self.settings.compiler.version))+1), latest=True, property_="installationVersion")[0]["installationVersion"] From eaa0681781929b48e23379ee834e417b58e944ec Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Fri, 26 Feb 2021 21:46:09 +0100 Subject: [PATCH 14/25] When vswhere is not runnable, raise a ConanInvalidConfiguration. --- recipes/imagl/all/conanfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index eba7bff9181d5..992df23f8ad3a 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,5 +1,6 @@ from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration +from conans.errors import ConanException import os required_conan_version = ">=1.32.0" @@ -59,8 +60,11 @@ def lazy_lt_semver(v1, v2): compiler_version = str(self.settings.compiler.version) if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1 and int(str(self.settings.compiler.version)) >= 16: - compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], - version="[{}.0,{}.0)".format(str(self.settings.compiler.version), int(str(self.settings.compiler.version))+1), latest=True, property_="installationVersion")[0]["installationVersion"] + try: + compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], + version="[{}.0,{}.0)".format(str(self.settings.compiler.version), int(str(self.settings.compiler.version))+1), latest=True, property_="installationVersion")[0]["installationVersion"] + except ConanException: + raise ConanInvalidConfiguration("Your Visual Studio compiler seems not to be installed in a common way. It is not supported.") minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: From 376bd3e22b4ec067d526d52b5378fe7a53837ff5 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Tue, 9 Mar 2021 18:52:36 +0100 Subject: [PATCH 15/25] Workaround to check libc++ version. --- recipes/imagl/all/conanfile.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 992df23f8ad3a..594a1669a90a3 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -2,6 +2,7 @@ from conans.errors import ConanInvalidConfiguration from conans.errors import ConanException import os +import subprocess required_conan_version = ">=1.32.0" @@ -57,6 +58,21 @@ def lazy_lt_semver(v1, v2): lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] + + def get_libcxx_majorver(): + tmp_file = subprocess.run(['mktemp'], text=True, capture_output=True).stdout.strip() + src_test = """ + #include + #ifndef _LIBCPP_VERSION + # define _LIBCPP_VERSION 0 + #endif + int main() { + std::cout << _LIBCPP_VERSION << '\\n'; + } + """ + subprocess.run(['clang++', '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() + libcxx_ver = int(int(subprocess.run([tmp_file], text=True, capture_output=True).stdout.strip()) / 1000) + return libcxx_ver compiler_version = str(self.settings.compiler.version) if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1 and int(str(self.settings.compiler.version)) >= 16: @@ -71,6 +87,8 @@ def lazy_lt_semver(v1, v2): 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 lazy_lt_semver(str(get_libcxx_majorver()), minimum_version): + raise ConanInvalidConfiguration("imagl requires libc++ minimum version {}. Your libc++ is version {}".format(minimum_version, get_libcxx_majorver())) else: print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) #Special check for clang that can only be linked to libc++ From da8f340f2aeed4f461edf74f73d8edaf4e77b25f Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 10 Mar 2021 22:18:02 +0100 Subject: [PATCH 16/25] Using CXX environment variable to run clang++ --- recipes/imagl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 594a1669a90a3..b5096297c968f 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -70,7 +70,7 @@ def get_libcxx_majorver(): std::cout << _LIBCPP_VERSION << '\\n'; } """ - subprocess.run(['clang++', '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() + subprocess.run([os.environ['CXX'], '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() libcxx_ver = int(int(subprocess.run([tmp_file], text=True, capture_output=True).stdout.strip()) / 1000) return libcxx_ver From 055e6a9098ccfd1492d85c21435c17f8e645dcd9 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 10 Mar 2021 22:31:15 +0100 Subject: [PATCH 17/25] Direct access to clang at /usr/bin/clang++ --- recipes/imagl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index b5096297c968f..05bce3bbe9ded 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -70,7 +70,7 @@ def get_libcxx_majorver(): std::cout << _LIBCPP_VERSION << '\\n'; } """ - subprocess.run([os.environ['CXX'], '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() + subprocess.run(['/usr/bin/clang++', '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() libcxx_ver = int(int(subprocess.run([tmp_file], text=True, capture_output=True).stdout.strip()) / 1000) return libcxx_ver From 36707d3e366324b698c5097fc14245b5e24af6a3 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 10 Mar 2021 23:10:44 +0100 Subject: [PATCH 18/25] Check for libc++ as stdlib before checking its version --- recipes/imagl/all/conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 05bce3bbe9ded..bce57484525fc 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -70,10 +70,14 @@ def get_libcxx_majorver(): std::cout << _LIBCPP_VERSION << '\\n'; } """ - subprocess.run(['/usr/bin/clang++', '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() + subprocess.run([os.environ['CXX'], '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() libcxx_ver = int(int(subprocess.run([tmp_file], text=True, capture_output=True).stdout.strip()) / 1000) return libcxx_ver + #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) if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1 and int(str(self.settings.compiler.version)) >= 16: try: @@ -91,9 +95,6 @@ def get_libcxx_majorver(): raise ConanInvalidConfiguration("imagl requires libc++ minimum version {}. Your libc++ is version {}".format(minimum_version, get_libcxx_majorver())) else: print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) - #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.") def config_options(self): if self.settings.os == "Windows": From ae26a9ad24910aa0a48b5d19a4599626b544ed5b Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 17 Mar 2021 23:33:21 +0100 Subject: [PATCH 19/25] Avoid to build imaGL in CCI with clang 11. Adding some Visual Studio tunning as well to let choose toolset minor version. --- recipes/imagl/all/conanfile.py | 55 +++++++++++---------- recipes/imagl/all/test_package/conanfile.py | 3 +- recipes/imagl/config.yml | 2 - 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index bce57484525fc..3526ca243ca9d 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -15,8 +15,8 @@ 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]} - default_options = {"shared": False, "fPIC": True, "with_png": True, "with_jpeg": True} + options = {"shared": [True, False], "fPIC": [True, False], "with_png": [True, False], "with_jpeg": [True, False], "not_in_cci": [True, False]} + default_options = {"shared": False, "fPIC": True, "with_png": True, "with_jpeg": True, "not_in_cci": False} generators = "cmake" exports_sources = "CMakeLists.txt" _cmake = None @@ -34,11 +34,22 @@ def _compilers_minimum_version(self): 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": minimum_versions["Visual Studio"] = "16.5" + minimum_versions["msvc"] = "19.25" + return minimum_versions + + @property + def _compiler_toolsets_minimum_version(self): + minimum_versions = { + "Visual Studio": "14.22" + } + if tools.Version(self.version) <= "0.1.1" or tools.Version(self.version) == "0.2.0": + minimum_versions["Visual Studio"] = "14.25" return minimum_versions @property @@ -59,48 +70,41 @@ def lazy_lt_semver(v1, v2): min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - def get_libcxx_majorver(): - tmp_file = subprocess.run(['mktemp'], text=True, capture_output=True).stdout.strip() - src_test = """ - #include - #ifndef _LIBCPP_VERSION - # define _LIBCPP_VERSION 0 - #endif - int main() { - std::cout << _LIBCPP_VERSION << '\\n'; - } - """ - subprocess.run([os.environ['CXX'], '-stdlib=libc++', '-x', 'c++', '-dM', '-o', tmp_file, '-'], input=src_test, text=True).check_returncode() - libcxx_ver = int(int(subprocess.run([tmp_file], text=True, capture_output=True).stdout.strip()) / 1000) - return libcxx_ver - #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) + toolset_version = "0" if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1 and int(str(self.settings.compiler.version)) >= 16: try: - compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], + compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], products="*", version="[{}.0,{}.0)".format(str(self.settings.compiler.version), int(str(self.settings.compiler.version))+1), latest=True, property_="installationVersion")[0]["installationVersion"] + toolset_version = tools.vcvars_dict(self).get("VCToolsVersion", os.environ.get("VCToolsVersion","")) except ConanException: - raise ConanInvalidConfiguration("Your Visual Studio compiler seems not to be installed in a common way. It is not supported.") + raise ConanInvalidConfiguration("Your Visual Studio compiler seems not to be installed in a common way. It is not supported. This unfortunately happens in conan center index. To build imaGL, append '--build missing' to your 'conan install' command line.") minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + minimum_toolset_version = self._compiler_toolsets_minimum_version.get(str(self.settings.compiler), "0") 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 lazy_lt_semver(str(get_libcxx_majorver()), minimum_version): - raise ConanInvalidConfiguration("imagl requires libc++ minimum version {}. Your libc++ is version {}".format(minimum_version, get_libcxx_majorver())) + self.output.warn("imaGL requires C++20. Your compiler is unknown. Assuming it supports C++20.") + elif lazy_lt_semver(compiler_version, minimum_version) or lazy_lt_semver(toolset_version, minimum_toolset_version): + raise ConanInvalidConfiguration("imaGL requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), compiler_version) + + (" Your Visual Studio toolset version is {}; version {}+ is required.".format(toolset_version, str(minimum_toolset_version)) if minimum_toolset_version else "")) + elif str(self.settings.compiler) == "clang" and compiler_version == "11" and not self.options.not_in_cci: + raise ConanInvalidConfiguration("Clang 11 is not currently supported by conan center index. To build imaGL, append '-o imagl:not_in_cci=True --build missing' to your 'conan install' command line.") else: print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) + if minimum_toolset_version != "0": + print("Its toolset is in version {} and is compatible. Minimum version is {}.".format(toolset_version, minimum_toolset_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.not_in_cci def requirements(self): if self.options.with_png: @@ -111,7 +115,8 @@ def requirements(self): def _configure_cmake(self): if self._cmake: return self._cmake - self._cmake = CMake(self) + 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 diff --git a/recipes/imagl/all/test_package/conanfile.py b/recipes/imagl/all/test_package/conanfile.py index 156e2a8976e7c..1b8ee4d8c099b 100644 --- a/recipes/imagl/all/test_package/conanfile.py +++ b/recipes/imagl/all/test_package/conanfile.py @@ -7,7 +7,8 @@ class ImaglTestConan(ConanFile): generators = "cmake" def build(self): - cmake = CMake(self) + generator = "Ninja" if str(self.settings.compiler) == "Visual Studio" else None + cmake = CMake(self, generator=generator) cmake.configure() cmake.build() diff --git a/recipes/imagl/config.yml b/recipes/imagl/config.yml index 252f91c9946f5..c9c8dd3f8df3b 100644 --- a/recipes/imagl/config.yml +++ b/recipes/imagl/config.yml @@ -5,7 +5,5 @@ versions: folder: all "0.1.2": folder: all - "0.2.0": - folder: all "0.2.1": folder: all From 0fd9fe39c09acf98dc9f7e76380204cf12237a84 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Wed, 17 Mar 2021 23:47:40 +0100 Subject: [PATCH 20/25] Removed unused import subprocess --- recipes/imagl/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 3526ca243ca9d..2781579d8a23f 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -2,7 +2,6 @@ from conans.errors import ConanInvalidConfiguration from conans.errors import ConanException import os -import subprocess required_conan_version = ">=1.32.0" From e2bcef85ef99a907f759a491eb55da0d07d8548c Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Sun, 28 Mar 2021 21:52:44 +0200 Subject: [PATCH 21/25] Better looking with imports and "allow_clang_11" option --- recipes/imagl/all/conanfile.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 2781579d8a23f..eecedb2ce54e7 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,6 +1,5 @@ from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conans.errors import ConanException +from conans.errors import ConanInvalidConfiguration, ConanException import os required_conan_version = ">=1.32.0" @@ -14,8 +13,8 @@ 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], "not_in_cci": [True, False]} - default_options = {"shared": False, "fPIC": True, "with_png": True, "with_jpeg": True, "not_in_cci": False} + 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} generators = "cmake" exports_sources = "CMakeLists.txt" _cmake = None @@ -90,8 +89,8 @@ def lazy_lt_semver(v1, v2): elif lazy_lt_semver(compiler_version, minimum_version) or lazy_lt_semver(toolset_version, minimum_toolset_version): raise ConanInvalidConfiguration("imaGL requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), compiler_version) + (" Your Visual Studio toolset version is {}; version {}+ is required.".format(toolset_version, str(minimum_toolset_version)) if minimum_toolset_version else "")) - elif str(self.settings.compiler) == "clang" and compiler_version == "11" and not self.options.not_in_cci: - raise ConanInvalidConfiguration("Clang 11 is not currently supported by conan center index. To build imaGL, append '-o imagl:not_in_cci=True --build missing' to your 'conan install' command line.") + 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: print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) if minimum_toolset_version != "0": @@ -103,7 +102,7 @@ def config_options(self): 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.not_in_cci + del self.options.allow_clang_11 def requirements(self): if self.options.with_png: From a41644739a1906f9e14b874d69a63ebc3f7738cb Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Mon, 29 Mar 2021 09:20:35 +0200 Subject: [PATCH 22/25] Remove fPIC option for shared option --- recipes/imagl/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index eecedb2ce54e7..573d5d4311cf3 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -104,6 +104,10 @@ def config_options(self): if not str(self.settings.compiler) == "clang" or not str(self.settings.compiler.version) == "11": del self.options.allow_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") From 0dcdf201d5fa73f758a7cdcc7af48cfc573e13b3 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Thu, 29 Apr 2021 00:19:13 +0200 Subject: [PATCH 23/25] Code formatting correction, warning when using allow_clang_11 & comments on CMake's Ninja generator need --- recipes/imagl/all/conanfile.py | 45 +++++++++++++++++++-- recipes/imagl/all/test_package/conanfile.py | 21 ++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 573d5d4311cf3..d422c01b32467 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -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 @@ -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" def requirements(self): if self.options.with_png: @@ -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 + # 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 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: diff --git a/recipes/imagl/all/test_package/conanfile.py b/recipes/imagl/all/test_package/conanfile.py index 1b8ee4d8c099b..4546672a8a290 100644 --- a/recipes/imagl/all/test_package/conanfile.py +++ b/recipes/imagl/all/test_package/conanfile.py @@ -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() From 3476bcba1d9900b9ca2aefc02963748bf0d5cb2c Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Tue, 11 May 2021 19:47:23 +0200 Subject: [PATCH 24/25] Removing vswhere in validate() and affectation to settings.compiler.cppstd --- recipes/imagl/all/conanfile.py | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index d422c01b32467..83ef14c2a24ef 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -53,15 +53,6 @@ def _compilers_minimum_version(self): minimum_versions["msvc"] = "19.25" return minimum_versions - @property - def _compiler_toolsets_minimum_version(self): - minimum_versions = { - "Visual Studio": "14.22" - } - if tools.Version(self.version) <= "0.1.1" or tools.Version(self.version) == "0.2.0": - minimum_versions["Visual Studio"] = "14.25" - return minimum_versions - @property def _supports_jpeg(self): return tools.Version(self.version) >= "0.2.0" @@ -85,28 +76,16 @@ def lazy_lt_semver(v1, v2): raise ConanInvalidConfiguration("imagl requires some C++20 features, which are available in libc++ for clang compiler.") compiler_version = str(self.settings.compiler.version) - toolset_version = "0" - if str(self.settings.compiler) == "Visual Studio" and str(self.settings.compiler.version).find(".") == -1 and int(str(self.settings.compiler.version)) >= 16: - try: - compiler_version = tools.vswhere(requires=["Microsoft.VisualStudio.Component.VC.Tools.x86.x64"], products="*", - version="[{}.0,{}.0)".format(str(self.settings.compiler.version), int(str(self.settings.compiler.version))+1), latest=True, property_="installationVersion")[0]["installationVersion"] - toolset_version = tools.vcvars_dict(self).get("VCToolsVersion", os.environ.get("VCToolsVersion","")) - except ConanException: - raise ConanInvalidConfiguration("Your Visual Studio compiler seems not to be installed in a common way. It is not supported. This unfortunately happens in conan center index. To build imaGL, append '--build missing' to your 'conan install' command line.") minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - minimum_toolset_version = self._compiler_toolsets_minimum_version.get(str(self.settings.compiler), "0") 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) or lazy_lt_semver(toolset_version, minimum_toolset_version): - raise ConanInvalidConfiguration("imaGL requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), compiler_version) - + (" Your Visual Studio toolset version is {}; version {}+ is required.".format(toolset_version, str(minimum_toolset_version)) if minimum_toolset_version else "")) + 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: print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_version)) - if minimum_toolset_version != "0": - print("Its toolset is in version {} and is compatible. Minimum version is {}.".format(toolset_version, minimum_toolset_version)) def config_options(self): if self.settings.os == "Windows": @@ -121,8 +100,6 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - if not self.settings.compiler.cppstd: - self.settings.compiler.cppstd = "20" def requirements(self): if self.options.with_png: From 0aab73292abef94d877b22b06baf31281322fc50 Mon Sep 17 00:00:00 2001 From: Benjamin ALBOUY-KISSI Date: Tue, 11 May 2021 23:46:51 +0200 Subject: [PATCH 25/25] Removing Ninja generator forcing which is no more needed since CCI uses MSVC 19.28 --- recipes/imagl/all/conanfile.py | 24 +-------------------- recipes/imagl/all/test_package/conanfile.py | 24 +-------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index 83ef14c2a24ef..93e23ca95372b 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -111,29 +111,7 @@ 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 - # 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 - self._cmake = CMake(self, generator=generator) + self._cmake = CMake(self) self._cmake.definitions["STATIC_LIB"] = not self.options.shared self._cmake.definitions["SUPPORT_PNG"] = self.options.with_png diff --git a/recipes/imagl/all/test_package/conanfile.py b/recipes/imagl/all/test_package/conanfile.py index 4546672a8a290..156e2a8976e7c 100644 --- a/recipes/imagl/all/test_package/conanfile.py +++ b/recipes/imagl/all/test_package/conanfile.py @@ -7,29 +7,7 @@ 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 = CMake(self) cmake.configure() cmake.build()