vcpkg/ports/libharu/portfile.cmake
Mengna Li 72cdfe25ee
[vcpkg baseline][libharu] update to 2.4.0-rc1 (#25569)
* update to 2.4.0-rc1

* update vtk vcpkg.json file

* export targets

* update patch

* update patch

* Fix FindLibHaru in vtk

* update ports/vtk/FindLibHaru.patch

* update patch

* fix find libharu
2022-07-13 10:30:11 -07:00

60 lines
2.0 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libharu/libharu
REF 6997cf775b2345e3db82ac774fe2931faf348458 #2.4.0-rc1
SHA512 758753b0f977c6b9f0b6309958e1edfba491851682c9b04cead6ebebc9af726fdec7265f36ca1b1e80f1849f9b4a43ad329a688b4844eb911c64d42a92cd7823
HEAD_REF master
PATCHES
fix-include-path.patch
export-targets.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(VCPKG_BUILD_SHARED_LIBS ON)
set(VCPKG_BUILD_STATIC_LIBS OFF)
else()
set(VCPKG_BUILD_SHARED_LIBS OFF)
set(VCPKG_BUILD_STATIC_LIBS ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DLIBHPDF_STATIC=${VCPKG_BUILD_STATIC_LIBS}
-DLIBHPDF_SHARED=${VCPKG_BUILD_SHARED_LIBS}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libharu)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/README.md"
"${CURRENT_PACKAGES_DIR}/debug/CHANGES"
"${CURRENT_PACKAGES_DIR}/debug/INSTALL"
"${CURRENT_PACKAGES_DIR}/README.md"
"${CURRENT_PACKAGES_DIR}/CHANGES"
"${CURRENT_PACKAGES_DIR}/INSTALL"
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(READ "${CURRENT_PACKAGES_DIR}/include/hpdf.h" _contents)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(REPLACE "#ifdef HPDF_DLL\n" "#if 1\n" _contents "${_contents}")
else()
string(REPLACE "#ifdef HPDF_DLL\n" "#if 0\n" _contents "${_contents}")
endif()
file(WRITE "${CURRENT_PACKAGES_DIR}/include/hpdf.h" "${_contents}")
file(READ "${CURRENT_PACKAGES_DIR}/include/hpdf_types.h" _contents)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(REPLACE "#ifdef HPDF_DLL\n" "#if 1\n" _contents "${_contents}")
else()
string(REPLACE "#ifdef HPDF_DLL\n" "#if 0\n" _contents "${_contents}")
endif()
file(WRITE "${CURRENT_PACKAGES_DIR}/include/hpdf_types.h" "${_contents}")
vcpkg_copy_pdbs()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)