Skip to content

Commit

Permalink
(conan-io#16457) jasper: add package_type + bump deps + fix check of …
Browse files Browse the repository at this point in the history
…custom CMake variables in test package

* add package_type

* bump libjpeg-turbo

* fix test of custom CMake variables

* typo

* improve JASPER_VERSION_STRING
  • Loading branch information
SpaceIm authored and 0xFireWolf committed Apr 2, 2023
1 parent fcd999f commit eef3017
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions recipes/jasper/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class JasperConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
topics = ("toolkit", "coding", "jpeg", "images")
description = "JasPer Image Processing/Coding Tool Kit"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
Expand Down Expand Up @@ -49,13 +50,12 @@ def requirements(self):
if self.options.with_libjpeg == "libjpeg":
self.requires("libjpeg/9e")
elif self.options.with_libjpeg == "libjpeg-turbo":
self.requires("libjpeg-turbo/2.1.4")
self.requires("libjpeg-turbo/2.1.5")
elif self.options.with_libjpeg == "mozjpeg":
self.requires("mozjpeg/4.1.1")

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

def generate(self):
tc = CMakeToolchain(self)
Expand Down Expand Up @@ -106,17 +106,15 @@ def package(self):

# 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("""\
content = textwrap.dedent(f"""\
set(JASPER_FOUND TRUE)
if(DEFINED Jasper_INCLUDE_DIR)
set(JASPER_INCLUDE_DIR ${Jasper_INCLUDE_DIR})
set(JASPER_INCLUDE_DIR ${{Jasper_INCLUDE_DIR}})
endif()
if(DEFINED Jasper_LIBRARIES)
set(JASPER_LIBRARIES ${Jasper_LIBRARIES})
endif()
if(DEFINED Jasper_VERSION)
set(JASPER_VERSION_STRING ${Jasper_VERSION})
set(JASPER_LIBRARIES ${{Jasper_LIBRARIES}})
endif()
set(JASPER_VERSION_STRING "{self.version}")
""")
save(self, module_file, content)

Expand Down
2 changes: 1 addition & 1 deletion recipes/jasper/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(_custom_vars
JASPER_VERSION_STRING
)
foreach(_custom_var ${_custom_vars})
if(DEFINED _custom_var)
if(DEFINED ${_custom_var})
message(STATUS "${_custom_var}: ${${_custom_var}}")
else()
message(FATAL_ERROR "${_custom_var} not defined")
Expand Down

0 comments on commit eef3017

Please sign in to comment.