Skip to content

Commit 3e06cab

Browse files
authored
split odrcore conanfiles (#40)
1 parent a52574e commit 3e06cab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1090
-123
lines changed

recipes/odrcore/config.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
versions:
22
"1.0.0":
3-
folder: "pre-v5"
3+
folder: "v1"
44
"2.0.0":
5-
folder: "pre-v5"
5+
folder: "v2.0"
66
"2.1.0":
7-
folder: "pre-v5"
7+
folder: "v2.1"
88
"2.1.1":
9-
folder: "pre-v5"
9+
folder: "v2.1"
1010
"2.1.2":
11-
folder: "pre-v5"
11+
folder: "v2.1"
1212
"2.2.0":
13-
folder: "pre-v5"
13+
folder: "v2.2"
1414
"3.0.0":
15-
folder: "pre-v5"
15+
folder: "v3"
1616
"4.0.0":
17-
folder: "pre-v5"
17+
folder: "v4.0"
1818
"4.1.0":
19-
folder: "pre-v5"
19+
folder: "v4.1"
2020
"4.1.1":
21-
folder: "pre-v5"
21+
folder: "v4.1"
2222
"5.0.0":
2323
folder: "v5"
2424
"5.0.1":
2525
folder: "v5"
2626
"5.0.2":
2727
folder: "v5"
2828
"9.9.9":
29-
folder: "v5"
29+
folder: "main"

recipes/odrcore/main/conandata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"9.9.9":
3+
source:
4+
url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/heads/main.tar.gz"

recipes/odrcore/main/conanfile.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
from conan import ConanFile
2+
from conan.tools.build import check_min_cppstd
3+
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
4+
from conan.tools.files import (
5+
apply_conandata_patches, export_conandata_patches, get
6+
)
7+
8+
9+
class OpenDocumentCoreConan(ConanFile):
10+
name = "odrcore"
11+
version = ""
12+
url = "https://github.com/opendocument-app/OpenDocument.core"
13+
homepage = "https://opendocument.app/"
14+
description = "C++ library that translates office documents to HTML"
15+
topics = "open document", "openoffice xml", "open document reader"
16+
license = "GPL 3.0"
17+
18+
settings = "os", "arch", "compiler", "build_type"
19+
options = {
20+
"shared": [True, False],
21+
"fPIC": [True, False],
22+
"with_pdf2htmlEX": [True, False],
23+
"with_wvWare": [True, False],
24+
}
25+
default_options = {
26+
"shared": False,
27+
"fPIC": True,
28+
"with_pdf2htmlEX": True,
29+
"with_wvWare": True,
30+
}
31+
32+
def config_options(self):
33+
if self.settings.os == "Windows":
34+
del self.options.fPIC
35+
# @TODO: ideally Windows should just default_options['with_pdf2htmlEX'] = False
36+
# But by the time config_options() is executed, default_options is already done parsed.
37+
del self.options.with_pdf2htmlEX
38+
del self.options.with_wvWare
39+
40+
def configure(self):
41+
if self.options.shared:
42+
self.options.rm_safe("fPIC")
43+
44+
def requirements(self):
45+
self.requires("pugixml/1.14")
46+
self.requires("cryptopp/8.9.0")
47+
self.requires("miniz/3.0.2")
48+
self.requires("nlohmann_json/3.11.3")
49+
self.requires("vincentlaucsb-csv-parser/2.3.0")
50+
self.requires("uchardet/0.0.8")
51+
self.requires("utfcpp/4.0.4")
52+
self.requires("argon2/20190702")
53+
self.requires("cpp-httplib/0.16.3")
54+
55+
if self.options.get_safe("with_pdf2htmlEX"):
56+
self.requires("pdf2htmlex/0.18.8.rc1-odr-git-eb5d291")
57+
if self.options.get_safe("with_wvWare"):
58+
self.requires("wvware/1.2.9-odr")
59+
60+
def build_requirements(self):
61+
self.test_requires("gtest/1.14.0")
62+
63+
def validate_build(self):
64+
if self.settings.get_safe("compiler.cppstd"):
65+
check_min_cppstd(self, 20)
66+
67+
def export_sources(self):
68+
export_conandata_patches(self)
69+
70+
def source(self):
71+
get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True)
72+
apply_conandata_patches(self)
73+
74+
def layout(self):
75+
cmake_layout(self, src_folder="src")
76+
77+
def generate(self):
78+
tc = CMakeToolchain(self)
79+
tc.variables["CMAKE_PROJECT_VERSION"] = self.version
80+
tc.variables["ODR_TEST"] = False
81+
tc.variables["WITH_PDF2HTMLEX"] = self.options.get_safe("with_pdf2htmlEX", False)
82+
tc.variables["WITH_WVWARE"] = self.options.get_safe("with_wvWare", False)
83+
tc.generate()
84+
85+
deps = CMakeDeps(self)
86+
deps.generate()
87+
88+
def build(self):
89+
cmake = CMake(self)
90+
cmake.configure()
91+
cmake.build()
92+
93+
def package(self):
94+
cmake = CMake(self)
95+
cmake.install()
96+
97+
def package_info(self):
98+
self.cpp_info.libs = ["odr"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
project(odr-test-downstream LANGUAGES C CXX)
4+
set(CMAKE_CXX_STANDARD 20)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
set(CMAKE_CXX_EXTENSIONS OFF)
7+
8+
find_package(odrcore REQUIRED)
9+
10+
add_executable(odr-test-downstream test_package.cpp)
11+
target_link_libraries(odr-test-downstream PRIVATE odrcore::odrcore)
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <odr/odr.hpp>
2+
3+
#include <iostream>
4+
5+
int main(void) {
6+
std::cout << "odr version=\"" << odr::version() << "\' "
7+
<< "commit=\'" << odr::commit_hash() << "\""
8+
<< std::endl;
9+
}

recipes/odrcore/pre-v5/conandata.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

recipes/odrcore/v1/conandata.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
sources:
2+
"1.0.0":
3+
source:
4+
url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/tags/v1.0.0.tar.gz"
5+
sha256: "4da749ce3ea1cd5fbc4d710f068f582e8e7e14c4847faca323436516ff59df8c"
6+
7+
patches:
8+
"1.0.0":
9+
- patch_file: "patches/1.0.0-0001-fix-cmake-install.patch"
10+
patch_description: "Fix header install in CMakeLists.txt"
11+
patch_type: "conan"
12+
- patch_file: "patches/1.0.0-0002-fix-glog-stacktrace-misdetection.patch"
13+
patch_description: "Glog checks if execinfo.h is available and if it is - expects backtrace to be there, but backtrace is only available from Android API 33"
14+
patch_type: "conan"
15+
- patch_file: "patches/1.0.0-0003-fix-cryptopp-cpu-features.patch"
16+
patch_description: "Cryptopp expects cpu-features.h and .c to be in the source dir, prepare them"
17+
patch_type: "conan"

recipes/odrcore/v1/conanfile.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
from conan import ConanFile
2+
from conan.tools.build import check_min_cppstd
3+
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
4+
from conan.tools.files import (
5+
apply_conandata_patches, export_conandata_patches, get
6+
)
7+
from conan.tools.scm import Version
8+
9+
10+
class OpenDocumentCoreConan(ConanFile):
11+
name = "odrcore"
12+
version = ""
13+
url = "https://github.com/opendocument-app/OpenDocument.core"
14+
homepage = "https://opendocument.app/"
15+
description = "C++ library that translates office documents to HTML"
16+
topics = "open document", "openoffice xml", "open document reader"
17+
license = "GPL 3.0"
18+
19+
settings = "os", "arch", "compiler", "build_type"
20+
options = {
21+
"shared": [True, False],
22+
"fPIC": [True, False],
23+
"with_pdf2htmlEX": [True, False],
24+
"with_wvWare": [True, False],
25+
}
26+
default_options = {
27+
"shared": False,
28+
"fPIC": True,
29+
"with_pdf2htmlEX": True,
30+
"with_wvWare": True,
31+
}
32+
33+
def config_options(self):
34+
if self.settings.os == "Windows":
35+
del self.options.fPIC
36+
# @TODO: ideally Windows should just default_options['with_pdf2htmlEX'] = False
37+
# But by the time config_options() is executed, default_options is already done parsed.
38+
del self.options.with_pdf2htmlEX
39+
del self.options.with_wvWare
40+
41+
def configure(self):
42+
if self.options.shared:
43+
self.options.rm_safe("fPIC")
44+
45+
def requirements(self):
46+
return
47+
48+
def build_requirements(self):
49+
return
50+
51+
def validate_build(self):
52+
if self.settings.get_safe("compiler.cppstd"):
53+
check_min_cppstd(self, 14)
54+
55+
def export_sources(self):
56+
export_conandata_patches(self)
57+
58+
def source(self):
59+
get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True)
60+
apply_conandata_patches(self)
61+
62+
def layout(self):
63+
cmake_layout(self, src_folder="src")
64+
65+
def generate(self):
66+
tc = CMakeToolchain(self)
67+
tc.variables["CMAKE_PROJECT_VERSION"] = self.version
68+
tc.variables["ODR_TEST"] = False
69+
tc.variables["WITH_PDF2HTMLEX"] = self.options.get_safe("with_pdf2htmlEX", False)
70+
tc.variables["WITH_WVWARE"] = self.options.get_safe("with_wvWare", False)
71+
tc.variables["CONAN_EXPORTED"] = True
72+
tc.generate()
73+
74+
deps = CMakeDeps(self)
75+
deps.generate()
76+
77+
def build(self):
78+
cmake = CMake(self)
79+
cmake.configure()
80+
cmake.build()
81+
82+
def package(self):
83+
cmake = CMake(self)
84+
cmake.install()
85+
86+
def package_info(self):
87+
self.cpp_info.libs = ["odrlib"]

recipes/odrcore/pre-v5/patches/1.0.0-0001-fix-cmake-install.patch renamed to recipes/odrcore/v1/patches/1.0.0-0001-fix-cmake-install.patch

File renamed without changes.

0 commit comments

Comments
 (0)