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

Pole 0.5 #25139

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Pole 0.5 #25139

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
4 changes: 4 additions & 0 deletions recipes/pole/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.5":
url: "https://github.com/luc-c/Pole/archive/refs/tags/0.5.zip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is your fork, but I'd like to ask what's the difference with the original https://github.com/otofoto/Pole and why one would be chosen above there other, thanks!

sha256: "e9fd994275fce71760c457a8343cbb075de20284cb49fc5116549a02dba5f7cf"
58 changes: 58 additions & 0 deletions recipes/pole/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get


class poleRecipe(ConanFile):
name = "pole"
package_type = "library"

# Optional metadata
license = "<Put the package license here>"
author = "<Put your name here> <And your email here>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow https://github.com/conan-io/conan-center-index/tree/master/docs/package_templates/cmake_package for what values to actually put here (Or use that template directly!), but author is not a field that should be added to a CCI recipe :)

Suggested change
author = "<Put your name here> <And your email here>"

url = "<Package recipe repository url here, for issues about the package>"
description = "<Description of pole package here>"
topics = ("<Put some tag here>", "<here>", "<and here>")
Comment on lines +11 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thous would need to be filled


# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def export_sources(self):
export_conandata_patches(self)
Comment on lines +30 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this if there are no patches :)


def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)

def layout(self):
cmake_layout(self, src_folder="src")

def generate(self):
deps = CMakeDeps(self)
deps.generate()
Comment on lines +41 to +42
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this generator if there are no dependencies

tc = CMakeToolchain(self)
tc.generate()

def build(self):
apply_conandata_patches(self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, no patches, no need for this

cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll also need to package the license file to a license folder in this method, check how this is done in the cmake_package template in https://github.com/conan-io/conan-center-index/tree/master/docs/package_templates/cmake_package


def package_info(self):
self.cpp_info.libs = ["pole"]

9 changes: 9 additions & 0 deletions recipes/pole/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.8)
project(test_package CXX)

find_package(pole CONFIG REQUIRED)

add_executable(${PROJECT_NAME} src/test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE pole::pole)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

26 changes: 26 additions & 0 deletions recipes/pole/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run


class poleTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "test_package")
self.run(cmd, env="conanrun")
15 changes: 15 additions & 0 deletions recipes/pole/all/test_package/src/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <pole/pole.h>

using namespace POLE;

int main() {
Storage aStorage("test.ole");
if( aStorage.open(true,true))
{
Stream sStream(&aStorage,"/test_stream", true);
constexpr char[] acPoleStr = "POLE library trial";
sStream.write(acPoleStr, sizeof(acPoleStr));
sStream.flush();
}
sStorage.close();
}
3 changes: 3 additions & 0 deletions recipes/pole/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.5":
folder: all
Loading