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

qpdf/11.1.1 add (lib only) package #13113

Merged
merged 75 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
1803539
initial conan qpdf package implementation
cguentherTUChemnitz Sep 23, 2022
ce7785f
make conan check hooks green: missing new line on test_package.cpp
cguentherTUChemnitz Sep 23, 2022
9c1e20d
add current cmake as build_requirements
cguentherTUChemnitz Sep 26, 2022
a1b5600
remove comments as requested from review
cguentherTUChemnitz Sep 26, 2022
47215ac
remove validation check from example, which was not validated for the…
cguentherTUChemnitz Sep 26, 2022
710daaf
remove implicit library depdendency from example
cguentherTUChemnitz Sep 26, 2022
a40c715
remove further comments from example
cguentherTUChemnitz Sep 26, 2022
cdf8edb
simplify test_package to just print QPDF_VERSION
cguentherTUChemnitz Sep 26, 2022
ddfd4fb
provide crypto provider selection
cguentherTUChemnitz Sep 26, 2022
72bd5b1
reenable missing system lib dependency m
cguentherTUChemnitz Sep 27, 2022
bd5fa70
cope with minor linting warnings
cguentherTUChemnitz Sep 27, 2022
00e24aa
add gnutls option as a placeholder, to activate later on but not chan…
cguentherTUChemnitz Sep 27, 2022
6e546f2
remove further comments
cguentherTUChemnitz Sep 27, 2022
3fe4d8a
remove not matching cleanup for packaging
cguentherTUChemnitz Sep 27, 2022
138dae7
add minimal as possible pdf handling to test_package to ensure link-t…
cguentherTUChemnitz Sep 27, 2022
f0960fb
cope with unused lint warning
cguentherTUChemnitz Sep 27, 2022
65394ea
introduce jpeg dependency option
cguentherTUChemnitz Sep 28, 2022
476c58a
add conan v1 test
cguentherTUChemnitz Sep 28, 2022
a662791
fix up test_v1_package for shared builds: correct the build env passi…
cguentherTUChemnitz Sep 29, 2022
ef4fa64
convert line breaks
cguentherTUChemnitz Sep 29, 2022
bded8ea
fix the visual code version number to select full C++14 supported com…
cguentherTUChemnitz Sep 29, 2022
714be69
try to migrate to is_msvc instead of own version comparison for vs co…
cguentherTUChemnitz Sep 29, 2022
a7582ba
remove duplicated test package source file
cguentherTUChemnitz Oct 5, 2022
f1c8696
clean import statement
cguentherTUChemnitz Oct 5, 2022
99ea532
go for string based compiler version comparison
cguentherTUChemnitz Oct 5, 2022
bed172f
call binaries of the package directly without manual path determinati…
cguentherTUChemnitz Oct 5, 2022
993bf7f
provide pkgconf as explicit build dependency, since msvc has it not p…
cguentherTUChemnitz Oct 5, 2022
ba7cf25
revert import review change, since it triggers the linter
cguentherTUChemnitz Oct 5, 2022
88b3992
patch level update qpdf to 11.1.1
cguentherTUChemnitz Oct 5, 2022
ecf0974
fix missing version update entry in config.yml
cguentherTUChemnitz Oct 5, 2022
3589e31
try to fix linter on import statement
cguentherTUChemnitz Oct 5, 2022
3687907
add packageConfigDeps and virtual build env to toolchain configure ha…
cguentherTUChemnitz Oct 5, 2022
a110852
current workaround for missing pkg_config dependency retrieval from c…
cguentherTUChemnitz Oct 6, 2022
6b73217
switch to working openssl version as qpdf dependency
cguentherTUChemnitz Oct 6, 2022
a2707fe
switch to libqpdf build only; patch qpdf cmake build files, injecting…
cguentherTUChemnitz Oct 6, 2022
ebfebba
cope with linter warning
cguentherTUChemnitz Oct 6, 2022
81b022c
remove not anymore compiled binaries from test_v1
cguentherTUChemnitz Oct 6, 2022
1b7f25e
apply review changes
cguentherTUChemnitz Oct 7, 2022
9444ed0
disable mac shared builds
cguentherTUChemnitz Oct 7, 2022
79fb439
try to get around windows and mac shared lib missing symbols into lib…
cguentherTUChemnitz Oct 7, 2022
e33bd9a
try to fix missing libjpeg symols problem for shared libs on windows …
cguentherTUChemnitz Oct 7, 2022
cb1dd09
provide cmake dependencies also to shared and static lib target direc…
cguentherTUChemnitz Oct 7, 2022
650dfdc
try to reenable mac os, since the missing symbols should be caused on…
cguentherTUChemnitz Oct 7, 2022
7daf87c
reuse existing target_link_libraries calls and append conan libs to t…
cguentherTUChemnitz Oct 7, 2022
b13d062
add missing public entries to target_link_libraries
cguentherTUChemnitz Oct 7, 2022
c400009
move cmake deps out of atomic library check and set only once for eve…
cguentherTUChemnitz Oct 7, 2022
f8faaf0
remove wrongly reintroduces target_link_libraries from overwritten qp…
cguentherTUChemnitz Oct 7, 2022
2f395d1
try to fix msvc tests with code-path avoiding #warning macro
cguentherTUChemnitz Oct 7, 2022
cab48c8
cope with linter error
cguentherTUChemnitz Oct 7, 2022
034e724
add necessary compile-definition also to test_v1_package
cguentherTUChemnitz Oct 7, 2022
392170f
cope with linter error
cguentherTUChemnitz Oct 7, 2022
8554014
Update recipes/qpdf/all/conanfile.py
cguentherTUChemnitz Oct 9, 2022
e585cde
Update recipes/qpdf/all/test_package/CMakeLists.txt
cguentherTUChemnitz Oct 9, 2022
6c62aa1
Update recipes/qpdf/all/test_v1_package/CMakeLists.txt
cguentherTUChemnitz Oct 9, 2022
7ad817c
Update recipes/qpdf/all/conanfile.py
cguentherTUChemnitz Oct 9, 2022
2af80eb
Update recipes/qpdf/all/test_v1_package/CMakeLists.txt
cguentherTUChemnitz Oct 9, 2022
9a222fa
make it link correctly again
cguentherTUChemnitz Oct 9, 2022
604ea04
remove not anymore necessary way to provide conan dependencies via pk…
cguentherTUChemnitz Oct 9, 2022
0f70f26
Update recipes/qpdf/all/conanfile.py
cguentherTUChemnitz Oct 9, 2022
7fa6b0f
Update recipes/qpdf/all/conanfile.py
cguentherTUChemnitz Oct 9, 2022
c7f141a
fix python function name definition
cguentherTUChemnitz Oct 9, 2022
99c6dd5
avoid cmake SEND_ERROR and FATAL_ERROR on patched-away dependency han…
cguentherTUChemnitz Oct 10, 2022
3861533
fix patch base addresses
cguentherTUChemnitz Oct 10, 2022
f62f115
Update recipes/qpdf/all/conandata.yml
cguentherTUChemnitz Oct 10, 2022
ce72980
Update recipes/qpdf/all/conanfile.py
cguentherTUChemnitz Oct 10, 2022
62ec8e5
export example file with fixed path from binary instead of agrument f…
cguentherTUChemnitz Oct 10, 2022
e718d38
clarify options names: with_crypto -> with_ssl; native -> internal
cguentherTUChemnitz Oct 10, 2022
4dfb79b
avoid code-duplication in patch-files, go for conditional python patc…
cguentherTUChemnitz Oct 10, 2022
74ca178
review-changes: add description and type for patches
cguentherTUChemnitz Oct 11, 2022
0810fc3
follow more precise the documentation guideline
cguentherTUChemnitz Oct 11, 2022
4db5019
prepare gnutls config
cguentherTUChemnitz Oct 14, 2022
aecf7bf
deactivate special windows exernal lib handling
cguentherTUChemnitz Oct 14, 2022
381e705
Patch found crypto flags, corresponding to conan options. This should…
cguentherTUChemnitz Oct 14, 2022
3a39b4c
update dependencies
cguentherTUChemnitz Oct 15, 2022
3aed2bb
remove slightly misleading comment
cguentherTUChemnitz Oct 16, 2022
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
12 changes: 12 additions & 0 deletions recipes/qpdf/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sources:
"11.1.1":
url: "https://github.com/qpdf/qpdf/archive/refs/tags/v11.1.1.tar.gz"
sha256: "785edab622a1bc7e25e1537ad2c325005d48c5c7957f7abedff405deb80fa59a"
patches:
"11.1.1":
- patch_file: "patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch"
patch_description: "Inject Conan Deps, disable qpdf-dep handling: update libqpdf/CMakeLists.txt by disabling cmake fails, caused by pkg_config fail to find dependencies. Add conan generated cmake dependencies instead."
patch_type: "conan"
- patch_file: "patches/0002-exclude-unnecessary-cmake-subprojects.patch"
patch_description: "Exclude unnecessary targets: update CMakeLists.txt removing subdir includes for binaries, tests, examples, docs and fuzzing"
patch_type: "conan"
181 changes: 181 additions & 0 deletions recipes/qpdf/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.files import replace_in_file, apply_conandata_patches, export_conandata_patches, get, copy, rmdir
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.microsoft import is_msvc, check_min_vs
from conan.tools.env import VirtualBuildEnv
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved
import os

