vcpkg/ports/discount/portfile.cmake
Tri Tran 8390d68837 [discount] Add new package Discount (#7400)
* [discount] Add new package Discount

* [discount] Add new package Discount

* New package [Discount](https://github.com/Orc/discount)

* Static build only

* [discount] Fix arm* and *uwp builds

* Discount needs to run `mktags.exe` to generate `blocktags`. This fix copy generated `blocktags` to `SOURCE_PATH` for arm\* builds and \*uwp builds.

* [discount] Fix UWP and ARM check

* [discount] Another fix for blocktags

* [discount] And another one

* [discount] And another one. Please squash these PR commits.

Sorry I don't have UWP or ARM compiler installed on my machine.

* [discount] Use definitions in msvc/Makefile

* [discount] Add homepage
2019-08-08 12:04:39 -04:00

46 lines
1.3 KiB
CMake

include(vcpkg_common_functions)
# No dynamic link for MSVC
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Orc/discount
REF v2.2.6
SHA512 4c5956dea78aacd3a105ddac13f1671d811a5b2b04990cdf8485c36190c8872c4b1b9432a7236f669c34b07564ecd0096632dced54d67de9eaf4f23641417ecc
HEAD_REF master
PATCHES
cmake.patch
generate-blocktags-command.patch
disable-deprecated-warnings.patch
)
set(GENERATE_BLOCKTAGS ON)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm64" OR VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
set(GENERATE_BLOCKTAGS OFF)
endif()
if(NOT GENERATE_BLOCKTAGS)
configure_file("${CURRENT_PORT_DIR}/blocktags" "${SOURCE_PATH}/blocktags" COPYONLY)
message(STATUS "Copied blocktags")
endif()
vcpkg_configure_cmake(
SOURCE_PATH "${SOURCE_PATH}/cmake"
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DDISCOUNT_ONLY_LIBRARY=ON
-DGENERATE_BLOCKTAGS=${GENERATE_BLOCKTAGS}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/discount)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/discount" RENAME copyright)