-
Notifications
You must be signed in to change notification settings - Fork 3
Adds support for libpng 1.6.50 #1
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
base: hunter-1.6.50
Are you sure you want to change the base?
Conversation
I've pushed Please update your PR such that it points to patch into the new This makes a review easier (or possible at all ;) ) I've also created https://github.com/cpp-pm/libpng/tree/hunter-1.6.50-neroburner with a few fixes we should integrate/discuss |
ah I can change the base myself. Nice! 😁 |
if(${CMAKE_MAJOR_VERSION} GREATER 3 OR | ||
(${CMAKE_MAJOR_VERSION} EQUAL 3 AND ${CMAKE_MINOR_VERSION} GREATER_EQUAL 12)) | ||
# For CMake >= 3.12, find_package(<PackageName>) searches prefixes given by | ||
# <PackageName>_ROOT CMake variable and <PackageName>_ROOT | ||
# environment variable. | ||
cmake_policy(SET CMP0074 NEW) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.6.50
has cmake_minimum_required(VERSION 3.14...4.0)
. So no need to guard here anymore
hunter_add_package(ZLIB) | ||
find_package(ZLIB CONFIG REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move that down to the original find_package(ZLIB)
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. tested and works fine.
option(PNG_STATIC "Build libpng as a static library" ON) | ||
if(APPLE) | ||
option(PNG_FRAMEWORK "Build libpng as a framework bundle" ON) | ||
option(PNG_FRAMEWORK "Build libpng as a framework bundle" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please explain the reasoning behind changing this flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just followed the original Hunterfied CMakeLists.txt file.
Line 58 in 88f37c2
option(PNG_FRAMEWORK "Build OS X framework" OFF) |
if(UNIX AND NOT (APPLE OR BEOS OR HAIKU OR EMSCRIPTEN)) | ||
check_library_exists(m pow "" PNG_HAVE_LIBM_POW) | ||
if(LIB_M_REQUIRED) | ||
set(M_LIBRARY m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why have M_LIBRARY
instead of using the already used PNG_LINK_LIBRARIES
of this project?
target_link_libraries(png_shared | ||
PUBLIC ${PNG_LINK_LIBRARIES}) | ||
endif() | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't needed, part of the public includes of the png
library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, just tested and it's safe to remove.
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}>") | ||
target_link_libraries(png_framework | ||
PUBLIC ${PNG_LINK_LIBRARIES}) | ||
PRIVATE ZLIB::zlib ${M_LIBRARY}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change from PUBLIC to PRIVATE
Can't we just leave the original line with PNG_LINK_LIBRARIES
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. Fixed in #2
endif() | ||
target_link_libraries(${TARGET_NAME} PRIVATE ZLIB::zlib ${M_LIBRARY}) | ||
|
||
if(PNG_TESTS AND PNG_SHARED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could replace the PNG_SHARED
with BUILD_SHARED_LIBS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rolled back most of the constants to the original code base in #2
endif() | ||
|
||
if(PNG_SHARED AND PNG_TOOLS) | ||
if(BUILD_SHARED_LIBS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PNG_TOOLS
got removed, please readd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readded in #2
@@ -0,0 +1,16 @@ | |||
include(CMakeFindDependencyMacro) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use the PNGConfig.cmake
file already available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #2
) | ||
|
||
# Create a CMake Config File that can be used via find_package(PNG CONFIG) | ||
if(NOT SKIP_INSTALL_CONFIG_FILE AND NOT SKIP_INSTALL_ALL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we keep most of the original code and change just the bits that need to be changed? Smaller patch size we need to reapply each update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. Added back original code in #2
@NeroBurner I tested your modification on the |
happy to hear it works for you. please respond to the review items as well and improve/fix them. I'd like to improve the PR even more |
This pull request adds support for libpng v1.6.50.
It is an update based on the existing hunter-1.6.36 branch. The underlying libpng source code is from the official v1.6.50 release.
Changes are confined to the Hunter-specific CMake configuration files (CMakeLists.txt and cmake/Config.cmake.in).
Tested and confirmed working on macOS.