required_conan_version = ">=1.52.0"

class PackageConan(ConanFile):
name = "qpdf"
description = "QPDF is a command-line tool and C++ library that performs content-preserving transformations on PDF files."
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/qpdf/qpdf"
topics = ("pdf")
settings = "os", "arch", "compiler", "build_type"
options = {
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved
"shared": [True, False],
"fPIC": [True, False],
"with_ssl": ["internal", "openssl", "gnutls"],
"with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"],
}
default_options = {
"shared": False,
"fPIC": True,
"with_ssl": "openssl",
"with_jpeg": "libjpeg",
}

@property
def _minimum_cpp_standard(self):
return 14

@property
def _compilers_minimum_version(self):
return {
"gcc": "5",
"clang": "3.4",
"apple-clang": "10",
}

def export_sources(self):
export_conandata_patches(self)

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

def configure(self):
if self.options.shared:
try:
del self.options.fPIC
except Exception:
pass

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

def requirements(self):
# https://qpdf.readthedocs.io/en/stable/installation.html#basic-dependencies
self.requires("zlib/1.2.13")
if self.options.with_ssl == "openssl":
self.requires("openssl/1.1.1q")
elif self.options.with_ssl == "gnutls":
raise ConanInvalidConfiguration("GnuTLS is not available in Conan Center yet.")
if self.options.with_jpeg == "libjpeg":
self.requires("libjpeg/9e")
elif self.options.with_jpeg == "libjpeg-turbo":
self.requires("libjpeg-turbo/2.1.4")
elif self.options.with_jpeg == "mozjpeg":
self.requires("mozjpeg/4.1.1")


