[tinyutf8] Initial port for tinyutf8. (#4388)

* Add tinyutf8 port.

* [tinyutf8] Use vcpkg_from_github(). Simplify patch.
This commit is contained in:
つむぎん 2018-10-04 13:32:36 +09:00 committed by Robert Schumacher
parent 37b1778053
commit dabfd4e022
3 changed files with 61 additions and 0 deletions

3
ports/tinyutf8/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: tinyutf8
Version: 2.1.1-1
Description: TINYUTF8 is a library for extremely easy integration of Unicode into an arbitrary C++11 project.

View File

@ -0,0 +1,29 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ec8787..cfea5b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(tinyutf8)
-set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
option(TINYUTF8_BUILD_STATIC "Build as static library" On)
@@ -14,3 +14,14 @@ endif()
add_library(tinyutf8 ${LIB_BUILD_TYPE} lib/tinyutf8.cpp)
target_include_directories(tinyutf8 PUBLIC include)
+
+if(MSVC)
+ ADD_DEFINITIONS(-D_UNICODE)
+endif()
+
+install(TARGETS tinyutf8
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+install(FILES include/tinyutf8.h DESTINATION include)
\ No newline at end of file

View File

@ -0,0 +1,29 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DuffsDevice/tinyutf8
REF v2.1.1
SHA512 0be9cebe1ac962c89e0620586d4f8d4f3059b52394e13506f19723855d146c35e6a1205ae5430a53ba95a89c60216054bfad9c4e8e8f1ec047f4096585de2efc
HEAD_REF master
PATCHES fixbuild.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" TINYUTF8_BUILD_STATIC)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DTINYUTF8_BUILD_STATIC=${TINYUTF8_BUILD_STATIC}
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
# Handle copyright
configure_file(${SOURCE_PATH}/LICENCE ${CURRENT_PACKAGES_DIR}/share/tinyutf8/copyright COPYONLY)
# remove unneeded files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)