-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: master
Are you sure you want to change the base?
Pole 0.5 #25139
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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" | ||
sha256: "e9fd994275fce71760c457a8343cbb075de20284cb49fc5116549a02dba5f7cf" |
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>" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||
|
||||
def package_info(self): | ||||
self.cpp_info.libs = ["pole"] | ||||
|
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) | ||
|
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") |
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(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"0.5": | ||
folder: all |
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.
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!