diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-11-25 14:16:49 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-25 14:16:49 -0800 |
| commit | 6b64a9adb606ad442e71ba562efd17d42baee3a0 (patch) | |
| tree | 613d82ab0009c0e37c754aa6a076f67b4f51180e | |
| parent | 8b591b2c439727e8c02fbd230de65207f0a244c2 (diff) | |
| parent | 7c6fb6081b461a8d546a76ea38bd3f0300111458 (diff) | |
| download | vcpkg-6b64a9adb606ad442e71ba562efd17d42baee3a0.tar.gz vcpkg-6b64a9adb606ad442e71ba562efd17d42baee3a0.zip | |
Merge pull request #2237 from kypp/openvdb
new port: openvdb
| -rw-r--r-- | ports/openvdb/AddLinkageAndToolsChoice.patch | 225 | ||||
| -rw-r--r-- | ports/openvdb/CONTROL | 8 | ||||
| -rw-r--r-- | ports/openvdb/UseGLEWOnWindowsForViewer.patch | 60 | ||||
| -rw-r--r-- | ports/openvdb/portfile.cmake | 118 |
4 files changed, 411 insertions, 0 deletions
diff --git a/ports/openvdb/AddLinkageAndToolsChoice.patch b/ports/openvdb/AddLinkageAndToolsChoice.patch new file mode 100644 index 000000000..3d155cbe4 --- /dev/null +++ b/ports/openvdb/AddLinkageAndToolsChoice.patch @@ -0,0 +1,225 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 712fb1d..440a63a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,9 @@ PROJECT ( OpenVDB ) + + ENABLE_TESTING() + ++OPTION ( OPENVDB_BUILD_TOOLS "Build OpenVDB utilities" ON ) ++OPTION ( OPENVDB_STATIC "Build statically linked library" ON ) ++OPTION ( OPENVDB_SHARED "Build dynamically linked library" ON ) + OPTION ( OPENVDB_BUILD_UNITTESTS "Build the OpenVDB unit tests" ON ) + OPTION ( OPENVDB_BUILD_DOCS "Build the OpenVDB documentation" OFF ) + OPTION ( OPENVDB_BUILD_PYTHON_MODULE "Build the pyopenvdb Python module" ON ) +diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt +index 5703eb9..6ff3c6a 100644 +--- a/openvdb/CMakeLists.txt ++++ b/openvdb/CMakeLists.txt +@@ -26,6 +26,7 @@ + # + PROJECT ( OpenVDBCore ) + ++IF ( OPENVDB_BUILD_TOOLS ) + IF ( USE_GLFW3 ) + FIND_PACKAGE ( GLFW3 REQUIRED ) + SET ( OPENVDB_USE_GLFW_FLAG "-DOPENVDB_USE_GLFW_3" ) +@@ -42,9 +43,12 @@ ELSE () + SET ( GLFW_LINK_LIBRARY ${GLFW_glfw_LIBRARY} ) + SET ( GLFW_INCLUDE_DIRECTORY ${GLFW_INCLUDE_DIR} CACHE STRING "GLFW include directory") + ENDIF () ++ENDIF ( OPENVDB_BUILD_TOOLS ) + + IF (WIN32) ++ IF ( OPENVDB_BUILD_TOOLS ) + FIND_PACKAGE ( GLEW REQUIRED ) ++ ENDIF ( OPENVDB_BUILD_TOOLS ) + ELSE () + FIND_PACKAGE ( Threads REQUIRED ) + ENDIF() +@@ -75,7 +79,7 @@ SET ( OPENVDB_PATCH_VERSION_NUMBER ${_openvdb_patch_version_number} CACHE STRING + # MESSAGE ( "OPENVDB_MINOR_VERSION_NUMBER = ${OPENVDB_MINOR_VERSION_NUMBER}" ) + # MESSAGE ( "OPENVDB_PATCH_VERSION_NUMBER = ${OPENVDB_PATCH_VERSION_NUMBER}" ) + +-FIND_PACKAGE ( Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system thread ${OPENVDB_BOOST_PYTHON_LIBRARY_COMPONENT_NAME} ) ++FIND_PACKAGE ( Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system thread date_time ${OPENVDB_BOOST_PYTHON_LIBRARY_COMPONENT_NAME} ) + IF (WIN32 AND OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING) + ADD_DEFINITIONS ( -DBOOST_ALL_NO_LIB ) + ENDIF () +@@ -85,7 +89,9 @@ FIND_PACKAGE ( TBB REQUIRED ) + FIND_PACKAGE ( ZLIB REQUIRED ) + FIND_PACKAGE ( ILMBase REQUIRED ) + FIND_PACKAGE ( OpenEXR REQUIRED ) ++IF ( OPENVDB_BUILD_TOOLS ) + FIND_PACKAGE ( OpenGL REQUIRED ) ++ENDIF () + IF (OPENVDB_BUILD_DOCS) + FIND_PACKAGE ( Doxygen REQUIRED ) + ENDIF () +@@ -127,7 +133,10 @@ 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_WIN32 -DNOMINMAX ) ++ IF ( OPENVDB_SHARED ) ++ ADD_DEFINITIONS ( -DOPENVDB_DLL ) ++ ENDIF () + ELSE () + ADD_DEFINITIONS ( -pthread -fPIC ) + ENDIF () +@@ -167,16 +176,20 @@ 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} +@@ -185,6 +198,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} +@@ -193,7 +208,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 +@@ -203,7 +220,9 @@ ELSE() + PROPERTIES OUTPUT_NAME openvdb + ) + ENDIF() ++ENDIF () + ++IF ( OPENVDB_SHARED ) + SET_TARGET_PROPERTIES( + openvdb_shared + PROPERTIES +@@ -211,13 +230,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} + ) +@@ -231,7 +252,7 @@ TARGET_LINK_LIBRARIES ( vdb_print + 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} +@@ -256,26 +277,26 @@ 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" + ) +-IF (NOT WIN32) + ADD_EXECUTABLE ( vdb_view + ${VDB_VIEW_SOURCE_FILES} + ) + + TARGET_LINK_LIBRARIES ( vdb_view + openvdb_shared +- ${Boost_THREAD_LIBRARY} ++ ${Boost_LIBRARIES} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +- ${COCOA_LIBRARY} +- ${IOKIT_LIBRARY} +- ${COREVIDEO_LIBRARY} ++ #${COCOA_LIBRARY} ++ #${IOKIT_LIBRARY} ++ #${COREVIDEO_LIBRARY} + ${GLFW_LINK_LIBRARY} + ${GLFW_DEPENDENT_LIBRARIES} + ${GLEW_GLEW_LIBRARY} + ) +-ENDIF () ++ ++ENDIF ( OPENVDB_BUILD_TOOLS ) + + SET ( UNITTEST_SOURCE_FILES + unittest/main.cc +@@ -405,27 +426,32 @@ IF (OPENVDB_BUILD_DOCS) + + ENDIF () + ++IF ( OPENVDB_BUILD_TOOLS ) + # Installation +-IF ( NOT WIN32 ) ++#IF ( NOT WIN32 ) + INSTALL ( TARGETS + vdb_view + DESTINATION + bin + ) +-ENDIF () ++#ENDIF () + INSTALL ( TARGETS + vdb_print + vdb_render + DESTINATION + bin + ) ++ENDIF ( OPENVDB_BUILD_TOOLS ) + ++IF ( OPENVDB_STATIC) + INSTALL ( TARGETS + openvdb_static + DESTINATION + lib + ) ++ENDIF () + ++IF ( OPENVDB_SHARED ) + IF (WIN32) + INSTALL ( TARGETS + openvdb_shared +@@ -439,6 +465,7 @@ ELSE() + lib + ) + ENDIF () ++ENDIF ( OPENVDB_SHARED ) + + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR} DESTINATION include + FILES_MATCHING PATTERN "*.h" diff --git a/ports/openvdb/CONTROL b/ports/openvdb/CONTROL new file mode 100644 index 000000000..cfcbfac6f --- /dev/null +++ b/ports/openvdb/CONTROL @@ -0,0 +1,8 @@ +Source: openvdb +Version: 5.0.0 +Build-Depends: boost, ilmbase, openexr, tbb, blosc +Description: Sparse volume data structure and tools + +Feature: tools +Description: OpenVDB utilities: view, print and render +Build-Depends: glew, glfw3
\ No newline at end of file diff --git a/ports/openvdb/UseGLEWOnWindowsForViewer.patch b/ports/openvdb/UseGLEWOnWindowsForViewer.patch new file mode 100644 index 000000000..bfa29c46c --- /dev/null +++ b/ports/openvdb/UseGLEWOnWindowsForViewer.patch @@ -0,0 +1,60 @@ +diff --git a/openvdb/viewer/ClipBox.h b/openvdb/viewer/ClipBox.h +index b792491..d2f50cc 100644 +--- a/openvdb/viewer/ClipBox.h ++++ b/openvdb/viewer/ClipBox.h +@@ -36,6 +36,8 @@ + #if defined(__APPLE__) || defined(MACOSX) + #include <OpenGL/gl.h> + #include <OpenGL/glu.h> ++#elif defined(WIN32) ++#include <GL/glew.h> + #else + #include <GL/gl.h> + #include <GL/glu.h> +diff --git a/openvdb/viewer/Font.h b/openvdb/viewer/Font.h +index 6e79704..566cfbd 100644 +--- a/openvdb/viewer/Font.h ++++ b/openvdb/viewer/Font.h +@@ -36,6 +36,8 @@ + #if defined(__APPLE__) || defined(MACOSX) + #include <OpenGL/gl.h> + #include <OpenGL/glu.h> ++#elif defined(WIN32) ++#include <GL/glew.h> + #else + #include <GL/gl.h> + #include <GL/glu.h> +diff --git a/openvdb/viewer/RenderModules.h b/openvdb/viewer/RenderModules.h +index f4745d9..339dfc3 100644 +--- a/openvdb/viewer/RenderModules.h ++++ b/openvdb/viewer/RenderModules.h +@@ -43,6 +43,8 @@ + #if defined(__APPLE__) || defined(MACOSX) + #include <OpenGL/gl.h> + #include <OpenGL/glu.h> ++#elif defined(WIN32) ++#include <GL/glew.h> + #else + #include <GL/gl.h> + #include <GL/glu.h> +diff --git a/openvdb/viewer/Viewer.cc b/openvdb/viewer/Viewer.cc +index 307aa2b..8b79358 100644 +--- a/openvdb/viewer/Viewer.cc ++++ b/openvdb/viewer/Viewer.cc +@@ -540,7 +540,15 @@ ViewerImpl::open(int width, int height) + std::shared_ptr<GLFWwindow> curWindow( + glfwGetCurrentContext(), glfwMakeContextCurrent); + glfwMakeContextCurrent(mWindow); +- BitmapFont13::initialize(); ++ BitmapFont13::initialize(); ++#ifdef WIN32 ++ if (glewInit() == GLEW_OK) { ++ OPENVDB_LOG_DEBUG_RUNTIME("initialized GLEW from thread " ++ << boost::this_thread::get_id()); ++ } else { ++ OPENVDB_LOG_ERROR("GLEW initialization failed"); ++ } ++#endif + } + } + mCamera->setWindow(mWindow); diff --git a/ports/openvdb/portfile.cmake b/ports/openvdb/portfile.cmake new file mode 100644 index 000000000..a21e82240 --- /dev/null +++ b/ports/openvdb/portfile.cmake @@ -0,0 +1,118 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO dreamworksanimation/openvdb + REF v5.0.0 + SHA512 8916d54683d81144114e57f8332be43b7547e6da5d194f6147bcefd4ee9e8e7ec817f27b65adb129dfd149e6b308f4bab30591ee953ee2c319636491bf051a2b + HEAD_REF master +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/UseGLEWOnWindowsForViewer.patch + ${CMAKE_CURRENT_LIST_DIR}/AddLinkageAndToolsChoice.patch +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(OPENVDB_STATIC ON) + set(OPENVDB_SHARED OFF) +else() + set(OPENVDB_STATIC OFF) + set(OPENVDB_SHARED ON) +endif() + +if ("tools" IN_LIST FEATURES) + set(OPENVDB_BUILD_TOOLS ON) + set(OPENVDB_SHARED ON) # tools require shared version of the library +else() + set(OPENVDB_BUILD_TOOLS OFF) +endif() + +file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}" INSTALL_LOCATION) + +file(TO_NATIVE_PATH "${INSTALL_LOCATION}/include" INCLUDE_LOCATION) +file(TO_NATIVE_PATH "${INSTALL_LOCATION}/lib/" LIB_LOCATION) +file(TO_NATIVE_PATH "${INSTALL_LOCATION}/debug/lib/" LIB_LOCATION_DEBUG) + +file(TO_NATIVE_PATH "${LIB_LOCATION}/zlib.lib" ZLIB_LIBRARY) +file(TO_NATIVE_PATH "${LIB_LOCATION}/tbb.lib" Tbb_TBB_LIBRARY) +file(TO_NATIVE_PATH "${LIB_LOCATION}/tbbmalloc.lib" Tbb_TBBMALLOC_LIBRARY) +file(TO_NATIVE_PATH "${LIB_LOCATION_DEBUG}/tbb_debug.lib" Tbb_TBB_LIBRARY_DEBUG) +file(TO_NATIVE_PATH "${LIB_LOCATION_DEBUG}/tbbmalloc_debug.lib" Tbb_TBBMALLOC_LIBRARY_DEBUG) + +file(TO_NATIVE_PATH "${LIB_LOCATION}/Half.lib" Ilmbase_HALF_LIBRARY) +file(TO_NATIVE_PATH "${LIB_LOCATION}/Iex-2_2.lib" Ilmbase_IEX_LIBRARY) +file(TO_NATIVE_PATH "${LIB_LOCATION}/IlmThread-2_2.lib" Ilmbase_ILMTHREAD_LIBRARY) + +if (OPENVDB_STATIC) + file(TO_NATIVE_PATH "${LIB_LOCATION}/glfw3.lib" GLFW3_LIBRARY) +else() + file(TO_NATIVE_PATH "${LIB_LOCATION}/glfw3dll.lib" GLFW3_LIBRARY) +endif() + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DOPENVDB_BUILD_UNITTESTS=OFF + -DOPENVDB_BUILD_PYTHON_MODULE=OFF + -DOPENVDB_ENABLE_3_ABI_COMPATIBLE=OFF + -DUSE_GLFW3=ON + -DGLFW3_USE_STATIC_LIBS=${OPENVDB_STATIC} + -DBlosc_USE_STATIC_LIBS=${OPENVDB_STATIC} + -DOpenexr_USE_STATIC_LIBS=${OPENVDB_STATIC} + -DIlmbase_USE_STATIC_LIBS=${OPENVDB_STATIC} + -DGLFW3_glfw_LIBRARY=${GLFW3_LIBRARY} + + -DIlmbase_HALF_LIBRARY=${Ilmbase_HALF_LIBRARY} + -DIlmbase_IEX_LIBRARY=${Ilmbase_IEX_LIBRARY} + -DIlmbase_ILMTHREAD_LIBRARY=${Ilmbase_ILMTHREAD_LIBRARY} + + -DOPENVDB_STATIC=${OPENVDB_STATIC} + -DOPENVDB_SHARED=${OPENVDB_SHARED} + -DOPENVDB_BUILD_TOOLS=${OPENVDB_BUILD_TOOLS} + + -DZLIB_INCLUDE_DIR=${INCLUDE_LOCATION} + -DTBB_INCLUDE_DIR=${INCLUDE_LOCATION} + -DZLIB_LIBRARY=${ZLIB_LIBRARY} + + -DGLFW3_LOCATION=${INSTALL_LOCATION} + -DGLEW_LOCATION=${INSTALL_LOCATION} + -DILMBASE_LOCATION=${INSTALL_LOCATION} + -DOPENEXR_LOCATION=${INSTALL_LOCATION} + -DTBB_LOCATION=${INSTALL_LOCATION} + -DBLOSC_LOCATION=${INSTALL_LOCATION} + OPTIONS_RELEASE + -DTBB_LIBRARY_PATH=${LIB_LOCATION} + -DTbb_TBB_LIBRARY=${Tbb_TBB_LIBRARY} + -DTbb_TBBMALLOC_LIBRARY=${Tbb_TBBMALLOC_LIBRARY} + OPTIONS_DEBUG + -DTBB_LIBRARY_PATH=${LIB_LOCATION_DEBUG} + -DTbb_TBB_LIBRARY=${Tbb_TBB_LIBRARY_DEBUG} + -DTbb_TBBMALLOC_LIBRARY=${Tbb_TBBMALLOC_LIBRARY_DEBUG} +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +if (OPENVDB_BUILD_TOOLS) + # copy tools to tools/openvdb directory + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT}/) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vdb_print.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/vdb_print.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vdb_render.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/vdb_render.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vdb_view.exe ${CURRENT_PACKAGES_DIR}/tools/${PORT}/vdb_view.exe) + vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + + # remove debug versions of tools + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vdb_render.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vdb_print.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vdb_view.exe) +endif() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/openvdb/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/openvdb RENAME copyright) |
