aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2020-05-27 12:45:20 +0800
committerGitHub <noreply@github.com>2020-05-26 21:45:20 -0700
commit01926a1eb1117052964959ef0d334812021a23fe (patch)
treedd9bd7cd2518372608a7969849bed14f1245a9d6
parent924eb894784f0256a6a2ca7796b3ee389a802afe (diff)
downloadvcpkg-01926a1eb1117052964959ef0d334812021a23fe.tar.gz
vcpkg-01926a1eb1117052964959ef0d334812021a23fe.zip
[tinyply] Add new port (#11534)
* [tinyply] Add new port * [tinyply] CMake patch
-rw-r--r--ports/tinyply/CONTROL4
-rw-r--r--ports/tinyply/fix-cmake.patch27
-rw-r--r--ports/tinyply/portfile.cmake34
3 files changed, 65 insertions, 0 deletions
diff --git a/ports/tinyply/CONTROL b/ports/tinyply/CONTROL
new file mode 100644
index 000000000..a75e1fb9b
--- /dev/null
+++ b/ports/tinyply/CONTROL
@@ -0,0 +1,4 @@
+Source: tinyply
+Version: 2020-05-22
+Description: C++11 ply 3d mesh format importer & exporter
+Homepage: https://github.com/ddiakopoulos/tinyply
diff --git a/ports/tinyply/fix-cmake.patch b/ports/tinyply/fix-cmake.patch
new file mode 100644
index 000000000..681e30f1f
--- /dev/null
+++ b/ports/tinyply/fix-cmake.patch
@@ -0,0 +1,27 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2bd9563..4d4d9fe 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -50,6 +50,8 @@ set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
+ set(targets_export_name "${PROJECT_NAME}Targets")
+ set(namespace "")
+
++include(GNUInstallDirs)
++
+ write_basic_package_version_file(
+ "${version_config}"
+ VERSION ${PROJECT_VERSION}
+@@ -63,9 +65,10 @@ configure_package_config_file(
+
+ # Install
+ install(TARGETS tinyply EXPORT ${targets_export_name}
+- RUNTIME DESTINATION bin
+- ARCHIVE DESTINATION lib
+- LIBRARY DESTINATION lib)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ install(FILES source/tinyply.h
+ DESTINATION include)
+
diff --git a/ports/tinyply/portfile.cmake b/ports/tinyply/portfile.cmake
new file mode 100644
index 000000000..a5e93530c
--- /dev/null
+++ b/ports/tinyply/portfile.cmake
@@ -0,0 +1,34 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ddiakopoulos/tinyply
+ REF ca7b279fb6c9af931ffdaed96a3b11ca3ccd79ea
+ SHA512 d3adfe7cce849a14fd473cfd67baef0163d4e45ff32724516270d5893a18086f7ac17d87bda5c33381442766849b41516bd2c7757e97038c95af0c70d5f0edde
+ HEAD_REF master
+ PATCHES
+ # TODO: Remove this patch if https://github.com/ddiakopoulos/tinyply/pull/41 was accepted.
+ fix-cmake.patch
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SHARED_LIB)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DSHARED_LIB=${SHARED_LIB}
+ -DBUILD_TESTS=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# License
+file(READ "${SOURCE_PATH}/readme.md" readme_contents)
+string(FIND "${readme_contents}" "License" license_line_pos)
+string(SUBSTRING "${readme_contents}" ${license_line_pos} -1 license_contents)
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright "${license_contents}")