mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 06:28:00 +08:00
[opensubdiv] Add features (#20895)
* [opensubdiv] Add features * version * Add more judgment * version * fix mac build - upstream bug * Re-fix dependency tbb * version * fix judgment * version * In order to remove them, change header file permission * version
This commit is contained in:
parent
fdac8bfc1b
commit
7c10f9883d
20
ports/opensubdiv/fix-build-type.patch
Normal file
20
ports/opensubdiv/fix-build-type.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff --git a/opensubdiv/CMakeLists.txt b/opensubdiv/CMakeLists.txt
|
||||
index 72c5b7e..ca24488 100644
|
||||
--- a/opensubdiv/CMakeLists.txt
|
||||
+++ b/opensubdiv/CMakeLists.txt
|
||||
@@ -124,6 +124,7 @@ if (NOT NO_LIB)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
+ if (NOT BUILD_SHARED_LIBS)
|
||||
# Build static libs ------------------------------------
|
||||
add_library(osd_static_cpu
|
||||
STATIC
|
||||
@@ -146,6 +147,7 @@ if (NOT NO_LIB)
|
||||
)
|
||||
|
||||
install( TARGETS osd_static_cpu DESTINATION "${CMAKE_LIBDIR_BASE}" )
|
||||
+ endif()
|
||||
|
||||
if( OSD_GPU )
|
||||
# this macro uses FindCUDA.cmake to compile .cu kernel files
|
146
ports/opensubdiv/fix-dependencies.patch
Normal file
146
ports/opensubdiv/fix-dependencies.patch
Normal file
@ -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"
|
13
ports/opensubdiv/fix-mac-build.patch
Normal file
13
ports/opensubdiv/fix-mac-build.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/opensubdiv/CMakeLists.txt b/opensubdiv/CMakeLists.txt
|
||||
index ca24488..adb0191 100644
|
||||
--- a/opensubdiv/CMakeLists.txt
|
||||
+++ b/opensubdiv/CMakeLists.txt
|
||||
@@ -241,7 +241,7 @@ if (NOT NO_LIB)
|
||||
endif()
|
||||
|
||||
# Build frameworks ----------------------------------
|
||||
- if(APPLE)
|
||||
+ if(APPLE AND OSD_GPU)
|
||||
get_directory_property(OSD_HEADER_FILES DIRECTORY ${CMAKE_SOURCE_DIR}/opensubdiv/osd DEFINITION PUBLIC_HEADER_FILES)
|
||||
get_directory_property(FAR_HEADER_FILES DIRECTORY ${CMAKE_SOURCE_DIR}/opensubdiv/far DEFINITION PUBLIC_HEADER_FILES)
|
||||
get_directory_property(SDC_HEADER_FILES DIRECTORY ${CMAKE_SOURCE_DIR}/opensubdiv/sdc DEFINITION PUBLIC_HEADER_FILES)
|
@ -1,3 +1,7 @@
|
||||
if (VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_IOS)
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "uwp")
|
||||
|
||||
vcpkg_from_github(
|
||||
@ -9,6 +13,9 @@ vcpkg_from_github(
|
||||
PATCHES
|
||||
fix_compile-option.patch
|
||||
fix-version-search.patch
|
||||
fix-build-type.patch
|
||||
fix-mac-build.patch
|
||||
fix-dependencies.patch
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
@ -29,28 +36,102 @@ else()
|
||||
set(STATIC_CRT_LNK OFF)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA # Disable this option if project cannot be built with Ninja
|
||||
OPTIONS
|
||||
-DNO_DX=ON
|
||||
-DNO_CUDA=ON
|
||||
-DNO_EXAMPLES=ON
|
||||
-DNO_TUTORIALS=ON
|
||||
-DNO_REGRESSION=ON
|
||||
-DNO_TESTS=ON
|
||||
-DMSVC_STATIC_CRT=${STATIC_CRT_LNK}
|
||||
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
|
||||
"ptex" NO_PTEX
|
||||
"tbb" NO_TBB
|
||||
"tutorials" NO_TUTORIALS
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
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()
|
||||
|
||||
# # Moves all .cmake files from /debug/share/opensubdiv/ to /share/opensubdiv/
|
||||
# # See /docs/maintainers/vcpkg_fixup_cmake_targets.md for more details
|
||||
# vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/opensubdiv)
|
||||
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
|
||||
-DNO_METAL=ON
|
||||
-DNO_OPENGL=ON # missing glloader
|
||||
${FEATURE_OPTIONS}
|
||||
${OSD_EXTRA_OPTS}
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
MSVC_STATIC_CRT
|
||||
)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
vcpkg_cmake_install()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
if ("opencl" IN_LIST FEATURES OR "dx" IN_LIST FEATURES)
|
||||
vcpkg_copy_tools(TOOL_NAMES stringify AUTO_CLEAN)
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
# 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"
|
||||
)
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
@ -1,8 +1,75 @@
|
||||
{
|
||||
"name": "opensubdiv",
|
||||
"version-semver": "3.4.3",
|
||||
"port-version": 2,
|
||||
"port-version": 3,
|
||||
"description": "An Open-Source subdivision surface library.",
|
||||
"homepage": "https://github.com/PixarAnimationStudios/OpenSubdiv",
|
||||
"supports": "!arm & !uwp"
|
||||
"supports": "!arm & !uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"cuda": {
|
||||
"description": "Enable CUDA backend",
|
||||
"dependencies": [
|
||||
"cuda"
|
||||
]
|
||||
},
|
||||
"dx": {
|
||||
"description": "Enable DirectX support",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "directxsdk",
|
||||
"features": [
|
||||
"xp"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"examples": {
|
||||
"description": "Enable examples build"
|
||||
},
|
||||
"glew": {
|
||||
"description": "Path to glew",
|
||||
"dependencies": [
|
||||
"glew"
|
||||
]
|
||||
},
|
||||
"glfw": {
|
||||
"description": "Path to glfw",
|
||||
"dependencies": [
|
||||
"glfw3"
|
||||
]
|
||||
},
|
||||
"omp": {
|
||||
"description": "Enable OpenMP backend"
|
||||
},
|
||||
"opencl": {
|
||||
"description": "Enable OpenCL backend",
|
||||
"dependencies": [
|
||||
"opencl"
|
||||
]
|
||||
},
|
||||
"ptex": {
|
||||
"description": "Path to Ptex",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4958,7 +4958,7 @@
|
||||
},
|
||||
"opensubdiv": {
|
||||
"baseline": "3.4.3",
|
||||
"port-version": 2
|
||||
"port-version": 3
|
||||
},
|
||||
"opentelemetry-cpp": {
|
||||
"baseline": "1.0.1",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "786a994b5a4637b9cd43eaf2b790d913bce9cdce",
|
||||
"version-semver": "3.4.3",
|
||||
"port-version": 3
|
||||
},
|
||||
{
|
||||
"git-tree": "a8158645b04f25a236cd3fdf2debc67b10cfd945",
|
||||
"version-semver": "3.4.3",
|
||||
|
Loading…
x
Reference in New Issue
Block a user