Cleanup: deduplicate OpenVDB library definitions/include/libs logic

This will more important when we start using OpenVDB in more modules.
This commit is contained in:
Brecht Van Lommel
2020-02-26 15:11:24 +01:00
parent 22abc7f080
commit 78391def6e
5 changed files with 25 additions and 66 deletions

View File

@@ -899,6 +899,28 @@ if(NOT WITH_SYSTEM_EIGEN3)
set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3) set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
endif() endif()
if(WITH_OPENVDB)
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB)
if(WITH_OPENVDB_3_ABI_COMPATIBLE)
list(APPEND OPENVDB_DEFINITIONS -DOPENVDB_3_ABI_COMPATIBLE)
endif()
list(APPEND OPENVDB_INCLUDE_DIRS
${BOOST_INCLUDE_DIR}
${TBB_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIRS})
list(APPEND OPENVDB_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
if(WITH_OPENVDB_BLOSC)
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB_BLOSC)
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES} ${ZLIB_LIBRARIES})
endif()
list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES})
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Configure OpenGL. # Configure OpenGL.

View File

@@ -504,7 +504,7 @@ if(WITH_OPENVDB)
set(OPENVDB_LIBPATH ${OPENVDB}/lib) set(OPENVDB_LIBPATH ${OPENVDB}/lib)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include) set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${BLOSC_LIBRARIES}) set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${BLOSC_LIBRARIES})
set(OPENVDB_DEFINITIONS -DNOMINMAX) set(OPENVDB_DEFINITIONS -DNOMINMAX -DOPENVDB_STATICLIB -D_USE_MATH_DEFINES)
endif() endif()
if(WITH_OPENIMAGEDENOISE) if(WITH_OPENIMAGEDENOISE)

View File

@@ -49,11 +49,6 @@ if(WITH_TBB)
add_definitions(-DTBB=1) add_definitions(-DTBB=1)
endif() endif()
if(WITH_OPENVDB)
add_definitions(-DOPENVDB=1)
add_definitions(-DOPENVDB_STATICLIB)
endif()
if(WIN32) if(WIN32)
add_definitions(-D_USE_MATH_DEFINES) add_definitions(-D_USE_MATH_DEFINES)
endif() endif()
@@ -83,23 +78,13 @@ if(WITH_TBB)
endif() endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
add_definitions(-DOPENVDB=1 ${OPENVDB_DEFINITIONS})
list(APPEND INC_SYS list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
${OPENEXR_INCLUDE_DIRS}
${OPENVDB_INCLUDE_DIRS} ${OPENVDB_INCLUDE_DIRS}
) )
list(APPEND LIB list(APPEND LIB
${OPENVDB_LIBRARIES} ${OPENVDB_LIBRARIES}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
) )
if(WITH_OPENVDB_BLOSC)
list(APPEND LIB
${BLOSC_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
endif() endif()
set(SRC set(SRC

View File

@@ -27,7 +27,6 @@ add_definitions(-DWITH_FLUID=1)
if(WITH_OPENVDB) if(WITH_OPENVDB)
add_definitions(-DOPENVDB=1) add_definitions(-DOPENVDB=1)
add_definitions(-DOPENVDB_STATICLIB)
else() else()
add_definitions(-DOPENVDB=0) add_definitions(-DOPENVDB=0)
endif() endif()
@@ -66,22 +65,11 @@ endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
list(APPEND INC_SYS list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
${OPENEXR_INCLUDE_DIRS}
${OPENVDB_INCLUDE_DIRS} ${OPENVDB_INCLUDE_DIRS}
) )
list(APPEND LIB list(APPEND LIB
${OPENVDB_LIBRARIES} ${OPENVDB_LIBRARIES}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
) )
if(WITH_OPENVDB_BLOSC)
list(APPEND LIB
${BLOSC_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
endif() endif()
set(SRC set(SRC

View File

@@ -35,28 +35,9 @@ set(LIB
) )
if(WITH_OPENVDB) if(WITH_OPENVDB)
add_definitions( add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
-DWITH_OPENVDB
${OPENVDB_DEFINITIONS}
)
if(WIN32)
add_definitions(
-DOPENVDB_STATICLIB
-D_USE_MATH_DEFINES
)
endif()
if(WITH_OPENVDB_3_ABI_COMPATIBLE)
add_definitions(
-DOPENVDB_3_ABI_COMPATIBLE
)
endif()
list(APPEND INC_SYS list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
${TBB_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIRS}
${OPENVDB_INCLUDE_DIRS} ${OPENVDB_INCLUDE_DIRS}
) )
@@ -79,23 +60,6 @@ if(WITH_OPENVDB)
list(APPEND LIB list(APPEND LIB
${OPENVDB_LIBRARIES} ${OPENVDB_LIBRARIES}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
)
if(WITH_OPENVDB_BLOSC)
add_definitions(
-DWITH_OPENVDB_BLOSC
)
list(APPEND LIB
${BLOSC_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
list(APPEND LIB
${BOOST_LIBRARIES}
${TBB_LIBRARIES}
) )
endif() endif()