From e708b3841fcb906ecec16ab027b7895e9e95cc26 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 19 May 2022 00:30:32 +0900 Subject: [PATCH 01/11] drogon: add recipe --- recipes/drogon/all/CMakeLists.txt | 7 + recipes/drogon/all/conandata.yml | 8 ++ recipes/drogon/all/conanfile.py | 135 ++++++++++++++++++ .../all/patches/1.7.5-disable_tron.patch | 30 ++++ .../drogon/all/test_package/CMakeLists.txt | 11 ++ recipes/drogon/all/test_package/conanfile.py | 15 ++ .../drogon/all/test_package/test_package.cpp | 14 ++ recipes/drogon/config.yml | 3 + 8 files changed, 223 insertions(+) create mode 100644 recipes/drogon/all/CMakeLists.txt create mode 100644 recipes/drogon/all/conandata.yml create mode 100644 recipes/drogon/all/conanfile.py create mode 100644 recipes/drogon/all/patches/1.7.5-disable_tron.patch create mode 100644 recipes/drogon/all/test_package/CMakeLists.txt create mode 100644 recipes/drogon/all/test_package/conanfile.py create mode 100644 recipes/drogon/all/test_package/test_package.cpp create mode 100644 recipes/drogon/config.yml diff --git a/recipes/drogon/all/CMakeLists.txt b/recipes/drogon/all/CMakeLists.txt new file mode 100644 index 0000000000000..794cf44408165 --- /dev/null +++ b/recipes/drogon/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(conan_wrapper C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(KEEP_RPATHS) + +add_subdirectory("source_subfolder") diff --git a/recipes/drogon/all/conandata.yml b/recipes/drogon/all/conandata.yml new file mode 100644 index 0000000000000..4b13550276b61 --- /dev/null +++ b/recipes/drogon/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "1.7.5": + url: "https://github.com/drogonframework/drogon/archive/refs/tags/v1.7.5.tar.gz" + sha256: "e2af7c55dcabafef16f26f5b3242692f5a2b54c19b7b626840bf9132d24766f6" +patches: + "1.7.5": + - base_path: "source_subfolder" + patch_file: "patches/1.7.5-disable_tron.patch" diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py new file mode 100644 index 0000000000000..aa5c7360b8b64 --- /dev/null +++ b/recipes/drogon/all/conanfile.py @@ -0,0 +1,135 @@ +from conans import ConanFile, CMake, tools +import os +import functools + +required_conan_version = ">=1.43.0" + +class DrogonConan(ConanFile): + name = "drogon" + description = "A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows" + topics = ("http-server", "non-blocking-io", "http-framework", "asynchronous-programming") + license = "MIT" + homepage = "https://github.com/drogonframework/drogon" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + options = { + "shared": [False, True], + "fPIC": [True, False], + "with_ctl": [True, False], + "with_orm": [True, False], + "with_profile": [True, False], + "with_brotli": [True, False], + "with_postgres": [True, False], + "with_postgres_batch": [True, False], + "with_mysql": [True, False], + "with_sqlite": [True, False], + "with_redis": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ctl": False, + "with_orm": True, + "with_profile": False, + "with_brotli": False, + "with_postgres": False, + "with_postgres_batch": False, + "with_mysql": False, + "with_sqlite": False, + "with_redis": False, + } + + @property + def _source_subfolder(self): + return "source_subfolder" + + def export_sources(self): + self.copy("CMakeLists.txt") + for patch in self.conan_data.get("patches", {}).get(self.version, []): + self.copy(patch["patch_file"]) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if not self.options.with_orm: + del self.options.with_postgres + del self.options.with_postgres_batch + del self.options.with_mysql + del self.options.with_sqlite + del self.options.with_redis + elif not self.options.with_postgres: + del self.options.with_postgres_batch + + def configure(self): + if self.options.shared: + del self.options.fPIC + self.options["trantor"].shared = True + + def requirements(self): + self.requires("trantor/1.5.5") + self.requires("jsoncpp/1.9.5") + self.requires("openssl/1.1.1o") + self.requires("zlib/1.2.12") + if self.settings.os == "Linux": + self.requires("libuuid/1.0.3") + if self.options.with_profile: + self.requires("coz/cci.20210322") + if self.options.with_brotli: + self.requires("brotli/1.0.9") + if self.options.with_postgres: + self.requires("libpq/14.2") + if self.options.with_mysql: + self.requires("libmysqlclient/8.0.25") + if self.options.with_sqlite: + self.requires("sqlite3/3.38.5") + if self.options.with_redis: + self.requires("hiredis/1.0.2") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + + @functools.lru_cache(1) + def _configure_cmake(self): + cmake = CMake(self) + cmake.definitions["BUILD_CTL"] = self.options.with_ctl + cmake.definitions["BUILD_EXAMPLES"] = False + cmake.definitions["BUILD_ORM"] = self.options.with_orm + cmake.definitions["COZ_PROFILING"] = self.options.with_profile + cmake.definitions["BUILD_DROGON_SHARED"] = self.options.shared + cmake.definitions["BUILD_DOC"] = False + cmake.definitions["BUILD_BROTLI"] = self.options.with_brotli + cmake.definitions["BUILD_POSTGRESQL"] = self.options.get_safe("with_postgres", False) + cmake.definitions["BUILD_POSTGRESQL_BATCH"] = self.options.get_safe("with_postgres_batch", False) + cmake.definitions["BUILD_MYSQL"] = self.options.get_safe("with_mysql", False) + cmake.definitions["BUILD_SQLITE"] = self.options.get_safe("with_sqlite", False) + cmake.definitions["BUILD_REDIS"] = self.options.get_safe("with_redis", False) + cmake.configure() + return cmake + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", "licenses", self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["drogon"] + if self.options.with_ctl: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.env_info.PATH.append(bin_path) + + self.cpp_info.set_property("cmake_file_name", "Drogon") + self.cpp_info.set_property("cmake_target_name", "Drogon::Drogon") + + self.cpp_info.filenames["cmake_find_package"] = "Drogon" + self.cpp_info.filenames["cmake_find_package_multi"] = "Drogon" + self.cpp_info.names["cmake_find_package"] = "Drogon" + self.cpp_info.names["cmake_find_package_multi"] = "Drogon" diff --git a/recipes/drogon/all/patches/1.7.5-disable_tron.patch b/recipes/drogon/all/patches/1.7.5-disable_tron.patch new file mode 100644 index 0000000000000..86be3acbf1705 --- /dev/null +++ b/recipes/drogon/all/patches/1.7.5-disable_tron.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 85e8ee7..a3117ca 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,7 +52,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + endif () + + if (BUILD_DROGON_SHARED) +- set(BUILD_TRANTOR_SHARED TRUE) + set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + find_package(Threads) + # set(BUILD_EXAMPLES FALSE) +@@ -110,7 +109,6 @@ target_include_directories( + $ + $ + $ +- $ + $ + $) + +@@ -120,9 +118,6 @@ if (WIN32) + PRIVATE $) + endif (WIN32) + +-add_subdirectory(trantor) +- +-target_link_libraries(${PROJECT_NAME} PUBLIC trantor) + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") + target_link_libraries(${PROJECT_NAME} PRIVATE network) diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..12198c7ad1270 --- /dev/null +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Drogon CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} Drogon::Drogon) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/drogon/all/test_package/conanfile.py b/recipes/drogon/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e0660e0801b96 --- /dev/null +++ b/recipes/drogon/all/test_package/conanfile.py @@ -0,0 +1,15 @@ +import os +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type", + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/drogon/all/test_package/test_package.cpp b/recipes/drogon/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4676e2ff59d38 --- /dev/null +++ b/recipes/drogon/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include "drogon/drogon.h" + +int main() { + trantor::Logger::setLogLevel(trantor::Logger::kTrace); + + auto client = drogon::HttpClient::newHttpClient("http://www.example.com"); + auto req = drogon::HttpRequest::newHttpRequest(); + req->setMethod(drogon::Get); + req->setPath("/s"); + req->setParameter("wd", "wx"); + req->setParameter("oq", "wx"); + + return 0; +} diff --git a/recipes/drogon/config.yml b/recipes/drogon/config.yml new file mode 100644 index 0000000000000..6793cfc73710a --- /dev/null +++ b/recipes/drogon/config.yml @@ -0,0 +1,3 @@ +versions: + "1.7.5": + folder: "all" From 47e2e781767e37d9cdab431809ebeab468699add Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 19 May 2022 00:31:56 +0900 Subject: [PATCH 02/11] fix LANGUAGE --- recipes/drogon/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/drogon/all/CMakeLists.txt b/recipes/drogon/all/CMakeLists.txt index 794cf44408165..1480db2f856ab 100644 --- a/recipes/drogon/all/CMakeLists.txt +++ b/recipes/drogon/all/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(conan_wrapper C) +project(conan_wrapper CXX) include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") conan_basic_setup(KEEP_RPATHS) From 5fc43b6fc7bb199b24cfb8fb975be975de699c0d Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 19 May 2022 01:19:23 +0900 Subject: [PATCH 03/11] add boost --- recipes/drogon/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index aa5c7360b8b64..dfa9e5a64c210 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -68,6 +68,7 @@ def configure(self): def requirements(self): self.requires("trantor/1.5.5") + self.requires("boost/1.79.0") self.requires("jsoncpp/1.9.5") self.requires("openssl/1.1.1o") self.requires("zlib/1.2.12") From 0d7e32803d66232074eb04b4151a3b1bac8d3d7c Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 19 May 2022 03:22:34 +0900 Subject: [PATCH 04/11] fix boost component check failed --- recipes/drogon/all/conandata.yml | 4 +++- recipes/drogon/all/conanfile.py | 17 ++++++++++++++++- ...n.patch => 1.7.5-0001-disable_trantor.patch} | 0 .../1.7.5-0002-remove-boost-components.patch | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) rename recipes/drogon/all/patches/{1.7.5-disable_tron.patch => 1.7.5-0001-disable_trantor.patch} (100%) create mode 100644 recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch diff --git a/recipes/drogon/all/conandata.yml b/recipes/drogon/all/conandata.yml index 4b13550276b61..b786da34b9524 100644 --- a/recipes/drogon/all/conandata.yml +++ b/recipes/drogon/all/conandata.yml @@ -5,4 +5,6 @@ sources: patches: "1.7.5": - base_path: "source_subfolder" - patch_file: "patches/1.7.5-disable_tron.patch" + patch_file: "patches/1.7.5-0001-disable_trantor.patch" + - base_path: "source_subfolder" + patch_file: "patches/1.7.5-0002-remove-boost-components.patch" diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index dfa9e5a64c210..084d597aaf7f6 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -25,6 +25,7 @@ class DrogonConan(ConanFile): "with_mysql": [True, False], "with_sqlite": [True, False], "with_redis": [True, False], + "with_boost": [True, False], } default_options = { "shared": False, @@ -38,6 +39,8 @@ class DrogonConan(ConanFile): "with_mysql": False, "with_sqlite": False, "with_redis": False, + # with_boost=False is accepted when compiler is C++17 with filesystem or C++20 above. + "with_boost": True, } @property @@ -66,9 +69,18 @@ def configure(self): del self.options.fPIC self.options["trantor"].shared = True + if self.options.with_boost: + self.options["boost"].without_filesystem = False + self.options["boost"].without_system = False + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, "14") + def requirements(self): self.requires("trantor/1.5.5") - self.requires("boost/1.79.0") + if self.options.with_boost: + self.requires("boost/1.79.0") self.requires("jsoncpp/1.9.5") self.requires("openssl/1.1.1o") self.requires("zlib/1.2.12") @@ -122,6 +134,9 @@ def package(self): def package_info(self): self.cpp_info.libs = ["drogon"] + if self.options.shared and self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["rpcrt4", "ws2_32", "crypt32", "advapi32"]) + if self.options.with_ctl: bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) diff --git a/recipes/drogon/all/patches/1.7.5-disable_tron.patch b/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch similarity index 100% rename from recipes/drogon/all/patches/1.7.5-disable_tron.patch rename to recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch diff --git a/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch b/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch new file mode 100644 index 0000000000000..93d7bd4197f59 --- /dev/null +++ b/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0644d2a..b95bc9d 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -176,7 +176,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") + endif () + + if(NEED_BOOST_FS) +- find_package(Boost 1.49.0 COMPONENTS filesystem system REQUIRED) ++ # TODO: component specified find_package is always failed. Need to fix it. ++ find_package(Boost 1.49.0 REQUIRED) + message(STATUS "Using Boost filesytem::path") + message(STATUS "Boost include dir: " ${Boost_INCLUDE_DIR}) + include_directories(${BOOST_INCLUDE_DIRS}) From 24a932ea6165baf9c01af6f4f7dcdf9878b11482 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 20 May 2022 23:39:14 +0900 Subject: [PATCH 05/11] drop gcc5 support --- recipes/drogon/all/conanfile.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index 084d597aaf7f6..5ad9f8b4d1502 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration import os import functools @@ -73,10 +74,26 @@ def configure(self): self.options["boost"].without_filesystem = False self.options["boost"].without_system = False + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "Visual Studio": "15.0", + "clang": "5", + "apple-clang": "10", + } + def validate(self): if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, "14") + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version: + if tools.Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name)) + else: + self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) + def requirements(self): self.requires("trantor/1.5.5") if self.options.with_boost: From 6ab1e0d7e22c269ed937e6c1971d926fabab9e27 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 21 May 2022 20:03:03 +0900 Subject: [PATCH 06/11] force use boost --- recipes/drogon/all/conanfile.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index 5ad9f8b4d1502..c779ba25bb5c2 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -26,7 +26,6 @@ class DrogonConan(ConanFile): "with_mysql": [True, False], "with_sqlite": [True, False], "with_redis": [True, False], - "with_boost": [True, False], } default_options = { "shared": False, @@ -40,8 +39,6 @@ class DrogonConan(ConanFile): "with_mysql": False, "with_sqlite": False, "with_redis": False, - # with_boost=False is accepted when compiler is C++17 with filesystem or C++20 above. - "with_boost": True, } @property @@ -70,10 +67,6 @@ def configure(self): del self.options.fPIC self.options["trantor"].shared = True - if self.options.with_boost: - self.options["boost"].without_filesystem = False - self.options["boost"].without_system = False - @property def _compilers_minimum_version(self): return { @@ -96,8 +89,7 @@ def validate(self): def requirements(self): self.requires("trantor/1.5.5") - if self.options.with_boost: - self.requires("boost/1.79.0") + self.requires("boost/1.79.0") self.requires("jsoncpp/1.9.5") self.requires("openssl/1.1.1o") self.requires("zlib/1.2.12") From 1ce04d8d012bfe3e36fff95519832e0d3c9e1e1e Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 21 May 2022 21:15:43 +0900 Subject: [PATCH 07/11] link stdc++fs on gcc/8.x --- recipes/drogon/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index c779ba25bb5c2..5728454831cc9 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -145,6 +145,8 @@ def package_info(self): self.cpp_info.libs = ["drogon"] if self.options.shared and self.settings.os == "Windows": self.cpp_info.system_libs.extend(["rpcrt4", "ws2_32", "crypt32", "advapi32"]) + if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version).major == "8": + self.cpp_info.system_libs.append("stdc++fs") if self.options.with_ctl: bin_path = os.path.join(self.package_folder, "bin") From f3eb304a622f8ed8d2e1725c7dd918f3438e1315 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 22 May 2022 20:17:23 +0900 Subject: [PATCH 08/11] try to fix trantor link error --- .../drogon/all/patches/1.7.5-0001-disable_trantor.patch | 7 +++---- .../all/patches/1.7.5-0002-remove-boost-components.patch | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch b/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch index 86be3acbf1705..bd56d16c697b5 100644 --- a/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch +++ b/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 85e8ee7..a3117ca 100755 +index 146d2b8..f83e119 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") @@ -18,13 +18,12 @@ index 85e8ee7..a3117ca 100755 $ $) -@@ -120,9 +118,6 @@ if (WIN32) +@@ -120,8 +118,6 @@ if (WIN32) PRIVATE $) endif (WIN32) -add_subdirectory(trantor) - --target_link_libraries(${PROJECT_NAME} PUBLIC trantor) + target_link_libraries(${PROJECT_NAME} PUBLIC trantor) if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") - target_link_libraries(${PROJECT_NAME} PRIVATE network) diff --git a/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch b/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch index 93d7bd4197f59..6823964b810ea 100644 --- a/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch +++ b/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0644d2a..b95bc9d 100755 +index f83e119..46a23fd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -176,7 +176,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") +@@ -177,7 +177,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") endif () if(NEED_BOOST_FS) From 9f1bcecec7d784fac9c172ce33035cd662ee3e26 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 23 May 2022 01:38:20 +0900 Subject: [PATCH 09/11] force C++17 when MSVC > 1900 --- recipes/drogon/all/test_package/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt index 12198c7ad1270..a8db5b906c051 100644 --- a/recipes/drogon/all/test_package/CMakeLists.txt +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -8,4 +8,11 @@ find_package(Drogon CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} Drogon::Drogon) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) + +# drogon uses string_view when MSVC_VERSION is greater than 1900. +# https://github.com/drogonframework/drogon/blob/v1.7.5/lib/inc/drogon/utils/string_view.h#L16 +if(DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() From c10f4d44c1e022e21e5a1cb1b449fa08eed42719 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 23 May 2022 08:20:56 +0900 Subject: [PATCH 10/11] link rpcrt4 on shared and static --- recipes/drogon/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index 5728454831cc9..0ba74777e06b4 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -143,7 +143,7 @@ def package(self): def package_info(self): self.cpp_info.libs = ["drogon"] - if self.options.shared and self.settings.os == "Windows": + if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["rpcrt4", "ws2_32", "crypt32", "advapi32"]) if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version).major == "8": self.cpp_info.system_libs.append("stdc++fs") From ce771ed3caa7691071be1ce4d015e69d49c337a8 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 23 May 2022 23:36:01 +0900 Subject: [PATCH 11/11] move deleting code for orm to configure() --- recipes/drogon/all/conanfile.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index 0ba74777e06b4..313e30b5a4988 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -53,6 +53,11 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + self.options["trantor"].shared = True if not self.options.with_orm: del self.options.with_postgres del self.options.with_postgres_batch @@ -62,11 +67,6 @@ def config_options(self): elif not self.options.with_postgres: del self.options.with_postgres_batch - def configure(self): - if self.options.shared: - del self.options.fPIC - self.options["trantor"].shared = True - @property def _compilers_minimum_version(self): return { @@ -99,13 +99,13 @@ def requirements(self): self.requires("coz/cci.20210322") if self.options.with_brotli: self.requires("brotli/1.0.9") - if self.options.with_postgres: + if self.options.get_safe("with_postgres"): self.requires("libpq/14.2") - if self.options.with_mysql: + if self.options.get_safe("with_mysql"): self.requires("libmysqlclient/8.0.25") - if self.options.with_sqlite: + if self.options.get_safe("with_sqlite"): self.requires("sqlite3/3.38.5") - if self.options.with_redis: + if self.options.get_safe("with_redis"): self.requires("hiredis/1.0.2") def source(self):