Skip to content

Commit 164bc4a

Browse files
committed
png
Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 45a24a0 commit 164bc4a

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
# Utility script to download and build libpng
4+
#
5+
# Copyright Contributors to the OpenImageIO project.
6+
# SPDX-License-Identifier: Apache-2.0
7+
# https://github.com/AcademySoftwareFoundation/OpenImageIO
8+
9+
# Exit the whole script if any command fails.
10+
set -ex
11+
12+
# Repo and branch/tag/commit of libpng to download if we don't have it yet
13+
LIBPNG_REPO=${LIBPNG_REPO:=https://github.com/glennrp/libpng.git}
14+
LIBPNG_VERSION=${LIBPNG_VERSION:=v1.6.35}
15+
16+
# Where to put libpng repo source (default to the ext area)
17+
LIBPNG_SRC_DIR=${LIBPNG_SRC_DIR:=${PWD}/ext/libpng}
18+
# Temp build area (default to a build/ subdir under source)
19+
LIBPNG_BUILD_DIR=${LIBPNG_BUILD_DIR:=${LIBPNG_SRC_DIR}/build}
20+
# Install area for libpng (default to ext/dist)
21+
LIBPNG_INSTALL_DIR=${LIBPNG_INSTALL_DIR:=${PWD}/ext/dist}
22+
#LIBPNG_CONFIG_OPTS=${LIBPNG_CONFIG_OPTS:=}
23+
24+
pwd
25+
echo "libpng install dir will be: ${LIBPNG_INSTALL_DIR}"
26+
27+
mkdir -p ./ext
28+
pushd ./ext
29+
30+
# Clone libpng project from GitHub and build
31+
if [[ ! -e ${LIBPNG_SRC_DIR} ]] ; then
32+
echo "git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}"
33+
git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}
34+
fi
35+
cd ${LIBPNG_SRC_DIR}
36+
37+
38+
echo "git checkout ${LIBPNG_VERSION} --force"
39+
git checkout ${LIBPNG_VERSION} --force
40+
41+
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
42+
time cmake -S . -B ${LIBPNG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
43+
-DCMAKE_INSTALL_PREFIX=${LIBPNG_INSTALL_DIR} \
44+
-DPNG_EXECUTABLES=OFF \
45+
-DPNG_TESTS=OFF \
46+
${LIBPNG_CONFIG_OPTS}
47+
time cmake --build ${LIBPNG_BUILD_DIR} --config Release --target install
48+
fi
49+
50+
# ls -R ${LIBPNG_INSTALL_DIR}
51+
popd
52+
53+
54+
# Set up paths. These will only affect the caller if this script is
55+
# run with 'source' rather than in a separate shell.
56+
export PNG_ROOT=$LIBPNG_INSTALL_DIR
57+

src/build-scripts/gh-win-installdeps.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ vcpkg list
9292
src/build-scripts/build_zlib.bash
9393
export ZLIB_ROOT=$PWD/ext/dist
9494

95-
# src/build-scripts/build_libpng.bash
96-
# export PNG_ROOT=$PWD/ext/dist
95+
src/build-scripts/build_libpng.bash
96+
export PNG_ROOT=$PWD/ext/dist
9797

9898
# We're currently getting libtiff from vcpkg
9999
# src/build-scripts/build_libtiff.bash

0 commit comments

Comments
 (0)