Skip to content

Commit

Permalink
fix: Only build static, and turn off Framework build
Browse files Browse the repository at this point in the history
MacOS builds require that PNG_FRAMEWORK=OFF in order to find and install dynamic libraries...
...but Windows still has trouble finding and installing dynamic libraries.

Only building static libraries seems to work, as far as building wheels is concerned; but I fear older dynamic libpngs found on the system will be preferred over newer static libpngs freshly-built by OIIO when linking.

Signed-off-by: Zach Lewis <[email protected]>
  • Loading branch information
zachlewis committed Sep 17, 2024
1 parent cbb7b3c commit e9ebd58
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/cmake/build_PNG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# PNG by hand!
######################################################################

set_cache (PNG_BUILD_VERSION 1.6.43 "PNG version for local builds")
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}
set_cache (PNG_BUILD_SHARED_LIBS OFF #${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)
Expand All @@ -23,14 +23,21 @@ build_dependency_with_cmake(PNG
-D PNG_SHARED=${PNG_BUILD_SHARED_LIBS}
-D PNG_EXECUTABLES=OFF
-D PNG_TESTS=OFF
-D PNG_FRAMEWORK=OFF
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D CMAKE_INSTALL_LIBDIR=lib
)

# Set some things up that we'll need for a subsequent find_package to work
set (PNG_ROOT ${PNG_LOCAL_INSTALL_DIR})

set (PNG_DIR ${PNG_LOCAL_INSTALL_DIR})
# Signal to caller that we need to find again at the installed location
set (PNG_REFIND TRUE)
set (PNG_REFIND_VERSION ${PNG_BUILD_VERSION})
if (${PNG_BUILD_VERSION} VERSION_GREATER_EQUAL "1.6.44")
# CMake configs added in libpng 1.6.44
set (PNG_REFIND_ARGS CONFIG)
endif ()

if (PNG_BUILD_SHARED_LIBS)
install_local_dependency_libs (PNG PNG)
Expand Down

0 comments on commit e9ebd58

Please sign in to comment.