def validate(self):
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, self._minimum_cpp_standard)
if is_msvc(self):
check_min_vs(self, "150")
else:
minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False)
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.")

def build_requirements(self):
self.tool_requires("cmake/3.24.1")
self.tool_requires("pkgconf/1.9.3")

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

def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared
# https://qpdf.readthedocs.io/en/latest/installation.html#build-time-crypto-selection
tc.variables["USE_IMPLICIT_CRYPTO"] = False
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved
tc.cache_variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True
if self.options.with_ssl == "internal":
tc.variables["REQUIRE_CRYPTO_NATIVE"] = True
tc.variables["REQUIRE_CRYPTO_GNUTLS"] = False
tc.variables["REQUIRE_CRYPTO_OPENSSL"] = False
if self.options.with_ssl == "openssl":
tc.variables["REQUIRE_CRYPTO_NATIVE"] = False
tc.variables["REQUIRE_CRYPTO_GNUTLS"] = False
tc.variables["REQUIRE_CRYPTO_OPENSSL"] = True
if self.options.with_ssl == "gnutls":
tc.variables["REQUIRE_CRYPTO_NATIVE"] = False
tc.variables["REQUIRE_CRYPTO_GNUTLS"] = True
tc.variables["REQUIRE_CRYPTO_OPENSSL"] = False
tc.generate()
# TODO: after https://github.com/conan-io/conan/issues/11962 is solved
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pin-point and clarifying at the remote discussion

# we might obsolete here cmake deps generation and cmake patching and get
# the possibility to go for to pkg_config based dependency discovery instead.
# At the moment, even with the linked work-around, the linkage is mixed-up
tc = CMakeDeps(self)
tc.generate()
tc = VirtualBuildEnv(self)
tc.generate(scope="build")
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved

def _patch_sources(self):
apply_conandata_patches(self)
# we generally expect to have one crypto in-place, but need to patch the found mechanics
# since we avoid currently the correct pkg_config
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
Copy link
Contributor

Choose a reason for hiding this comment

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

This can go in the parch I think

Copy link
Contributor Author

@cguentherTUChemnitz cguentherTUChemnitz Oct 16, 2022

Choose a reason for hiding this comment

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

Mh, it is possible, but i would like to have the handling for the FOUND_CRYPTO, USE_CRYPTO_OPENSSL, USE_CRYPTO_GNUTLS, USE_CRYPTO_NATIVE next to each other, since they are already contextwise near to each other. Since the use_crypto_xxx flags are easier handled in the conanfile.py, since they are dependending on the conan options, i would like to keep the FROUND_CRYPTO also there. Is that fine for you, @prince-chrismc ?

