-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
new recipe for melon/1.0.0-alpha.1 #25189
Merged
conan-center-bot
merged 4 commits into
conan-io:master
from
fhamonic:melon/1.0.0-alpha.1
Sep 16, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.0.0-alpha.1": | ||
url: "https://github.com/fhamonic/melon/archive/refs/tags/v1.0.0-alpha.1.tar.gz" | ||
sha256: "370f6bb1fddc68f1ab771c8b659fed6d9dc8da51290897ed72fd87589143220c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.files import copy, get | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.scm import Version | ||
import os | ||
|
||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
class PackageConan(ConanFile): | ||
name = "melon" | ||
description = "A modern and efficient graph library using C++20 ranges and concepts." | ||
license = "BSL-1.0" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/fhamonic/melon" | ||
topics = ("graph", "algorithm", "ranges", "c++20", "header-only") | ||
package_type = "header-library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
no_copy_source = True | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return 20 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"apple-clang": "14", | ||
"clang": "17", | ||
"gcc": "12", | ||
"msvc": "192", | ||
"Visual Studio": "17", | ||
} | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("range-v3/0.12.0") | ||
self.requires("fmt/10.2.1") | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, self._min_cppstd) | ||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) | ||
if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration( | ||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." | ||
) | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def build(self): | ||
pass | ||
|
||
def package(self): | ||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
copy( | ||
self, | ||
"*.hpp", | ||
os.path.join(self.source_folder, "include"), | ||
os.path.join(self.package_folder, "include"), | ||
) | ||
|
||
def package_info(self): | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.libdirs = [] | ||
|
||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.extend(["pthread"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(melon REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE melon::melon) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
# It will become the standard on Conan 2.x | ||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
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.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "melon/algorithm/bidirectional_dijkstra.hpp" | ||
#include "melon/utility/static_digraph_builder.hpp" | ||
#include "melon/container/static_digraph.hpp" | ||
|
||
using namespace fhamonic::melon; | ||
|
||
// test_package with bidirectional dijkstra because it condenses range-v3 uses | ||
// shown to overwhelm some compilers | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
static_digraph_builder<static_digraph, int> builder(6); | ||
|
||
builder.add_arc(0u, 1u, 7); // 0 | ||
builder.add_arc(0u, 2u, 9); // 1 | ||
builder.add_arc(0u, 5u, 14); // 2 | ||
builder.add_arc(1u, 0u, 7); // 3 | ||
builder.add_arc(1u, 2u, 10); // 4 | ||
builder.add_arc(1u, 3u, 15); // 5 | ||
builder.add_arc(2u, 0u, 9); // 6 | ||
builder.add_arc(2u, 1u, 10); // 7 | ||
builder.add_arc(2u, 3u, 12); // 8 | ||
builder.add_arc(2u, 5u, 2); // 9 | ||
builder.add_arc(3u, 1u, 15); // 10 | ||
builder.add_arc(3u, 2u, 12); // 11 | ||
builder.add_arc(3u, 4u, 6); // 12 | ||
builder.add_arc(4u, 3u, 6); // 13 | ||
builder.add_arc(4u, 5u, 9); // 14 | ||
builder.add_arc(5u, 0u, 14); // 15 | ||
builder.add_arc(5u, 2u, 2); // 16 | ||
builder.add_arc(5u, 4u, 9); // 17 | ||
|
||
auto [graph, length_map] = builder.build(); | ||
|
||
bidirectional_dijkstra alg(graph, length_map, 0u, 3u); | ||
|
||
int dist = alg.run(); | ||
if (dist != 21) return EXIT_FAILURE; | ||
|
||
if (!alg.path_found()) return EXIT_FAILURE; | ||
auto path = alg.path(); | ||
if (std::ranges::distance(path) != 2) return EXIT_FAILURE; | ||
if (std::ranges::find(path, 1u) == path.end()) return EXIT_FAILURE; | ||
if (std::ranges::find(path, 8u) == path.end()) return EXIT_FAILURE; | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.0.0-alpha.1": | ||
folder: all |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an idea on when proper
1.0.0
would be released?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, algorithms are well tested but I feel like the library lacks some features like serialization/visualization to be complete. I have been asked to submit a recipe and I think that making the library available on Conan-center could stimulate potential feedback and maybe contributions for designing these features.
Given that this is an important project for me, I'll continue working on it for sure :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to hear! Thanks for the extra insight