AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb

[BUILD] ZLIB Optional dependency

Open
#1,301 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.4k
Forks
774
Avg merge
3d 9h
Merged PRs (30d)
34

Description

https://github.com/AcademySoftwareFoundation/openvdb/blob/ad209a385f13cad88315b114db1c728f1bbcd2dd/CMakeLists.txt#L186

Looks like there have been some doubts about this topic when #817 got merged....

Hello there :) Is there any interest in making ZLIB a truly ZLIB? I have an application that doesn't need it and therefore I'm avoiding it to include it on the build. By just applying the following patch is enough to fix this problem. I'm building `blos-c` from source, with the ` -DPREFER_EXTERNAL_COMPLIBS=OFF` flag disabled and so far the whole build has been working

```diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2afab66..09556c18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,10 +183,6 @@ elseif(NOT ${OPENVDB_SIMD} IN_LIST _OPENVDB_SIMD_OPTIONS)
set(OPENVDB_SIMD None CACHE STRING FORCE)
endif()

-if(USE_BLOSC AND NOT USE_ZLIB)
- message(WARNING "ZLib can only be disabled if Blosc is also disabled. Enabling ZLib.")
-endif()
-
if(USE_NANOVDB)
if(OPENVDB_BUILD_CORE AND NOT OPENVDB_BUILD_NANOVDB)
message(FATAL_ERROR "Invalid CMake build configuration:
diff --git a/openvdb/openvdb/CMakeLists.txt b/openvdb/openvdb/CMakeLists.txt
index dcdaddad..7e45d64d 100644
--- a/openvdb/openvdb/CMakeLists.txt
+++ b/openvdb/openvdb/CMakeLists.txt
@@ -184,7 +184,7 @@ else()
)
endif()

-if(USE_BLOSC OR USE_ZLIB)
+if(USE_ZLIB)
if(USE_STATIC_DEPENDENCIES)
set(_ZLIB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
@@ -237,7 +237,7 @@ if(USE_BLOSC)
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS Blosc::blosc)
endif()

-if(USE_BLOSC OR USE_ZLIB)
+if(USE_ZLIB)
list(APPEND OPENVDB_CORE_DEPENDENT_LIBS ZLIB::ZLIB)
endif()

```

Contributor guide

Open the contributing guide

Research direction

Start with the linked CMakeLists.txt section and the dependency logic in openvdb/openvdb/CMakeLists.txt. Review the proposed conditions for USE_BLOSC and USE_ZLIB, then configure and build with ZLIB disabled to verify that an application using Blosc does not force ZLIB.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.