@ -8,6 +8,7 @@ package("openvdb")
add_versions ( " 7.1.0 " , " 0c3588c1ca6e647610738654ec2c6aaf41a203fd797f609fbeab1c9f7c3dc116 " )
add_versions ( " 8.0.1 " , " a6845da7c604d2c72e4141c898930ac8a2375521e535f696c2cd92bebbe43c4f " )
add_versions ( " 8.1.0 " , " 3e09d47331429be7409a3a3c27fdd3c297f96d31d2153febe194e664a99d6183 " )
add_versions ( " 9.0.0 " , " ad3816e8f1931d1d6fdbddcec5a1acd30695d049dd10aa965096b2fb9972b468 " )
add_deps ( " cmake " )
add_deps ( " boost " , { system = false , configs = { regex = true , system = true , iostreams = true } } )
@ -19,23 +20,35 @@ package("openvdb")
add_configs ( " lod " , { description = " Command line binary for generating volume mipmaps from an OpenVDB grid. " , default = false , type = " boolean " } )
add_configs ( " render " , { description = " Command line binary for ray-tracing OpenVDB grids. " , default = false , type = " boolean " } )
add_configs ( " view " , { description = " Command line binary for displaying OpenVDB grids in a GL viewport. " , default = false , type = " boolean " } )
add_configs ( " nanovdb " , { description = " Enable building of NanoVDB Module. " , default = false , type = " boolean " } )
on_load ( " macosx " , " linux " , " windows " , function ( package )
if package : config ( " with_houdini " ) == " " then
package : add ( " deps " , " zlib " )
package : add ( " deps " , " blosc ~1.5.0 " , { configs = { shared = package : is_plat ( " linux " ) } } )
package : add ( " deps " , " openexr " , { configs = { shared = package : is_plat ( " windows " ) } } )
if package : version ( ) : ge ( " 9.0.0 " ) then
package : add ( " deps " , " blosc " )
else
package : add ( " deps " , " blosc ~1.5.0 " , { configs = { shared = package : is_plat ( " linux " ) } } )
package : add ( " deps " , " openexr 2.x " , { configs = { shared = package : is_plat ( " windows " ) } } )
end
if package : config ( " with_maya " ) == " " then
package : add ( " deps " , " tbb <2021.0 " )
package : add ( " deps " , package : version ( ) : ge ( " 9.0.0 " ) and " tbb " or "tbb <2021.0 " )
end
end
if package : config ( " view " ) then
package : add ( " deps " , " glew " , { configs = { shared = true } } )
package : add ( " deps " , " glfw " )
end
if package : config ( " render " ) then
package : add ( " deps " , " libpng " )
end
if not package : config ( " shared " ) then
package : add ( " defines " , " OPENVDB_STATICLIB " )
end
if package : version ( ) : ge ( " 9.0.0 " ) and package : config ( " nanovdb " ) then
package : add ( " deps " , " cuda " )
package : add ( " deps " , " optix " )
end
if package : is_plat ( " windows " ) then
package : add ( " defines " , " _USE_MATH_DEFINES " )
package : add ( " defines " , " NOMINMAX " )
@ -43,6 +56,8 @@ package("openvdb")
end )
on_install ( " macosx " , " linux " , " windows " , function ( package )
io.replace ( " cmake/FindBlosc.cmake " , " ${BUILD_TYPE} ${_BLOSC_LIB_NAME} " , " ${BUILD_TYPE} blosc libblosc " , { plain = true } )
io.replace ( " cmake/FindTBB.cmake " , " Tbb_${COMPONENT}_LIB_TYPE STREQUAL STATIC " , " TRUE " , { plain = true } )
local configs = { " -DOPENVDB_BUILD_DOCS=OFF " , " -DUSE_PKGCONFIG=OFF " , " -DBoost_USE_STATIC_LIBS=ON " , " -DUSE_CCACHE=OFF " }
if package : config ( " shared " ) then
table.insert ( configs , " -DOPENVDB_CORE_SHARED=ON " )
@ -53,7 +68,7 @@ package("openvdb")
end
table.insert ( configs , " -DCMAKE_BUILD_TYPE= " .. ( package : debug ( ) and " Debug " or " Release " ) )
if package : is_plat ( " windows " ) then
if package : config ( " shared " ) and package : config ( " vs_runtime " ) : startswith ( " MT " ) then
if package : version ( ) : lt ( " 9.0.0 " ) and package : config ( " shared " ) and package : config ( " vs_runtime " ) : startswith ( " MT " ) then
raise ( " OpenVDB shared library cannot be linked to a static msvc runtime " )
end
table.insert ( configs , " -DBoost_USE_STATIC_RUNTIME= " .. ( package : config ( " vs_runtime " ) : startswith ( " MT " ) and " ON " or " OFF " ) )
@ -81,6 +96,10 @@ package("openvdb")
table.insert ( configs , " -DUSE_EXR=ON " )
end
end
if package : version ( ) : ge ( " 9.0.0 " ) then
table.insert ( configs , " -DUSE_NANOVDB= " .. ( package : config ( " nanovdb " ) and " ON " or " OFF " ) )
table.insert ( configs , " -DNANOVDB_USE_CUDA=ON " )
end
import ( " package.tools.cmake " ) . install ( package , configs )
package : addenv ( " PATH " , " bin " )
end )
@ -96,4 +115,14 @@ package("openvdb")
}
] ] } , { configs = { languages = " c++14 " } ,
includes = { " openvdb/openvdb.h " , " openvdb/tools/LevelSetSphere.h " } } ) )
if package : version ( ) : ge ( " 9.0.0 " ) and package : config ( " nanovdb " ) then
assert ( package : check_cxxsnippets ( { test = [ [
void test ( ) {
nanovdb :: GridBuilder < float > builder ( 0 . 0f ) ;
auto acc = builder.getAccessor ( ) ;
acc.setValue ( nanovdb :: Coord ( 1 , 2 , 3 ) , 1 . 0f ) ;
}
] ] } , { configs = { languages = " c++14 " } ,
includes = { " nanovdb/util/GridBuilder.h " } } ) )
end
end )