Skip to content

Commit

Permalink
(#19942) imagl: Patching sources' CMakeLists.txt to use find_package …
Browse files Browse the repository at this point in the history
…instead of legacy conan 1.X cmake generator

* Updating imagl recipe for conan 2.0

* adding src_folder parameter to cmake_layout to please linter

* Back to minimum conan 1.59

* Inspired by zlib recipe and now it passes v1 hooks.

* Do not use validate_build(), but validate() instead

* Applying jwillikers suggestions.

* Final endline added

* add cmake_find_package_multi generator as jwillikers suggests it.

Co-authored-by: Jordan Williams <jordan@jwillikers.com>

* Removing base_path from patches and a useless _cmake member of ImaglConan class

* -Switch to github URLs since my GitLab instance is temporarily down
-Change license name to uppercase

* Patching sources' CMakeLists.txt to make it compatible with conan 2.0+ by using find_package instead of old conan 1.X cmake generator

* new-line forgotten

* This time, one space too many...

---------

Co-authored-by: Jordan Williams <jordan@jwillikers.com>
Co-authored-by: Daniel <danimanzaneque@gmail.com>
  • Loading branch information
3 people authored Jun 7, 2024
1 parent f1f5eb3 commit 4b6396d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
12 changes: 12 additions & 0 deletions recipes/imagl/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@ patches:
- patch_file: "patches/0001-no-unmanaged-conan-0.1.x.patch"
patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan"
patch_type: conan
- patch_file: "patches/0002-use-findpackage-0.1.x.patch"
patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0"
patch_type: conan
"0.1.1":
- patch_file: "patches/0001-no-unmanaged-conan-0.1.x.patch"
patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan"
patch_type: conan
- patch_file: "patches/0002-use-findpackage-0.1.x.patch"
patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0"
patch_type: conan
"0.1.2":
- patch_file: "patches/0001-no-unmanaged-conan-0.1.x.patch"
patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan"
patch_type: conan
- patch_file: "patches/0002-use-findpackage-0.1.x.patch"
patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0"
patch_type: conan
"0.2.1":
- patch_file: "patches/0001-no-unmanaged-conan-0.2.1.patch"
patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan"
patch_type: conan
- patch_file: "patches/0002-use-findpackage-0.2.1.patch"
patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0"
patch_type: conan
15 changes: 15 additions & 0 deletions recipes/imagl/all/patches/0002-use-findpackage-0.1.x.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- a/imaGL/CMakeLists.txt
+++ b/imaGL/CMakeLists.txt
@@ -12,9 +12,10 @@ set_property(TARGET libImaGL PROPERTY OUTPUT_NAME imaGL)
set_property(TARGET libImaGL PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/public/imaGL/imaGL.h")
target_include_directories(libImaGL INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/public")

-if(TARGET CONAN_PKG::libpng)
+find_package(PNG)
+if(PNG_FOUND)
add_compile_definitions(_HAS_PNG)
- target_link_libraries (libImaGL CONAN_PKG::libpng)
+ target_link_libraries (libImaGL PNG::PNG)
endif()

file(GLOB_RECURSE ImaGL_SRC "*.h" "*.cpp")
23 changes: 23 additions & 0 deletions recipes/imagl/all/patches/0002-use-findpackage-0.2.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/imaGL/CMakeLists.txt
+++ b/imaGL/CMakeLists.txt
@@ -12,14 +12,16 @@ set_property(TARGET libImaGL PROPERTY OUTPUT_NAME imaGL)
set_property(TARGET libImaGL PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/public/imaGL/imaGL.h")
target_include_directories(libImaGL INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/public")

-if(TARGET CONAN_PKG::libpng)
+find_package(PNG)
+if(PNG_FOUND)
add_compile_definitions(_HAS_PNG)
- target_link_libraries (libImaGL CONAN_PKG::libpng)
+ target_link_libraries (libImaGL PNG::PNG)
endif()

-if(TARGET CONAN_PKG::libjpeg)
+find_package(JPEG)
+if(JPEG_FOUND)
add_compile_definitions(_HAS_JPEG)
- target_link_libraries (libImaGL CONAN_PKG::libjpeg)
+ target_link_libraries (libImaGL JPEG::JPEG)
endif()

file(GLOB_RECURSE ImaGL_SRC "*.h" "*.cpp")

0 comments on commit 4b6396d

Please sign in to comment.