"set(FOUND_CRYPTO OFF)", "set(FOUND_CRYPTO ON)")
if self.options.with_ssl == "openssl":
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(USE_CRYPTO_OPENSSL OFF)", "set(USE_CRYPTO_OPENSSL ON)")
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"find_package(ZLIB REQUIRED)",
"find_package(ZLIB REQUIRED)\nfind_package(OpenSSL REQUIRED)\n")
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"PUBLIC JPEG::JPEG ZLIB::ZLIB", "PUBLIC JPEG::JPEG ZLIB::ZLIB OpenSSL::SSL")
if self.options.with_ssl == "gnutls":
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(USE_CRYPTO_GNUTLS OFF)", "set(USE_CRYPTO_GNUTLS ON)")
if self.options.with_ssl == "internal":
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(USE_CRYPTO_NATIVE OFF)", "set(USE_CRYPTO_NATIVE ON)")

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

def package(self):
copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "qpdf")

self.cpp_info.components["libqpdf"].libs = ["qpdf"]
self.cpp_info.components["libqpdf"].set_property("pkg_config_name", "libqpdf")
self.cpp_info.components["libqpdf"].set_property("cmake_target_name", "qpdf::libqpdf")
self.cpp_info.components["libqpdf"].requires.append("zlib::zlib")
self.cpp_info.components["libqpdf"].requires.append(f"{self.options.with_jpeg}::{self.options.with_jpeg}")

if self.options.with_ssl == "openssl":
self.cpp_info.components["libqpdf"].requires.append("openssl::openssl")

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["libqpdf"].system_libs.append("m")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "qpdf"
self.cpp_info.filenames["cmake_find_package_multi"] = "qpdf"
self.cpp_info.names["cmake_find_package"] = "qpdf"
self.cpp_info.names["cmake_find_package_multi"] = "qpdf"
self.cpp_info.components["libqpdf"].names["cmake_find_package"] = "libqpdf"
self.cpp_info.components["libqpdf"].names["cmake_find_package_multi"] = "libqpdf"
113 changes: 113 additions & 0 deletions recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
diff --git a/libqpdf/CMakeLists.txt b/libqpdf/CMakeLists.txt
index 7053e205..9f5962f7 100644
--- a/libqpdf/CMakeLists.txt
+++ b/libqpdf/CMakeLists.txt
@@ -128,13 +128,8 @@ include(CheckSymbolExists)
set(dep_include_directories)
set(dep_link_directories)
set(dep_link_libraries)
-set(ANYTHING_MISSING 0)

-if(WIN32 AND (EXISTS ${qpdf_SOURCE_DIR}/external-libs))
- set(EXTERNAL_LIBS 1)
-else()
- set(EXTERNAL_LIBS 0)
-endif()
+set(EXTERNAL_LIBS 0)

if(EXTERNAL_LIBS)
set(EXTLIBDIR ${qpdf_SOURCE_DIR}/external-libs)
@@ -161,9 +156,6 @@ if(NOT EXTERNAL_LIBS)
if(ZLIB_H_PATH AND ZLIB_LIB_PATH)
list(APPEND dep_include_directories ${ZLIB_H_PATH})
list(APPEND dep_link_libraries ${ZLIB_LIB_PATH})
- else()
- message(SEND_ERROR "zlib not found")
- set(ANYTHING_MISSING 1)
endif()
endif()
endif()
@@ -182,9 +174,6 @@ if(NOT EXTERNAL_LIBS)
list(APPEND dep_include_directories ${LIBJPEG_H_PATH})
list(APPEND dep_link_libraries ${LIBJPEG_LIB_PATH})
set(JPEG_INCLUDE ${LIBJPEG_H_PATH})
- else()
- message(SEND_ERROR "libjpeg not found")
- set(ANYTHING_MISSING 1)
endif()
endif()
endif()
@@ -220,9 +209,6 @@ if(USE_IMPLICIT_CRYPTO OR REQUIRE_CRYPTO_OPENSSL)
list(APPEND dep_link_libraries ${OPENSSL_LIB_PATH})
set(USE_CRYPTO_OPENSSL ON)
set(FOUND_CRYPTO ON)
- elseif(REQUIRE_CRYPTO_OPENSSL)
- message(SEND_ERROR "openssl not found")
- set(ANYTHING_MISSING 1)
endif()
endif()
endif()
@@ -241,9 +227,6 @@ if(USE_IMPLICIT_CRYPTO OR REQUIRE_CRYPTO_GNUTLS)
list(APPEND dep_link_libraries ${GNUTLS_LIB_PATH})
set(USE_CRYPTO_GNUTLS ON)
set(FOUND_CRYPTO ON)
- elseif(REQUIRE_CRYPTO_GNUTLS)
- message(SEND_ERROR "gnutls not found")
- set(ANYTHING_MISSING 1)
endif()
endif()
endif()
@@ -268,14 +251,9 @@ if(FOUND_CRYPTO)
set(DEFAULT_CRYPTO "native")
endif()
endif()
-else()
- message(SEND_ERROR "no crypto provider is available")
- set(ANYTHING_MISSING 1)
-endif()
-if(ANYTHING_MISSING)
- message(FATAL_ERROR "Missing dependencies; unable to continue")
endif()

