Merge branch 'master' into add-llvm

This commit is contained in:
Stephane Lajoie 2017-07-03 21:53:35 -04:00
commit a2fc99fa31
4 changed files with 106 additions and 2 deletions

View File

@ -107,8 +107,8 @@ To override the automatically chosen [triplet][], you can specify the MSBuild pr
```xml
<PropertyGroup Label="Globals">
<!-- .... -->
<VcpkgTriplet Condition="'$(Configuration)'=='Win32'">x86-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Configuration)'=='x64'">x64-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
</PropertyGroup>
```

4
ports/ptex/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: ptex
Version: 2.1.28
Description: Per-Face Texture Mapping for Production Rendering.
Build-Depends: zlib

View File

@ -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

35
ports/ptex/portfile.cmake Normal file
View File

@ -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)