vcpkg/ports/ptex/portfile.cmake

50 lines
1.5 KiB
CMake
Raw Normal View History

vcpkg_fail_port_install(ON_TARGET "uwp")
2017-06-22 22:07:21 +08:00
set(PTEX_VER 2.3.2)
2017-06-22 22:07:21 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO wdas/ptex
REF 1b8bc985a71143317ae9e4969fa08e164da7c2e5
SHA512 37f2df9ec195f3d69d9526d0dea6a93ef49d69287bfae6ccd9671477491502ea760ed14e3b206b4f488831ab728dc749847b7d176c9b8439fb58b0a0466fe6c5
HEAD_REF master
PATCHES
fix-build.patch
fix-config.cmake.patch
)
2017-06-22 22:07:21 +08:00
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()
2017-06-22 22:07:21 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
2020-10-21 12:05:09 +08:00
-DPTEX_VER=v${PTEX_VER}
-DPTEX_BUILD_SHARED_LIBS=${BUILD_SHARED_LIB}
-DPTEX_BUILD_STATIC_LIBS=${BUILD_STATIC_LIB}
)
2017-06-22 22:07:21 +08:00
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/Ptex)
2017-06-22 22:07:21 +08:00
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)
# Handle copyright
2020-10-21 12:05:09 +08:00
file(INSTALL ${SOURCE_PATH}/src/doc/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)