Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drogon: update boost, trivial improvement #15034

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions recipes/drogon/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake
from conan.tools.files import copy, get, apply_conandata_patches, rmdir
from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rmdir
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2"
required_conan_version = ">=1.53.0"

class DrogonConan(ConanFile):
name = "drogon"
Expand Down Expand Up @@ -46,16 +46,15 @@ class DrogonConan(ConanFile):
}

def export_sources(self):
for p in self.conan_data.get("patches", {}).get(self.version, []):
copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder)
export_conandata_patches(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.rm_safe("fPIC")
self.options["trantor"].shared = True
if not self.options.with_orm:
del self.options.with_postgres
Expand All @@ -66,26 +65,39 @@ def configure(self):
elif not self.options.with_postgres:
del self.options.with_postgres_batch

@property
def _min_cppstd(self):
return 14 if Version(self.version) < "1.8.2" else 17

@property
def _compilers_minimum_version(self):
return {
"Visual Studio": "15" if Version(self.version) < "1.8.2" else "16",
"msvc": "191" if Version(self.version) < "1.8.2" else "192",
"gcc": "6",
"clang": "5",
"apple-clang": "10",
}
if Version(self.version) < "1.8.2":
return {
"Visual Studio": "15",
"msvc": "191",
"gcc": "6",
"clang": "5",
"apple-clang": "10",
}
else:
return {
"Visual Studio": "16",
"msvc": "192",
"gcc": "8",
"clang": "7",
"apple-clang": "12",
}

def validate(self):
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, "14")
check_min_cppstd(self, self._min_cppstd)

minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False)
if minimum_version:
if Version(self.info.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name))
raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.")
else:
self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name))
self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.")

def requirements(self):
self.requires("trantor/1.5.8")
Expand All @@ -97,7 +109,7 @@ def requirements(self):
if self.options.with_profile:
self.requires("coz/cci.20210322")
if self.options.with_boost:
self.requires("boost/1.80.0")
self.requires("boost/1.81.0")
if self.options.with_brotli:
self.requires("brotli/1.0.9")
if self.options.get_safe("with_postgres"):
Expand Down Expand Up @@ -154,7 +166,7 @@ def package_info(self):

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.output.info(f"Appending PATH environment variable: {bin_path}")
self.env_info.PATH.append(bin_path)

self.cpp_info.set_property("cmake_file_name", "Drogon")
Expand Down
2 changes: 1 addition & 1 deletion recipes/drogon/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon)

# 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)
if((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) OR Drogon_VERSION VERSION_GREATER_EQUAL "1.8.2")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
else()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
Expand Down