mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-16 11:31:19 +00:00
(#10956) Import beauty/1.0.0-rc1
* Import beauty/1.0.0-rc1
* Updates after review
* Remove unused import CMakeDeps and CMakeToolchain
* Add missing math missing dependency
Co-authored-by: dvirtz <dvirtz@gmail.com>
* Fix boost version
C++20 as min (to fix later in next release)
* Add missing fPIC management
Co-authored-by: Uilian Ries <uilianries@gmail.com>
* Remove fPIC on shared and Windows
* Move Windows detection in configure_options
* Revert "Move Windows detection in configure_options"
This reverts commit 5013bc60f0
.
* Apply suggestions from code review
missing open parenthese ?
Co-authored-by: Uilian Ries <uilianries@gmail.com>
* Not as easy as I first thought...
* Update recipes/beauty/all/conanfile.py
Co-authored-by: Uilian Ries <uilianries@gmail.com>
* Update recipes/beauty/all/conanfile.py
Co-authored-by: Uilian Ries <uilianries@gmail.com>
* Update recipes/beauty/all/test_package/CMakeLists.txt
Co-authored-by: Uilian Ries <uilianries@gmail.com>
* Update recipes/beauty/all/conanfile.py
Co-authored-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: dvirtz <dvirtz@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
This commit is contained in:
4
recipes/beauty/all/conandata.yml
Normal file
4
recipes/beauty/all/conandata.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
sources:
|
||||
"1.0.0-rc1":
|
||||
url: "https://github.com/dfleury2/beauty/archive/refs/tags/1.0.0-rc1.tar.gz"
|
||||
sha256: "e5c0cdffd9324ed0cbe771a4aaff3a572ec553dc0275bbaf4db754ce043ecf49"
|
83
recipes/beauty/all/conanfile.py
Normal file
83
recipes/beauty/all/conanfile.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import os
|
||||
from conans import ConanFile, tools
|
||||
from conan.tools.cmake import CMake
|
||||
from conan.tools.microsoft import is_msvc
|
||||
from conans.errors import ConanInvalidConfiguration
|
||||
|
||||
|
||||
required_conan_version = ">=1.45.0"
|
||||
|
||||
|
||||
class BeautyConan(ConanFile):
|
||||
name = "beauty"
|
||||
homepage = "https://github.com/dfleury2/beauty"
|
||||
description = "HTTP Server above Boost.Beast"
|
||||
topics = ("http", "server", "boost.beast")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
license = "MIT"
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
options = {"shared": [True, False], "fPIC": [True, False]}
|
||||
default_options = {"shared": False, "fPIC": True}
|
||||
generators = "CMakeDeps", "CMakeToolchain"
|
||||
|
||||
requires = ("boost/1.79.0",
|
||||
"openssl/1.1.1o")
|
||||
|
||||
@property
|
||||
def _source_subfolder(self):
|
||||
return "source_subfolder"
|
||||
|
||||
@property
|
||||
def _compilers_minimum_version(self):
|
||||
return {
|
||||
"gcc": "8",
|
||||
"clang": "11",
|
||||
"Visual Studio": "16",
|
||||
}
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
del self.options.fPIC
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
tools.check_min_cppstd(self, "20")
|
||||
|
||||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
|
||||
if minimum_version and tools.Version(self.settings.compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration(
|
||||
f"Compiler {self.name} must be at least {minimum_version}")
|
||||
|
||||
if self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libc++":
|
||||
raise ConanInvalidConfiguration("Only libc++ is supported for clang")
|
||||
|
||||
if self.settings.compiler == "apple-clang" and self.options.shared:
|
||||
raise ConanInvalidConfiguration("shared is not supported on apple-clang")
|
||||
|
||||
if is_msvc and self.options.shared:
|
||||
raise ConanInvalidConfiguration("shared is not supported on Visual Studio")
|
||||
|
||||
def source(self):
|
||||
tools.get(**self.conan_data["sources"][self.version],
|
||||
destination=self._source_subfolder, strip_root=True)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_script_folder=self._source_subfolder)
|
||||
cmake.build(target="beauty")
|
||||
|
||||
def package(self):
|
||||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["beauty"]
|
||||
self.cpp_info.requires = ["boost::headers", "openssl::openssl"]
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.system_libs = ["m"]
|
11
recipes/beauty/all/test_package/CMakeLists.txt
Normal file
11
recipes/beauty/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package CXX)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(beauty REQUIRED CONFIG)
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} test_package.cpp)
|
||||
set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 20)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} beauty::beauty)
|
17
recipes/beauty/all/test_package/conanfile.py
Normal file
17
recipes/beauty/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import os
|
||||
from conans import ConanFile, CMake, tools
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "cmake_find_package_multi", "cmake"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not tools.cross_building(self):
|
||||
bin_path = os.path.join("bin","test_package")
|
||||
self.run(bin_path, run_environment=True)
|
7
recipes/beauty/all/test_package/test_package.cpp
Normal file
7
recipes/beauty/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <beauty/beauty.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Create a server
|
||||
beauty::server server;
|
||||
}
|
3
recipes/beauty/config.yml
Normal file
3
recipes/beauty/config.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
versions:
|
||||
"1.0.0-rc1":
|
||||
folder: all
|
Reference in New Issue
Block a user