From 221972b081042ae628c74650f1cfe08c0867fc12 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 28 Sep 2022 19:04:50 +0900 Subject: [PATCH] (#13031) mozjpeg: add version 4.1.1 and support conan v2 * mozjpeg: add version 4.1.1 and support conan v2 * add argument to is_msvc_static_untime * Update conanfile.py * fix bug in bin_path * remove lib64 folder * fix jpeg file path * fix binary install folder * fix link error in MT * fix wrong condition for WITH_CRT_DLL * revert ENABLE_SHARED,ENABLE_STATIC * fix static binary path * use TARGET_FILE in 3.3.1 --- recipes/mozjpeg/all/CMakeLists.txt | 9 - recipes/mozjpeg/all/conandata.yml | 17 +- recipes/mozjpeg/all/conanfile.py | 208 ++++++++++-------- .../all/patches/3.3.1-0001-cmake-fixes.patch | 10 +- .../all/patches/4.1.1-0001-cmake-fixes.patch | 34 +++ .../mozjpeg/all/test_package/CMakeLists.txt | 8 +- recipes/mozjpeg/all/test_package/conanfile.py | 22 +- .../all/test_v1_package/CMakeLists.txt | 11 + .../mozjpeg/all/test_v1_package/conanfile.py | 19 ++ recipes/mozjpeg/config.yml | 4 +- 10 files changed, 218 insertions(+), 124 deletions(-) delete mode 100644 recipes/mozjpeg/all/CMakeLists.txt create mode 100644 recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch create mode 100644 recipes/mozjpeg/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/mozjpeg/all/test_v1_package/conanfile.py diff --git a/recipes/mozjpeg/all/CMakeLists.txt b/recipes/mozjpeg/all/CMakeLists.txt deleted file mode 100644 index 6d4e2abf9a485..0000000000000 --- a/recipes/mozjpeg/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -include(GNUInstallDirs) - -add_subdirectory(source_subfolder) diff --git a/recipes/mozjpeg/all/conandata.yml b/recipes/mozjpeg/all/conandata.yml index 49a83576b27b3..b3cb941ad21eb 100644 --- a/recipes/mozjpeg/all/conandata.yml +++ b/recipes/mozjpeg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.1": + url: "https://github.com/mozilla/mozjpeg/archive/v4.1.1.tar.gz" + sha256: "66b1b8d6b55d263f35f27f55acaaa3234df2a401232de99b6d099e2bb0a9d196" "4.0.0": url: "https://github.com/mozilla/mozjpeg/archive/v4.0.0.tar.gz" sha256: "961e14e73d06a015e9b23b8af416f010187cc0bec95f6e3b0fcb28cc7e2cbdd4" @@ -6,9 +9,15 @@ sources: url: "https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz" sha256: "aebbea60ea038a84a2d1ed3de38fdbca34027e2e54ee2b7d08a97578be72599d" patches: + "4.1.1": + - patch_file: "patches/4.1.1-0001-cmake-fixes.patch" + patch_description: "fix install folder and disable /NODEFAULT in MSVC" + patch_type: "conan" "4.0.0": - - base_path: "source_subfolder" - patch_file: "patches/4.0.0-0001-cmake-fixes.patch" + - patch_file: "patches/4.0.0-0001-cmake-fixes.patch" + patch_description: "fix install folder" + patch_type: "conan" "3.3.1": - - base_path: "source_subfolder" - patch_file: "patches/3.3.1-0001-cmake-fixes.patch" + - patch_file: "patches/3.3.1-0001-cmake-fixes.patch" + patch_description: "fix install folder" + patch_type: "conan" diff --git a/recipes/mozjpeg/all/conanfile.py b/recipes/mozjpeg/all/conanfile.py index 5e05fb0bce716..691c801f8bb8c 100644 --- a/recipes/mozjpeg/all/conanfile.py +++ b/recipes/mozjpeg/all/conanfile.py @@ -1,19 +1,24 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools -import os - +from conan import ConanFile +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, get, copy, rm, rmdir, export_conandata_patches +from conan.tools.build import cross_building +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.env import VirtualBuildEnv +from conan.tools.layout import basic_layout -required_conan_version = ">=1.33.0" +import os +required_conan_version = ">=1.52.0" class MozjpegConan(ConanFile): name = "mozjpeg" description = "MozJPEG is an improved JPEG encoder" - url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics") license = ("BSD", "BSD-3-Clause", "ZLIB") + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mozilla/mozjpeg" - exports_sources = ("CMakeLists.txt", "patches/*") - generators = "cmake" + topics = ("conan", "image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -42,21 +47,13 @@ class MozjpegConan(ConanFile): "enable12bit": False, } - _autotools = None - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_simd_support(self): return self.settings.arch in ["x86", "x86_64"] + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -65,110 +62,133 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass self.provides = ["libjpeg", "libjpeg-turbo"] if self.options.turbojpeg else "libjpeg" @property def _use_cmake(self): - return self.settings.os == "Windows" or tools.Version(self.version) >= "4.0.0" + return self.settings.os == "Windows" or Version(self.version) >= "4.0.0" + + def layout(self): + if self._use_cmake: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder='src') def build_requirements(self): - if not self._use_cmake: - if self.settings.os != "Windows": - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") + if not self._use_cmake and self.settings.os != "Windows": + self.tool_requires("libtool/2.4.7") + self.tool_requires("pkgconf/1.7.4") if self.options.get_safe("SIMD"): - self.build_requires("nasm/2.15.05") + self.tool_requires("nasm/2.15.05") def source(self): - tools.get(**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) - if tools.cross_building(self.settings): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate_cmake(self): + tc = CMakeToolchain(self) + if cross_building(self): # FIXME: too specific and error prone, should be delegated to CMake helper cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor - self._cmake.definitions["ENABLE_TESTING"] = False - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["REQUIRE_SIMD"] = self.options.get_safe("SIMD", False) - self._cmake.definitions["WITH_SIMD"] = self.options.get_safe("SIMD", False) - self._cmake.definitions["WITH_ARITH_ENC"] = self.options.arithmetic_encoder - self._cmake.definitions["WITH_ARITH_DEC"] = self.options.arithmetic_decoder - self._cmake.definitions["WITH_JPEG7"] = self.options.libjpeg7_compatibility - self._cmake.definitions["WITH_JPEG8"] = self.options.libjpeg8_compatibility - self._cmake.definitions["WITH_MEM_SRCDST"] = self.options.mem_src_dst - self._cmake.definitions["WITH_TURBOJPEG"] = self.options.turbojpeg - self._cmake.definitions["WITH_JAVA"] = self.options.java - self._cmake.definitions["WITH_12BIT"] = self.options.enable12bit - self._cmake.definitions["CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT"] = False - self._cmake.definitions["PNG_SUPPORTED"] = False # PNG and zlib are only required for executables (and static libraries) - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["WITH_CRT_DLL"] = "MD" in str(self.settings.compiler.runtime) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), - "--with-simd={}".format(yes_no(self.options.get_safe("SIMD", False))), - "--with-arith-enc={}".format(yes_no(self.options.arithmetic_encoder)), - "--with-arith-dec={}".format(yes_no(self.options.arithmetic_decoder)), - "--with-jpeg7={}".format(yes_no(self.options.libjpeg7_compatibility)), - "--with-jpeg8={}".format(yes_no(self.options.libjpeg8_compatibility)), - "--with-mem-srcdst={}".format(yes_no(self.options.mem_src_dst)), - "--with-turbojpeg={}".format(yes_no(self.options.turbojpeg)), - "--with-java={}".format(yes_no(self.options.java)), - "--with-12bit={}".format(yes_no(self.options.enable12bit)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_TESTING"] = False + tc.variables["REQUIRE_SIMD"] = bool(self.options.get_safe("SIMD", False)) + tc.variables["WITH_SIMD"] = bool(self.options.get_safe("SIMD", False)) + tc.variables["WITH_ARITH_ENC"] = bool(self.options.arithmetic_encoder) + tc.variables["WITH_ARITH_DEC"] = bool(self.options.arithmetic_decoder) + tc.variables["WITH_JPEG7"] = bool(self.options.libjpeg7_compatibility) + tc.variables["WITH_JPEG8"] = bool(self.options.libjpeg8_compatibility) + tc.variables["WITH_MEM_SRCDST"] = bool(self.options.mem_src_dst) + tc.variables["WITH_TURBOJPEG"] = bool(self.options.turbojpeg) + tc.variables["WITH_JAVA"] = bool(self.options.java) + tc.variables["WITH_12BIT"] = bool(self.options.enable12bit) + tc.variables["CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT"] = False + tc.variables["PNG_SUPPORTED"] = False # PNG and zlib are only required for executables (and static libraries) + if is_msvc(self): + tc.variables["WITH_CRT_DLL"] = not is_msvc_static_runtime(self) + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def generate_autotools(self): + toolchain = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + toolchain.configure_args.append("--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True)))) + toolchain.configure_args.append("--with-simd={}".format(yes_no(self.options.get_safe("SIMD", False)))) + toolchain.configure_args.append("--with-arith-enc={}".format(yes_no(self.options.arithmetic_encoder))) + toolchain.configure_args.append("--with-arith-dec={}".format(yes_no(self.options.arithmetic_decoder))) + toolchain.configure_args.append("--with-jpeg7={}".format(yes_no(self.options.libjpeg7_compatibility))) + toolchain.configure_args.append("--with-jpeg8={}".format(yes_no(self.options.libjpeg8_compatibility))) + toolchain.configure_args.append("--with-mem-srcdst={}".format(yes_no(self.options.mem_src_dst))) + toolchain.configure_args.append("--with-turbojpeg={}".format(yes_no(self.options.turbojpeg))) + toolchain.configure_args.append("--with-java={}".format(yes_no(self.options.java))) + toolchain.configure_args.append("--with-12bit={}".format(yes_no(self.options.enable12bit))) + toolchain.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + def generate(self): + if self._use_cmake: + self.generate_cmake() + else: + self.generate_autotools() + + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self._use_cmake: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self._use_cmake: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "doc")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rm(self, pattern="*.la", folder=os.path.join(self.package_folder, "lib")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=os.path.join(self.package_folder, "lib64")) + rmdir(self, os.path.join(self.package_folder, "lib64")) # remove binaries and pdb files for bin_pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), bin_pattern_to_remove) + rm(self, pattern=bin_pattern_to_remove, folder=os.path.join(self.package_folder, "bin")) def _lib_name(self, name): - if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio" and not self.options.shared: + if is_msvc(self) and not self.options.shared: return name + "-static" return name @@ -176,11 +196,11 @@ def package_info(self): # libjpeg self.cpp_info.components["libjpeg"].names["pkg_config"] = "libjpeg" self.cpp_info.components["libjpeg"].libs = [self._lib_name("jpeg")] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libjpeg"].system_libs.append("m") # libturbojpeg if self.options.turbojpeg: self.cpp_info.components["libturbojpeg"].names["pkg_config"] = "libturbojpeg" self.cpp_info.components["libturbojpeg"].libs = [self._lib_name("turbojpeg")] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libturbojpeg"].system_libs.append("m") diff --git a/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch b/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch index b126195864e79..de72859433e6a 100644 --- a/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch +++ b/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 743a243..b5d41a1 100644 +index 743a243..eb787c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") @@ -34,7 +34,7 @@ index 743a243..b5d41a1 100644 install(TARGETS turbojpeg-static ARCHIVE DESTINATION lib) if(NOT ENABLE_SHARED) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tjbench-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME tjbench.exe) endif() endif() @@ -46,13 +46,13 @@ index 743a243..b5d41a1 100644 install(TARGETS jpeg-static ARCHIVE DESTINATION lib) if(NOT ENABLE_SHARED) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cjpeg-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME cjpeg.exe) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/djpeg-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME djpeg.exe) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jpegtran-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME jpegtran.exe) endif() endif() diff --git a/recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch b/recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch new file mode 100644 index 0000000000000..0d6ad37fc19fd --- /dev/null +++ b/recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8d295c6..b30dacb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1461,7 +1461,7 @@ if(WITH_TURBOJPEG) + else() + set(DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() +- install(PROGRAMS ${DIR}/tjbench-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME tjbench${EXE}) + endif() + endif() +@@ -1479,16 +1479,16 @@ if(ENABLE_STATIC) + else() + set(DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() +- install(PROGRAMS ${DIR}/cjpeg-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME cjpeg${EXE}) +- install(PROGRAMS ${DIR}/djpeg-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME djpeg${EXE}) +- install(PROGRAMS ${DIR}/jpegtran-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME jpegtran${EXE}) + endif() + endif() + +-install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++install(TARGETS rdjpgcom wrjpgcom DESTINATION ${CMAKE_INSTALL_BINDIR}) + + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.ijg + ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/example.txt diff --git a/recipes/mozjpeg/all/test_package/CMakeLists.txt b/recipes/mozjpeg/all/test_package/CMakeLists.txt index 7b9b613cbb24a..9d43e05ca2a27 100644 --- a/recipes/mozjpeg/all/test_package/CMakeLists.txt +++ b/recipes/mozjpeg/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) + project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mozjpeg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::libjpeg) diff --git a/recipes/mozjpeg/all/test_package/conanfile.py b/recipes/mozjpeg/all/test_package/conanfile.py index 3ae27388e5a6d..eb44b6270b92d 100644 --- a/recipes/mozjpeg/all/test_package/conanfile.py +++ b/recipes/mozjpeg/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -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" + 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) @@ -12,7 +20,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_name = os.path.join(self.source_folder, "testimg.jpg") - self.run("%s %s" % (bin_path, img_name), run_environment=True) + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt b/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f4df079837a44 --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(mozjpeg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::libjpeg) diff --git a/recipes/mozjpeg/all/test_v1_package/conanfile.py b/recipes/mozjpeg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cf6e3a0371de5 --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/mozjpeg/config.yml b/recipes/mozjpeg/config.yml index 7bdb507696897..c5a4dbb215dd3 100644 --- a/recipes/mozjpeg/config.yml +++ b/recipes/mozjpeg/config.yml @@ -1,5 +1,7 @@ versions: - "3.3.1": + "4.1.1": folder: all "4.0.0": folder: all + "3.3.1": + folder: all