Skip to content

Commit 7202c27

Browse files
committed
patch 2.0.0; seems to build
1 parent 84d39f2 commit 7202c27

File tree

3 files changed

+54
-4
lines changed

3 files changed

+54
-4
lines changed

recipes/odrcore/all/conandata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ sources:
3232
url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/tags/v4.0.0.tar.gz"
3333
sha256: "b2d671f34bf641d465dfaae9adefdcb4a6210d58a519594a182ba2839531435e"
3434
patches:
35+
"2.0.0":
36+
- patch_file: "patches/2.0.0-0001-fix-cmake.patch"
37+
patch_description: "Fix broken dependencies in CMakeLists.txt"
38+
patch_type: "conan"

recipes/odrcore/all/conanfile.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
from conan import ConanFile
33
from conan.tools.build import check_min_cppstd
44
from conan.tools.files import copy
5-
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake
5+
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
6+
from conan.tools.files import (
7+
apply_conandata_patches, export_conandata_patches, get, copy
8+
)
9+
from conan.tools.scm import Version
610

711

812
class OpenDocumentCoreConan(ConanFile):
913
name = "odrcore"
10-
version = ""
11-
url = ""
12-
homepage = "https://github.com/opendocument-app/OpenDocument.core"
14+
url = "https://github.com/opendocument-app/OpenDocument.core"
15+
homepage = "https://opendocument.app/"
1316
description = "C++ library that translates office documents to HTML"
1417
topics = "open document", "openoffice xml", "open document reader"
1518
license = "GPL 3.0"
@@ -26,7 +29,24 @@ class OpenDocumentCoreConan(ConanFile):
2629

2730
exports_sources = ["cli/*", "cmake/*", "src/*", "CMakeLists.txt"]
2831

32+
def export_sources(self):
33+
export_conandata_patches(self)
34+
35+
def config_options(self):
36+
if self.settings.os == "Windows":
37+
del self.options.fPIC
38+
39+
def configure(self):
40+
if self.options.shared:
41+
self.options.rm_safe("fPIC")
42+
43+
def layout(self):
44+
cmake_layout(self, src_folder="src")
45+
2946
def requirements(self):
47+
if Version(self.version) <= "2.0.0":
48+
return
49+
3050
self.requires("pugixml/1.14")
3151
self.requires("cryptopp/8.8.0")
3252
self.requires("miniz/3.0.2")
@@ -36,23 +56,36 @@ def requirements(self):
3656
self.requires("utfcpp/4.0.4")
3757

3858
def build_requirements(self):
59+
if Version(self.version) <= "2.0.0":
60+
return
61+
3962
self.test_requires("gtest/1.14.0")
4063

4164
def validate_build(self):
4265
if self.settings.get_safe("compiler.cppstd"):
4366
check_min_cppstd(self, 17)
4467

68+
def source(self):
69+
get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True)
70+
4571
def generate(self):
4672
tc = CMakeToolchain(self)
4773
tc.variables["CMAKE_PROJECT_VERSION"] = self.version
4874
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
4975
tc.variables["ODR_TEST"] = False
76+
if Version(self.version) < "4.0.0":
77+
tc.variables["CONAN_EXPORTED"] = True
5078
tc.generate()
5179

5280
deps = CMakeDeps(self)
5381
deps.generate()
5482

83+
def _patch_sources(self):
84+
apply_conandata_patches(self)
85+
5586
def build(self):
87+
self._patch_sources()
88+
5689
cmake = CMake(self)
5790
cmake.configure()
5891
cmake.build()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
2+
index fd817e1..792f18b 100644
3+
--- a/3rdparty/CMakeLists.txt
4+
+++ b/3rdparty/CMakeLists.txt
5+
@@ -33,7 +33,7 @@ FetchContent_Declare(
6+
)
7+
FetchContent_Declare(
8+
uchardet
9+
- GIT_REPOSITORY https://github.com/freedesktop/uchardet.git
10+
+ GIT_REPOSITORY https://gitlab.freedesktop.org/uchardet/uchardet.git
11+
GIT_TAG d7dad54
12+
)
13+
FetchContent_Declare(

0 commit comments

Comments
 (0)