vcpkg/ports/ptex/portfile.cmake
Robert Schumacher 1550b9e71b
[many ports] Updates 2019.07.09 (#7217)
* [many ports] Upgrades 2019.07.11

* Re-generate patches and fix build errors.

* [manyport]Fix build errors.

* Fix avro-c and console-bridge failures, revert curl and tesseract

* fix botan failure

* Fix build errors and undo some ports upgrades.

* [aws-c-common,chipmunk,cxxopts,grpc]Fix build errors

* Fix build errors.

* [angle]Undo upgrade changes.

* [directxtk]Fix UWP build error (#7233)

* Revert leptonica since it cause tesseract failed

* Revert jsonnet

* [google-cloud-cpp] Disable parallel configure due to source directory writes

* [many ports] Undo undesired changes

* [bitsery] Fix indentation

* [avro-c][aws-c-common][graphite2] Convert line endings to minimize PR diff

* fix console-bridge and remove usockets unused patch

* update ogre patch

* [many ports] Revert unneeded changes w.r.t. master. Add missing write to console-bridge.

* [console-bridge] Fix export macro

* [avro-c] Revert upgrade; split to #7875

* [avro-c] Complete previous revert
2019-08-24 13:43:57 -07:00

52 lines
1.7 KiB
CMake

include(vcpkg_common_functions)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "UWP build not supported")
endif()
set(PTEX_VER 2.3.2)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO wdas/ptex
REF 1b8bc985a71143317ae9e4969fa08e164da7c2e5
SHA512 37f2df9ec195f3d69d9526d0dea6a93ef49d69287bfae6ccd9671477491502ea760ed14e3b206b4f488831ab728dc749847b7d176c9b8439fb58b0a0466fe6c5
HEAD_REF master
PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-build.patch
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(BUILD_SHARED_LIB ON)
set(BUILD_STATIC_LIB OFF)
else()
set(BUILD_SHARED_LIB OFF)
set(BUILD_STATIC_LIB ON)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DPTEX_VER="v${PTEX_VER}"
-DPTEX_BUILD_SHARED_LIBS=${BUILD_SHARED_LIB}
-DPTEX_BUILD_STATIC_LIBS=${BUILD_STATIC_LIB}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/Ptex)
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 ${CURRENT_PACKAGES_DIR}/debug/share)
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)