From c872fb9f53243ff5a91904dfff9298a8c0f95fbf Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 21 Dec 2022 12:45:29 +0100 Subject: [PATCH] (#13285) [jasper] Add version 3.0.6 and cross-support Conan v1 and v2 * Add version 3.0.6 Signed-off-by: Uilian Ries * Remove cmake file Signed-off-by: Uilian Ries * missing folder Signed-off-by: Uilian Ries * Fixes jasper 3.0.6 Signed-off-by: Uilian Ries * patch 2.0.33 Signed-off-by: Uilian Ries * requires conan 1.52.0 Signed-off-by: Uilian Ries * use c99 when cross-building Signed-off-by: Uilian Ries * fix cross-building Signed-off-by: Uilian Ries * Add Ninja to avoid sdk Signed-off-by: Uilian Ries * Ninja is not mandatory Signed-off-by: Uilian Ries * Remove duplicated test_package.c Signed-off-by: Uilian Ries * Links pthread Signed-off-by: Uilian Ries * Use safe deletion Signed-off-by: Uilian Ries * Remove Ninja Signed-off-by: Uilian Ries * Validate cmake defs Signed-off-by: Uilian Ries * Validate cmake alias variables Signed-off-by: Uilian Ries * Update recipes/jasper/all/test_package/CMakeLists.txt Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * cleanup & small improvements * deterministic libname * Use latest Windows SDK available Adopt a workaround provided by @jcar87, which is a temporary hotfix until having https://github.com/conan-io/conan-center-index/issues/13159 fixed. Signed-off-by: Uilian Ries * Fix toolchain position variables Signed-off-by: Uilian Ries Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/jasper/all/CMakeLists.txt | 9 - recipes/jasper/all/conandata.yml | 64 +++---- recipes/jasper/all/conanfile.py | 116 ++++++------- .../all/patches/2.0.33-0001-skip-rpath.patch | 24 +++ .../patches/2.0.33-0002-find-libjpeg.patch | 18 ++ .../all/patches/3.0.6-0001-skip-rpath.patch | 24 +++ .../all/patches/3.0.6-0002-find-libjpeg.patch | 18 ++ .../3.0.6-0003-deterministic-libname.patch | 11 ++ .../all/patches/fix-exported-symbols.patch | 163 ------------------ .../jasper/all/test_package/CMakeLists.txt | 25 +-- recipes/jasper/all/test_package/conanfile.py | 21 ++- .../jasper/all/test_v1_package/CMakeLists.txt | 8 + .../jasper/all/test_v1_package/conanfile.py | 17 ++ recipes/jasper/config.yml | 26 +-- 14 files changed, 225 insertions(+), 319 deletions(-) delete mode 100644 recipes/jasper/all/CMakeLists.txt create mode 100644 recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch create mode 100644 recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch create mode 100644 recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch create mode 100644 recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch create mode 100644 recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch delete mode 100644 recipes/jasper/all/patches/fix-exported-symbols.patch create mode 100644 recipes/jasper/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/jasper/all/test_v1_package/conanfile.py diff --git a/recipes/jasper/all/CMakeLists.txt b/recipes/jasper/all/CMakeLists.txt deleted file mode 100644 index daed229fb32e0..0000000000000 --- a/recipes/jasper/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_MODULE_PATH ${CONAN_CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/source_subfolder/build/cmake/modules ${CMAKE_MODULE_PATH}) - -add_subdirectory(source_subfolder) diff --git a/recipes/jasper/all/conandata.yml b/recipes/jasper/all/conandata.yml index 6867be2627152..e929114808462 100644 --- a/recipes/jasper/all/conandata.yml +++ b/recipes/jasper/all/conandata.yml @@ -1,47 +1,27 @@ sources: + "3.0.6": + url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-3.0.6.tar.gz" + sha256: "c79961bc00158f5b5dc5f5fcfa792fde9bebb024432689d0f9e3f95a097d0ec3" "2.0.33": url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-2.0.33.tar.gz" sha256: "38b8f74565ee9e7fec44657e69adb5c9b2a966ca5947ced5717cde18a7d2eca6" - "2.0.32": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.32.tar.gz" - sha256: "a3583a06698a6d6106f2fc413aa42d65d86bedf9a988d60e5cfa38bf72bc64b9" - "2.0.28": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.28.tar.gz" - sha256: "6b4e5f682be0ab1a5acb0eeb6bf41d6ce17a658bb8e2dbda95de40100939cc88" - "2.0.27": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.27.tar.gz" - sha256: "df41bd015a9dd0cc2a2e696f8ca5cbfb633323ca9429621f7fa801778681f2dd" - "2.0.26": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.26.tar.gz" - sha256: "a82a119e85b7d1f448e61309777fa5f79053a9adca4a2b5bfe44be5439fb8fea" - "2.0.25": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz" - sha256: "f5bc48e2884bcabd2aca1737baff4ca962ec665b6eb673966ced1f7adea07edb" - "2.0.24": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.24.tar.gz" - sha256: "d2d28e115968d38499163cf8086179503668ce0d71b90dd33855b3de96a1ca1d" - "2.0.23": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.23.tar.gz" - sha256: "20facc904bd9d38c20e0c090b1be3ae02ae5b2703b803013be2ecad586a18927" - "2.0.22": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.22.tar.gz" - sha256: "afc4166bff29b8a0dc46ed5e8d6a208d7976fccfd0b1146e3400c8b2948794a2" - "2.0.21": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.21.tar.gz" - sha256: "2482def06dfaa33b8d93cbe992a29723309f3c2b6e75674423a52fc82be10418" - "2.0.19": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.19.tar.gz" - sha256: "b9d16162a088617ada36450f2374d72165377cb64b33ed197c200bcfb73ec76c" - "2.0.16": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.16.tar.gz" - sha256: "f1d8b90f231184d99968f361884e2054a1714fdbbd9944ba1ae4ebdcc9bbfdb1" - "2.0.14": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.14.tar.gz" - sha256: "85266eea728f8b14365db9eaf1edc7be4c348704e562bb05095b9a077cf1a97b" patches: - "2.0.16": - - patch_file: "patches/fix-exported-symbols.patch" - base_path: "source_subfolder" - "2.0.14": - - patch_file: "patches/fix-exported-symbols.patch" - base_path: "source_subfolder" + "3.0.6": + - patch_file: "patches/3.0.6-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" + - patch_file: "patches/3.0.6-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "2.0.33": + - patch_file: "patches/2.0.33-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/2.0.33-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 796bf127244db..d677d22f394d5 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -1,8 +1,8 @@ -from conans import CMake from conan import ConanFile -from conan.tools.files import get, save, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches -from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save +from conan.tools.microsoft import is_msvc import os import textwrap @@ -14,9 +14,8 @@ class JasperConan(ConanFile): license = "JasPer-2.0" homepage = "https://jasper-software.github.io/jasper" url = "https://github.com/conan-io/conan-center-index" - topics = ("tool-kit", "coding") + topics = ("toolkit", "coding", "jpeg", "images") description = "JasPer Image Processing/Coding Tool Kit" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,19 +28,7 @@ class JasperConan(ConanFile): "with_libjpeg": "libjpeg", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") export_conandata_patches(self) def config_options(self): @@ -49,72 +36,71 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/2.1.4") elif self.options.with_libjpeg == "libjpeg": self.requires("libjpeg/9e") - def validate(self): - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) == "16": - raise ConanInvalidConfiguration(f"{self.name} Current can not build in CCI due to windows SDK version. See https://github.com/conan-io/conan-center-index/pull/13285 for the solution hopefully") - def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["JAS_ENABLE_DOC"] = False - self._cmake.definitions["JAS_ENABLE_PROGRAMS"] = False - self._cmake.definitions["JAS_ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" - self._cmake.definitions["JAS_ENABLE_OPENGL"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - apply_conandata_patches(self) - # Clean rpath in installed shared lib - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - cmds_to_remove = [ - "set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/lib\")", - "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", - "set(CMAKE_INSTALL_RPATH\n \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")", - ] - for cmd_to_remove in cmds_to_remove: - replace_in_file(self, cmakelists, cmd_to_remove, "") + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["JAS_ENABLE_DOC"] = False + tc.variables["JAS_ENABLE_LATEX"] = False + tc.variables["JAS_ENABLE_PROGRAMS"] = False + tc.variables["JAS_ENABLE_SHARED"] = self.options.shared + tc.variables["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" + tc.variables["JAS_ENABLE_OPENGL"] = False + tc.variables["JAS_ENABLE_LIBJPEG"] = True + + if cross_building(self): + tc.cache_variables["JAS_CROSSCOMPILING"] = True + tc.cache_variables["JAS_STDC_VERSION"] = "199901L" + + # TODO: Remove after fixing https://github.com/conan-io/conan-center-index/issues/13159 + # C3I workaround to force CMake to choose the highest version of + # the windows SDK available in the system + if is_msvc(self) and not self.conf.get("tools.cmake.cmaketoolchain:system_version"): + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0" + + tc.generate() + + cmakedeps = CMakeDeps(self) + cmakedeps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYRIGHT*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.settings.os == "Windows": for dll_prefix in ["concrt", "msvcp", "vcruntime"]: rm(self, f"{dll_prefix}*.dll", os.path.join(self.package_folder, "bin")) - self._create_cmake_module_variables( - os.path.join(self.package_folder, self._module_file_rel_path) - ) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_file_rel_path)) + # FIXME: Missing CMake alias variables. See https://github.com/conan-io/conan/issues/7691 def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED Jasper_FOUND) - set(JASPER_FOUND ${Jasper_FOUND}) - endif() + set(JASPER_FOUND TRUE) if(DEFINED Jasper_INCLUDE_DIR) set(JASPER_INCLUDE_DIR ${Jasper_INCLUDE_DIR}) endif() @@ -129,7 +115,7 @@ def _create_cmake_module_variables(self, module_file): @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -137,11 +123,11 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "Jasper::Jasper") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "jasper") + self.cpp_info.libs = ["jasper"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "Jasper" self.cpp_info.names["cmake_find_package_multi"] = "Jasper" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - - self.cpp_info.libs = ["jasper"] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") diff --git a/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch b/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch new file mode 100644 index 0000000000000..eb9d47cbbb014 --- /dev/null +++ b/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 230d88c..79081c2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -298,19 +298,15 @@ if (JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif("${isSystemDir}" STREQUAL "-1") + + endif() diff --git a/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch b/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch new file mode 100644 index 0000000000000..e95e029549359 --- /dev/null +++ b/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 79081c2..38b6238 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -244,12 +244,7 @@ if (JAS_ENABLE_LIBJPEG AND JPEG_FOUND) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + include_directories(${JPEG_INCLUDE_DIR}) diff --git a/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch b/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch new file mode 100644 index 0000000000000..959d169bd49ad --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cf594c..a0d253d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -740,19 +740,15 @@ if(JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if(isSystemDir EQUAL -1) +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch b/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch new file mode 100644 index 0000000000000..47a8350d738d4 --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a0d253d..19518af 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -680,12 +680,7 @@ if(JAS_ENABLE_LIBJPEG) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + jas_get_includes_from_targets(CMAKE_REQUIRED_INCLUDES JPEG::JPEG) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + set(JAS_LIBJPEG_TARGET JPEG::JPEG) diff --git a/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch b/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch new file mode 100644 index 0000000000000..567ff16e021a4 --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -254,7 +254,7 @@ endif() + # If a multiconfiguration generator is used, ensure that various output + # files are not placed in subdirectories (such as Debug and Release) + # as this will cause the CTest test suite to fail. +-if(JAS_MULTICONFIGURATION_GENERATOR) ++if(0) + if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEBUG_POSTFIX d) + endif() diff --git a/recipes/jasper/all/patches/fix-exported-symbols.patch b/recipes/jasper/all/patches/fix-exported-symbols.patch deleted file mode 100644 index 9db2d08488cee..0000000000000 --- a/recipes/jasper/all/patches/fix-exported-symbols.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- a/src/libjasper/include/jasper/jas_cm.h -+++ b/src/libjasper/include/jasper/jas_cm.h -@@ -237,13 +237,13 @@ int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name, void *val); - void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name); - #endif - --jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof, -+JAS_DLLEXPORT jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof, - jas_cmprof_t *proofprof, int op, int intent, int optimize); - --void jas_cmxform_destroy(jas_cmxform_t *xform); -+JAS_DLLEXPORT void jas_cmxform_destroy(jas_cmxform_t *xform); - - /* Apply a transform to data. */ --int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, -+JAS_DLLEXPORT int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, - jas_cmpixmap_t *out); - - int jas_cxform_optimize(jas_cmxform_t *xform, int optimize); ---- a/src/libjasper/include/jasper/jas_debug.h -+++ b/src/libjasper/include/jasper/jas_debug.h -@@ -107,10 +107,10 @@ JAS_DLLEXPORT int jas_setdbglevel(int dbglevel); - JAS_DLLEXPORT int jas_eprintf(const char *fmt, ...); - - /* Dump memory to a stream. */ --int jas_memdump(FILE *out, void *data, size_t len); -+JAS_DLLEXPORT int jas_memdump(FILE *out, void *data, size_t len); - - /* Warn about use of deprecated functionality. */ --void jas_deprecated(const char *s); -+JAS_DLLEXPORT void jas_deprecated(const char *s); - - /* Convert to a string literal */ - #define JAS_STRINGIFY(x) #x ---- a/src/libjasper/include/jasper/jas_icc.h -+++ b/src/libjasper/include/jasper/jas_icc.h -@@ -395,10 +395,10 @@ JAS_DLLEXPORT jas_iccattrval_t *jas_iccattrval_create(jas_iccuint32_t type); - - JAS_DLLEXPORT void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out); - --extern jas_uchar jas_iccprofdata_srgb[]; --extern int jas_iccprofdata_srgblen; --extern jas_uchar jas_iccprofdata_sgray[]; --extern int jas_iccprofdata_sgraylen; -+JAS_DLLEXPORT extern jas_uchar jas_iccprofdata_srgb[]; -+JAS_DLLEXPORT extern int jas_iccprofdata_srgblen; -+JAS_DLLEXPORT extern jas_uchar jas_iccprofdata_sgray[]; -+JAS_DLLEXPORT extern int jas_iccprofdata_sgraylen; - JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfrombuf(jas_uchar *buf, int len); - JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfromclrspc(int clrspc); - ---- a/src/libjasper/include/jasper/jas_image.h -+++ b/src/libjasper/include/jasper/jas_image.h -@@ -492,21 +492,21 @@ JAS_DLLEXPORT int jas_image_getfmt(jas_stream_t *in); - - - #define jas_image_cmprof(image) ((image)->cmprof_) --int jas_image_ishomosamp(jas_image_t *image); --int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, -+JAS_DLLEXPORT int jas_image_ishomosamp(jas_image_t *image); -+JAS_DLLEXPORT int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, - jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, - jas_image_coord_t vs, int sgnd, int prec); --int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, -+JAS_DLLEXPORT int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, - jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, - long *buf); --int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, -+JAS_DLLEXPORT int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, - jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, - long *buf); - - #define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof) - JAS_DLLEXPORT jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof, - int intent); --void jas_image_dump(jas_image_t *image, FILE *out); -+JAS_DLLEXPORT void jas_image_dump(jas_image_t *image, FILE *out); - - /******************************************************************************\ - * Image format-dependent operations. -@@ -514,58 +514,58 @@ void jas_image_dump(jas_image_t *image, FILE *out); - - #if !defined(EXCLUDE_JPG_SUPPORT) - /* Format-dependent operations for JPG support. */ --jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr); --int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jpg_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jpg_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_MIF_SUPPORT) - /* Format-dependent operations for MIF support. */ --jas_image_t *mif_decode(jas_stream_t *in, const char *optstr); --int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int mif_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *mif_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int mif_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_PNM_SUPPORT) - /* Format-dependent operations for PNM support. */ --jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr); --int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int pnm_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int pnm_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_RAS_SUPPORT) - /* Format-dependent operations for Sun Rasterfile support. */ --jas_image_t *ras_decode(jas_stream_t *in, const char *optstr); --int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int ras_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *ras_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int ras_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_BMP_SUPPORT) - /* Format-dependent operations for BMP support. */ --jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr); --int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int bmp_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int bmp_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_JP2_SUPPORT) - /* Format-dependent operations for JP2 support. */ --jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr); --int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jp2_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jp2_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_JPC_SUPPORT) - /* Format-dependent operations for JPEG-2000 code stream support. */ --jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr); --int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jpc_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jpc_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_PGX_SUPPORT) - /* Format-dependent operations for PGX support. */ --jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr); --int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int pgx_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int pgx_validate(jas_stream_t *in); - #endif - - #ifdef __cplusplus diff --git a/recipes/jasper/all/test_package/CMakeLists.txt b/recipes/jasper/all/test_package/CMakeLists.txt index bee826cf5aec0..54cd6e29fc23c 100644 --- a/recipes/jasper/all/test_package/CMakeLists.txt +++ b/recipes/jasper/all/test_package/CMakeLists.txt @@ -1,16 +1,21 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Jasper REQUIRED) -message("JASPER_FOUND: ${JASPER_FOUND}") -message("JASPER_INCLUDE_DIR: ${JASPER_INCLUDE_DIR}") -message("JASPER_LIBRARIES: ${JASPER_LIBRARIES}") -message("JASPER_VERSION_STRING: ${JASPER_VERSION_STRING}") +set(_custom_vars + JASPER_FOUND + JASPER_INCLUDE_DIR + JASPER_LIBRARIES + JASPER_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) +if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") +else() + message(FATAL_ERROR "${_custom_var} not defined") +endif() +endforeach() add_executable(${PROJECT_NAME} test_package.c) -target_include_directories(${PROJECT_NAME} PRIVATE ${JASPER_INCLUDE_DIR}) -target_link_libraries(${PROJECT_NAME} ${JASPER_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PRIVATE Jasper::Jasper) diff --git a/recipes/jasper/all/test_package/conanfile.py b/recipes/jasper/all/test_package/conanfile.py index 3da371b660e0a..e845ae751a301 100644 --- a/recipes/jasper/all/test_package/conanfile.py +++ b/recipes/jasper/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +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", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jasper/all/test_v1_package/CMakeLists.txt b/recipes/jasper/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/jasper/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/jasper/all/test_v1_package/conanfile.py b/recipes/jasper/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/jasper/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jasper/config.yml b/recipes/jasper/config.yml index 61123bdc2e508..8b1f048c0d0c7 100644 --- a/recipes/jasper/config.yml +++ b/recipes/jasper/config.yml @@ -1,27 +1,5 @@ versions: - "2.0.33": - folder: all - "2.0.32": - folder: all - "2.0.28": - folder: all - "2.0.27": - folder: all - "2.0.26": - folder: all - "2.0.25": - folder: all - "2.0.24": + "3.0.6": folder: all - "2.0.23": - folder: all - "2.0.22": - folder: all - "2.0.21": - folder: all - "2.0.19": - folder: all - "2.0.16": - folder: all - "2.0.14": + "2.0.33": folder: all