From 21467c9d493aedf40a7ad95f8b38fc0a719309d7 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 20 Sep 2022 22:48:02 +0200 Subject: [PATCH 01/79] [STLab] upgrade to 1.7.0 --- recipes/stlab/all/conandata.yml | 3 +++ recipes/stlab/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/stlab/all/conandata.yml b/recipes/stlab/all/conandata.yml index cde4739b5d32c..b0671d9f5ba9f 100644 --- a/recipes/stlab/all/conandata.yml +++ b/recipes/stlab/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.6.2": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.0.tar.gz" + sha256: "91b6732aab93d269a64a4e385870f15d0b435ab6aec95bbd6adcead5fb6c17ec" "1.6.2": url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 28a287ac4f61d..7f2e1aa7dca7b 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,4 +1,6 @@ versions: + "1.7.0": + folder: all "1.6.2": folder: all "1.5.6": From 3ab6af65af970d9972d14817e005280f38530728 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 20 Sep 2022 23:07:46 +0200 Subject: [PATCH 02/79] fix --- recipes/stlab/all/conanfile.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index b315741f04d56..f710cd9024ed1 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools -from conans.tools import Version -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd + import os +required_conan_version = ">=1.52.0" + class Stlab(ConanFile): name = 'stlab' description = 'The Software Technology Lab libraries.' @@ -11,7 +16,7 @@ class Stlab(ConanFile): license = 'BSL-1.0' topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' - settings = "arch", "os", "compiler", "build_type", + settings = "arch", "os", "compiler", "build_type", options = { "boost_optional": [True, False], @@ -34,7 +39,7 @@ def _use_boost(self): return self.options.boost_optional or self.options.boost_variant def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is + # On macOS it is not necessary to use the libdispatch conan package, because the library is # included in the OS. return self.options.task_system == "libdispatch" and self.settings.os != "Macos" @@ -46,7 +51,8 @@ def requirements(self): self.requires("libdispatch/5.3.2") def source(self): - tools.get(**self.conan_data["sources"][self.version]) + get(self, **self.conan_data["sources"][self.version]) + extracted_dir = "libraries-" + self.version os.rename(extracted_dir, self._source_subfolder) @@ -63,7 +69,7 @@ def _fix_boost_components(self): self.options.boost_variant = True def _default_task_system(self): - if self.settings.os == "Macos": + if self.settings.os == "Macos": return "libdispatch" if self.settings.os == "Windows": @@ -104,7 +110,7 @@ def _validate_boost_components(self): if Version(self.settings.compiler.version) >= "12": return if self.options.boost_optional and self.options.boost_variant: return # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 + # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 # is not complete. # msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " @@ -119,7 +125,7 @@ def _validate_boost_components(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, '17') + check_min_cppstd(self, 17) if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") From e35356e9c7d2695d81181e54aedb52fc6bcb3503 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 21 Sep 2022 11:53:04 +0200 Subject: [PATCH 03/79] fix --- recipes/stlab/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index f710cd9024ed1..06ee10ef23469 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -51,7 +51,7 @@ def requirements(self): self.requires("libdispatch/5.3.2") def source(self): - get(self, **self.conan_data["sources"][self.version]) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) extracted_dir = "libraries-" + self.version os.rename(extracted_dir, self._source_subfolder) From 4dce302cf95ea6ad7e649ef0b538388fd3586c65 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 21 Sep 2022 12:01:32 +0200 Subject: [PATCH 04/79] fix --- recipes/stlab/all/conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conandata.yml b/recipes/stlab/all/conandata.yml index b0671d9f5ba9f..5f52da560038b 100644 --- a/recipes/stlab/all/conandata.yml +++ b/recipes/stlab/all/conandata.yml @@ -1,5 +1,5 @@ sources: - "1.6.2": + "1.7.0": url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.0.tar.gz" sha256: "91b6732aab93d269a64a4e385870f15d0b435ab6aec95bbd6adcead5fb6c17ec" "1.6.2": From bc5e68f1357e2e79f7240cfb88af4c51508ba4a9 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 21 Sep 2022 12:15:42 +0200 Subject: [PATCH 05/79] fix --- recipes/stlab/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 06ee10ef23469..b873828e9b514 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -33,7 +33,7 @@ class Stlab(ConanFile): } no_copy_source = True - _source_subfolder = 'source_subfolder' + # _source_subfolder = 'source_subfolder' def _use_boost(self): return self.options.boost_optional or self.options.boost_variant @@ -54,7 +54,7 @@ def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) extracted_dir = "libraries-" + self.version - os.rename(extracted_dir, self._source_subfolder) + os.rename(extracted_dir, self.source_folder) def _fix_boost_components(self): if self.settings.os != "Macos": return @@ -150,7 +150,7 @@ def configure(self): def package(self): self.copy("*LICENSE", dst="licenses", keep_path=False) - self.copy("stlab/*", src=self._source_subfolder, dst='include/') + self.copy("stlab/*", src=self.source_folder, dst='include/') def package_id(self): self.info.header_only() From 5952797330e1c41b583431e5fe4a64f7c07669a1 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 21 Sep 2022 12:33:38 +0200 Subject: [PATCH 06/79] fix --- recipes/stlab/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index b873828e9b514..0d1c7424b29a0 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -32,7 +32,7 @@ class Stlab(ConanFile): "task_system": "auto", } - no_copy_source = True + # no_copy_source = True # _source_subfolder = 'source_subfolder' def _use_boost(self): From 26cf51333ebfb30f6e757cdd1471cfb2955e7ae0 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 21 Sep 2022 19:44:29 +0200 Subject: [PATCH 07/79] fix --- .../{all => 1.7.0_and_above}/conandata.yml | 0 recipes/stlab/1.7.0_and_above/conanfile.py | 201 ++++++++++++++++++ .../test_package/CMakeLists.txt | 0 .../test_package/conanfile.py | 0 .../test_package/test_package.cpp | 0 recipes/stlab/all/conanfile.py | 186 ---------------- recipes/stlab/config.yml | 12 +- 7 files changed, 207 insertions(+), 192 deletions(-) rename recipes/stlab/{all => 1.7.0_and_above}/conandata.yml (100%) create mode 100644 recipes/stlab/1.7.0_and_above/conanfile.py rename recipes/stlab/{all => 1.7.0_and_above}/test_package/CMakeLists.txt (100%) rename recipes/stlab/{all => 1.7.0_and_above}/test_package/conanfile.py (100%) rename recipes/stlab/{all => 1.7.0_and_above}/test_package/test_package.cpp (100%) delete mode 100644 recipes/stlab/all/conanfile.py diff --git a/recipes/stlab/all/conandata.yml b/recipes/stlab/1.7.0_and_above/conandata.yml similarity index 100% rename from recipes/stlab/all/conandata.yml rename to recipes/stlab/1.7.0_and_above/conandata.yml diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py new file mode 100644 index 0000000000000..53c326e57277d --- /dev/null +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -0,0 +1,201 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + +import os + +required_conan_version = ">=1.52.0" + +class Stlab(ConanFile): + name = 'stlab' + description = 'The Software Technology Lab libraries.' + url = 'https://github.com/conan-io/conan-center-index' + homepage = 'https://github.com/stlab/libraries' + license = 'BSL-1.0' + topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' + + settings = "arch", "os", "compiler", "build_type", + + options = { + "use_boost": [True, False], + "no_std_coroutines": [True, False], + "future_coroutines": [True, False], + "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], + "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], + # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], + "test": [True, False], + } + + default_options = { + "use_boost": False, + "no_std_coroutines": False, + "future_coroutines": False, + "task_system": "auto", + "thread_system": "auto", + "test": False, + } + + def layout(self): + cmake_layout(self, src_folder="src") + + # no_copy_source = True + # _source_subfolder = 'source_subfolder' + + def _requires_libdispatch(self): + # On macOS it is not necessary to use the libdispatch conan package, because the library is + # included in the OS. + return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + + def requirements(self): + if self.options.use_boost: + self.requires("boost/1.75.0") + + if self._requires_libdispatch(): + self.requires("libdispatch/5.3.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + # extracted_dir = "libraries-" + self.version + # os.rename(extracted_dir, self.source_folder) + + def _default_task_system(self): + if self.settings.os == "Macos": + return "libdispatch" + + if self.settings.os == "Windows": + return "windows" + + return "portable" + + def _validate_task_system_libdispatch(self): + if self.settings.os == "Linux": + if self.settings.compiler != "clang": + raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) + elif self.settings.os != "Macos": + raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_task_system(self): + if self.options.task_system == "libdispatch": + self._validate_task_system_libdispatch() + elif self.options.task_system == "windows": + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _default_thread_system(self): + if self.settings.os == "Macos": + return "pthread-apple" + + if self.settings.os == "Linux": + return "pthread" + + if self.settings.os == "Windows": + return "win32" + + if self.settings.os == "Emscripten": + return "pthread-emscripten" + + return "none" + + def _validate_thread_system(self): + if self.options.thread_system == "pthread-apple": + if self.settings.os != "Macos": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "pthread": + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "win32": + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "pthread-emscripten": + if self.settings.os != "Emscripten": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_boost_components(self): + if self.settings.os != "Macos": return + if self.settings.compiler != "apple-clang": return + if Version(self.settings.compiler.version) >= "12": return + if self.options.use_boost: return + # + # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 + # is not complete. + # + raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) + + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + raise ConanInvalidConfiguration("Need GCC >= 9") + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": + raise ConanInvalidConfiguration("Need Clang >= 8") + + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": + raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": + raise ConanInvalidConfiguration("Need msvc >= 19.15") + + self._validate_task_system() + self._validate_thread_system() + self._validate_boost_components() + + def configure(self): + if self.options.task_system == "auto": + self.options.task_system = self._default_task_system() + + if self.options.thread_system == "auto": + self.options.thread_system = self._default_thread_system() + + self.output.info("STLab Use Boost: {}.".format(self.options.use_boost)) + self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) + self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) + self.output.info("STLab Task System: {}.".format(self.options.task_system)) + self.output.info("STLab Thread System: {}.".format(self.options.thread_system)) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = self.options.test + tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.use_boost + tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines + tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system + tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system + + # # If main_executor == "auto" it will be detected by CMake scripts + # if self.options.main_executor != "auto": + # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor + + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + # self.copy("*LICENSE", dst="licenses", keep_path=False) + # self.copy("stlab/*", src=self.source_folder, dst='include/') + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_id(self): + # self.info.header_only() + self.info.options.use_boost = "ANY" + self.info.options.test = "ANY" + + def package_info(self): + future_coroutines_value = 1 if self.options.future_coroutines else 0 + + self.cpp_info.defines = [ + 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) + ] + + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/all/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt similarity index 100% rename from recipes/stlab/all/test_package/CMakeLists.txt rename to recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt diff --git a/recipes/stlab/all/test_package/conanfile.py b/recipes/stlab/1.7.0_and_above/test_package/conanfile.py similarity index 100% rename from recipes/stlab/all/test_package/conanfile.py rename to recipes/stlab/1.7.0_and_above/test_package/conanfile.py diff --git a/recipes/stlab/all/test_package/test_package.cpp b/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp similarity index 100% rename from recipes/stlab/all/test_package/test_package.cpp rename to recipes/stlab/1.7.0_and_above/test_package/test_package.cpp diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py deleted file mode 100644 index 0d1c7424b29a0..0000000000000 --- a/recipes/stlab/all/conanfile.py +++ /dev/null @@ -1,186 +0,0 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save -from conan.tools.scm import Version -from conan.tools.build import check_min_cppstd - -import os - -required_conan_version = ">=1.52.0" - -class Stlab(ConanFile): - name = 'stlab' - description = 'The Software Technology Lab libraries.' - url = 'https://github.com/conan-io/conan-center-index' - homepage = 'https://github.com/stlab/libraries' - license = 'BSL-1.0' - topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' - - settings = "arch", "os", "compiler", "build_type", - - options = { - "boost_optional": [True, False], - "boost_variant": [True, False], - "coroutines": [True, False], - "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], - } - - default_options = { - "boost_optional": False, - "boost_variant": False, - "coroutines": False, - "task_system": "auto", - } - - # no_copy_source = True - # _source_subfolder = 'source_subfolder' - - def _use_boost(self): - return self.options.boost_optional or self.options.boost_variant - - def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is - # included in the OS. - return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - - def requirements(self): - if self._use_boost(): - self.requires("boost/1.75.0") - - if self._requires_libdispatch(): - self.requires("libdispatch/5.3.2") - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - - extracted_dir = "libraries-" + self.version - os.rename(extracted_dir, self.source_folder) - - def _fix_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 is not complete. - # - self.output.info("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead.") - self.options.boost_optional = True - self.options.boost_variant = True - - def _default_task_system(self): - if self.settings.os == "Macos": - return "libdispatch" - - if self.settings.os == "Windows": - return "windows" - - if self.settings.os == "Emscripten": - return "emscripten" - - return "portable" - - def _validate_task_system_libdispatch(self): - if self.settings.os == "Linux": - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) - elif self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_windows(self): - if self.settings.os != "Windows": - self.output.info("Libdispatch is not supported on {}. The task system is changed to {}.".format(self.settings.os, self.options.task_system)) - raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_emscripten(self): - if self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} task_system=emscripten is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system(self): - if self.options.task_system == "libdispatch": - self._validate_task_system_libdispatch() - elif self.options.task_system == "windows": - self._validate_task_system_windows() - elif self.options.task_system == "emscripten": - self._validate_task_system_emscripten() - - def _validate_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - if self.options.boost_optional and self.options.boost_variant: return - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 - # is not complete. - # - msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " - if not self.options.boost_optional and not self.options.boost_variant: - msg += "Try -o boost_optional=True -o boost_variant=True" - elif not self.options.boost_optional: - msg += "Try -o boost_optional=True." - else: - msg += "Try -o boost_variant=True." - - raise ConanInvalidConfiguration(msg) - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) - - if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": - raise ConanInvalidConfiguration("Need GCC >= 9") - - if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": - raise ConanInvalidConfiguration("Need Clang >= 8") - - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": - raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": - raise ConanInvalidConfiguration("Need msvc >= 19.15") - - self._validate_task_system() - self._validate_boost_components() - - def configure(self): - if self.options.task_system == "auto": - self.options.task_system = self._default_task_system() - self.output.info("Stlab Task System: {}.".format(self.options.task_system)) - - def package(self): - self.copy("*LICENSE", dst="licenses", keep_path=False) - self.copy("stlab/*", src=self.source_folder, dst='include/') - - def package_id(self): - self.info.header_only() - self.info.options.boost_optional = "ANY" - self.info.options.boost_variant = "ANY" - - def package_info(self): - coroutines_value = 1 if self.options.coroutines else 0 - - self.cpp_info.defines = [ - 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) - ] - - if self.options.boost_optional: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_OPTIONAL") - - if self.options.boost_variant: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_VARIANT") - - if self.options.task_system == "portable": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PORTABLE") - elif self.options.task_system == "libdispatch": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_LIBDISPATCH") - elif self.options.task_system == "emscripten": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSRIPTEN") #Note: there is a typo in Stlab Cmake. - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSCRIPTEN") #Note: for typo fix in later versions - elif self.options.task_system == "pnacl": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PNACL") - elif self.options.task_system == "windows": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") - - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 7f2e1aa7dca7b..90fdd6d982583 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,13 +1,13 @@ versions: "1.7.0": - folder: all + folder: 1.7.0_and_above "1.6.2": - folder: all + folder: 1.7.0_before "1.5.6": - folder: all + folder: 1.7.0_before "1.5.5": - folder: all + folder: 1.7.0_before "1.5.4": - folder: all + folder: 1.7.0_before "1.5.2": - folder: all + folder: 1.7.0_before From dd411e5b1af24a6bac1798ff1e10dca57ba3aa2d Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 21 Sep 2022 19:45:16 +0200 Subject: [PATCH 08/79] fix --- recipes/stlab/1.7.0_before/conandata.yml | 19 ++ recipes/stlab/1.7.0_before/conanfile.py | 201 ++++++++++++++++++ .../1.7.0_before/test_package/CMakeLists.txt | 10 + .../1.7.0_before/test_package/conanfile.py | 17 ++ .../test_package/test_package.cpp | 25 +++ 5 files changed, 272 insertions(+) create mode 100644 recipes/stlab/1.7.0_before/conandata.yml create mode 100644 recipes/stlab/1.7.0_before/conanfile.py create mode 100644 recipes/stlab/1.7.0_before/test_package/CMakeLists.txt create mode 100644 recipes/stlab/1.7.0_before/test_package/conanfile.py create mode 100644 recipes/stlab/1.7.0_before/test_package/test_package.cpp diff --git a/recipes/stlab/1.7.0_before/conandata.yml b/recipes/stlab/1.7.0_before/conandata.yml new file mode 100644 index 0000000000000..5f52da560038b --- /dev/null +++ b/recipes/stlab/1.7.0_before/conandata.yml @@ -0,0 +1,19 @@ +sources: + "1.7.0": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.0.tar.gz" + sha256: "91b6732aab93d269a64a4e385870f15d0b435ab6aec95bbd6adcead5fb6c17ec" + "1.6.2": + url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" + sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" + "1.5.6": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" + sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" + "1.5.5": + url: "https://github.com/stlab/libraries/archive/v1.5.5.tar.gz" + sha256: "30ec5a36b4c074feac72a1b9a744f0b279010e18c7bb04bbdc5d44fe9eaf5ad8" + "1.5.4": + url: "https://github.com/stlab/libraries/archive/v1.5.4.tar.gz" + sha256: "87306f58f6614f4a1ca54dda52fedff7e610d3b3dae035829657bac77bc33640" + "1.5.2": + url: https://github.com/stlab/libraries/archive/v1.5.2.tar.gz + sha256: a82eb013e51d0bb3ee2050f0eda31e11997cb4ca74d2abfdc2c8249c5c67c9fb diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py new file mode 100644 index 0000000000000..53c326e57277d --- /dev/null +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -0,0 +1,201 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + +import os + +required_conan_version = ">=1.52.0" + +class Stlab(ConanFile): + name = 'stlab' + description = 'The Software Technology Lab libraries.' + url = 'https://github.com/conan-io/conan-center-index' + homepage = 'https://github.com/stlab/libraries' + license = 'BSL-1.0' + topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' + + settings = "arch", "os", "compiler", "build_type", + + options = { + "use_boost": [True, False], + "no_std_coroutines": [True, False], + "future_coroutines": [True, False], + "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], + "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], + # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], + "test": [True, False], + } + + default_options = { + "use_boost": False, + "no_std_coroutines": False, + "future_coroutines": False, + "task_system": "auto", + "thread_system": "auto", + "test": False, + } + + def layout(self): + cmake_layout(self, src_folder="src") + + # no_copy_source = True + # _source_subfolder = 'source_subfolder' + + def _requires_libdispatch(self): + # On macOS it is not necessary to use the libdispatch conan package, because the library is + # included in the OS. + return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + + def requirements(self): + if self.options.use_boost: + self.requires("boost/1.75.0") + + if self._requires_libdispatch(): + self.requires("libdispatch/5.3.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + # extracted_dir = "libraries-" + self.version + # os.rename(extracted_dir, self.source_folder) + + def _default_task_system(self): + if self.settings.os == "Macos": + return "libdispatch" + + if self.settings.os == "Windows": + return "windows" + + return "portable" + + def _validate_task_system_libdispatch(self): + if self.settings.os == "Linux": + if self.settings.compiler != "clang": + raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) + elif self.settings.os != "Macos": + raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_task_system(self): + if self.options.task_system == "libdispatch": + self._validate_task_system_libdispatch() + elif self.options.task_system == "windows": + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _default_thread_system(self): + if self.settings.os == "Macos": + return "pthread-apple" + + if self.settings.os == "Linux": + return "pthread" + + if self.settings.os == "Windows": + return "win32" + + if self.settings.os == "Emscripten": + return "pthread-emscripten" + + return "none" + + def _validate_thread_system(self): + if self.options.thread_system == "pthread-apple": + if self.settings.os != "Macos": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "pthread": + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "win32": + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "pthread-emscripten": + if self.settings.os != "Emscripten": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_boost_components(self): + if self.settings.os != "Macos": return + if self.settings.compiler != "apple-clang": return + if Version(self.settings.compiler.version) >= "12": return + if self.options.use_boost: return + # + # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 + # is not complete. + # + raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) + + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + raise ConanInvalidConfiguration("Need GCC >= 9") + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": + raise ConanInvalidConfiguration("Need Clang >= 8") + + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": + raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": + raise ConanInvalidConfiguration("Need msvc >= 19.15") + + self._validate_task_system() + self._validate_thread_system() + self._validate_boost_components() + + def configure(self): + if self.options.task_system == "auto": + self.options.task_system = self._default_task_system() + + if self.options.thread_system == "auto": + self.options.thread_system = self._default_thread_system() + + self.output.info("STLab Use Boost: {}.".format(self.options.use_boost)) + self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) + self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) + self.output.info("STLab Task System: {}.".format(self.options.task_system)) + self.output.info("STLab Thread System: {}.".format(self.options.thread_system)) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = self.options.test + tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.use_boost + tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines + tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system + tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system + + # # If main_executor == "auto" it will be detected by CMake scripts + # if self.options.main_executor != "auto": + # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor + + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + # self.copy("*LICENSE", dst="licenses", keep_path=False) + # self.copy("stlab/*", src=self.source_folder, dst='include/') + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_id(self): + # self.info.header_only() + self.info.options.use_boost = "ANY" + self.info.options.test = "ANY" + + def package_info(self): + future_coroutines_value = 1 if self.options.future_coroutines else 0 + + self.cpp_info.defines = [ + 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) + ] + + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..98fa8e5af1b41 --- /dev/null +++ b/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +set(CMAKE_CXX_STANDARD 17) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/stlab/1.7.0_before/test_package/conanfile.py b/recipes/stlab/1.7.0_before/test_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/stlab/1.7.0_before/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/stlab/1.7.0_before/test_package/test_package.cpp b/recipes/stlab/1.7.0_before/test_package/test_package.cpp new file mode 100644 index 0000000000000..cbf630bd2f9a3 --- /dev/null +++ b/recipes/stlab/1.7.0_before/test_package/test_package.cpp @@ -0,0 +1,25 @@ +// Async example from https://stlab.cc/libraries/concurrency/ + +#include +#include + +#include +#include + +using namespace std; +using namespace stlab; + +int main() { + auto f = async(default_executor, [] { return 42; }); + + // Waiting just for illustration purpose + while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } + + cout << "The answer is " << *f.get_try() << "\n"; +} + +/* + Result: + + The answer is 42 +*/ From 4ca763734e4e2c643f3630d65ffdd49bda60be4a Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Sep 2022 16:53:34 +0200 Subject: [PATCH 09/79] version 1.7.1 --- recipes/stlab/1.7.0_and_above/conandata.yml | 6 +++--- recipes/stlab/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conandata.yml b/recipes/stlab/1.7.0_and_above/conandata.yml index 5f52da560038b..d930cf1401034 100644 --- a/recipes/stlab/1.7.0_and_above/conandata.yml +++ b/recipes/stlab/1.7.0_and_above/conandata.yml @@ -1,7 +1,7 @@ sources: - "1.7.0": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.0.tar.gz" - sha256: "91b6732aab93d269a64a4e385870f15d0b435ab6aec95bbd6adcead5fb6c17ec" + "1.7.1": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.1.tar.gz" + sha256: "0160b5f7be7d423100a9a8b205a99285b106dd438f806978028a82b9f01c6b64" "1.6.2": url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 90fdd6d982583..4e266cb93aa0f 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,5 +1,5 @@ versions: - "1.7.0": + "1.7.1": folder: 1.7.0_and_above "1.6.2": folder: 1.7.0_before From 48e1ec865eb8e9426b508d3db6cfc416bfb39286 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Sep 2022 17:26:15 +0200 Subject: [PATCH 10/79] fixes --- recipes/stlab/1.7.0_and_above/conandata.yml | 15 --------------- recipes/stlab/1.7.0_before/conandata.yml | 3 --- 2 files changed, 18 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conandata.yml b/recipes/stlab/1.7.0_and_above/conandata.yml index d930cf1401034..5b3683503f4d0 100644 --- a/recipes/stlab/1.7.0_and_above/conandata.yml +++ b/recipes/stlab/1.7.0_and_above/conandata.yml @@ -2,18 +2,3 @@ sources: "1.7.1": url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.1.tar.gz" sha256: "0160b5f7be7d423100a9a8b205a99285b106dd438f806978028a82b9f01c6b64" - "1.6.2": - url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" - sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" - "1.5.6": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" - sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" - "1.5.5": - url: "https://github.com/stlab/libraries/archive/v1.5.5.tar.gz" - sha256: "30ec5a36b4c074feac72a1b9a744f0b279010e18c7bb04bbdc5d44fe9eaf5ad8" - "1.5.4": - url: "https://github.com/stlab/libraries/archive/v1.5.4.tar.gz" - sha256: "87306f58f6614f4a1ca54dda52fedff7e610d3b3dae035829657bac77bc33640" - "1.5.2": - url: https://github.com/stlab/libraries/archive/v1.5.2.tar.gz - sha256: a82eb013e51d0bb3ee2050f0eda31e11997cb4ca74d2abfdc2c8249c5c67c9fb diff --git a/recipes/stlab/1.7.0_before/conandata.yml b/recipes/stlab/1.7.0_before/conandata.yml index 5f52da560038b..cde4739b5d32c 100644 --- a/recipes/stlab/1.7.0_before/conandata.yml +++ b/recipes/stlab/1.7.0_before/conandata.yml @@ -1,7 +1,4 @@ sources: - "1.7.0": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.0.tar.gz" - sha256: "91b6732aab93d269a64a4e385870f15d0b435ab6aec95bbd6adcead5fb6c17ec" "1.6.2": url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" From b3e349532c6080191196119b1a6afcf03f1dbaa0 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Sep 2022 20:06:16 +0200 Subject: [PATCH 11/79] fix test recipe --- recipes/stlab/1.7.0_and_above/test_package/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/test_package/conanfile.py b/recipes/stlab/1.7.0_and_above/test_package/conanfile.py index bd7165a553cf4..7b6863a649306 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/test_package/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake +from conan.tools.build import cross_building import os @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From be16a32713757fbc12d8c50e2da08afc9d5269bc Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Sep 2022 20:23:44 +0200 Subject: [PATCH 12/79] fix test recipe --- recipes/stlab/1.7.0_before/test_package/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/1.7.0_before/test_package/conanfile.py b/recipes/stlab/1.7.0_before/test_package/conanfile.py index bd7165a553cf4..7b6863a649306 100644 --- a/recipes/stlab/1.7.0_before/test_package/conanfile.py +++ b/recipes/stlab/1.7.0_before/test_package/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake +from conan.tools.build import cross_building import os @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 83d52784845a9e4a3bdb2d07168c50b77ee36e30 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Sep 2022 20:43:51 +0200 Subject: [PATCH 13/79] uses cmake v23 --- recipes/stlab/1.7.0_and_above/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 53c326e57277d..fe1c30557d47e 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -49,6 +49,9 @@ def _requires_libdispatch(self): # included in the OS. return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + def build_requirements(self): + self.build_requires("cmake/3.23.3") + def requirements(self): if self.options.use_boost: self.requires("boost/1.75.0") From e4051c42cbd07bf40bed7a74ecd0a50bfd6ad302 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Sep 2022 22:44:00 +0200 Subject: [PATCH 14/79] fixes --- recipes/stlab/1.7.0_and_above/conanfile.py | 21 +-- .../test_package/CMakeLists.txt | 12 +- .../1.7.0_and_above/test_package/conanfile.py | 15 +- recipes/stlab/1.7.0_before/conanfile.py | 137 ++++++++---------- .../1.7.0_before/test_package/CMakeLists.txt | 12 +- .../1.7.0_before/test_package/conanfile.py | 16 +- 6 files changed, 97 insertions(+), 116 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index fe1c30557d47e..9fa6965d3b9c4 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save from conan.tools.scm import Version from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os @@ -25,13 +25,16 @@ class Stlab(ConanFile): "future_coroutines": [True, False], "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], + + # TODO # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], + "test": [True, False], } default_options = { "use_boost": False, - "no_std_coroutines": False, + "no_std_coroutines": True, #TODO: how to make checks similar to what are made in Cmake https://github.com/stlab/libraries/blob/main/cmake/StlabUtil.cmake#L35 "future_coroutines": False, "task_system": "auto", "thread_system": "auto", @@ -41,9 +44,6 @@ class Stlab(ConanFile): def layout(self): cmake_layout(self, src_folder="src") - # no_copy_source = True - # _source_subfolder = 'source_subfolder' - def _requires_libdispatch(self): # On macOS it is not necessary to use the libdispatch conan package, because the library is # included in the OS. @@ -62,9 +62,6 @@ def requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - # extracted_dir = "libraries-" + self.version - # os.rename(extracted_dir, self.source_folder) - def _default_task_system(self): if self.settings.os == "Macos": return "libdispatch" @@ -170,25 +167,29 @@ def generate(self): tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system + # TODO # # If main_executor == "auto" it will be detected by CMake scripts # if self.options.main_executor != "auto": # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def package(self): - # self.copy("*LICENSE", dst="licenses", keep_path=False) - # self.copy("stlab/*", src=self.source_folder, dst='include/') copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) cmake = CMake(self) cmake.install() def package_id(self): + #TODO: is header only but needs a header modified by cmake # self.info.header_only() self.info.options.use_boost = "ANY" self.info.options.test = "ANY" diff --git a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt index 98fa8e5af1b41..c0142a400f512 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt +++ b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) -set(CMAKE_CXX_STANDARD 17) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) # if the project uses c++ +find_package(stlab REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/stlab/1.7.0_and_above/test_package/conanfile.py b/recipes/stlab/1.7.0_and_above/test_package/conanfile.py index 7b6863a649306..43d09430b77d5 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/test_package/conanfile.py @@ -1,12 +1,15 @@ from conan import ConanFile -from conan.tools.cmake import CMake -from conan.tools.build import cross_building +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -14,6 +17,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 53c326e57277d..c0ab1e853b1c7 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save from conan.tools.scm import Version from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os @@ -20,29 +20,24 @@ class Stlab(ConanFile): settings = "arch", "os", "compiler", "build_type", options = { - "use_boost": [True, False], - "no_std_coroutines": [True, False], - "future_coroutines": [True, False], + "boost_optional": [True, False], + "boost_variant": [True, False], + "coroutines": [True, False], "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], - "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], - # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], - "test": [True, False], } default_options = { - "use_boost": False, - "no_std_coroutines": False, - "future_coroutines": False, + "boost_optional": False, + "boost_variant": False, + "coroutines": False, "task_system": "auto", - "thread_system": "auto", - "test": False, } def layout(self): cmake_layout(self, src_folder="src") - # no_copy_source = True - # _source_subfolder = 'source_subfolder' + def _use_boost(self): + return self.options.boost_optional or self.options.boost_variant def _requires_libdispatch(self): # On macOS it is not necessary to use the libdispatch conan package, because the library is @@ -50,7 +45,7 @@ def _requires_libdispatch(self): return self.options.task_system == "libdispatch" and self.settings.os != "Macos" def requirements(self): - if self.options.use_boost: + if self._use_boost(): self.requires("boost/1.75.0") if self._requires_libdispatch(): @@ -59,8 +54,17 @@ def requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - # extracted_dir = "libraries-" + self.version - # os.rename(extracted_dir, self.source_folder) + def _fix_boost_components(self): + if self.settings.os != "Macos": return + if self.settings.compiler != "apple-clang": return + if Version(self.settings.compiler.version) >= "12": return + + # + # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 is not complete. + # + self.output.info("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead.") + self.options.boost_optional = True + self.options.boost_variant = True def _default_task_system(self): if self.settings.os == "Macos": @@ -69,6 +73,9 @@ def _default_task_system(self): if self.settings.os == "Windows": return "windows" + if self.settings.os == "Emscripten": + return "emscripten" + return "portable" def _validate_task_system_libdispatch(self): @@ -78,52 +85,41 @@ def _validate_task_system_libdispatch(self): elif self.settings.os != "Macos": raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + def _validate_task_system_windows(self): + if self.settings.os != "Windows": + self.output.info("Libdispatch is not supported on {}. The task system is changed to {}.".format(self.settings.os, self.options.task_system)) + raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_task_system_emscripten(self): + if self.settings.os != "Emscripten": + raise ConanInvalidConfiguration("{}/{} task_system=emscripten is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + def _validate_task_system(self): if self.options.task_system == "libdispatch": self._validate_task_system_libdispatch() elif self.options.task_system == "windows": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _default_thread_system(self): - if self.settings.os == "Macos": - return "pthread-apple" - - if self.settings.os == "Linux": - return "pthread" - - if self.settings.os == "Windows": - return "win32" - - if self.settings.os == "Emscripten": - return "pthread-emscripten" - - return "none" - - def _validate_thread_system(self): - if self.options.thread_system == "pthread-apple": - if self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread": - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "win32": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread-emscripten": - if self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + self._validate_task_system_windows() + elif self.options.task_system == "emscripten": + self._validate_task_system_emscripten() def _validate_boost_components(self): if self.settings.os != "Macos": return if self.settings.compiler != "apple-clang": return if Version(self.settings.compiler.version) >= "12": return - if self.options.use_boost: return + if self.options.boost_optional and self.options.boost_variant: return # - # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 + # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 # is not complete. # - raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") + msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " + if not self.options.boost_optional and not self.options.boost_variant: + msg += "Try -o boost_optional=True -o boost_variant=True" + elif not self.options.boost_optional: + msg += "Try -o boost_optional=True." + else: + msg += "Try -o boost_variant=True." + + raise ConanInvalidConfiguration(msg) def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -143,34 +139,22 @@ def validate(self): raise ConanInvalidConfiguration("Need msvc >= 19.15") self._validate_task_system() - self._validate_thread_system() self._validate_boost_components() def configure(self): if self.options.task_system == "auto": self.options.task_system = self._default_task_system() + self.output.info("Stlab Task System: {}.".format(self.options.task_system)) - if self.options.thread_system == "auto": - self.options.thread_system = self._default_thread_system() - - self.output.info("STLab Use Boost: {}.".format(self.options.use_boost)) - self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) - self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) - self.output.info("STLab Task System: {}.".format(self.options.task_system)) - self.output.info("STLab Thread System: {}.".format(self.options.thread_system)) def generate(self): tc = CMakeToolchain(self) - tc.variables["BUILD_TESTING"] = self.options.test - tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.use_boost - tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines - tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system - tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system - - # # If main_executor == "auto" it will be detected by CMake scripts - # if self.options.main_executor != "auto": - # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor - + tc.variables["stlab.boost_variant"] = self.options.boost_optional + tc.variables["stlab.boost_optional"] = self.options.boost_variant + tc.variables["stlab.coroutines"] = self.options.coroutines + tc.variables["stlab.task_system"] = self.options.task_system + tc.generate() + tc = CMakeDeps(self) tc.generate() def build(self): @@ -179,23 +163,18 @@ def build(self): cmake.build() def package(self): - # self.copy("*LICENSE", dst="licenses", keep_path=False) - # self.copy("stlab/*", src=self.source_folder, dst='include/') copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) cmake = CMake(self) cmake.install() def package_id(self): # self.info.header_only() - self.info.options.use_boost = "ANY" - self.info.options.test = "ANY" + self.info.options.boost_optional = "ANY" + self.info.options.boost_variant = "ANY" def package_info(self): - future_coroutines_value = 1 if self.options.future_coroutines else 0 + coroutines_value = 1 if self.options.coroutines else 0 self.cpp_info.defines = [ - 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) + 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) ] - - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt index 98fa8e5af1b41..c0142a400f512 100644 --- a/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt +++ b/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) -set(CMAKE_CXX_STANDARD 17) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) # if the project uses c++ +find_package(stlab REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/stlab/1.7.0_before/test_package/conanfile.py b/recipes/stlab/1.7.0_before/test_package/conanfile.py index 7b6863a649306..d18c63259a98e 100644 --- a/recipes/stlab/1.7.0_before/test_package/conanfile.py +++ b/recipes/stlab/1.7.0_before/test_package/conanfile.py @@ -1,12 +1,14 @@ from conan import ConanFile -from conan.tools.cmake import CMake -from conan.tools.build import cross_building +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -14,6 +16,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") From 2d372125d5fac5e0e91e4f8bf1b5da24b3ba6528 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 27 Sep 2022 09:31:53 +0200 Subject: [PATCH 15/79] adds short_paths = True --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 ++ recipes/stlab/1.7.0_before/conanfile.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 9fa6965d3b9c4..2800229ac9bea 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -41,6 +41,8 @@ class Stlab(ConanFile): "test": False, } + short_paths = True + def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index c0ab1e853b1c7..55b5586cc348b 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -33,6 +33,8 @@ class Stlab(ConanFile): "task_system": "auto", } + short_paths = True + def layout(self): cmake_layout(self, src_folder="src") From 6cc5b14f048851d0e16c80b7872e54f059cf355e Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 27 Sep 2022 09:42:21 +0200 Subject: [PATCH 16/79] remove share folder --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 ++ recipes/stlab/1.7.0_before/conanfile.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 2800229ac9bea..3497e52b686a0 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -190,6 +190,8 @@ def package(self): cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + def package_id(self): #TODO: is header only but needs a header modified by cmake # self.info.header_only() diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 55b5586cc348b..43cbda16e5816 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -169,6 +169,8 @@ def package(self): cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + def package_id(self): # self.info.header_only() self.info.options.boost_optional = "ANY" From 34e37792ca49595f9430b429004ddf7762797aa6 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 27 Sep 2022 10:41:44 +0200 Subject: [PATCH 17/79] temp removal of old files --- recipes/stlab/1.7.0_before/conanfile.py | 3 +++ recipes/stlab/config.yml | 11 +---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 43cbda16e5816..9f86d945ac9a6 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -46,6 +46,9 @@ def _requires_libdispatch(self): # included in the OS. return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + def build_requirements(self): + self.build_requires("cmake/3.23.3") + def requirements(self): if self._use_boost(): self.requires("boost/1.75.0") diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 4e266cb93aa0f..91d0f53710dc5 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,13 +1,4 @@ versions: "1.7.1": folder: 1.7.0_and_above - "1.6.2": - folder: 1.7.0_before - "1.5.6": - folder: 1.7.0_before - "1.5.5": - folder: 1.7.0_before - "1.5.4": - folder: 1.7.0_before - "1.5.2": - folder: 1.7.0_before + From aeddbc31d475c33f6baa3e84c43592613343a350 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 10:34:27 +0200 Subject: [PATCH 18/79] fix text package --- recipes/stlab/1.7.0_and_above/test_package/test_package.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp b/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp index cbf630bd2f9a3..b125ed3c4bd3d 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp +++ b/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp @@ -16,6 +16,8 @@ int main() { while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } cout << "The answer is " << *f.get_try() << "\n"; + + stlab::pre_exit(); } /* From dc9a196383580fa7b9c2b2d793bd01dbb03cc3fe Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 10:51:04 +0200 Subject: [PATCH 19/79] fix --- recipes/stlab/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 91d0f53710dc5..2b3350a22cdff 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,4 +1,3 @@ versions: "1.7.1": folder: 1.7.0_and_above - From ed524d8b4c8155743c725f94bee28e101f5682fa Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 11:52:49 +0200 Subject: [PATCH 20/79] skip coying systems libs --- recipes/stlab/1.7.0_and_above/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 3497e52b686a0..f7455e2ae8ccb 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -163,6 +163,7 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True tc.variables["BUILD_TESTING"] = self.options.test tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.use_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines From 649e2f9136f5840547578635e6b987a19f37071e Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 13:29:32 +0200 Subject: [PATCH 21/79] NOMINMAX --- recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt index c0142a400f512..6867a4b0802e4 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt +++ b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) # if the project uses c++ find_package(stlab REQUIRED CONFIG) +target_compile_definitions( stlab INTERFACE $<$:NOMINMAX> ) + add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_compile_definitions( ${PROJECT_NAME} INTERFACE $<$:NOMINMAX> ) From fe0377c658cf1880bf1ea06e0563c27a991958ae Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 13:43:42 +0200 Subject: [PATCH 22/79] fix --- recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt index 6867a4b0802e4..3772ac212bae3 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt +++ b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt @@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) # if the project uses c++ find_package(stlab REQUIRED CONFIG) -target_compile_definitions( stlab INTERFACE $<$:NOMINMAX> ) - add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) From 30719d1a5bc714c0e31ff0d3f062f02b70d43ab9 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 14:34:13 +0200 Subject: [PATCH 23/79] fix --- recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt index 3772ac212bae3..07f83d9f7660e 100644 --- a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt +++ b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt @@ -4,6 +4,7 @@ project(test_package CXX) # if the project uses c++ find_package(stlab REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_definitions( ${PROJECT_NAME} INTERFACE $<$:NOMINMAX> ) target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -target_compile_definitions( ${PROJECT_NAME} INTERFACE $<$:NOMINMAX> ) + From 324f505939d0a876b19efcd2c5cef2f5faf96d7a Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 16:40:33 +0200 Subject: [PATCH 24/79] define NOMINMAX on conan recipe --- recipes/stlab/1.7.0_and_above/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index f7455e2ae8ccb..9ff9525ce99b4 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -206,5 +206,8 @@ def package_info(self): 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) ] + if self.settings.os == "Windows": + self.cpp_info.defines = ['NOMINMAX'] + if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] From 94843235a6bdbd6960ee29753a0543721fc37c19 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 17:13:19 +0200 Subject: [PATCH 25/79] now try all the versions --- recipes/stlab/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 2b3350a22cdff..4e266cb93aa0f 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,3 +1,13 @@ versions: "1.7.1": folder: 1.7.0_and_above + "1.6.2": + folder: 1.7.0_before + "1.5.6": + folder: 1.7.0_before + "1.5.5": + folder: 1.7.0_before + "1.5.4": + folder: 1.7.0_before + "1.5.2": + folder: 1.7.0_before From e1a10ba8f1abb724f1d40ad46a14cac1a093d656 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 18:15:37 +0200 Subject: [PATCH 26/79] fix --- recipes/stlab/1.7.0_before/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 9f86d945ac9a6..9924e7b2d3339 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -46,8 +46,8 @@ def _requires_libdispatch(self): # included in the OS. return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - def build_requirements(self): - self.build_requires("cmake/3.23.3") + # def build_requirements(self): + # self.build_requires("cmake/3.23.3") def requirements(self): if self._use_boost(): From 11506bf2ab6ffd156ca06bdd74aeb1be1830fe04 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 18:32:50 +0200 Subject: [PATCH 27/79] remove old versions (temp) --- recipes/stlab/config.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 4e266cb93aa0f..e75d2c7533f6d 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -3,11 +3,3 @@ versions: folder: 1.7.0_and_above "1.6.2": folder: 1.7.0_before - "1.5.6": - folder: 1.7.0_before - "1.5.5": - folder: 1.7.0_before - "1.5.4": - folder: 1.7.0_before - "1.5.2": - folder: 1.7.0_before From a9762a8a88a110179f8d1aae5210c8055846d2e2 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 19:21:26 +0200 Subject: [PATCH 28/79] remove old versions (temp) --- recipes/stlab/1.7.0_before/conandata.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/recipes/stlab/1.7.0_before/conandata.yml b/recipes/stlab/1.7.0_before/conandata.yml index cde4739b5d32c..1dfcc9da738a0 100644 --- a/recipes/stlab/1.7.0_before/conandata.yml +++ b/recipes/stlab/1.7.0_before/conandata.yml @@ -2,15 +2,3 @@ sources: "1.6.2": url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" - "1.5.6": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" - sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" - "1.5.5": - url: "https://github.com/stlab/libraries/archive/v1.5.5.tar.gz" - sha256: "30ec5a36b4c074feac72a1b9a744f0b279010e18c7bb04bbdc5d44fe9eaf5ad8" - "1.5.4": - url: "https://github.com/stlab/libraries/archive/v1.5.4.tar.gz" - sha256: "87306f58f6614f4a1ca54dda52fedff7e610d3b3dae035829657bac77bc33640" - "1.5.2": - url: https://github.com/stlab/libraries/archive/v1.5.2.tar.gz - sha256: a82eb013e51d0bb3ee2050f0eda31e11997cb4ca74d2abfdc2c8249c5c67c9fb From 7bcef4128950776db541693efef1bbe614b6a389 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 19:31:29 +0200 Subject: [PATCH 29/79] rollback --- recipes/stlab/1.7.0_before/conanfile.py | 73 +++++++++++-------------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 9924e7b2d3339..1b5c68bfcf487 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -1,14 +1,8 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save -from conan.tools.scm import Version -from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout - +from conans import ConanFile, tools +from conans.tools import Version +from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.52.0" - class Stlab(ConanFile): name = 'stlab' description = 'The Software Technology Lab libraries.' @@ -33,10 +27,8 @@ class Stlab(ConanFile): "task_system": "auto", } - short_paths = True - - def layout(self): - cmake_layout(self, src_folder="src") + no_copy_source = True + _source_subfolder = 'source_subfolder' def _use_boost(self): return self.options.boost_optional or self.options.boost_variant @@ -46,9 +38,6 @@ def _requires_libdispatch(self): # included in the OS. return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - # def build_requirements(self): - # self.build_requires("cmake/3.23.3") - def requirements(self): if self._use_boost(): self.requires("boost/1.75.0") @@ -57,7 +46,9 @@ def requirements(self): self.requires("libdispatch/5.3.2") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + tools.get(**self.conan_data["sources"][self.version]) + extracted_dir = "libraries-" + self.version + os.rename(extracted_dir, self._source_subfolder) def _fix_boost_components(self): if self.settings.os != "Macos": return @@ -128,7 +119,7 @@ def _validate_boost_components(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) + tools.check_min_cppstd(self, '17') if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") @@ -151,31 +142,12 @@ def configure(self): self.options.task_system = self._default_task_system() self.output.info("Stlab Task System: {}.".format(self.options.task_system)) - - def generate(self): - tc = CMakeToolchain(self) - tc.variables["stlab.boost_variant"] = self.options.boost_optional - tc.variables["stlab.boost_optional"] = self.options.boost_variant - tc.variables["stlab.coroutines"] = self.options.coroutines - tc.variables["stlab.task_system"] = self.options.task_system - tc.generate() - tc = CMakeDeps(self) - tc.generate() - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = CMake(self) - cmake.install() - - rmdir(self, os.path.join(self.package_folder, "share")) + self.copy("*LICENSE", dst="licenses", keep_path=False) + self.copy("stlab/*", src=self._source_subfolder, dst='include/') def package_id(self): - # self.info.header_only() + self.info.header_only() self.info.options.boost_optional = "ANY" self.info.options.boost_variant = "ANY" @@ -185,3 +157,24 @@ def package_info(self): self.cpp_info.defines = [ 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) ] + + if self.options.boost_optional: + self.cpp_info.defines.append("STLAB_FORCE_BOOST_OPTIONAL") + + if self.options.boost_variant: + self.cpp_info.defines.append("STLAB_FORCE_BOOST_VARIANT") + + if self.options.task_system == "portable": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PORTABLE") + elif self.options.task_system == "libdispatch": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_LIBDISPATCH") + elif self.options.task_system == "emscripten": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSRIPTEN") #Note: there is a typo in Stlab Cmake. + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSCRIPTEN") #Note: for typo fix in later versions + elif self.options.task_system == "pnacl": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PNACL") + elif self.options.task_system == "windows": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") + + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] \ No newline at end of file From 427151a4a94b0595f0003af1d8de9d802cad8b83 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 19:34:29 +0200 Subject: [PATCH 30/79] fixes --- recipes/stlab/1.7.0_and_above/conanfile.py | 10 ++++---- recipes/stlab/1.7.0_before/conanfile.py | 29 +++++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 9ff9525ce99b4..db879721ba287 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -128,20 +128,20 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") def validate(self): - if self.settings.compiler.get_safe("cppstd"): + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 17) - if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") - if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": + if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": raise ConanInvalidConfiguration("Need Clang >= 8") - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": + if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": + if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": raise ConanInvalidConfiguration("Need msvc >= 19.15") self._validate_task_system() diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 1b5c68bfcf487..353fe3c2cc080 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, tools -from conans.tools import Version -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os class Stlab(ConanFile): @@ -30,6 +33,10 @@ class Stlab(ConanFile): no_copy_source = True _source_subfolder = 'source_subfolder' + # short_paths = True + # def layout(self): + # cmake_layout(self, src_folder="src") + def _use_boost(self): return self.options.boost_optional or self.options.boost_variant @@ -46,9 +53,7 @@ def requirements(self): self.requires("libdispatch/5.3.2") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "libraries-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def _fix_boost_components(self): if self.settings.os != "Macos": return @@ -118,20 +123,20 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration(msg) def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, '17') + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) - if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") - if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": + if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": raise ConanInvalidConfiguration("Need Clang >= 8") - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": + if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": + if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": raise ConanInvalidConfiguration("Need msvc >= 19.15") self._validate_task_system() From 47154138389c6a145d437b917f7175cada12b82a Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 19:45:37 +0200 Subject: [PATCH 31/79] fix --- recipes/stlab/1.7.0_before/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 353fe3c2cc080..712076c2a374b 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -182,4 +182,4 @@ def package_info(self): self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] \ No newline at end of file + self.cpp_info.system_libs = ["pthread"] From a1fcf6665b4ea29ff94dc638c95b833ae1dca82e Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 19:58:42 +0200 Subject: [PATCH 32/79] fix --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- recipes/stlab/1.7.0_before/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index db879721ba287..8bbdefca44959 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -128,7 +128,7 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.info.settings.compiler.cppstd: check_min_cppstd(self, 17) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 712076c2a374b..f7b089c2725c5 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -123,7 +123,7 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration(msg) def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.info.settings.compiler.cppstd: check_min_cppstd(self, 17) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": From cf81d57bfb582188e712634e6851051e6d3892b2 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 20:57:30 +0200 Subject: [PATCH 33/79] fix --- recipes/stlab/1.7.0_before/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index f7b089c2725c5..8bd2d11ccb12d 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -123,8 +123,8 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration(msg) def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 17) + # if self.info.settings.compiler.cppstd: + # check_min_cppstd(self, 17) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") From f7ae5dcdf3d813940719d07f9c9ba36424e48fab Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 22:02:40 +0200 Subject: [PATCH 34/79] fix --- recipes/absent/all/conanfile.py | 3 +-- recipes/stlab/1.7.0_before/conanfile.py | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/absent/all/conanfile.py b/recipes/absent/all/conanfile.py index bdc5f5e18836b..002a9e37083aa 100644 --- a/recipes/absent/all/conanfile.py +++ b/recipes/absent/all/conanfile.py @@ -2,8 +2,7 @@ from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AbsentConan(ConanFile): name = "absent" diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py index 8bd2d11ccb12d..0a4b45b78ce47 100644 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ b/recipes/stlab/1.7.0_before/conanfile.py @@ -6,6 +6,8 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.52.0" + class Stlab(ConanFile): name = 'stlab' description = 'The Software Technology Lab libraries.' @@ -152,7 +154,7 @@ def package(self): self.copy("stlab/*", src=self._source_subfolder, dst='include/') def package_id(self): - self.info.header_only() + self.info.clear() self.info.options.boost_optional = "ANY" self.info.options.boost_variant = "ANY" From 241028ad01102910a0381c100c94ce4cd8f49ecf Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 28 Sep 2022 17:11:41 -0300 Subject: [PATCH 35/79] Update recipes/absent/all/conanfile.py --- recipes/absent/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/absent/all/conanfile.py b/recipes/absent/all/conanfile.py index 002a9e37083aa..bdc5f5e18836b 100644 --- a/recipes/absent/all/conanfile.py +++ b/recipes/absent/all/conanfile.py @@ -2,7 +2,8 @@ from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.43.0" + class AbsentConan(ConanFile): name = "absent" From a4f8d58e3f50da87907538f4eedc9bd744c7731f Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 06:42:57 -0300 Subject: [PATCH 36/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Uilian Ries --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 8bbdefca44959..963ad1574f7e0 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -56,7 +56,7 @@ def build_requirements(self): def requirements(self): if self.options.use_boost: - self.requires("boost/1.75.0") + self.requires("boost/1.80.0") if self._requires_libdispatch(): self.requires("libdispatch/5.3.2") From cca28881a8b2e8aa715b00a53a3a55324f747c5f Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 06:43:04 -0300 Subject: [PATCH 37/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Uilian Ries --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 963ad1574f7e0..8fbee0298d2ec 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.files import copy, get, replace_in_file, rmdir from conan.tools.scm import Version from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout From 2f8385ad4b1034bf8e50cf21c590f61c69f2d171 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 06:43:27 -0300 Subject: [PATCH 38/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Uilian Ries --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 8fbee0298d2ec..0328c276fc1ee 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -76,7 +76,7 @@ def _default_task_system(self): def _validate_task_system_libdispatch(self): if self.settings.os == "Linux": if self.settings.compiler != "clang": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}. Use Clang compiler or switch to task_system=portable or task_system=auto") elif self.settings.os != "Macos": raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) From 92276e747bdd733e26f6ccc919f54cd518cf4261 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 06:43:38 -0300 Subject: [PATCH 39/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Uilian Ries --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 0328c276fc1ee..7000ee2a5a55d 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -78,7 +78,7 @@ def _validate_task_system_libdispatch(self): if self.settings.compiler != "clang": raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}. Use Clang compiler or switch to task_system=portable or task_system=auto") elif self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch is not supported on {self.settings.os}. Try using task_system=auto") def _validate_task_system(self): if self.options.task_system == "libdispatch": From 804809c1c37085a505093e14f5506106005978b9 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 06:43:49 -0300 Subject: [PATCH 40/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Uilian Ries --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 7000ee2a5a55d..6da398dadd437 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -85,7 +85,7 @@ def _validate_task_system(self): self._validate_task_system_libdispatch() elif self.options.task_system == "windows": if self.settings.os != "Windows": - raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + raise ConanInvalidConfiguration(f"{sefl.ref} task_system=windows is not supported on {self.settings.os}. Try using task_system=auto") def _default_thread_system(self): if self.settings.os == "Macos": From d3c9d1742f9ab27085a8a7715513f6348d15e9d9 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 06:44:18 -0300 Subject: [PATCH 41/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Uilian Ries --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 6da398dadd437..c937ffddae79d 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -195,7 +195,7 @@ def package(self): def package_id(self): #TODO: is header only but needs a header modified by cmake - # self.info.header_only() + self.info.settings.clear() self.info.options.use_boost = "ANY" self.info.options.test = "ANY" From 915695b3a7d6dd633ff5b35f415e5ba072886864 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 30 Sep 2022 13:37:25 -0300 Subject: [PATCH 42/79] Update recipes/stlab/1.7.0_and_above/conanfile.py --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index c937ffddae79d..bcaa25276895d 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -85,7 +85,7 @@ def _validate_task_system(self): self._validate_task_system_libdispatch() elif self.options.task_system == "windows": if self.settings.os != "Windows": - raise ConanInvalidConfiguration(f"{sefl.ref} task_system=windows is not supported on {self.settings.os}. Try using task_system=auto") + raise ConanInvalidConfiguration(f"{self.ref} task_system=windows is not supported on {self.settings.os}. Try using task_system=auto") def _default_thread_system(self): if self.settings.os == "Macos": From 738e8652582db7d23bec319d52eb9c2ec9ac4a5b Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 3 Oct 2022 05:23:17 -0300 Subject: [PATCH 43/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index bcaa25276895d..7e403e5f282d2 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.files import copy, get, rmdir from conan.tools.scm import Version from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout From d042566c06a5f6420bd2042e19459892bab80cd7 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 3 Oct 2022 05:23:31 -0300 Subject: [PATCH 44/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 7e403e5f282d2..c1b068779a1d1 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -15,7 +15,7 @@ class Stlab(ConanFile): url = 'https://github.com/conan-io/conan-center-index' homepage = 'https://github.com/stlab/libraries' license = 'BSL-1.0' - topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' + topics = 'concurrency', 'futures', 'channels' settings = "arch", "os", "compiler", "build_type", From 43c8f2dbe3f0c52a818a94d6a98ff6ed64ee7c33 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 3 Oct 2022 05:27:26 -0300 Subject: [PATCH 45/79] Update recipes/stlab/1.7.0_and_above/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index c1b068779a1d1..6f389af4adbd8 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -125,7 +125,7 @@ def _validate_boost_components(self): # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 # is not complete. # - raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") + raise ConanInvalidConfiguration(f"Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o {self.name}:use_boost=True.") def validate(self): if self.info.settings.compiler.cppstd: From 03b4fc07985532efcaa6b1594c5047380393b704 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 3 Oct 2022 10:27:46 +0200 Subject: [PATCH 46/79] with_boost --- recipes/stlab/1.7.0_and_above/conanfile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index c1b068779a1d1..ee6fa494547b3 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -20,7 +20,7 @@ class Stlab(ConanFile): settings = "arch", "os", "compiler", "build_type", options = { - "use_boost": [True, False], + "with_boost": [True, False], "no_std_coroutines": [True, False], "future_coroutines": [True, False], "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], @@ -33,7 +33,7 @@ class Stlab(ConanFile): } default_options = { - "use_boost": False, + "with_boost": False, "no_std_coroutines": True, #TODO: how to make checks similar to what are made in Cmake https://github.com/stlab/libraries/blob/main/cmake/StlabUtil.cmake#L35 "future_coroutines": False, "task_system": "auto", @@ -55,7 +55,7 @@ def build_requirements(self): self.build_requires("cmake/3.23.3") def requirements(self): - if self.options.use_boost: + if self.options.with_boost: self.requires("boost/1.80.0") if self._requires_libdispatch(): @@ -120,12 +120,12 @@ def _validate_boost_components(self): if self.settings.os != "Macos": return if self.settings.compiler != "apple-clang": return if Version(self.settings.compiler.version) >= "12": return - if self.options.use_boost: return + if self.options.with_boost: return # # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 # is not complete. # - raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o use_boost=True.") + raise ConanInvalidConfiguration("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o with_boost=True.") def validate(self): if self.info.settings.compiler.cppstd: @@ -155,7 +155,7 @@ def configure(self): if self.options.thread_system == "auto": self.options.thread_system = self._default_thread_system() - self.output.info("STLab Use Boost: {}.".format(self.options.use_boost)) + self.output.info("STLab With Boost: {}.".format(self.options.with_boost)) self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) self.output.info("STLab Task System: {}.".format(self.options.task_system)) @@ -165,7 +165,7 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True tc.variables["BUILD_TESTING"] = self.options.test - tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.use_boost + tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system @@ -196,7 +196,7 @@ def package(self): def package_id(self): #TODO: is header only but needs a header modified by cmake self.info.settings.clear() - self.info.options.use_boost = "ANY" + self.info.options.with_boost = "ANY" self.info.options.test = "ANY" def package_info(self): From 2148dff09b9157f5c892477275e7e2b58440c8a8 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 3 Oct 2022 10:47:02 +0200 Subject: [PATCH 47/79] no test option --- recipes/stlab/1.7.0_and_above/conanfile.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index ad6ff7e69060d..0eafa2b816ab9 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -29,7 +29,7 @@ class Stlab(ConanFile): # TODO # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], - "test": [True, False], + # "test": [True, False], } default_options = { @@ -38,7 +38,7 @@ class Stlab(ConanFile): "future_coroutines": False, "task_system": "auto", "thread_system": "auto", - "test": False, + # "test": False, } short_paths = True @@ -128,8 +128,10 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration(f"Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 17) + # TODO: No cppstd check until this issue is solved + # https://github.com/conan-io/conan/issues/12210 + # if self.info.settings.compiler.cppstd: + # check_min_cppstd(self, 17) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") @@ -164,7 +166,10 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True - tc.variables["BUILD_TESTING"] = self.options.test + + # tc.variables["BUILD_TESTING"] = self.options.test + tc.definitions['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system From ba5ecf8d43de50b17db8deee32e0ea03e22542f1 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 3 Oct 2022 11:51:02 +0200 Subject: [PATCH 48/79] fix --- recipes/stlab/1.7.0_and_above/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 0eafa2b816ab9..59041b9135898 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -168,7 +168,7 @@ def generate(self): tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True # tc.variables["BUILD_TESTING"] = self.options.test - tc.definitions['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines From 00eafe600715d99a6285e5d5ab5a8004afe881dd Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 8 Nov 2022 15:57:32 +0100 Subject: [PATCH 49/79] Trigger notification From 384802f045325f6c4c8ac9dddda35c02cd35ab5a Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 24 Nov 2022 10:27:03 +0100 Subject: [PATCH 50/79] fix --- recipes/stlab/1.7.0_and_above/conanfile.py | 4 ++-- recipes/stlab/config.yml | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 59041b9135898..efded7eb37e74 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -201,8 +201,8 @@ def package(self): def package_id(self): #TODO: is header only but needs a header modified by cmake self.info.settings.clear() - self.info.options.with_boost = "ANY" - self.info.options.test = "ANY" + # self.info.options.with_boost = "ANY" + # self.info.options.test = "ANY" def package_info(self): future_coroutines_value = 1 if self.options.future_coroutines else 0 diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index e75d2c7533f6d..2b3350a22cdff 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,5 +1,3 @@ versions: "1.7.1": folder: 1.7.0_and_above - "1.6.2": - folder: 1.7.0_before From eba3a47da82d43e8d96a1262e7aa2e0255d9f894 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 25 Nov 2022 10:21:35 +0100 Subject: [PATCH 51/79] fixes --- recipes/stlab/1.7.0_and_above/conanfile.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index efded7eb37e74..dad8e1b241f9f 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -43,6 +43,10 @@ class Stlab(ConanFile): short_paths = True + @property + def _minimum_cpp_standard(self): + return 17 + def layout(self): cmake_layout(self, src_folder="src") @@ -133,6 +137,9 @@ def validate(self): # if self.info.settings.compiler.cppstd: # check_min_cppstd(self, 17) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") @@ -144,7 +151,7 @@ def validate(self): # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": - raise ConanInvalidConfiguration("Need msvc >= 19.15") + raise ConanInvalidConfiguration("Need MSVC >= 19.15") self._validate_task_system() self._validate_thread_system() @@ -200,7 +207,9 @@ def package(self): def package_id(self): #TODO: is header only but needs a header modified by cmake - self.info.settings.clear() + # self.info.settings.clear() + self.info.header_only() + # self.info.options.with_boost = "ANY" # self.info.options.test = "ANY" From 92e3915667828d1c5f1503914428e7f84268a49f Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 25 Nov 2022 12:17:11 +0100 Subject: [PATCH 52/79] fixes 2 --- recipes/bertrand/all/conanfile.py | 3 +- recipes/stlab/1.7.0_and_above/conanfile.py | 62 ++++++++++++++++++---- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/recipes/bertrand/all/conanfile.py b/recipes/bertrand/all/conanfile.py index 3e410daba2d59..b41ba029c489a 100644 --- a/recipes/bertrand/all/conanfile.py +++ b/recipes/bertrand/all/conanfile.py @@ -5,8 +5,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.52.0" class BertrandConan(ConanFile): name = "bertrand" diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index dad8e1b241f9f..6ea4c4c27fc72 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.scm import Version from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import check_min_vs, is_msvc import os @@ -47,6 +48,14 @@ class Stlab(ConanFile): def _minimum_cpp_standard(self): return 17 + @property + def _compilers_minimum_version(self): + return {"gcc": "9", + "Visual Studio": "15.8", + "clang": "8", + "apple-clang": "13", + } + def layout(self): cmake_layout(self, src_folder="src") @@ -137,21 +146,54 @@ def validate(self): # if self.info.settings.compiler.cppstd: # check_min_cppstd(self, 17) - if self.info.settings.compiler.cppstd: + # if self.info.settings.compiler.cppstd: + # check_min_cppstd(self, self._minimum_cpp_standard) + + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": - raise ConanInvalidConfiguration("Need GCC >= 9") + # if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": + # raise ConanInvalidConfiguration("Need GCC >= 9") + + # if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": + # raise ConanInvalidConfiguration("Need Clang >= 8") + + # if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": + # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + # if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": + # raise ConanInvalidConfiguration("Need MSVC >= 19.15") + + # if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + # raise ConanInvalidConfiguration("Need GCC >= 9") + + # if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": + # raise ConanInvalidConfiguration("Need Clang >= 8") + + # if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": + # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + # if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": + # raise ConanInvalidConfiguration("Need MSVC >= 19.15") - if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": - raise ConanInvalidConfiguration("Need Clang >= 8") - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": - raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + 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] - # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": - raise ConanInvalidConfiguration("Need MSVC >= 19.15") + check_min_vs(self, "192") + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if not minimum_version: + self.output.warn(f"{self.name} {self.version} 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(f"{self.name} {self.version} requires C++20, which your compiler does not support.") + if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): + raise ConanInvalidConfiguration(f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") self._validate_task_system() self._validate_thread_system() From 111a3b37da70d6248e3c497b2f6beef080048993 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 25 Nov 2022 08:20:53 -0300 Subject: [PATCH 53/79] Update recipes/bertrand/all/conanfile.py --- recipes/bertrand/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/bertrand/all/conanfile.py b/recipes/bertrand/all/conanfile.py index b41ba029c489a..3e410daba2d59 100644 --- a/recipes/bertrand/all/conanfile.py +++ b/recipes/bertrand/all/conanfile.py @@ -5,7 +5,8 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.50.0" + class BertrandConan(ConanFile): name = "bertrand" From bdf7347e4f939c2f8260e349b62587751241c1fd Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 25 Nov 2022 15:15:54 +0100 Subject: [PATCH 54/79] fixes 3 --- recipes/stlab/1.7.0_and_above/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py index 6ea4c4c27fc72..eece4d3e7486d 100644 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ b/recipes/stlab/1.7.0_and_above/conanfile.py @@ -250,10 +250,11 @@ def package(self): def package_id(self): #TODO: is header only but needs a header modified by cmake # self.info.settings.clear() - self.info.header_only() + # self.info.header_only() # self.info.options.with_boost = "ANY" # self.info.options.test = "ANY" + pass def package_info(self): future_coroutines_value = 1 if self.options.future_coroutines else 0 From c3dd0ffab3e4b50f0a701c91dcf76a3934bdd522 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Tue, 29 Nov 2022 14:04:34 +0100 Subject: [PATCH 55/79] Trigger notification From c68bf7d8388d041c00f07b1a29b887e3f8306429 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 30 Nov 2022 09:54:16 +0100 Subject: [PATCH 56/79] fix linting --- recipes/stlab/1.7.0_and_above/conandata.yml | 4 - recipes/stlab/1.7.0_and_above/conanfile.py | 270 ------------------ .../test_package/CMakeLists.txt | 10 - .../1.7.0_and_above/test_package/conanfile.py | 22 -- .../test_package/test_package.cpp | 27 -- recipes/stlab/1.7.0_before/conandata.yml | 4 - recipes/stlab/1.7.0_before/conanfile.py | 187 ------------ .../1.7.0_before/test_package/CMakeLists.txt | 8 - .../1.7.0_before/test_package/conanfile.py | 21 -- .../test_package/test_package.cpp | 25 -- recipes/stlab/config.yml | 2 +- 11 files changed, 1 insertion(+), 579 deletions(-) delete mode 100644 recipes/stlab/1.7.0_and_above/conandata.yml delete mode 100644 recipes/stlab/1.7.0_and_above/conanfile.py delete mode 100644 recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt delete mode 100644 recipes/stlab/1.7.0_and_above/test_package/conanfile.py delete mode 100644 recipes/stlab/1.7.0_and_above/test_package/test_package.cpp delete mode 100644 recipes/stlab/1.7.0_before/conandata.yml delete mode 100644 recipes/stlab/1.7.0_before/conanfile.py delete mode 100644 recipes/stlab/1.7.0_before/test_package/CMakeLists.txt delete mode 100644 recipes/stlab/1.7.0_before/test_package/conanfile.py delete mode 100644 recipes/stlab/1.7.0_before/test_package/test_package.cpp diff --git a/recipes/stlab/1.7.0_and_above/conandata.yml b/recipes/stlab/1.7.0_and_above/conandata.yml deleted file mode 100644 index 5b3683503f4d0..0000000000000 --- a/recipes/stlab/1.7.0_and_above/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "1.7.1": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.1.tar.gz" - sha256: "0160b5f7be7d423100a9a8b205a99285b106dd438f806978028a82b9f01c6b64" diff --git a/recipes/stlab/1.7.0_and_above/conanfile.py b/recipes/stlab/1.7.0_and_above/conanfile.py deleted file mode 100644 index eece4d3e7486d..0000000000000 --- a/recipes/stlab/1.7.0_and_above/conanfile.py +++ /dev/null @@ -1,270 +0,0 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import copy, get, rmdir -from conan.tools.scm import Version -from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.microsoft import check_min_vs, is_msvc - -import os - -required_conan_version = ">=1.52.0" - -class Stlab(ConanFile): - name = 'stlab' - description = 'The Software Technology Lab libraries.' - url = 'https://github.com/conan-io/conan-center-index' - homepage = 'https://github.com/stlab/libraries' - license = 'BSL-1.0' - topics = 'concurrency', 'futures', 'channels' - - settings = "arch", "os", "compiler", "build_type", - - options = { - "with_boost": [True, False], - "no_std_coroutines": [True, False], - "future_coroutines": [True, False], - "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], - "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], - - # TODO - # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], - - # "test": [True, False], - } - - default_options = { - "with_boost": False, - "no_std_coroutines": True, #TODO: how to make checks similar to what are made in Cmake https://github.com/stlab/libraries/blob/main/cmake/StlabUtil.cmake#L35 - "future_coroutines": False, - "task_system": "auto", - "thread_system": "auto", - # "test": False, - } - - short_paths = True - - @property - def _minimum_cpp_standard(self): - return 17 - - @property - def _compilers_minimum_version(self): - return {"gcc": "9", - "Visual Studio": "15.8", - "clang": "8", - "apple-clang": "13", - } - - def layout(self): - cmake_layout(self, src_folder="src") - - def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is - # included in the OS. - return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - - def build_requirements(self): - self.build_requires("cmake/3.23.3") - - def requirements(self): - if self.options.with_boost: - self.requires("boost/1.80.0") - - if self._requires_libdispatch(): - self.requires("libdispatch/5.3.2") - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - - def _default_task_system(self): - if self.settings.os == "Macos": - return "libdispatch" - - if self.settings.os == "Windows": - return "windows" - - return "portable" - - def _validate_task_system_libdispatch(self): - if self.settings.os == "Linux": - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}. Use Clang compiler or switch to task_system=portable or task_system=auto") - elif self.settings.os != "Macos": - raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch is not supported on {self.settings.os}. Try using task_system=auto") - - def _validate_task_system(self): - if self.options.task_system == "libdispatch": - self._validate_task_system_libdispatch() - elif self.options.task_system == "windows": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration(f"{self.ref} task_system=windows is not supported on {self.settings.os}. Try using task_system=auto") - - def _default_thread_system(self): - if self.settings.os == "Macos": - return "pthread-apple" - - if self.settings.os == "Linux": - return "pthread" - - if self.settings.os == "Windows": - return "win32" - - if self.settings.os == "Emscripten": - return "pthread-emscripten" - - return "none" - - def _validate_thread_system(self): - if self.options.thread_system == "pthread-apple": - if self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread": - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "win32": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread-emscripten": - if self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - if self.options.with_boost: return - # - # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 - # is not complete. - # - raise ConanInvalidConfiguration(f"Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") - - def validate(self): - # TODO: No cppstd check until this issue is solved - # https://github.com/conan-io/conan/issues/12210 - # if self.info.settings.compiler.cppstd: - # check_min_cppstd(self, 17) - - # if self.info.settings.compiler.cppstd: - # check_min_cppstd(self, self._minimum_cpp_standard) - - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) - - # if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": - # raise ConanInvalidConfiguration("Need GCC >= 9") - - # if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": - # raise ConanInvalidConfiguration("Need Clang >= 8") - - # if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": - # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - # if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": - # raise ConanInvalidConfiguration("Need MSVC >= 19.15") - - # if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": - # raise ConanInvalidConfiguration("Need GCC >= 9") - - # if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": - # raise ConanInvalidConfiguration("Need Clang >= 8") - - # if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": - # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - # if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": - # raise ConanInvalidConfiguration("Need MSVC >= 19.15") - - - 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] - - check_min_vs(self, "192") - if not is_msvc(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn(f"{self.name} {self.version} 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(f"{self.name} {self.version} requires C++20, which your compiler does not support.") - if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): - raise ConanInvalidConfiguration(f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") - - self._validate_task_system() - self._validate_thread_system() - self._validate_boost_components() - - def configure(self): - if self.options.task_system == "auto": - self.options.task_system = self._default_task_system() - - if self.options.thread_system == "auto": - self.options.thread_system = self._default_thread_system() - - self.output.info("STLab With Boost: {}.".format(self.options.with_boost)) - self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) - self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) - self.output.info("STLab Task System: {}.".format(self.options.task_system)) - self.output.info("STLab Thread System: {}.".format(self.options.thread_system)) - - def generate(self): - tc = CMakeToolchain(self) - tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True - - # tc.variables["BUILD_TESTING"] = self.options.test - tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) - - tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost - tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines - tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system - tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system - - # TODO - # # If main_executor == "auto" it will be detected by CMake scripts - # if self.options.main_executor != "auto": - # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor - - tc.generate() - - tc = CMakeDeps(self) - tc.generate() - - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = CMake(self) - cmake.install() - - rmdir(self, os.path.join(self.package_folder, "share")) - - def package_id(self): - #TODO: is header only but needs a header modified by cmake - # self.info.settings.clear() - # self.info.header_only() - - # self.info.options.with_boost = "ANY" - # self.info.options.test = "ANY" - pass - - def package_info(self): - future_coroutines_value = 1 if self.options.future_coroutines else 0 - - self.cpp_info.defines = [ - 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) - ] - - if self.settings.os == "Windows": - self.cpp_info.defines = ['NOMINMAX'] - - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt deleted file mode 100644 index 07f83d9f7660e..0000000000000 --- a/recipes/stlab/1.7.0_and_above/test_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) # if the project uses c++ -find_package(stlab REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_definitions( ${PROJECT_NAME} INTERFACE $<$:NOMINMAX> ) -target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) - diff --git a/recipes/stlab/1.7.0_and_above/test_package/conanfile.py b/recipes/stlab/1.7.0_and_above/test_package/conanfile.py deleted file mode 100644 index 43d09430b77d5..0000000000000 --- a/recipes/stlab/1.7.0_and_above/test_package/conanfile.py +++ /dev/null @@ -1,22 +0,0 @@ -from conan import ConanFile -from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake -import os - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" - - def layout(self): - cmake_layout(self) - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(bin_path, env="conanrun") diff --git a/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp b/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp deleted file mode 100644 index b125ed3c4bd3d..0000000000000 --- a/recipes/stlab/1.7.0_and_above/test_package/test_package.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Async example from https://stlab.cc/libraries/concurrency/ - -#include -#include - -#include -#include - -using namespace std; -using namespace stlab; - -int main() { - auto f = async(default_executor, [] { return 42; }); - - // Waiting just for illustration purpose - while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } - - cout << "The answer is " << *f.get_try() << "\n"; - - stlab::pre_exit(); -} - -/* - Result: - - The answer is 42 -*/ diff --git a/recipes/stlab/1.7.0_before/conandata.yml b/recipes/stlab/1.7.0_before/conandata.yml deleted file mode 100644 index 1dfcc9da738a0..0000000000000 --- a/recipes/stlab/1.7.0_before/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "1.6.2": - url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" - sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" diff --git a/recipes/stlab/1.7.0_before/conanfile.py b/recipes/stlab/1.7.0_before/conanfile.py deleted file mode 100644 index 0a4b45b78ce47..0000000000000 --- a/recipes/stlab/1.7.0_before/conanfile.py +++ /dev/null @@ -1,187 +0,0 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save -from conan.tools.scm import Version -from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -import os - -required_conan_version = ">=1.52.0" - -class Stlab(ConanFile): - name = 'stlab' - description = 'The Software Technology Lab libraries.' - url = 'https://github.com/conan-io/conan-center-index' - homepage = 'https://github.com/stlab/libraries' - license = 'BSL-1.0' - topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' - - settings = "arch", "os", "compiler", "build_type", - - options = { - "boost_optional": [True, False], - "boost_variant": [True, False], - "coroutines": [True, False], - "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], - } - - default_options = { - "boost_optional": False, - "boost_variant": False, - "coroutines": False, - "task_system": "auto", - } - - no_copy_source = True - _source_subfolder = 'source_subfolder' - - # short_paths = True - # def layout(self): - # cmake_layout(self, src_folder="src") - - def _use_boost(self): - return self.options.boost_optional or self.options.boost_variant - - def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is - # included in the OS. - return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - - def requirements(self): - if self._use_boost(): - self.requires("boost/1.75.0") - - if self._requires_libdispatch(): - self.requires("libdispatch/5.3.2") - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - - def _fix_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 is not complete. - # - self.output.info("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead.") - self.options.boost_optional = True - self.options.boost_variant = True - - def _default_task_system(self): - if self.settings.os == "Macos": - return "libdispatch" - - if self.settings.os == "Windows": - return "windows" - - if self.settings.os == "Emscripten": - return "emscripten" - - return "portable" - - def _validate_task_system_libdispatch(self): - if self.settings.os == "Linux": - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) - elif self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_windows(self): - if self.settings.os != "Windows": - self.output.info("Libdispatch is not supported on {}. The task system is changed to {}.".format(self.settings.os, self.options.task_system)) - raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_emscripten(self): - if self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} task_system=emscripten is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system(self): - if self.options.task_system == "libdispatch": - self._validate_task_system_libdispatch() - elif self.options.task_system == "windows": - self._validate_task_system_windows() - elif self.options.task_system == "emscripten": - self._validate_task_system_emscripten() - - def _validate_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - if self.options.boost_optional and self.options.boost_variant: return - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 - # is not complete. - # - msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " - if not self.options.boost_optional and not self.options.boost_variant: - msg += "Try -o boost_optional=True -o boost_variant=True" - elif not self.options.boost_optional: - msg += "Try -o boost_optional=True." - else: - msg += "Try -o boost_variant=True." - - raise ConanInvalidConfiguration(msg) - - def validate(self): - # if self.info.settings.compiler.cppstd: - # check_min_cppstd(self, 17) - - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": - raise ConanInvalidConfiguration("Need GCC >= 9") - - if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": - raise ConanInvalidConfiguration("Need Clang >= 8") - - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": - raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": - raise ConanInvalidConfiguration("Need msvc >= 19.15") - - self._validate_task_system() - self._validate_boost_components() - - def configure(self): - if self.options.task_system == "auto": - self.options.task_system = self._default_task_system() - self.output.info("Stlab Task System: {}.".format(self.options.task_system)) - - def package(self): - self.copy("*LICENSE", dst="licenses", keep_path=False) - self.copy("stlab/*", src=self._source_subfolder, dst='include/') - - def package_id(self): - self.info.clear() - self.info.options.boost_optional = "ANY" - self.info.options.boost_variant = "ANY" - - def package_info(self): - coroutines_value = 1 if self.options.coroutines else 0 - - self.cpp_info.defines = [ - 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) - ] - - if self.options.boost_optional: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_OPTIONAL") - - if self.options.boost_variant: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_VARIANT") - - if self.options.task_system == "portable": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PORTABLE") - elif self.options.task_system == "libdispatch": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_LIBDISPATCH") - elif self.options.task_system == "emscripten": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSRIPTEN") #Note: there is a typo in Stlab Cmake. - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSCRIPTEN") #Note: for typo fix in later versions - elif self.options.task_system == "pnacl": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PNACL") - elif self.options.task_system == "windows": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") - - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt b/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt deleted file mode 100644 index c0142a400f512..0000000000000 --- a/recipes/stlab/1.7.0_before/test_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) # if the project uses c++ -find_package(stlab REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/stlab/1.7.0_before/test_package/conanfile.py b/recipes/stlab/1.7.0_before/test_package/conanfile.py deleted file mode 100644 index d18c63259a98e..0000000000000 --- a/recipes/stlab/1.7.0_before/test_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -from conan import ConanFile -from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake -import os - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" - - def layout(self): - cmake_layout(self) - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(bin_path, env="conanrun") diff --git a/recipes/stlab/1.7.0_before/test_package/test_package.cpp b/recipes/stlab/1.7.0_before/test_package/test_package.cpp deleted file mode 100644 index cbf630bd2f9a3..0000000000000 --- a/recipes/stlab/1.7.0_before/test_package/test_package.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Async example from https://stlab.cc/libraries/concurrency/ - -#include -#include - -#include -#include - -using namespace std; -using namespace stlab; - -int main() { - auto f = async(default_executor, [] { return 42; }); - - // Waiting just for illustration purpose - while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } - - cout << "The answer is " << *f.get_try() << "\n"; -} - -/* - Result: - - The answer is 42 -*/ diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 2b3350a22cdff..4821864cf318a 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,3 +1,3 @@ versions: "1.7.1": - folder: 1.7.0_and_above + folder: all From b08669ee94a13be16a59009a70e2916d972b5ed4 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 30 Nov 2022 09:54:24 +0100 Subject: [PATCH 57/79] fix linting --- recipes/stlab/all/conandata.yml | 4 + recipes/stlab/all/conanfile.py | 270 ++++++++++++++++++ recipes/stlab/all/test_package/CMakeLists.txt | 10 + recipes/stlab/all/test_package/conanfile.py | 22 ++ .../stlab/all/test_package/test_package.cpp | 27 ++ recipes/stlab/old/conandata.yml | 4 + recipes/stlab/old/conanfile.py | 187 ++++++++++++ recipes/stlab/old/test_package/CMakeLists.txt | 8 + recipes/stlab/old/test_package/conanfile.py | 21 ++ .../stlab/old/test_package/test_package.cpp | 25 ++ 10 files changed, 578 insertions(+) create mode 100644 recipes/stlab/all/conandata.yml create mode 100644 recipes/stlab/all/conanfile.py create mode 100644 recipes/stlab/all/test_package/CMakeLists.txt create mode 100644 recipes/stlab/all/test_package/conanfile.py create mode 100644 recipes/stlab/all/test_package/test_package.cpp create mode 100644 recipes/stlab/old/conandata.yml create mode 100644 recipes/stlab/old/conanfile.py create mode 100644 recipes/stlab/old/test_package/CMakeLists.txt create mode 100644 recipes/stlab/old/test_package/conanfile.py create mode 100644 recipes/stlab/old/test_package/test_package.cpp diff --git a/recipes/stlab/all/conandata.yml b/recipes/stlab/all/conandata.yml new file mode 100644 index 0000000000000..5b3683503f4d0 --- /dev/null +++ b/recipes/stlab/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.7.1": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.1.tar.gz" + sha256: "0160b5f7be7d423100a9a8b205a99285b106dd438f806978028a82b9f01c6b64" diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py new file mode 100644 index 0000000000000..eece4d3e7486d --- /dev/null +++ b/recipes/stlab/all/conanfile.py @@ -0,0 +1,270 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import check_min_vs, is_msvc + +import os + +required_conan_version = ">=1.52.0" + +class Stlab(ConanFile): + name = 'stlab' + description = 'The Software Technology Lab libraries.' + url = 'https://github.com/conan-io/conan-center-index' + homepage = 'https://github.com/stlab/libraries' + license = 'BSL-1.0' + topics = 'concurrency', 'futures', 'channels' + + settings = "arch", "os", "compiler", "build_type", + + options = { + "with_boost": [True, False], + "no_std_coroutines": [True, False], + "future_coroutines": [True, False], + "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], + "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], + + # TODO + # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], + + # "test": [True, False], + } + + default_options = { + "with_boost": False, + "no_std_coroutines": True, #TODO: how to make checks similar to what are made in Cmake https://github.com/stlab/libraries/blob/main/cmake/StlabUtil.cmake#L35 + "future_coroutines": False, + "task_system": "auto", + "thread_system": "auto", + # "test": False, + } + + short_paths = True + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return {"gcc": "9", + "Visual Studio": "15.8", + "clang": "8", + "apple-clang": "13", + } + + def layout(self): + cmake_layout(self, src_folder="src") + + def _requires_libdispatch(self): + # On macOS it is not necessary to use the libdispatch conan package, because the library is + # included in the OS. + return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + + def build_requirements(self): + self.build_requires("cmake/3.23.3") + + def requirements(self): + if self.options.with_boost: + self.requires("boost/1.80.0") + + if self._requires_libdispatch(): + self.requires("libdispatch/5.3.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def _default_task_system(self): + if self.settings.os == "Macos": + return "libdispatch" + + if self.settings.os == "Windows": + return "windows" + + return "portable" + + def _validate_task_system_libdispatch(self): + if self.settings.os == "Linux": + if self.settings.compiler != "clang": + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}. Use Clang compiler or switch to task_system=portable or task_system=auto") + elif self.settings.os != "Macos": + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch is not supported on {self.settings.os}. Try using task_system=auto") + + def _validate_task_system(self): + if self.options.task_system == "libdispatch": + self._validate_task_system_libdispatch() + elif self.options.task_system == "windows": + if self.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} task_system=windows is not supported on {self.settings.os}. Try using task_system=auto") + + def _default_thread_system(self): + if self.settings.os == "Macos": + return "pthread-apple" + + if self.settings.os == "Linux": + return "pthread" + + if self.settings.os == "Windows": + return "win32" + + if self.settings.os == "Emscripten": + return "pthread-emscripten" + + return "none" + + def _validate_thread_system(self): + if self.options.thread_system == "pthread-apple": + if self.settings.os != "Macos": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "pthread": + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "win32": + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + elif self.options.thread_system == "pthread-emscripten": + if self.settings.os != "Emscripten": + raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_boost_components(self): + if self.settings.os != "Macos": return + if self.settings.compiler != "apple-clang": return + if Version(self.settings.compiler.version) >= "12": return + if self.options.with_boost: return + # + # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 + # is not complete. + # + raise ConanInvalidConfiguration(f"Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") + + def validate(self): + # TODO: No cppstd check until this issue is solved + # https://github.com/conan-io/conan/issues/12210 + # if self.info.settings.compiler.cppstd: + # check_min_cppstd(self, 17) + + # if self.info.settings.compiler.cppstd: + # check_min_cppstd(self, self._minimum_cpp_standard) + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + + # if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": + # raise ConanInvalidConfiguration("Need GCC >= 9") + + # if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": + # raise ConanInvalidConfiguration("Need Clang >= 8") + + # if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": + # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + # if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": + # raise ConanInvalidConfiguration("Need MSVC >= 19.15") + + # if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + # raise ConanInvalidConfiguration("Need GCC >= 9") + + # if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": + # raise ConanInvalidConfiguration("Need Clang >= 8") + + # if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": + # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + # if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": + # raise ConanInvalidConfiguration("Need MSVC >= 19.15") + + + 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] + + check_min_vs(self, "192") + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if not minimum_version: + self.output.warn(f"{self.name} {self.version} 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(f"{self.name} {self.version} requires C++20, which your compiler does not support.") + if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): + raise ConanInvalidConfiguration(f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") + + self._validate_task_system() + self._validate_thread_system() + self._validate_boost_components() + + def configure(self): + if self.options.task_system == "auto": + self.options.task_system = self._default_task_system() + + if self.options.thread_system == "auto": + self.options.thread_system = self._default_thread_system() + + self.output.info("STLab With Boost: {}.".format(self.options.with_boost)) + self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) + self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) + self.output.info("STLab Task System: {}.".format(self.options.task_system)) + self.output.info("STLab Thread System: {}.".format(self.options.thread_system)) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + + # tc.variables["BUILD_TESTING"] = self.options.test + tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + + tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost + tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines + tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system + tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system + + # TODO + # # If main_executor == "auto" it will be detected by CMake scripts + # if self.options.main_executor != "auto": + # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor + + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_id(self): + #TODO: is header only but needs a header modified by cmake + # self.info.settings.clear() + # self.info.header_only() + + # self.info.options.with_boost = "ANY" + # self.info.options.test = "ANY" + pass + + def package_info(self): + future_coroutines_value = 1 if self.options.future_coroutines else 0 + + self.cpp_info.defines = [ + 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) + ] + + if self.settings.os == "Windows": + self.cpp_info.defines = ['NOMINMAX'] + + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/all/test_package/CMakeLists.txt b/recipes/stlab/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..07f83d9f7660e --- /dev/null +++ b/recipes/stlab/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) # if the project uses c++ +find_package(stlab REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_definitions( ${PROJECT_NAME} INTERFACE $<$:NOMINMAX> ) +target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + diff --git a/recipes/stlab/all/test_package/conanfile.py b/recipes/stlab/all/test_package/conanfile.py new file mode 100644 index 0000000000000..43d09430b77d5 --- /dev/null +++ b/recipes/stlab/all/test_package/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stlab/all/test_package/test_package.cpp b/recipes/stlab/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b125ed3c4bd3d --- /dev/null +++ b/recipes/stlab/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +// Async example from https://stlab.cc/libraries/concurrency/ + +#include +#include + +#include +#include + +using namespace std; +using namespace stlab; + +int main() { + auto f = async(default_executor, [] { return 42; }); + + // Waiting just for illustration purpose + while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } + + cout << "The answer is " << *f.get_try() << "\n"; + + stlab::pre_exit(); +} + +/* + Result: + + The answer is 42 +*/ diff --git a/recipes/stlab/old/conandata.yml b/recipes/stlab/old/conandata.yml new file mode 100644 index 0000000000000..1dfcc9da738a0 --- /dev/null +++ b/recipes/stlab/old/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.6.2": + url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" + sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py new file mode 100644 index 0000000000000..0a4b45b78ce47 --- /dev/null +++ b/recipes/stlab/old/conanfile.py @@ -0,0 +1,187 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.52.0" + +class Stlab(ConanFile): + name = 'stlab' + description = 'The Software Technology Lab libraries.' + url = 'https://github.com/conan-io/conan-center-index' + homepage = 'https://github.com/stlab/libraries' + license = 'BSL-1.0' + topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' + + settings = "arch", "os", "compiler", "build_type", + + options = { + "boost_optional": [True, False], + "boost_variant": [True, False], + "coroutines": [True, False], + "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], + } + + default_options = { + "boost_optional": False, + "boost_variant": False, + "coroutines": False, + "task_system": "auto", + } + + no_copy_source = True + _source_subfolder = 'source_subfolder' + + # short_paths = True + # def layout(self): + # cmake_layout(self, src_folder="src") + + def _use_boost(self): + return self.options.boost_optional or self.options.boost_variant + + def _requires_libdispatch(self): + # On macOS it is not necessary to use the libdispatch conan package, because the library is + # included in the OS. + return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + + def requirements(self): + if self._use_boost(): + self.requires("boost/1.75.0") + + if self._requires_libdispatch(): + self.requires("libdispatch/5.3.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def _fix_boost_components(self): + if self.settings.os != "Macos": return + if self.settings.compiler != "apple-clang": return + if Version(self.settings.compiler.version) >= "12": return + + # + # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 is not complete. + # + self.output.info("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead.") + self.options.boost_optional = True + self.options.boost_variant = True + + def _default_task_system(self): + if self.settings.os == "Macos": + return "libdispatch" + + if self.settings.os == "Windows": + return "windows" + + if self.settings.os == "Emscripten": + return "emscripten" + + return "portable" + + def _validate_task_system_libdispatch(self): + if self.settings.os == "Linux": + if self.settings.compiler != "clang": + raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) + elif self.settings.os != "Macos": + raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_task_system_windows(self): + if self.settings.os != "Windows": + self.output.info("Libdispatch is not supported on {}. The task system is changed to {}.".format(self.settings.os, self.options.task_system)) + raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_task_system_emscripten(self): + if self.settings.os != "Emscripten": + raise ConanInvalidConfiguration("{}/{} task_system=emscripten is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + + def _validate_task_system(self): + if self.options.task_system == "libdispatch": + self._validate_task_system_libdispatch() + elif self.options.task_system == "windows": + self._validate_task_system_windows() + elif self.options.task_system == "emscripten": + self._validate_task_system_emscripten() + + def _validate_boost_components(self): + if self.settings.os != "Macos": return + if self.settings.compiler != "apple-clang": return + if Version(self.settings.compiler.version) >= "12": return + if self.options.boost_optional and self.options.boost_variant: return + # + # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 + # is not complete. + # + msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " + if not self.options.boost_optional and not self.options.boost_variant: + msg += "Try -o boost_optional=True -o boost_variant=True" + elif not self.options.boost_optional: + msg += "Try -o boost_optional=True." + else: + msg += "Try -o boost_variant=True." + + raise ConanInvalidConfiguration(msg) + + def validate(self): + # if self.info.settings.compiler.cppstd: + # check_min_cppstd(self, 17) + + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": + raise ConanInvalidConfiguration("Need GCC >= 9") + + if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": + raise ConanInvalidConfiguration("Need Clang >= 8") + + if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": + raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") + + # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. + if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": + raise ConanInvalidConfiguration("Need msvc >= 19.15") + + self._validate_task_system() + self._validate_boost_components() + + def configure(self): + if self.options.task_system == "auto": + self.options.task_system = self._default_task_system() + self.output.info("Stlab Task System: {}.".format(self.options.task_system)) + + def package(self): + self.copy("*LICENSE", dst="licenses", keep_path=False) + self.copy("stlab/*", src=self._source_subfolder, dst='include/') + + def package_id(self): + self.info.clear() + self.info.options.boost_optional = "ANY" + self.info.options.boost_variant = "ANY" + + def package_info(self): + coroutines_value = 1 if self.options.coroutines else 0 + + self.cpp_info.defines = [ + 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) + ] + + if self.options.boost_optional: + self.cpp_info.defines.append("STLAB_FORCE_BOOST_OPTIONAL") + + if self.options.boost_variant: + self.cpp_info.defines.append("STLAB_FORCE_BOOST_VARIANT") + + if self.options.task_system == "portable": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PORTABLE") + elif self.options.task_system == "libdispatch": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_LIBDISPATCH") + elif self.options.task_system == "emscripten": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSRIPTEN") #Note: there is a typo in Stlab Cmake. + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSCRIPTEN") #Note: for typo fix in later versions + elif self.options.task_system == "pnacl": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PNACL") + elif self.options.task_system == "windows": + self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") + + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/old/test_package/CMakeLists.txt b/recipes/stlab/old/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c0142a400f512 --- /dev/null +++ b/recipes/stlab/old/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) # if the project uses c++ +find_package(stlab REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/stlab/old/test_package/conanfile.py b/recipes/stlab/old/test_package/conanfile.py new file mode 100644 index 0000000000000..d18c63259a98e --- /dev/null +++ b/recipes/stlab/old/test_package/conanfile.py @@ -0,0 +1,21 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stlab/old/test_package/test_package.cpp b/recipes/stlab/old/test_package/test_package.cpp new file mode 100644 index 0000000000000..cbf630bd2f9a3 --- /dev/null +++ b/recipes/stlab/old/test_package/test_package.cpp @@ -0,0 +1,25 @@ +// Async example from https://stlab.cc/libraries/concurrency/ + +#include +#include + +#include +#include + +using namespace std; +using namespace stlab; + +int main() { + auto f = async(default_executor, [] { return 42; }); + + // Waiting just for illustration purpose + while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } + + cout << "The answer is " << *f.get_try() << "\n"; +} + +/* + Result: + + The answer is 42 +*/ From c6ad438be79ae1eded3ce124b71fce554c364962 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 1 Dec 2022 17:58:34 +0100 Subject: [PATCH 58/79] remove dead code --- recipes/stlab/all/conanfile.py | 44 ---------------------------------- 1 file changed, 44 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index eece4d3e7486d..d089b1c05874b 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -26,11 +26,6 @@ class Stlab(ConanFile): "future_coroutines": [True, False], "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], - - # TODO - # "main_executor": ["qt", "libdispatch", "emscripten", "none", "auto"], - - # "test": [True, False], } default_options = { @@ -39,7 +34,6 @@ class Stlab(ConanFile): "future_coroutines": False, "task_system": "auto", "thread_system": "auto", - # "test": False, } short_paths = True @@ -152,33 +146,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - # if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": - # raise ConanInvalidConfiguration("Need GCC >= 9") - - # if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": - # raise ConanInvalidConfiguration("Need Clang >= 8") - - # if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": - # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - # if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": - # raise ConanInvalidConfiguration("Need MSVC >= 19.15") - - # if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": - # raise ConanInvalidConfiguration("Need GCC >= 9") - - # if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": - # raise ConanInvalidConfiguration("Need Clang >= 8") - - # if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": - # raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - # if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": - # raise ConanInvalidConfiguration("Need MSVC >= 19.15") - - def _lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] @@ -215,20 +182,12 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True - - # tc.variables["BUILD_TESTING"] = self.options.test tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) - tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system - # TODO - # # If main_executor == "auto" it will be detected by CMake scripts - # if self.options.main_executor != "auto": - # tc.variables["STLAB_MAIN_EXECUTOR"] = self.options.main_executor - tc.generate() tc = CMakeDeps(self) @@ -251,9 +210,6 @@ def package_id(self): #TODO: is header only but needs a header modified by cmake # self.info.settings.clear() # self.info.header_only() - - # self.info.options.with_boost = "ANY" - # self.info.options.test = "ANY" pass def package_info(self): From e69043b5865fac6de6b74c3bc78af756ad83dd4d Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Fri, 2 Dec 2022 11:13:30 -0300 Subject: [PATCH 59/79] Update recipes/stlab/old/conandata.yml --- recipes/stlab/old/conandata.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/stlab/old/conandata.yml b/recipes/stlab/old/conandata.yml index 1dfcc9da738a0..9f04263559349 100644 --- a/recipes/stlab/old/conandata.yml +++ b/recipes/stlab/old/conandata.yml @@ -2,3 +2,6 @@ sources: "1.6.2": url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" + "1.5.6": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" + sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" From 7bb7d41ea0a7bcc8fb44518dd6efa1f6bea1cd08 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Sat, 10 Dec 2022 18:16:52 -0300 Subject: [PATCH 60/79] Update recipes/stlab/old/conandata.yml Co-authored-by: Chris Mc --- recipes/stlab/old/conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/old/conandata.yml b/recipes/stlab/old/conandata.yml index 9f04263559349..b47a33ab46f33 100644 --- a/recipes/stlab/old/conandata.yml +++ b/recipes/stlab/old/conandata.yml @@ -4,4 +4,4 @@ sources: sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" "1.5.6": url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" - sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" + sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" From fb27191e4081452bfa476f4c5cedd3fce46a8ba5 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Sat, 10 Dec 2022 18:17:15 -0300 Subject: [PATCH 61/79] Update recipes/stlab/old/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/old/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py index 0a4b45b78ce47..5deeeb96a61d8 100644 --- a/recipes/stlab/old/conanfile.py +++ b/recipes/stlab/old/conanfile.py @@ -125,8 +125,8 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration(msg) def validate(self): - # if self.info.settings.compiler.cppstd: - # check_min_cppstd(self, 17) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 17) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") From 20829d05ef9da4339c1a9e806ed2f91e53a71126 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Sat, 10 Dec 2022 22:21:07 +0100 Subject: [PATCH 62/79] remove dead code --- recipes/stlab/all/conanfile.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index d089b1c05874b..6ffdee3e9a1a7 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -135,14 +135,6 @@ def _validate_boost_components(self): raise ConanInvalidConfiguration(f"Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") def validate(self): - # TODO: No cppstd check until this issue is solved - # https://github.com/conan-io/conan/issues/12210 - # if self.info.settings.compiler.cppstd: - # check_min_cppstd(self, 17) - - # if self.info.settings.compiler.cppstd: - # check_min_cppstd(self, self._minimum_cpp_standard) - if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) From f61f261b6c1852d93263795f596231075bc3d849 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 14 Dec 2022 09:34:20 +0100 Subject: [PATCH 63/79] fix linter warnings --- recipes/stlab/old/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py index 5deeeb96a61d8..33f2a3839426f 100644 --- a/recipes/stlab/old/conanfile.py +++ b/recipes/stlab/old/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.files import get from conan.tools.scm import Version from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os required_conan_version = ">=1.52.0" From 27f1840458fd418aacd9c27dc1950451ad4bbe37 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 14 Dec 2022 05:37:05 -0300 Subject: [PATCH 64/79] Update recipes/stlab/all/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 6ffdee3e9a1a7..128e5fe0afd72 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -110,8 +110,7 @@ def _default_thread_system(self): return "none" def _validate_thread_system(self): - if self.options.thread_system == "pthread-apple": - if self.settings.os != "Macos": + if self.options.thread_system == "pthread-apple" and self.settings.os != "Macos": raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) elif self.options.thread_system == "pthread": if self.settings.os != "Linux": From 0eb14addbe1c7ca92ffe674dd1f94a10a86bf87d Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 14 Dec 2022 09:38:10 +0100 Subject: [PATCH 65/79] reduce nesting --- recipes/stlab/all/conanfile.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 128e5fe0afd72..c952a8ace2f0d 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -112,14 +112,11 @@ def _default_thread_system(self): def _validate_thread_system(self): if self.options.thread_system == "pthread-apple" and self.settings.os != "Macos": raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread": - if self.settings.os != "Linux": + elif self.options.thread_system == "pthread" and self.settings.os != "Linux": raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "win32": - if self.settings.os != "Windows": + elif self.options.thread_system == "win32" and self.settings.os != "Windows": raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread-emscripten": - if self.settings.os != "Emscripten": + elif self.options.thread_system == "pthread-emscripten" and self.settings.os != "Emscripten": raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) def _validate_boost_components(self): From c1ca0537a3064d114876dd2dd7b3414a9ad5435e Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 15 Dec 2022 08:01:39 -0300 Subject: [PATCH 66/79] Update recipes/stlab/old/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/old/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py index 33f2a3839426f..3bb58b3e57869 100644 --- a/recipes/stlab/old/conanfile.py +++ b/recipes/stlab/old/conanfile.py @@ -3,7 +3,6 @@ from conan.tools.files import get from conan.tools.scm import Version from conan.tools.build import check_min_cppstd -import os required_conan_version = ">=1.52.0" From d53741e4f898a1293aa81451d7cbee778c88e689 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 15 Dec 2022 08:01:54 -0300 Subject: [PATCH 67/79] Update recipes/stlab/old/conanfile.py Co-authored-by: Chris Mc --- recipes/stlab/old/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py index 3bb58b3e57869..cb16b8773f9ac 100644 --- a/recipes/stlab/old/conanfile.py +++ b/recipes/stlab/old/conanfile.py @@ -124,7 +124,7 @@ def _validate_boost_components(self): def validate(self): if self.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, 17) + check_min_cppstd(self, 17) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Need GCC >= 9") From fc464aef523f6bb058591c2e3441efd420a33d46 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 15 Dec 2022 17:59:03 +0100 Subject: [PATCH 68/79] review suggestions --- recipes/stlab/all/conanfile.py | 6 +++--- recipes/stlab/old/conanfile.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index c952a8ace2f0d..0f33e8a5a77dd 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -169,7 +169,7 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + # tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines @@ -207,8 +207,8 @@ def package_info(self): 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) ] - if self.settings.os == "Windows": - self.cpp_info.defines = ['NOMINMAX'] + # if self.settings.os == "Windows": + # self.cpp_info.defines = ['NOMINMAX'] if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py index cb16b8773f9ac..b5bd37acecd2b 100644 --- a/recipes/stlab/old/conanfile.py +++ b/recipes/stlab/old/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.files import get from conan.tools.scm import Version from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout required_conan_version = ">=1.52.0" @@ -33,9 +34,9 @@ class Stlab(ConanFile): no_copy_source = True _source_subfolder = 'source_subfolder' - # short_paths = True - # def layout(self): - # cmake_layout(self, src_folder="src") + def layout(self): + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") def _use_boost(self): return self.options.boost_optional or self.options.boost_variant From 2badd604902055c9e63fd4479d97ba9b6759e451 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 15 Dec 2022 18:32:03 +0100 Subject: [PATCH 69/79] set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP --- recipes/stlab/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 0f33e8a5a77dd..33bbc75b659e6 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -169,7 +169,7 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) - # tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines From 9e7af4a2daee11bd0d95f91f71098acba9a0a866 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 15 Dec 2022 22:44:19 +0100 Subject: [PATCH 70/79] test things --- recipes/stlab/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 33bbc75b659e6..e372373c34774 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -169,7 +169,7 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + # tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines @@ -207,8 +207,8 @@ def package_info(self): 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) ] - # if self.settings.os == "Windows": - # self.cpp_info.defines = ['NOMINMAX'] + if self.settings.os == "Windows": + self.cpp_info.defines = ['NOMINMAX'] if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] From d877434054615999b5154b779f353947ca2a05dc Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 4 Jan 2023 16:04:03 +0100 Subject: [PATCH 71/79] remove Windows runtime libs --- recipes/stlab/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index e372373c34774..6aa8169bc297f 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import copy, get, rmdir +from conan.tools.files import copy, get, rm, rmdir from conan.tools.scm import Version from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout @@ -193,6 +193,9 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "msvcp*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "concrt*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "vcruntime*.dll", os.path.join(self.package_folder, "bin")) def package_id(self): #TODO: is header only but needs a header modified by cmake From 92bfa4e3b9de0104048976b2e7c3c4b1bd707a5a Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Wed, 29 Mar 2023 06:38:03 -0300 Subject: [PATCH 72/79] Update conanfile.py --- recipes/stlab/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 6aa8169bc297f..dfd505e0a06ae 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -30,7 +30,7 @@ class Stlab(ConanFile): default_options = { "with_boost": False, - "no_std_coroutines": True, #TODO: how to make checks similar to what are made in Cmake https://github.com/stlab/libraries/blob/main/cmake/StlabUtil.cmake#L35 + "no_std_coroutines": True, "future_coroutines": False, "task_system": "auto", "thread_system": "auto", From ec898c07f67b0574c6cd3a05e1afcdf73b81093c Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Thu, 22 Jun 2023 12:38:59 +0200 Subject: [PATCH 73/79] Refactoring and fixing errors --- recipes/stlab/all/conanfile.py | 158 +++++++----------- recipes/stlab/all/test_package/CMakeLists.txt | 2 +- recipes/stlab/all/test_package/conanfile.py | 6 +- 3 files changed, 64 insertions(+), 102 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index dfd505e0a06ae..6529186cef86e 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -1,15 +1,16 @@ +import os + from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import copy, get, rm, rmdir -from conan.tools.scm import Version from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir from conan.tools.microsoft import check_min_vs, is_msvc - -import os +from conan.tools.scm import Version required_conan_version = ">=1.52.0" + class Stlab(ConanFile): name = 'stlab' description = 'The Software Technology Lab libraries.' @@ -17,27 +18,32 @@ class Stlab(ConanFile): homepage = 'https://github.com/stlab/libraries' license = 'BSL-1.0' topics = 'concurrency', 'futures', 'channels' - settings = "arch", "os", "compiler", "build_type", - options = { "with_boost": [True, False], "no_std_coroutines": [True, False], "future_coroutines": [True, False], - "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], - "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none", "auto"], + "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows"], + "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none"], } - default_options = { "with_boost": False, "no_std_coroutines": True, - "future_coroutines": False, - "task_system": "auto", - "thread_system": "auto", + "future_coroutines": False + # Handle default value for `thread_system` in `config_options` method + # Handle default value for `task_system` in `config_options` method } - + package_type = "header-library" short_paths = True + def config_options(self): + self.options.thread_system = {"Macos": "pthread-apple", + "Linux": "pthread", + "Windows": "win32", + "Emscripten": "pthread-emscripten"}.get(str(self.settings.os), "none") + self.options.task_system = {"Macos": "libdispatch", + "Windows": "windows"}.get(str(self.settings.os), "portable") + @property def _minimum_cpp_standard(self): return 17 @@ -45,122 +51,77 @@ def _minimum_cpp_standard(self): @property def _compilers_minimum_version(self): return {"gcc": "9", - "Visual Studio": "15.8", "clang": "8", - "apple-clang": "13", - } + "apple-clang": "13"} def layout(self): cmake_layout(self, src_folder="src") - def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is - # included in the OS. - return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - def build_requirements(self): - self.build_requires("cmake/3.23.3") + self.tool_requires("cmake/[>=3.23.3]") def requirements(self): if self.options.with_boost: self.requires("boost/1.80.0") - if self._requires_libdispatch(): + # On macOS, it is not necessary to use the libdispatch conan package, because the library is + # included in the OS. + if self.options.task_system == "libdispatch" and self.settings.os != "Macos": self.requires("libdispatch/5.3.2") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _default_task_system(self): - if self.settings.os == "Macos": - return "libdispatch" - - if self.settings.os == "Windows": - return "windows" - - return "portable" - - def _validate_task_system_libdispatch(self): - if self.settings.os == "Linux": - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}. Use Clang compiler or switch to task_system=portable or task_system=auto") - elif self.settings.os != "Macos": - raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch is not supported on {self.settings.os}. Try using task_system=auto") - def _validate_task_system(self): if self.options.task_system == "libdispatch": - self._validate_task_system_libdispatch() - elif self.options.task_system == "windows": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration(f"{self.ref} task_system=windows is not supported on {self.settings.os}. Try using task_system=auto") - - def _default_thread_system(self): - if self.settings.os == "Macos": - return "pthread-apple" - - if self.settings.os == "Linux": - return "pthread" - - if self.settings.os == "Windows": - return "win32" - - if self.settings.os == "Emscripten": - return "pthread-emscripten" - - return "none" + if self.settings.os == "Linux" and self.settings.compiler != "clang": + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}." + f" Use Clang compiler or switch to task_system=portable") + elif self.settings.os != "Macos": + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch is not supported on {self.settings.os}") + elif self.options.task_system == "windows" and self.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} task_system=windows is not supported on {self.settings.os}") def _validate_thread_system(self): - if self.options.thread_system == "pthread-apple" and self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread-apple is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread" and self.settings.os != "Linux": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "win32" and self.settings.os != "Windows": - raise ConanInvalidConfiguration("{}/{} thread_system=win32 is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) - elif self.options.thread_system == "pthread-emscripten" and self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} thread_system=pthread-emscripten is not supported on {}. Try using thread_system=auto".format(self.name, self.version, self.settings.os)) + if any([self.options.thread_system == "pthread-apple" and self.settings.os != "Macos", + self.options.thread_system == "pthread" and self.settings.os != "Linux", + self.options.thread_system == "win32" and self.settings.os != "Windows", + self.options.thread_system == "pthread-emscripten" and self.settings.os != "Emscripten"]): + raise ConanInvalidConfiguration(f"{self.ref} thread_system={self.options.thread_system} is not supported on {self.settings.os}") def _validate_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - if self.options.with_boost: return - # - # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 - # is not complete. - # - raise ConanInvalidConfiguration(f"Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) - - 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] - - check_min_vs(self, "192") - if not is_msvc(self): + if not any([self.settings.os != "Macos", self.settings.compiler != "apple-clang", + Version(str(self.settings.compiler.version)) >= "12", self.options.with_boost]): + # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 + # is not complete. + raise ConanInvalidConfiguration( + f"Compiler Apple-Clang < 12 versions do not correctly support std::optional or std::variant, " + f"so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") + + def _validate_min_compiler_version(self): + if is_msvc(self): + check_min_vs(self, "192") + else: minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn(f"{self.name} {self.version} requires C++20. Your compiler is unknown. Assuming it supports C++20.") - elif _lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + elif Version(str(self.settings.compiler.version)) < minimum_version: raise ConanInvalidConfiguration(f"{self.name} {self.version} requires C++20, which your compiler does not support.") if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): - raise ConanInvalidConfiguration(f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") + raise ConanInvalidConfiguration( + f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters " + f"in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + + self._validate_min_compiler_version() self._validate_task_system() self._validate_thread_system() self._validate_boost_components() def configure(self): - if self.options.task_system == "auto": - self.options.task_system = self._default_task_system() - - if self.options.thread_system == "auto": - self.options.thread_system = self._default_thread_system() - self.output.info("STLab With Boost: {}.".format(self.options.with_boost)) self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) @@ -169,19 +130,16 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) - # tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system - tc.generate() tc = CMakeDeps(self) tc.generate() - def build(self): cmake = CMake(self) cmake.configure() @@ -198,7 +156,7 @@ def package(self): rm(self, "vcruntime*.dll", os.path.join(self.package_folder, "bin")) def package_id(self): - #TODO: is header only but needs a header modified by cmake + # TODO: is header only but needs a header modified by cmake # self.info.settings.clear() # self.info.header_only() pass diff --git a/recipes/stlab/all/test_package/CMakeLists.txt b/recipes/stlab/all/test_package/CMakeLists.txt index 07f83d9f7660e..b52ae3503ebad 100644 --- a/recipes/stlab/all/test_package/CMakeLists.txt +++ b/recipes/stlab/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) # if the project uses c++ find_package(stlab REQUIRED CONFIG) diff --git a/recipes/stlab/all/test_package/conanfile.py b/recipes/stlab/all/test_package/conanfile.py index 43d09430b77d5..ab351a264621f 100644 --- a/recipes/stlab/all/test_package/conanfile.py +++ b/recipes/stlab/all/test_package/conanfile.py @@ -1,13 +1,17 @@ +import os + from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import cmake_layout, CMake -import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + def requirements(self): + self.requires(self.tested_reference_str) + def layout(self): cmake_layout(self) From 729f173d9c2bd2d3fd15e0f73156e87826e940d1 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Thu, 22 Jun 2023 12:40:44 +0200 Subject: [PATCH 74/79] putting self.ref instead of self.name --- recipes/stlab/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 6529186cef86e..ff8008972aecc 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -96,7 +96,7 @@ def _validate_boost_components(self): # is not complete. raise ConanInvalidConfiguration( f"Compiler Apple-Clang < 12 versions do not correctly support std::optional or std::variant, " - f"so we will use boost::optional and boost::variant instead. Try -o {self.name}:with_boost=True.") + f"so we will use boost::optional and boost::variant instead. Try -o {self.ref}:with_boost=True.") def _validate_min_compiler_version(self): if is_msvc(self): @@ -104,9 +104,9 @@ def _validate_min_compiler_version(self): else: minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: - self.output.warn(f"{self.name} {self.version} requires C++20. Your compiler is unknown. Assuming it supports C++20.") + self.output.warn(f"{self.ref} requires C++20. Your compiler is unknown. Assuming it supports C++20.") elif Version(str(self.settings.compiler.version)) < minimum_version: - raise ConanInvalidConfiguration(f"{self.name} {self.version} requires C++20, which your compiler does not support.") + raise ConanInvalidConfiguration(f"{self.ref} requires C++20, which your compiler does not support.") if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): raise ConanInvalidConfiguration( f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters " From 0796e5ec331cb16667ad89c950d97f039679a811 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Thu, 22 Jun 2023 12:44:08 +0200 Subject: [PATCH 75/79] suggestions --- recipes/stlab/all/conanfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index ff8008972aecc..c2d7cd816d9af 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -104,12 +104,14 @@ def _validate_min_compiler_version(self): else: minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: - self.output.warn(f"{self.ref} requires C++20. Your compiler is unknown. Assuming it supports C++20.") + self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. " + f"Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}.") elif Version(str(self.settings.compiler.version)) < minimum_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++20, which your compiler does not support.") - if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, " + f"which your compiler does not support.") + if self.settings.compiler == "clang" and str(self.settings.compiler.version) in ("13", "14"): raise ConanInvalidConfiguration( - f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters " + f"{self.ref} currently does not work with Clang {self.settings.compiler.version} on CCI, it enters " f"in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") def validate(self): From 1026f6785434b9df4cbece0e4a56ca0bc71833d7 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Thu, 22 Jun 2023 16:03:23 +0200 Subject: [PATCH 76/79] Removed old versions --- recipes/stlab/old/conandata.yml | 7 - recipes/stlab/old/conanfile.py | 186 ------------------ recipes/stlab/old/test_package/CMakeLists.txt | 8 - recipes/stlab/old/test_package/conanfile.py | 21 -- .../stlab/old/test_package/test_package.cpp | 25 --- 5 files changed, 247 deletions(-) delete mode 100644 recipes/stlab/old/conandata.yml delete mode 100644 recipes/stlab/old/conanfile.py delete mode 100644 recipes/stlab/old/test_package/CMakeLists.txt delete mode 100644 recipes/stlab/old/test_package/conanfile.py delete mode 100644 recipes/stlab/old/test_package/test_package.cpp diff --git a/recipes/stlab/old/conandata.yml b/recipes/stlab/old/conandata.yml deleted file mode 100644 index b47a33ab46f33..0000000000000 --- a/recipes/stlab/old/conandata.yml +++ /dev/null @@ -1,7 +0,0 @@ -sources: - "1.6.2": - url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" - sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" - "1.5.6": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" - sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" diff --git a/recipes/stlab/old/conanfile.py b/recipes/stlab/old/conanfile.py deleted file mode 100644 index b5bd37acecd2b..0000000000000 --- a/recipes/stlab/old/conanfile.py +++ /dev/null @@ -1,186 +0,0 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get -from conan.tools.scm import Version -from conan.tools.build import check_min_cppstd -from conan.tools.layout import basic_layout - -required_conan_version = ">=1.52.0" - -class Stlab(ConanFile): - name = 'stlab' - description = 'The Software Technology Lab libraries.' - url = 'https://github.com/conan-io/conan-center-index' - homepage = 'https://github.com/stlab/libraries' - license = 'BSL-1.0' - topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' - - settings = "arch", "os", "compiler", "build_type", - - options = { - "boost_optional": [True, False], - "boost_variant": [True, False], - "coroutines": [True, False], - "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], - } - - default_options = { - "boost_optional": False, - "boost_variant": False, - "coroutines": False, - "task_system": "auto", - } - - no_copy_source = True - _source_subfolder = 'source_subfolder' - - def layout(self): - # src_folder must use the same source folder name the project - basic_layout(self, src_folder="src") - - def _use_boost(self): - return self.options.boost_optional or self.options.boost_variant - - def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is - # included in the OS. - return self.options.task_system == "libdispatch" and self.settings.os != "Macos" - - def requirements(self): - if self._use_boost(): - self.requires("boost/1.75.0") - - if self._requires_libdispatch(): - self.requires("libdispatch/5.3.2") - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - - def _fix_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 is not complete. - # - self.output.info("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead.") - self.options.boost_optional = True - self.options.boost_variant = True - - def _default_task_system(self): - if self.settings.os == "Macos": - return "libdispatch" - - if self.settings.os == "Windows": - return "windows" - - if self.settings.os == "Emscripten": - return "emscripten" - - return "portable" - - def _validate_task_system_libdispatch(self): - if self.settings.os == "Linux": - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) - elif self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_windows(self): - if self.settings.os != "Windows": - self.output.info("Libdispatch is not supported on {}. The task system is changed to {}.".format(self.settings.os, self.options.task_system)) - raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_emscripten(self): - if self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} task_system=emscripten is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system(self): - if self.options.task_system == "libdispatch": - self._validate_task_system_libdispatch() - elif self.options.task_system == "windows": - self._validate_task_system_windows() - elif self.options.task_system == "emscripten": - self._validate_task_system_emscripten() - - def _validate_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - if self.options.boost_optional and self.options.boost_variant: return - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 - # is not complete. - # - msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " - if not self.options.boost_optional and not self.options.boost_variant: - msg += "Try -o boost_optional=True -o boost_variant=True" - elif not self.options.boost_optional: - msg += "Try -o boost_optional=True." - else: - msg += "Try -o boost_variant=True." - - raise ConanInvalidConfiguration(msg) - - def validate(self): - if self.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, 17) - - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "9": - raise ConanInvalidConfiguration("Need GCC >= 9") - - if self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) < "8": - raise ConanInvalidConfiguration("Need Clang >= 8") - - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "15.8": - raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) < "19.15": - raise ConanInvalidConfiguration("Need msvc >= 19.15") - - self._validate_task_system() - self._validate_boost_components() - - def configure(self): - if self.options.task_system == "auto": - self.options.task_system = self._default_task_system() - self.output.info("Stlab Task System: {}.".format(self.options.task_system)) - - def package(self): - self.copy("*LICENSE", dst="licenses", keep_path=False) - self.copy("stlab/*", src=self._source_subfolder, dst='include/') - - def package_id(self): - self.info.clear() - self.info.options.boost_optional = "ANY" - self.info.options.boost_variant = "ANY" - - def package_info(self): - coroutines_value = 1 if self.options.coroutines else 0 - - self.cpp_info.defines = [ - 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) - ] - - if self.options.boost_optional: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_OPTIONAL") - - if self.options.boost_variant: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_VARIANT") - - if self.options.task_system == "portable": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PORTABLE") - elif self.options.task_system == "libdispatch": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_LIBDISPATCH") - elif self.options.task_system == "emscripten": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSRIPTEN") #Note: there is a typo in Stlab Cmake. - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSCRIPTEN") #Note: for typo fix in later versions - elif self.options.task_system == "pnacl": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PNACL") - elif self.options.task_system == "windows": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") - - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/old/test_package/CMakeLists.txt b/recipes/stlab/old/test_package/CMakeLists.txt deleted file mode 100644 index c0142a400f512..0000000000000 --- a/recipes/stlab/old/test_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) # if the project uses c++ -find_package(stlab REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/stlab/old/test_package/conanfile.py b/recipes/stlab/old/test_package/conanfile.py deleted file mode 100644 index d18c63259a98e..0000000000000 --- a/recipes/stlab/old/test_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -from conan import ConanFile -from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake -import os - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" - - def layout(self): - cmake_layout(self) - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(bin_path, env="conanrun") diff --git a/recipes/stlab/old/test_package/test_package.cpp b/recipes/stlab/old/test_package/test_package.cpp deleted file mode 100644 index cbf630bd2f9a3..0000000000000 --- a/recipes/stlab/old/test_package/test_package.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Async example from https://stlab.cc/libraries/concurrency/ - -#include -#include - -#include -#include - -using namespace std; -using namespace stlab; - -int main() { - auto f = async(default_executor, [] { return 42; }); - - // Waiting just for illustration purpose - while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } - - cout << "The answer is " << *f.get_try() << "\n"; -} - -/* - Result: - - The answer is 42 -*/ From 6e3d4f767ba4f1d676f686ed1c3124045c114d79 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Fri, 23 Jun 2023 15:29:24 +0200 Subject: [PATCH 77/79] Added new CMake var --- recipes/stlab/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index c2d7cd816d9af..00ddb26cc1869 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -2,7 +2,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, cross_building from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rm, rmdir from conan.tools.microsoft import check_min_vs, is_msvc @@ -137,6 +137,8 @@ def generate(self): tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system + if cross_building(self): + tc.variables["STLAB_HAVE_FUNCTIONAL_VARIANT_OPTIONAL"] = True tc.generate() tc = CMakeDeps(self) From ff737fe12c8ca18594e05d910ee5167f283e75c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Mon, 26 Jun 2023 12:54:20 +0200 Subject: [PATCH 78/79] Update recipes/stlab/all/conanfile.py --- recipes/stlab/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 00ddb26cc1869..5b13825f2a105 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -62,7 +62,7 @@ def build_requirements(self): def requirements(self): if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") # On macOS, it is not necessary to use the libdispatch conan package, because the library is # included in the OS. From 58ba8594b21e44dd4478102dc6453d2288467f48 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Mon, 26 Jun 2023 08:15:17 -0300 Subject: [PATCH 79/79] Update conanfile.py --- recipes/stlab/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index 5b13825f2a105..b78d535f7ef8e 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -62,7 +62,7 @@ def build_requirements(self): def requirements(self): if self.options.with_boost: - self.requires("boost/1.81.0") + self.requires("boost/1.82.0") # On macOS, it is not necessary to use the libdispatch conan package, because the library is # included in the OS.