+
message(STATUS "")
message(STATUS "*** Crypto Summary ***")
message(STATUS " GNU TLS crypto enabled: " ${USE_CRYPTO_GNUTLS})
@@ -403,6 +381,10 @@ endif()
# use PIC for the object library so we don't have to compile twice.
set(OBJECT_LIB libqpdf_object)
add_library(${OBJECT_LIB} OBJECT ${libqpdf_SOURCES})
+find_package(JPEG REQUIRED)
+find_package(ZLIB REQUIRED)
+target_link_libraries(${OBJECT_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB)
+
if(OBJECT_LIB_IS_PIC)
target_compile_definitions(${OBJECT_LIB} PRIVATE libqpdf_EXPORTS)
endif()
@@ -498,8 +480,6 @@ if(BUILD_SHARED_LIBS)
PUBLIC
$<BUILD_INTERFACE:${qpdf_INCLUDE}>
$<INSTALL_INTERFACE:include>)
- target_link_directories(${SHARED_LIB} PRIVATE ${dep_link_directories})
- target_link_libraries(${SHARED_LIB} PRIVATE ${dep_link_libraries})
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved
if(ATOMIC_LIBRARY)
target_link_libraries(${SHARED_LIB} PRIVATE ${ATOMIC_LIBRARY})
endif()
@@ -507,6 +487,8 @@ if(BUILD_SHARED_LIBS)
target_link_options(${SHARED_LIB} PRIVATE ${LD_VERSION_FLAGS})
endif()

+ target_link_libraries(${SHARED_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB)
+
target_include_directories(${SHARED_LIB}
PRIVATE ${qpdf_SOURCE_DIR}/libqpdf ${CMAKE_CURRENT_BINARY_DIR})

@@ -544,6 +526,8 @@ if(BUILD_STATIC_LIBS)
target_link_libraries(${STATIC_LIB} INTERFACE ${ATOMIC_LIBRARY})
endif()

+ target_link_libraries(${STATIC_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB)
+
# Avoid name clashes on Windows with the the DLL import library.
if(NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS)
if (WIN32)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c0915f3..6c4945d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -323,12 +323,6 @@ add_test(
# add_subdirectory order affects test order
add_subdirectory(include)
add_subdirectory(libqpdf)
-add_subdirectory(qpdf)
-add_subdirectory(libtests)
-add_subdirectory(examples)
-add_subdirectory(zlib-flate)
-add_subdirectory(manual)
-add_subdirectory(fuzz)

# We don't need to show everything -- just the things that we really
# need to be sure are right or that are turned on or off with complex
12 changes: 12 additions & 0 deletions recipes/qpdf/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.8)

project(test_package CXX)

find_package(qpdf REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE qpdf::libqpdf)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
# msvc has problems consuming #warning macro
# therefore we need a code-path in the include avoiding this warning https://github.com/qpdf/qpdf/issues/804
target_compile_definitions(${PROJECT_NAME} PUBLIC POINTERHOLDER_TRANSITION=4)
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 24 additions & 0 deletions recipes/qpdf/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os

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

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

def layout(self):
cmake_layout(self)

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

def test(self):
if can_run(self):
self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun")
21 changes: 21 additions & 0 deletions recipes/qpdf/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <qpdf/DLL.h>
#include <qpdf/QPDF.hh>
#include <qpdf/QPDFWriter.hh>
#include <iostream>

int main(int argc, char* argv[])
{
std::cout << "QPDF_VERSION " << QPDF_VERSION << "\n";
cguentherTUChemnitz marked this conversation as resolved.
Show resolved Hide resolved

try {
QPDF pdf;
pdf.emptyPDF();
QPDFWriter w(pdf, "empty_example.pdf");
w.write();
} catch (std::exception& e) {
std::cerr << e.what() << "\n";
exit(2);
}

return 0;
}
Loading