Skip to content
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

deps: Add build recipe for PNG #4423

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions THIRD-PARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,44 @@ DEALINGS IN THE SOFTWARE.

-------------------------------------------------------------------------

PNG Reference Library License version 2
SPDX-License-Identifier: libpng-2.0

* libpng https://github.com/pnggroup/libpng
Copyright (c) 1995-2024 The PNG Reference Library Authors.
Copyright (c) 1995-2024 The PNG Reference Library Authors.
Copyright (c) 2018-2024 Cosmin Truta.
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
Copyright (c) 1996-1997 Andreas Dilger.
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.

The software is supplied "as is", without warranty of any kind,
express or implied, including, without limitation, the warranties
of merchantability, fitness for a particular purpose, title, and
non-infringement. In no event shall the Copyright owners, or
anyone distributing the software, be liable for any damages or
other liability, whether in contract, tort or otherwise, arising
from, out of, or in connection with the software, or the use or
other dealings in the software, even if advised of the possibility
of such damage.

Permission is hereby granted to use, copy, modify, and distribute
this software, or portions hereof, for any purpose, without fee,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you
use this software in a product, an acknowledgment in the product
documentation would be appreciated, but is not required.

2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.

3. This Copyright notice may not be removed or altered from any
source or altered source distribution.

-------------------------------------------------------------------------

Zlib license
SPDX-License-Identifier: Zlib

Expand Down
45 changes: 45 additions & 0 deletions src/cmake/build_PNG.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

######################################################################
# PNG by hand!
######################################################################

set_cache (PNG_BUILD_VERSION 1.6.44 "PNG version for local builds")
set (PNG_GIT_REPOSITORY "https://github.com/glennrp/libpng")
set (PNG_GIT_TAG "v${PNG_BUILD_VERSION}")

set_cache (PNG_BUILD_SHARED_LIBS ${LOCAL_BUILD_SHARED_LIBS_DEFAULT}
DOC "Should execute a local PNG build, if necessary, build shared libraries" ADVANCED)

string (MAKE_C_IDENTIFIER ${PNG_BUILD_VERSION} PNG_VERSION_IDENT)

build_dependency_with_cmake(PNG
VERSION ${PNG_BUILD_VERSION}
GIT_REPOSITORY ${PNG_GIT_REPOSITORY}
GIT_TAG ${PNG_GIT_TAG}
CMAKE_ARGS
-D PNG_SHARED=${PNG_BUILD_SHARED_LIBS}
-D PNG_STATIC=ON
-D PNG_EXECUTABLES=OFF
-D PNG_TESTS=OFF
-D PNG_FRAMEWORK=OFF
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D CMAKE_INSTALL_LIBDIR=lib
)


if (PNG_BUILD_VERSION VERSION_LESS 1.6.44)
set (PNG_DIR ${PNG_LOCAL_INSTALL_DIR}/lib/libpng/libpng16)
else ()
set (PNG_DIR ${PNG_LOCAL_INSTALL_DIR}/lib/cmake/PNG)
endif ()

find_package(PNG ${PNG_BUILD_VERSION} REQUIRED
PATHS "${PNG_LOCAL_INSTALL_DIR}" "${PNG_DIR}"
NO_DEFAULT_PATH)

if (PNG_BUILD_SHARED_LIBS)
install_local_dependency_libs (PNG png16)
endif ()
Loading