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 12 commits into
base: master
Choose a base branch
from
Open

Pole 0.5 #25139

Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[Library] Add pole 0.6
  • Loading branch information
lcrepin-dtk committed Oct 2, 2024
commit c540f48888f49a9e1a731cd2922ef78a3df971d7
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.6":
url: https://github.com/otofoto/Pole/archive/refs/heads/master.zip
sha256: "aec798295fc9b48375b6dda7ca944fb71b18e96a1c2ed8345f9c7885cf91a5a9"
64 changes: 64 additions & 0 deletions recipes/pole/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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
from conan.tools.scm import Git



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>")
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved

# 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)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved

def source(self):
git = Git(self)
git.clone(url=self.conan_data["sources"][self.version]["url"], target=".")
git.checkout(commit= self.conan_data["sources"][self.version]["revision"])

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

def generate(self):
deps = CMakeDeps(self)
deps.generate()
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)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved

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.60":
folder: all