mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 04:53:02 +08:00
[ms-gltf] Add new port (#14971)
* [ms-gltf] create a new port * [ms-gltf] install with CMAKE_INSTALL_PREFIX * add a patch to change install path style * [ms-gltf] enable iOS/UWP & support features * feature: support tests/samples to help debugging in buildtrees * triplet: ios/uwp are now available * [ms-gltf] disable Ninja for Windows * [ms-gltf] format the manifest json * [ms-gltf] update expected failures * x64-linux * [ms-gltf] format the manifest json * [ms-gltf] update comments * [ms-gltf] make "test" default feature * [ms-gltf] add version JSON * Address the review suggestions * vcpkg x-add-version ms-gltf * [ms-gltf] fix 'x64-osx' triplet 'samples' feature * [ms-gltf] update git-tree of port Co-authored-by: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com>
This commit is contained in:
parent
cc093a8224
commit
bb4de6fe3f
66
ports/ms-gltf/fix-apple-filesystem.patch
Normal file
66
ports/ms-gltf/fix-apple-filesystem.patch
Normal file
@ -0,0 +1,66 @@
|
||||
diff --git a/GLTFSDK.Samples/CMakeLists.txt b/GLTFSDK.Samples/CMakeLists.txt
|
||||
index a66ed93..d948ee2 100644
|
||||
--- a/GLTFSDK.Samples/CMakeLists.txt
|
||||
+++ b/GLTFSDK.Samples/CMakeLists.txt
|
||||
@@ -1,4 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
-
|
||||
+if(APPLE)
|
||||
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
|
||||
+endif()
|
||||
add_subdirectory(Deserialize)
|
||||
add_subdirectory(Serialize)
|
||||
diff --git a/GLTFSDK.Samples/Deserialize/CMakeLists.txt b/GLTFSDK.Samples/Deserialize/CMakeLists.txt
|
||||
index 791898c..6474aee 100644
|
||||
--- a/GLTFSDK.Samples/Deserialize/CMakeLists.txt
|
||||
+++ b/GLTFSDK.Samples/Deserialize/CMakeLists.txt
|
||||
@@ -17,6 +17,8 @@ if (MSVC)
|
||||
|
||||
# Make sure that all PDB files on Windows are installed to the output folder. By default, only the debug build does this.
|
||||
set_target_properties(Deserialize PROPERTIES COMPILE_PDB_NAME "Deserialize" COMPILE_PDB_OUTPUT_DIRECTORY "${RUNTIME_OUTPUT_DIRECTORY}")
|
||||
+elseif(APPLE)
|
||||
+ set_target_properties(Deserialize PROPERTIES CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
diff --git a/GLTFSDK.Samples/Deserialize/Source/main.cpp b/GLTFSDK.Samples/Deserialize/Source/main.cpp
|
||||
index 80198fa..fb560e0 100644
|
||||
--- a/GLTFSDK.Samples/Deserialize/Source/main.cpp
|
||||
+++ b/GLTFSDK.Samples/Deserialize/Source/main.cpp
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
// Replace this with <filesystem> (and use std::filesystem rather than
|
||||
// std::experimental::filesystem) if your toolchain fully supports C++17
|
||||
+#if defined(__APPLE__)
|
||||
+#define _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
|
||||
+#endif
|
||||
#include <experimental/filesystem>
|
||||
|
||||
#include <fstream>
|
||||
diff --git a/GLTFSDK.Samples/Serialize/CMakeLists.txt b/GLTFSDK.Samples/Serialize/CMakeLists.txt
|
||||
index 5269da8..1129ea0 100644
|
||||
--- a/GLTFSDK.Samples/Serialize/CMakeLists.txt
|
||||
+++ b/GLTFSDK.Samples/Serialize/CMakeLists.txt
|
||||
@@ -17,6 +17,8 @@ if (MSVC)
|
||||
|
||||
# Make sure that all PDB files on Windows are installed to the output folder. By default, only the debug build does this.
|
||||
set_target_properties(Serialize PROPERTIES COMPILE_PDB_NAME "Serialize" COMPILE_PDB_OUTPUT_DIRECTORY "${RUNTIME_OUTPUT_DIRECTORY}")
|
||||
+elseif(APPLE)
|
||||
+ set_target_properties(Serialize PROPERTIES CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
diff --git a/GLTFSDK.Samples/Serialize/Source/main.cpp b/GLTFSDK.Samples/Serialize/Source/main.cpp
|
||||
index ac87c10..f5c6e0b 100644
|
||||
--- a/GLTFSDK.Samples/Serialize/Source/main.cpp
|
||||
+++ b/GLTFSDK.Samples/Serialize/Source/main.cpp
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
// Replace this with <filesystem> (and use std::filesystem rather than
|
||||
// std::experimental::filesystem) if your toolchain fully supports C++17
|
||||
+#if defined(__APPLE__)
|
||||
+#define _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
|
||||
+#endif
|
||||
#include <experimental/filesystem>
|
||||
|
||||
#include <fstream>
|
44
ports/ms-gltf/fix-install.patch
Normal file
44
ports/ms-gltf/fix-install.patch
Normal file
@ -0,0 +1,44 @@
|
||||
diff --git a/Build/CMake/Modules/GLTFPlatform.cmake b/Build/CMake/Modules/GLTFPlatform.cmake
|
||||
index 3d940f5..322f029 100644
|
||||
--- a/Build/CMake/Modules/GLTFPlatform.cmake
|
||||
+++ b/Build/CMake/Modules/GLTFPlatform.cmake
|
||||
@@ -55,14 +55,14 @@ endfunction(GetGLTFPlatform)
|
||||
function(CreateGLTFInstallTargets target platform)
|
||||
|
||||
install(TARGETS ${target}
|
||||
- ARCHIVE DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/${platform}/$<CONFIG>/${PROJECT_NAME}
|
||||
- LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/${platform}/$<CONFIG>/${PROJECT_NAME}
|
||||
- RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/${platform}/$<CONFIG>/${PROJECT_NAME}
|
||||
- BUNDLE DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/${platform}/$<CONFIG>/${PROJECT_NAME}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
|
||||
+ BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${PROJECT_NAME}.pdb DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/${platform}/$<CONFIG>/${PROJECT_NAME})
|
||||
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${PROJECT_NAME}.pdb DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
|
||||
endfunction(CreateGLTFInstallTargets)
|
||||
diff --git a/GLTFSDK.Test/CMakeLists.txt b/GLTFSDK.Test/CMakeLists.txt
|
||||
index 5c8eca7..a0752a3 100644
|
||||
--- a/GLTFSDK.Test/CMakeLists.txt
|
||||
+++ b/GLTFSDK.Test/CMakeLists.txt
|
||||
@@ -46,4 +46,4 @@ add_custom_command(TARGET GLTFSDK.Test
|
||||
AddGLTFIOSAppProperties(GLTFSDK.Test)
|
||||
CreateGLTFInstallTargets(GLTFSDK.Test ${Platform})
|
||||
|
||||
-install(FILES ${PROJECT_BINARY_DIR}/$<CONFIG>/Resources/ DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/${Platform}/$<CONFIG>/${PROJECT_NAME}/Resources)
|
||||
+install(FILES ${PROJECT_BINARY_DIR}/$<CONFIG>/Resources/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
diff --git a/GLTFSDK/CMakeLists.txt b/GLTFSDK/CMakeLists.txt
|
||||
index 3c53c74..1e8d223 100644
|
||||
--- a/GLTFSDK/CMakeLists.txt
|
||||
+++ b/GLTFSDK/CMakeLists.txt
|
||||
@@ -46,4 +46,5 @@ target_include_directories(GLTFSDK
|
||||
PRIVATE "${CMAKE_BINARY_DIR}/GeneratedFiles"
|
||||
)
|
||||
|
||||
+install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/Inc/GLTFSDK DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
CreateGLTFInstallTargets(GLTFSDK ${Platform})
|
41
ports/ms-gltf/portfile.cmake
Normal file
41
ports/ms-gltf/portfile.cmake
Normal file
@ -0,0 +1,41 @@
|
||||
vcpkg_fail_port_install(MESSAGE "ms-gltf currently only supports Windows and Mac platforms" ON_TARGET "linux" "ios")
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO microsoft/glTF-SDK
|
||||
REF 9428f114b540fb93e6533d5ec460fc123efe0c86 # todo: r1.9.6.0
|
||||
SHA512 900caf6d72d360bae4c7af769a8879507f7f727b40f61723ffed679ad22877fb37daed2a0dfcbf27e15ab3adc8afe3249530b95691ce489b3446e5d9a35f205a
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-install.patch
|
||||
fix-apple-filesystem.patch
|
||||
)
|
||||
|
||||
# note: Test/Sample executables won't be installed
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
test ENABLE_UNIT_TESTS
|
||||
samples ENABLE_SAMPLES
|
||||
)
|
||||
|
||||
# note: Platform-native buildsystem will be more helpful to launch/debug the tests/samples.
|
||||
# note: The PDB file path is making Ninja fails to install.
|
||||
# For Windows, we rely on /MP. The other platforms should be able to build with PREFER_NINJA.
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
)
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright
|
||||
)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
endif()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
24
ports/ms-gltf/vcpkg.json
Normal file
24
ports/ms-gltf/vcpkg.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "ms-gltf",
|
||||
"version-string": "r1.9.5.0",
|
||||
"description": "glTF-SDK is a C++ Software Development Kit for glTF",
|
||||
"homepage": "https://github.com/microsoft/ms-gltf",
|
||||
"supports": "!linux",
|
||||
"dependencies": [
|
||||
"rapidjson"
|
||||
],
|
||||
"default-features": [
|
||||
"test"
|
||||
],
|
||||
"features": {
|
||||
"samples": {
|
||||
"description": "Build with GLTF samples"
|
||||
},
|
||||
"test": {
|
||||
"description": "Build test programs",
|
||||
"dependencies": [
|
||||
"gtest"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -3868,6 +3868,10 @@
|
||||
"baseline": "alias",
|
||||
"port-version": 0
|
||||
},
|
||||
"ms-gltf": {
|
||||
"baseline": "r1.9.5.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"ms-gsl": {
|
||||
"baseline": "3.1.0",
|
||||
"port-version": 0
|
||||
|
9
versions/m-/ms-gltf.json
Normal file
9
versions/m-/ms-gltf.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "1c3bf009ece6942607e095c0088810b6dbf86d38",
|
||||
"version-string": "r1.9.5.0",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user