aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/opensubdiv
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/opensubdiv')
-rw-r--r--vcpkg/ports/opensubdiv/fix-build-type.patch36
-rw-r--r--vcpkg/ports/opensubdiv/fix-dependencies.patch146
-rw-r--r--vcpkg/ports/opensubdiv/fix-feature-cuda.patch13
-rw-r--r--vcpkg/ports/opensubdiv/fix-notfind-header.patch31
-rw-r--r--vcpkg/ports/opensubdiv/fix-version-search.patch13
-rw-r--r--vcpkg/ports/opensubdiv/fix_compile-option.patch13
-rw-r--r--vcpkg/ports/opensubdiv/portfile.cmake140
-rw-r--r--vcpkg/ports/opensubdiv/vcpkg.json86
8 files changed, 478 insertions, 0 deletions
diff --git a/vcpkg/ports/opensubdiv/fix-build-type.patch b/vcpkg/ports/opensubdiv/fix-build-type.patch
new file mode 100644
index 0000000..b9f7752
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/fix-build-type.patch
@@ -0,0 +1,36 @@
+diff --git a/opensubdiv/CMakeLists.txt b/opensubdiv/CMakeLists.txt
+index f01a8a0..e1c24eb 100644
+--- a/opensubdiv/CMakeLists.txt
++++ b/opensubdiv/CMakeLists.txt
+@@ -122,6 +122,7 @@ if (NOT NO_LIB)
+
+ #---------------------------------------------------------------------------
+
++ if(NOT BUILD_SHARED_LIBS)
+ # Build static libs ------------------------------------
+ add_library(osd_static_cpu
+ STATIC
+@@ -169,6 +170,7 @@ if (NOT NO_LIB)
+
+ install( TARGETS osd_static_gpu EXPORT opensubdiv-targets DESTINATION "${CMAKE_LIBDIR_BASE}" )
+ endif()
++ endif()
+
+
+ # Build dynamic libs ----------------------------------
+@@ -284,6 +286,7 @@ if (NOT NO_LIB)
+ list(APPEND PUBLIC_HEADER_FILES "version.h")
+
+ #static framework
++ if(NOT BUILD_SHARED_LIBS)
+ add_library(osd_static_framework
+ STATIC
+ version.cpp
+@@ -330,6 +333,7 @@ if (NOT NO_LIB)
+ "Versions/Current/Headers"
+ "$<TARGET_FILE_DIR:osd_static_framework>/../../Headers"
+ )
++ endif()
+
+ #shared framework
+ if (BUILD_SHARED_LIBS)
diff --git a/vcpkg/ports/opensubdiv/fix-dependencies.patch b/vcpkg/ports/opensubdiv/fix-dependencies.patch
new file mode 100644
index 0000000..8b04aa4
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/fix-dependencies.patch
@@ -0,0 +1,146 @@
+diff --git a/cmake/FindDXSDK.cmake b/cmake/FindDXSDK.cmake
+index a396d97..edd06db 100644
+--- a/cmake/FindDXSDK.cmake
++++ b/cmake/FindDXSDK.cmake
+@@ -48,15 +48,8 @@ if (WIN32)
+ "C:/Program Files/Microsoft DirectX SDK*/Include"
+ )
+
+- if ("${CMAKE_GENERATOR}" MATCHES "[Ww]in64" OR
+- "${CMAKE_GENERATOR_PLATFORM}" MATCHES "x64")
+- set(ARCH x64)
+- else()
+- set(ARCH x86)
+- endif()
+-
+ find_path(LIBRARY_DIR
+- d3d11.lib
++ d3dx11.lib
+ PATHS
+ "${DXSDK_LOCATION}/Lib/${ARCH}"
+ "$ENV{DXSDK_LOCATION}/Lib/${ARCH}"
+@@ -70,7 +63,7 @@ if (WIN32)
+
+ set(DXSDK_LIBRARY_DIR ${LIBRARY_DIR})
+
+- foreach(DX_LIB d3d11 d3dcompiler)
++ foreach(DX_LIB d3dx11 d3dcompiler)
+
+ find_library(DXSDK_${DX_LIB}_LIBRARY
+ NAMES
+diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake
+index 2f4efd3..5f4f85b 100644
+--- a/cmake/FindTBB.cmake
++++ b/cmake/FindTBB.cmake
+@@ -30,6 +30,10 @@
+ # TBB_LIBRARIES - The libraries needed to use TBB
+
+ # Obtain include directory
++find_package(TBB CONFIG REQUIRED)
++set(TBB_FOUND 1)
++set(TBB_LIBRARIES TBB::tbb)
++if (0)
+ if (WIN32)
+ find_path(TBB_INCLUDE_DIR
+ NAMES
+@@ -180,4 +184,4 @@ mark_as_advanced(
+ TBB_INCLUDE_DIR
+ TBB_LIBRARIES
+ )
+-
++endif()
+diff --git a/examples/dxPtexViewer/CMakeLists.txt b/examples/dxPtexViewer/CMakeLists.txt
+index 2743423..81c8806 100644
+--- a/examples/dxPtexViewer/CMakeLists.txt
++++ b/examples/dxPtexViewer/CMakeLists.txt
+@@ -36,6 +36,19 @@ set(PLATFORM_LIBRARIES
+ "${ZLIB_LIBRARY}"
+ )
+
++if (OPENCL_FOUND)
++ list(APPEND PLATFORM_LIBRARIES
++ Opengl32
++ Cfgmgr32
++ )
++endif()
++
++if (DXSDK_FOUND)
++ list(APPEND PLATFORM_LIBRARIES
++ D3D11
++ )
++endif()
++
+ include_directories(
+ "${OPENSUBDIV_INCLUDE_DIR}"
+ "${DXSDK_INCLUDE_DIR}"
+diff --git a/examples/dxViewer/CMakeLists.txt b/examples/dxViewer/CMakeLists.txt
+index 245ecbd..83b39b8 100644
+--- a/examples/dxViewer/CMakeLists.txt
++++ b/examples/dxViewer/CMakeLists.txt
+@@ -33,6 +33,19 @@ set(PLATFORM_LIBRARIES
+ "${DXSDK_LIBRARIES}"
+ )
+
++if (OPENCL_FOUND)
++ list(APPEND PLATFORM_LIBRARIES
++ Opengl32
++ Cfgmgr32
++ )
++endif()
++
++if (DXSDK_FOUND)
++ list(APPEND PLATFORM_LIBRARIES
++ D3D11
++ )
++endif()
++
+ include_directories(
+ "${OPENSUBDIV_INCLUDE_DIR}"
+ "${DXSDK_INCLUDE_DIR}"
+diff --git a/examples/glEvalLimit/CMakeLists.txt b/examples/glEvalLimit/CMakeLists.txt
+index 1a71f72..8eaaccb 100644
+--- a/examples/glEvalLimit/CMakeLists.txt
++++ b/examples/glEvalLimit/CMakeLists.txt
+@@ -41,7 +41,6 @@ if( OPENCL_FOUND )
+ endif()
+
+ if( TBB_FOUND )
+- include_directories("${TBB_INCLUDE_DIR}")
+ list(APPEND PLATFORM_LIBRARIES
+ "${TBB_LIBRARIES}"
+ )
+diff --git a/opensubdiv/CMakeLists.txt b/opensubdiv/CMakeLists.txt
+index adb0191..0f90a37 100644
+--- a/opensubdiv/CMakeLists.txt
++++ b/opensubdiv/CMakeLists.txt
+@@ -49,7 +49,6 @@ if (NOT NO_LIB)
+ endif()
+
+ if( TBB_FOUND )
+- include_directories("${TBB_INCLUDE_DIR}")
+ list(APPEND PLATFORM_CPU_LIBRARIES
+ ${TBB_LIBRARIES}
+ )
+diff --git a/opensubdiv/osd/CMakeLists.txt b/opensubdiv/osd/CMakeLists.txt
+index 75f64b6..90d5ea2 100644
+--- a/opensubdiv/osd/CMakeLists.txt
++++ b/opensubdiv/osd/CMakeLists.txt
+@@ -88,7 +88,6 @@ set(TBB_PUBLIC_HEADERS
+ )
+
+ if( TBB_FOUND )
+- include_directories("${TBB_INCLUDE_DIR}")
+
+ list(APPEND CPU_SOURCE_FILES
+ tbbEvaluator.cpp
+@@ -379,6 +378,10 @@ add_library(osd_cpu_obj
+ ${PUBLIC_HEADER_FILES}
+ )
+
++if (TBB_FOUND)
++ target_link_libraries(osd_cpu_obj ${TBB_LIBRARIES})
++endif()
++
+ set_target_properties(osd_cpu_obj
+ PROPERTIES
+ FOLDER "opensubdiv"
diff --git a/vcpkg/ports/opensubdiv/fix-feature-cuda.patch b/vcpkg/ports/opensubdiv/fix-feature-cuda.patch
new file mode 100644
index 0000000..e9c4e93
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/fix-feature-cuda.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 098df7d..9314d03 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -730,7 +730,7 @@ endmacro()
+ # use when cross compiling or building multi-architecture binaries.
+ # We also provide a C++ binary implementation so that Python is not
+ # required (for backward compatibility).
+-if (OPENGL_FOUND OR OPENCL_FOUND OR DXSDK_FOUND OR METAL_FOUND)
++if (OPENGL_FOUND OR OPENCL_FOUND OR DXSDK_FOUND OR METAL_FOUND OR CUDA_FOUND)
+ if(Python_Interpreter_FOUND)
+ set(OSD_STRINGIFY_TOOL ${CMAKE_CURRENT_SOURCE_DIR}/tools/stringify/stringify.py)
+ set(OSD_STRINGIFY ${Python_EXECUTABLE} ${OSD_STRINGIFY_TOOL})
diff --git a/vcpkg/ports/opensubdiv/fix-notfind-header.patch b/vcpkg/ports/opensubdiv/fix-notfind-header.patch
new file mode 100644
index 0000000..3396fca
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/fix-notfind-header.patch
@@ -0,0 +1,31 @@
+diff --git a/opensubdiv/osd/tbbEvaluator.cpp b/opensubdiv/osd/tbbEvaluator.cpp
+index c98db9f..5a4bc98 100644
+--- a/opensubdiv/osd/tbbEvaluator.cpp
++++ b/opensubdiv/osd/tbbEvaluator.cpp
+@@ -25,7 +25,10 @@
+ #include "../osd/tbbEvaluator.h"
+ #include "../osd/tbbKernel.h"
+
++#if defined(TBB_INTERFACE_VERSION_MAJOR) && (TBB_INTERFACE_VERSION_MAJOR < 12)
++// This is deprecated functionality.
+ #include <tbb/task_scheduler_init.h>
++#endif
+
+ namespace OpenSubdiv {
+ namespace OPENSUBDIV_VERSION {
+@@ -215,11 +218,15 @@ TbbEvaluator::Synchronize(void *) {
+ /* static */
+ void
+ TbbEvaluator::SetNumThreads(int numThreads) {
++#if defined(TBB_INTERFACE_VERSION_MAJOR) && (TBB_INTERFACE_VERSION_MAJOR < 12)
++ // This is deprecated functionality. We preserve the existing behavior
++ // for consistency (when using older versions of tbb).
+ if (numThreads == -1) {
+ tbb::task_scheduler_init init;
+ } else {
+ tbb::task_scheduler_init init(numThreads);
+ }
++#endif
+ }
+
+ } // end namespace Osd
diff --git a/vcpkg/ports/opensubdiv/fix-version-search.patch b/vcpkg/ports/opensubdiv/fix-version-search.patch
new file mode 100644
index 0000000..7973472
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/fix-version-search.patch
@@ -0,0 +1,13 @@
+diff --git a/cmake/FindOpenCL.cmake b/cmake/FindOpenCL.cmake
+index 485e55e..1c98b91 100644
+--- a/cmake/FindOpenCL.cmake
++++ b/cmake/FindOpenCL.cmake
+@@ -177,7 +177,7 @@ if(_OPENCL_CPP_INCLUDE_DIRS)
+
+ if(EXISTS "${OPENCL_INCLUDE_DIRS}/CL/cl.h")
+
+- file(STRINGS "${OPENCL_INCLUDE_DIRS}/CL/cl.h" LINES REGEX "^#define CL_VERSION_.*$")
++ file(STRINGS "${OPENCL_INCLUDE_DIRS}/CL/cl.h" LINES REGEX "^#define CL_VERSION_[0-9]+_[0-9]+.*$")
+
+ foreach(LINE ${LINES})
+
diff --git a/vcpkg/ports/opensubdiv/fix_compile-option.patch b/vcpkg/ports/opensubdiv/fix_compile-option.patch
new file mode 100644
index 0000000..1acae92
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/fix_compile-option.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b69912ae..dcde4297 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -218,7 +218,7 @@ elseif(MSVC)
+
+ list(APPEND OSD_COMPILER_FLAGS
+ /W3 # Use warning level recommended for production purposes.
+- /WX # Treat all compiler warnings as errors.
++ # /WX # Treat all compiler warnings as errors.
+
+ # warning C4005: macro redefinition
+ /wd4005
diff --git a/vcpkg/ports/opensubdiv/portfile.cmake b/vcpkg/ports/opensubdiv/portfile.cmake
new file mode 100644
index 0000000..5b7138a
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/portfile.cmake
@@ -0,0 +1,140 @@
+if (VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_IOS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO PixarAnimationStudios/OpenSubdiv
+ REF 8ffa2b6566be10209529d7a0d1db02a0796b160c # v3.5.0
+ SHA512 cb48470f044ca4e9fcdfb3ff05d710fd710212d5a2f539f3f90ebb33cc6a6b1530fd9deb7d3eb25b275133dbdf5c1a5d4777b289d13b15006a59db12e8b28398
+ HEAD_REF release
+ PATCHES
+ fix_compile-option.patch
+ fix-version-search.patch
+ fix-build-type.patch
+ fix-dependencies.patch
+ fix-feature-cuda.patch
+ fix-notfind-header.patch
+)
+
+if(VCPKG_TARGET_IS_LINUX)
+ message(
+"OpenSubdiv currently requires the following libraries from the system package manager:
+ xinerama xxf86vm
+
+These can be installed on Ubuntu systems via sudo apt install libxinerama-dev libxxf86vm-dev")
+endif()
+
+vcpkg_find_acquire_program(PYTHON3)
+get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
+vcpkg_add_to_path("${PYTHON3_DIR}")
+
+if (VCPKG_CRT_LINKAGE STREQUAL static)
+ set(STATIC_CRT_LNK ON)
+else()
+ set(STATIC_CRT_LNK OFF)
+endif()
+
+if ("cuda" IN_LIST FEATURES AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ message(FATAL_ERROR "Feature 'cuda' can only build on x64 arch.")
+endif()
+
+if (("dx" IN_LIST FEATURES OR "omp" IN_LIST FEATURES) AND NOT VCPKG_TARGET_IS_WINDOWS)
+ message(FATAL_ERROR "Feature 'dx' and 'omp' only support Windows.")
+endif()
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ "true-deriv-eval" OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES
+ INVERTED_FEATURES
+ "cuda" NO_CUDA
+ "dx" NO_DX
+ "examples" NO_EXAMPLES
+ "glew" NO_GLEW
+ "glfw" NO_GLFW
+ "glfw" NO_GLFW_X11
+ "omp" NO_OMP
+ "opencl" NO_OPENCL
+ "opengl" NO_OPENGL
+ "ptex" NO_PTEX
+ "tbb" NO_TBB
+ "tutorials" NO_TUTORIALS
+)
+
+set(OSD_EXTRA_OPTS)
+if ("ptex" IN_LIST FEATURES)
+ list(APPEND OSD_EXTRA_OPTS -DPTEX_LOCATION=${CURRENT_INSTALLED_DIR})
+endif()
+if ("glew" IN_LIST FEATURES)
+ list(APPEND OSD_EXTRA_OPTS -DGLEW_LOCATION=${CURRENT_INSTALLED_DIR})
+endif()
+if ("glfw" IN_LIST FEATURES)
+ list(APPEND OSD_EXTRA_OPTS -DGLFW_LOCATION=${CURRENT_INSTALLED_DIR})
+endif()
+if ("dx" IN_LIST FEATURES)
+ list(APPEND OSD_EXTRA_OPTS -DDXSDK_LOCATION=${CURRENT_INSTALLED_DIR})
+endif()
+if (VCPKG_TARGET_IS_OSX)
+ list(APPEND OSD_EXTRA_OPTS -DNO_METAL=OFF)
+else()
+ list(APPEND OSD_EXTRA_OPTS -DNO_METAL=ON)
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DMSVC_STATIC_CRT=${STATIC_CRT_LNK}
+ -DNO_LIB=OFF
+ -DNO_REGRESSION=ON
+ -DNO_DOC=ON
+ -DNO_TESTS=ON
+ -DNO_GLTESTS=ON
+ -DNO_CLEW=ON
+ ${FEATURE_OPTIONS}
+ ${OSD_EXTRA_OPTS}
+ MAYBE_UNUSED_VARIABLES
+ MSVC_STATIC_CRT
+)
+
+vcpkg_cmake_install()
+
+if ("examples" IN_LIST FEATURES)
+ if ("dx" IN_LIST FEATURES)
+ vcpkg_copy_tools(TOOL_NAMES dxViewer AUTO_CLEAN)
+ if ("ptex" IN_LIST FEATURES)
+ vcpkg_copy_tools(TOOL_NAMES dxPtexViewer AUTO_CLEAN)
+ endif()
+ endif()
+endif()
+
+if ("tutorials" IN_LIST FEATURES)
+ file(GLOB TUTORIALS_TOOLS "${CURRENT_PACKAGES_DIR}/bin/tutorials/*${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
+ set(TUTORIALS_TOOL_NAMES )
+ foreach(TUTORIALS_TOOL IN LISTS TUTORIALS_TOOLS)
+ get_filename_component(TUTORIALS_TOOL_NAME "${TUTORIALS_TOOL}" NAME_WE)
+ list(APPEND TUTORIALS_TOOL_NAMES "${TUTORIALS_TOOL_NAME}")
+ endforeach()
+ if (TUTORIALS_TOOL_NAMES)
+ vcpkg_copy_tools(TOOL_NAMES ${TUTORIALS_TOOL_NAMES} SEARCH_DIR "${CURRENT_PACKAGES_DIR}/bin/tutorials/" AUTO_CLEAN)
+ endif()
+endif()
+
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup(PACKAGE_NAME OpenSubdiv CONFIG_PATH lib/cmake/OpenSubdiv)
+vcpkg_fixup_pkgconfig()
+
+# The header files are read only and can't remove when remove this port
+file(GLOB_RECURSE OSD_HDRS "${CURRENT_PACKAGES_DIR}/include/*.h")
+file(CHMOD_RECURSE ${OSD_HDRS}
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ GROUP_WRITE
+ WORLD_READ WORLD_WRITE
+)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/bin"
+ "${CURRENT_PACKAGES_DIR}/debug/bin"
+)
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
diff --git a/vcpkg/ports/opensubdiv/vcpkg.json b/vcpkg/ports/opensubdiv/vcpkg.json
new file mode 100644
index 0000000..59f05e0
--- /dev/null
+++ b/vcpkg/ports/opensubdiv/vcpkg.json
@@ -0,0 +1,86 @@
+{
+ "name": "opensubdiv",
+ "version-semver": "3.5.0",
+ "port-version": 3,
+ "description": "An Open-Source subdivision surface library.",
+ "homepage": "https://github.com/PixarAnimationStudios/OpenSubdiv",
+ "license": "Apache-2.0",
+ "supports": "!(arm & android) & !uwp",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "cuda": {
+ "description": "Enable CUDA backend",
+ "dependencies": [
+ "cuda"
+ ]
+ },
+ "dx": {
+ "description": "Enable DirectX support",
+ "dependencies": [
+ {
+ "name": "directxsdk",
+ "features": [
+ "xp"
+ ]
+ }
+ ]
+ },
+ "examples": {
+ "description": "Build examples"
+ },
+ "glew": {
+ "description": "Enable GLEW wrapper library",
+ "dependencies": [
+ "glew"
+ ]
+ },
+ "glfw": {
+ "description": "Build components depending on GLFW",
+ "dependencies": [
+ "glfw3"
+ ]
+ },
+ "omp": {
+ "description": "Enable OpenMP backend"
+ },
+ "opencl": {
+ "description": "Enable OpenCL backend",
+ "dependencies": [
+ "opencl"
+ ]
+ },
+ "opengl": {
+ "description": "Enable OpenGL backend",
+ "dependencies": [
+ "opengl"
+ ]
+ },
+ "ptex": {
+ "description": "Enable Ptex support",
+ "dependencies": [
+ "ptex"
+ ]
+ },
+ "tbb": {
+ "description": "Enable TBB backend",
+ "dependencies": [
+ "tbb"
+ ]
+ },
+ "true-deriv-eval": {
+ "description": "Enable true derivative evaluation for Gregory basis patches"
+ },
+ "tutorials": {
+ "description": "Enable tutorials build"
+ }
+ }
+}