Skip to content

Commit

Permalink
Adsk contrib - Fix issue with minizip build (#1725)
Browse files Browse the repository at this point in the history
* - Refactoring how OCIO search for minizip-ng. The first step is to search for an external minizip-ng. If not found, search for minizip-ng with MZ_COMPAT=ON (libminizip). If it is not found either, download and install minizip-ng with MZ_COMPAT=OFF.
- Removing the minizip-ng part for the includes for minizip-ng headers.

Signed-off-by: Cédrik Fuoco <[email protected]>

* Update comments

Signed-off-by: Cédrik Fuoco <[email protected]>

* Improved find_package in Config mode (adding it back)
Added missing scripts to install minizip-ng and zlib for the analysis workflow

Signed-off-by: Cédrik Fuoco <[email protected]>

* Adding +x permissions for install_minizip_ng and zlib
Fixing path to find zlib in install_minizip-ng.sh

Signed-off-by: Cédrik Fuoco <[email protected]>

* Changing target name to match the one used by minizip-ng library (+ using the imported target instead of creating a new one when minizip-ng is found)

Signed-off-by: Cédrik Fuoco <[email protected]>

Signed-off-by: Cédrik Fuoco <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
(cherry picked from commit 811902b)
  • Loading branch information
cedrik-fuoco-adsk committed Jan 5, 2023
1 parent 69ed32a commit 139e36f
Show file tree
Hide file tree
Showing 10 changed files with 479 additions and 124 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/analysis_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ jobs:
run: |
share/ci/scripts/multi/install_pugixml.sh latest
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
Expand Down Expand Up @@ -206,12 +209,15 @@ jobs:
share/ci/scripts/macos/install_boost.sh latest
share/ci/scripts/multi/install_pugixml.sh latest $EXT_PATH
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
- name: Install latest ext package versions
run: |
share/ci/scripts/multi/install_imath.sh latest $EXT_PATH
Expand Down Expand Up @@ -325,12 +331,15 @@ jobs:
share/ci/scripts/multi/install_pugixml.sh latest $EXT_PATH
shell: bash
- name: Install fixed ext package versions
# Minizip-ng depends on ZLIB. ZLIB must be installed first.
run: |
share/ci/scripts/multi/install_lcms2.sh 2.2 $EXT_PATH
share/ci/scripts/multi/install_yaml-cpp.sh 0.7.0 $EXT_PATH
share/ci/scripts/multi/install_pystring.sh 1.1.3 $EXT_PATH
share/ci/scripts/multi/install_pybind11.sh 2.9.2 $EXT_PATH
share/ci/scripts/multi/install_expat.sh 2.4.1 $EXT_PATH
share/ci/scripts/multi/install_zlib.sh 1.2.12 $EXT_PATH
share/ci/scripts/multi/install_minizip-ng.sh 3.0.6 $EXT_PATH
shell: bash
# OSL not installed due to LLVM compilation time.
- name: Install latest ext package versions
Expand Down
57 changes: 57 additions & 0 deletions share/ci/scripts/multi/install_minizip-ng.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.

set -ex

MINIZIPNG_VERSION="$1"
INSTALL_TARGET="$2"

MINIZIPNG_MAJOR_MINOR=$(echo "${MINIZIPNG_VERSION}" | cut -d. -f-2)
MINIZIPNG_MAJOR=$(echo "${MINIZIPNG_VERSION}" | cut -d. -f-1)
MINIZIPNG_MINOR=$(echo "${MINIZIPNG_MAJOR_MINOR}" | cut -d. -f2-)
MINIZIPNG_PATCH=$(echo "${MINIZIPNG_VERSION}" | cut -d. -f3-)
MINIZIPNG_VERSION_U="${MINIZIPNG_MAJOR}.${MINIZIPNG_MINOR}.${MINIZIPNG_PATCH}"

git clone https://github.com/zlib-ng/minizip-ng
cd minizip-ng

if [ "$MINIZIPNG_VERSION" == "latest" ]; then
LATEST_TAG=$(git describe --abbrev=0 --tags)
git checkout tags/${LATEST_TAG} -b ${LATEST_TAG}
else
git checkout tags/${MINIZIPNG_VERSION_U} -b ${MINIZIPNG_VERSION_U}
fi

mkdir build
cd build

cmake -DCMAKE_BUILD_TYPE=Release \
${INSTALL_TARGET:+"-DCMAKE_INSTALL_PREFIX="${INSTALL_TARGET}""} \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DMZ_OPENSSL=OFF \
-DMZ_LIBBSD=OFF \
-DMZ_BUILD_TESTS=OFF \
-DMZ_COMPAT=OFF \
-DMZ_BZIP2=OFF \
-DMZ_LZMA=OFF \
-DMZ_LIBCOMP=OFF \
-DMZ_ZSTD=OFF \
-DMZ_PKCRYPT=OFF \
-DMZ_WZAES=OFF \
-DMZ_SIGNING=OFF \
-DMZ_ZLIB=ON \
-DMZ_ICONV=OFF \
-DMZ_FETCH_LIBS=OFF \
-DMZ_FORCE_FETCH_LIBS=OFF \
-DZLIB_LIBRARY=${INSTALL_TARGET}/${CMAKE_INSTALL_LIBDIR} \
-DZLIB_INCLUDE_DIR=${INSTALL_TARGET}/include \
../.
cmake --build . \
--target install \
--config Release \
--parallel 2

cd ../..
rm -rf minizip-ng
40 changes: 40 additions & 0 deletions share/ci/scripts/multi/install_zlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.

set -ex

ZLIB_VERSION="$1"
INSTALL_TARGET="$2"

ZLIB_MAJOR_MINOR=$(echo "${ZLIB_VERSION}" | cut -d. -f-2)
ZLIB_MAJOR=$(echo "${ZLIB_VERSION}" | cut -d. -f-1)
ZLIB_MINOR=$(echo "${ZLIB_MAJOR_MINOR}" | cut -d. -f2-)
ZLIB_PATCH=$(echo "${ZLIB_VERSION}" | cut -d. -f3-)
ZLIB_VERSION_U="${ZLIB_MAJOR}.${ZLIB_MINOR}.${ZLIB_PATCH}"

git clone https://github.com/madler/zlib
cd zlib

if [ "$ZLIB_VERSION" == "latest" ]; then
LATEST_TAG=$(git describe --abbrev=0 --tags)
git checkout tags/${LATEST_TAG} -b ${LATEST_TAG}
else
git checkout tags/v${ZLIB_VERSION_U} -b v${ZLIB_VERSION_U}
fi

mkdir build
cd build

cmake -DCMAKE_BUILD_TYPE=Release \
${INSTALL_TARGET:+"-DCMAKE_INSTALL_PREFIX="${INSTALL_TARGET}""} \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=OFF \
../.
cmake --build . \
--target install \
--config Release \
--parallel 2

cd ../..
rm -rf zlib
Loading

0 comments on commit 139e36f

Please sign in to comment.