vcpkg/ports/opencc/portfile.cmake
Mengna Li ac4f80ae9d
[opencc] De-vendor marisa ()
* Add feature marisa

* update

* remove useless code

* add pkgconf

* update
2023-03-13 12:04:42 -07:00

55 lines
1.7 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO BYVoid/OpenCC
REF "ver.${VERSION}"
SHA512 bfc40bdf1348e6a265b3304ab1e8acee2f4b6ac9c377ff3d8c996435a92dee98c3758503186b4fd424653faf44db339f8a90300e3290c59942ccf04b1bbb2a30
HEAD_REF master
PATCHES
fix-dependencies.patch
)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_DOCUMENTATION=OFF
-DENABLE_GTEST=OFF
-DUSE_SYSTEM_RAPIDJSON=ON
-DUSE_SYSTEM_TCLAP=ON
-DUSE_SYSTEM_DARTS=ON
-DUSE_SYSTEM_MARISA=ON
-DPKG_CONFIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf
)
vcpkg_cmake_install(
DISABLE_PARALLEL
)
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
set(tool_names "opencc" "opencc_dict" "opencc_phrase_extract")
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ${tool_names} AUTO_CLEAN)
endif()
foreach(opencc_tool IN LISTS tool_names)
file(REMOVE
"${CURRENT_PACKAGES_DIR}/bin/${opencc_tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
"${CURRENT_PACKAGES_DIR}/debug/bin/${opencc_tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
)
endforeach()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")