diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt index 9404dbc..94daf8c 100644 --- a/openvdb/CMakeLists.txt +++ b/openvdb/CMakeLists.txt @@ -29,28 +29,31 @@ PROJECT ( OpenVDBCore ) set(CMAKE_CXX_STANDARD 11) +IF ( OPENVDB_BUILD_TOOLS ) IF ( USE_GLFW3 ) FIND_PACKAGE ( GLFW3 REQUIRED ) SET ( OPENVDB_USE_GLFW_FLAG "-DOPENVDB_USE_GLFW_3" ) IF ( UNIX AND NOT APPLE ) - SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) - ENDIF ( UNIX AND NOT APPLE ) + SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) + ENDIF () SET ( GLFW_LINK_LIBRARY ${GLFW3_glfw_LIBRARY} ) SET ( GLFW_INCLUDE_DIRECTORY ${GLFW3_INCLUDE_DIR} CACHE STRING "GLFW3 include directory") ELSE () FIND_PACKAGE ( GLFW REQUIRED ) IF ( UNIX AND NOT APPLE ) - SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) + SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) ENDIF () SET ( GLFW_LINK_LIBRARY ${GLFW_glfw_LIBRARY} ) SET ( GLFW_INCLUDE_DIRECTORY ${GLFW_INCLUDE_DIR} CACHE STRING "GLFW include directory") ENDIF () +ENDIF () +IF ( OPENVDB_BUILD_TOOLS ) IF (WIN32) FIND_PACKAGE ( GLEW REQUIRED ) -ELSE () - FIND_PACKAGE ( Threads REQUIRED ) -ENDIF() +ENDIF () +ENDIF () +FIND_PACKAGE ( Threads REQUIRED ) # Determine OpenVDB version #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 4 @@ -130,7 +133,12 @@ INCLUDE_DIRECTORIES ( SYSTEM ${BLOSC_INCLUDE_DIR} ) INCLUDE_DIRECTORIES ( SYSTEM ${CPPUNIT_INCLUDE_DIR} ) IF (WIN32) - ADD_DEFINITIONS ( -D_WIN32 -DNOMINMAX -DHALF_EXPORTS -DOPENVDB_DLL ) + ADD_DEFINITIONS ( -D__TBB_NO_IMPLICIT_LINKAGE ) + ADD_DEFINITIONS ( -D__TBBMALLOC_NO_IMPLICIT_LINKAGE ) + ADD_DEFINITIONS ( -D_WIN32 -DNOMINMAX ) + IF ( OPENVDB_SHARED ) + ADD_DEFINITIONS ( -DOPENEXR_DLL -DOPENVDB_DLL ) + ENDIF () ELSE () ADD_DEFINITIONS ( -pthread -fPIC ) ENDIF () @@ -170,16 +178,21 @@ SET ( OPENVDB_LIBRARY_SOURCE_FILES SET_SOURCE_FILES_PROPERTIES ( ${OPENVDB_LIBRARY_SOURCE_FILES} PROPERTIES - COMPILE_FLAGS "-DOPENVDB_PRIVATE -DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}" + COMPILE_FLAGS "-DOPENVDB_PRIVATE -DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$:/bigobj>" ) - + +IF ( OPENVDB_STATIC ) ADD_LIBRARY ( openvdb_static STATIC ${OPENVDB_LIBRARY_SOURCE_FILES} ) +ENDIF () +IF ( OPENVDB_SHARED ) ADD_LIBRARY ( openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES} ) +ENDIF () +IF ( OPENVDB_STATIC ) TARGET_LINK_LIBRARIES ( openvdb_static ${Boost_IOSTREAMS_LIBRARY} ${Boost_SYSTEM_LIBRARY} @@ -188,6 +201,8 @@ TARGET_LINK_LIBRARIES ( openvdb_static ${ZLIB_LIBRARY} ${BLOSC_blosc_LIBRARY} ) +ENDIF () +IF ( OPENVDB_SHARED ) TARGET_LINK_LIBRARIES ( openvdb_shared ${Boost_IOSTREAMS_LIBRARY} ${Boost_SYSTEM_LIBRARY} @@ -196,7 +211,9 @@ TARGET_LINK_LIBRARIES ( openvdb_shared ${ZLIB_LIBRARY} ${BLOSC_blosc_LIBRARY} ) +ENDIF () +IF ( OPENVDB_STATIC ) IF (WIN32) SET_TARGET_PROPERTIES ( openvdb_static PROPERTIES OUTPUT_NAME libopenvdb @@ -205,8 +222,10 @@ ELSE() SET_TARGET_PROPERTIES ( openvdb_static PROPERTIES OUTPUT_NAME openvdb ) -ENDIF() +ENDIF () +ENDIF () +IF ( OPENVDB_SHARED ) SET_TARGET_PROPERTIES( openvdb_shared PROPERTIES @@ -214,13 +233,15 @@ SET_TARGET_PROPERTIES( SOVERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER} VERSION ${OPENVDB_MAJOR_VERSION_NUMBER}.${OPENVDB_MINOR_VERSION_NUMBER}.${OPENVDB_PATCH_VERSION_NUMBER} ) +ENDIF () SET ( VDB_PRINT_SOURCE_FILES cmd/openvdb_print/main.cc ) SET_SOURCE_FILES_PROPERTIES ( ${VDB_PRINT_SOURCE_FILES} PROPERTIES - COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}" + COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$:/bigobj>" ) +IF ( OPENVDB_BUILD_TOOLS ) ADD_EXECUTABLE ( vdb_print ${VDB_PRINT_SOURCE_FILES} ) @@ -229,14 +250,19 @@ TARGET_LINK_LIBRARIES ( vdb_print openvdb_shared ${CMAKE_THREAD_LIBS_INIT} ${BLOSC_blosc_LIBRARY} + ) + +IF (NOT WIN32) +TARGET_LINK_LIBRARIES ( vdb_print m stdc++ ) +ENDIF () SET ( VDB_RENDER_SOURCE_FILES cmd/openvdb_render/main.cc ) SET_SOURCE_FILES_PROPERTIES ( ${VDB_RENDER_SOURCE_FILES} PROPERTIES - COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}" + COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$:/bigobj>" ) ADD_EXECUTABLE ( vdb_render ${VDB_RENDER_SOURCE_FILES} @@ -249,9 +275,14 @@ TARGET_LINK_LIBRARIES ( vdb_render ${Openexr_ILMIMF_LIBRARY} ${Ilmbase_ILMTHREAD_LIBRARY} ${Ilmbase_IEX_LIBRARY} + ) + +IF (NOT WIN32) +TARGET_LINK_LIBRARIES ( vdb_render m stdc++ ) +ENDIF () SET ( VDB_VIEW_SOURCE_FILES cmd/openvdb_view/main.cc @@ -263,29 +294,38 @@ SET ( VDB_VIEW_SOURCE_FILES ) SET_SOURCE_FILES_PROPERTIES ( ${VDB_VIEW_SOURCE_FILES} PROPERTIES - COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} -DGL_GLEXT_PROTOTYPES=1" + COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} -DGL_GLEXT_PROTOTYPES=1 $<$:/bigobj>" + ) + +ADD_EXECUTABLE ( vdb_view + ${VDB_VIEW_SOURCE_FILES} ) -IF (NOT WIN32) - ADD_EXECUTABLE ( vdb_view - ${VDB_VIEW_SOURCE_FILES} - ) - target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} ) +target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} ) - TARGET_LINK_LIBRARIES ( vdb_view - openvdb_shared - ${Boost_THREAD_LIBRARY} - ${OPENGL_gl_LIBRARY} - ${OPENGL_glu_LIBRARY} - ${COCOA_LIBRARY} - ${IOKIT_LIBRARY} - ${COREVIDEO_LIBRARY} - ${GLFW_LINK_LIBRARY} - ${GLFW_DEPENDENT_LIBRARIES} - ${GLEW_GLEW_LIBRARY} - m - stdc++ - ) +TARGET_LINK_LIBRARIES ( vdb_view + openvdb_shared + ${Boost_LIBRARIES} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} + ${GLFW_LINK_LIBRARY} + ${GLFW_DEPENDENT_LIBRARIES} + ${GLEW_GLEW_LIBRARY} + ) +IF (APPLE) +TARGET_LINK_LIBRARIES ( vdb_view + ${COCOA_LIBRARY} + ${IOKIT_LIBRARY} + ${COREVIDEO_LIBRARY} +) +ENDIF () +IF (NOT WIN32) +TARGET_LINK_LIBRARIES ( vdb_view + m + stdc++ + ) + +ENDIF () ENDIF () SET ( UNITTEST_SOURCE_FILES @@ -398,7 +438,7 @@ IF ( OPENVDB_BUILD_UNITTESTS ) ADD_TEST ( vdb_unit_test vdb_test ) -ENDIF (OPENVDB_BUILD_UNITTESTS) +ENDIF () # Doxygen docmentation IF (OPENVDB_BUILD_DOCS) @@ -419,26 +459,29 @@ IF (OPENVDB_BUILD_DOCS) ENDIF () # Installation -IF ( NOT WIN32 ) +IF ( OPENVDB_BUILD_TOOLS ) INSTALL ( TARGETS vdb_view DESTINATION bin ) + INSTALL ( TARGETS + vdb_print + vdb_render + DESTINATION + bin + ) ENDIF () -INSTALL ( TARGETS - vdb_print - vdb_render - DESTINATION - bin - ) -INSTALL ( TARGETS - openvdb_static - DESTINATION - lib - ) +IF ( OPENVDB_STATIC) + INSTALL ( TARGETS + openvdb_static + DESTINATION + lib + ) +ENDIF () +IF ( OPENVDB_SHARED ) IF (WIN32) INSTALL ( TARGETS openvdb_shared @@ -452,6 +495,7 @@ ELSE() lib ) ENDIF () +ENDIF () INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h"