aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-07-03 15:54:09 -0700
committerGitHub <noreply@github.com>2017-07-03 15:54:09 -0700
commit20eac6399951d1bd25af6e68fad093d2076038d4 (patch)
tree2681891eedc183f6e68d789294a490ee7765cabe
parent1c196835b4d86c4f63318e4a63ceb104ea1d2355 (diff)
parentc75a8aa7acce785ff0231921c829041f0d7fb131 (diff)
downloadvcpkg-20eac6399951d1bd25af6e68fad093d2076038d4.tar.gz
vcpkg-20eac6399951d1bd25af6e68fad093d2076038d4.zip
Merge pull request #1381 from codicodi/ptex
[ptex] new port
-rw-r--r--ports/ptex/CONTROL4
-rw-r--r--ports/ptex/fix-build.patch65
-rw-r--r--ports/ptex/portfile.cmake35
3 files changed, 104 insertions, 0 deletions
diff --git a/ports/ptex/CONTROL b/ports/ptex/CONTROL
new file mode 100644
index 000000000..b2e6bff27
--- /dev/null
+++ b/ports/ptex/CONTROL
@@ -0,0 +1,4 @@
+Source: ptex
+Version: 2.1.28
+Description: Per-Face Texture Mapping for Production Rendering.
+Build-Depends: zlib
diff --git a/ports/ptex/fix-build.patch b/ports/ptex/fix-build.patch
new file mode 100644
index 000000000..6d6484d60
--- /dev/null
+++ b/ports/ptex/fix-build.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dd327d0..5043452 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,15 +6,6 @@ include(CTest)
+ include(FindZLIB)
+ include(FindThreads)
+
+-enable_testing()
+-
+-# Detect the build type from the $FLAVOR environment variable
+-if ("$ENV{FLAVOR}" MATCHES "debug")
+- set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "type of build" FORCE)
+-else ()
+- set(CMAKE_BUILD_TYPE "Release" CACHE STRING "type of build" FORCE)
+-endif ()
+-
+ if (NOT WIN32)
+ set(CMAKE_CXX_FLAGS "-std=c++98 -Wall -Wextra -pedantic")
+ endif ()
+@@ -40,6 +31,6 @@ include_directories(src/ptex)
+ include_directories(${ZLIB_INCLUDE_DIR})
+
+ add_subdirectory(src/ptex)
+-add_subdirectory(src/utils)
+-add_subdirectory(src/tests)
+-add_subdirectory(src/doc)
++#add_subdirectory(src/utils)
++#add_subdirectory(src/tests)
++#add_subdirectory(src/doc)
+diff --git a/src/ptex/CMakeLists.txt b/src/ptex/CMakeLists.txt
+index c926d98..ac2c71d 100644
+--- a/src/ptex/CMakeLists.txt
++++ b/src/ptex/CMakeLists.txt
+@@ -1,6 +1,8 @@
+-if (WIN32)
+- add_definitions(/DPTEX_EXPORTS)
+-endif (WIN32)
++if (BUILD_SHARED_LIBS)
++ add_definitions(-DPTEX_EXPORTS)
++else ()
++ add_definitions(-DPTEX_STATIC)
++endif ()
+
+ set(SRCS
+ PtexCache.cpp
+@@ -14,15 +16,11 @@ set(SRCS
+ PtexUtils.cpp
+ PtexWriter.cpp)
+
+-add_library(Ptex_static STATIC ${SRCS})
+-set_target_properties(Ptex_static PROPERTIES OUTPUT_NAME Ptex)
++add_library(Ptex ${SRCS})
+
+-add_library(Ptex_dynamic SHARED ${SRCS})
+-set_target_properties(Ptex_dynamic PROPERTIES OUTPUT_NAME Ptex)
++target_link_libraries(Ptex ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
+
+-target_link_libraries(Ptex_dynamic ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
+-
+-install(TARGETS Ptex_static Ptex_dynamic DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS Ptex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ install(FILES
+ PtexHalf.h
diff --git a/ports/ptex/portfile.cmake b/ports/ptex/portfile.cmake
new file mode 100644
index 000000000..52d77096b
--- /dev/null
+++ b/ports/ptex/portfile.cmake
@@ -0,0 +1,35 @@
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ message(FATAL_ERROR "UWP build not supported")
+endif()
+
+include(vcpkg_common_functions)
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO wdas/ptex
+ REF v2.1.28
+ SHA512 ddce3c79f14d196e550c1e8a5b371482f88190cd667a2e2aa84601de1639f7cabb8571c1b3a49b48df46ce550d27088a00a67b1403c3bfec2ed73437c3dca3e8
+ HEAD_REF master)
+
+vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-build.patch)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+foreach(HEADER PtexHalf.h Ptexture.h)
+ file(READ ${CURRENT_PACKAGES_DIR}/include/${HEADER} PTEX_HEADER)
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ string(REPLACE "ifndef PTEX_STATIC" "if 1" PTEX_HEADER "${PTEX_HEADER}")
+ else()
+ string(REPLACE "ifndef PTEX_STATIC" "if 0" PTEX_HEADER "${PTEX_HEADER}")
+ endif()
+ file(WRITE ${CURRENT_PACKAGES_DIR}/include/${HEADER} "${PTEX_HEADER}")
+endforeach()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(COPY ${SOURCE_PATH}/src/doc/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/ptex)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/ptex/license.txt ${CURRENT_PACKAGES_DIR}/share/ptex/copyright)