[utfcpp] Use vcpkg_*_cmake and add features (#13521)

This commit is contained in:
Jack·Boos·Yu 2020-10-13 14:46:28 -07:00 committed by GitHub
parent 0a41fb2dfa
commit cebe051841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 150 additions and 95 deletions

View File

@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dcafb64..4b131cc 100644
index dcafb64..453fdff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,6 +130,17 @@ OPTION ( IGNORE_GIT_HASH
@ -9,8 +9,8 @@ index dcafb64..4b131cc 100644
+find_package(Stb REQUIRED)
+include_directories(${Stb_INCLUDE_DIR})
+find_package(irrXML CONFIG REQUIRED)
+find_path(UTF8_INCLUDE_DIRS "utf8.h")
+include_directories(${UTF8_INCLUDE_DIRS})
+find_package(utf8cpp CONFIG REQUIRED)
+link_libraries(utf8cpp)
+find_package(RapidJSON CONFIG REQUIRED)
+include_directories(${RAPIDJSON_INCLUDE_DIRS})
+find_path(UNZIP_INCLUDE_DIRS "minizip/unzip.h")
@ -31,16 +31,15 @@ index dcafb64..4b131cc 100644
# Grouped compiler settings
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
@@ -253,7 +262,7 @@ ELSEIF(MSVC)
@@ -253,7 +262,6 @@ ELSEIF(MSVC)
IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351)
ENDIF()
- SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob2 /DEBUG:FULL /Zi")
+# SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob2 /DEBUG:FULL /Zi")
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
IF(NOT HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
@@ -352,35 +361,17 @@ IF (NOT TARGET uninstall)
@@ -352,35 +360,17 @@ IF (NOT TARGET uninstall)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
@ -80,7 +79,7 @@ index dcafb64..4b131cc 100644
DESTINATION "${CONFIG_INSTALL_DIR}"
)
@@ -389,30 +380,6 @@ IF(HUNTER_ENABLED)
@@ -389,30 +379,6 @@ IF(HUNTER_ENABLED)
NAMESPACE "${NAMESPACE}"
DESTINATION "${CONFIG_INSTALL_DIR}"
)
@ -111,7 +110,7 @@ index dcafb64..4b131cc 100644
FIND_PACKAGE( DirectX )
@@ -422,63 +389,19 @@ ENDIF( BUILD_DOCS )
@@ -422,63 +388,19 @@ ENDIF( BUILD_DOCS )
# Look for system installed irrXML
IF ( SYSTEM_IRRXML )
@ -179,7 +178,7 @@ index dcafb64..4b131cc 100644
IF ( ASSIMP_NO_EXPORT )
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
@@ -633,7 +556,7 @@ IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
@@ -633,7 +555,7 @@ IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
INCLUDE(DebSourcePPA)
ENDIF()
@ -188,7 +187,7 @@ index dcafb64..4b131cc 100644
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
@@ -677,4 +600,4 @@ if(WIN32)
@@ -677,4 +599,4 @@ if(WIN32)
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
ENDIF()
ENDIF(MSVC12 OR MSVC14 OR MSVC15 )

View File

@ -1,82 +1,82 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ec072d..3c8b5ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,7 +132,6 @@ OPTION ( IGNORE_GIT_HASH
find_package(Stb REQUIRED)
include_directories(${Stb_INCLUDE_DIR})
-find_package(irrXML CONFIG REQUIRED)
find_path(UTF8_INCLUDE_DIRS "utf8.h")
include_directories(${UTF8_INCLUDE_DIRS})
find_package(RapidJSON CONFIG REQUIRED)
@@ -389,7 +388,7 @@ ENDIF( BUILD_DOCS )
# Look for system installed irrXML
IF ( SYSTEM_IRRXML )
- FIND_PACKAGE( irrXML REQUIRED )
+ FIND_PACKAGE( irrlicht CONFIG REQUIRED )
ENDIF( SYSTEM_IRRXML )
# Search for external dependencies, and build them from source if not found
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index 17fcea7..f08f59f 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -862,7 +862,7 @@ SET( Extra_SRCS
SOURCE_GROUP( Extra FILES ${Extra_SRCS})
# irrXML
- find_package(irrXML CONFIG REQUIRED)
+ find_package(irrlicht CONFIG REQUIRED)
# polyclipping
find_package(polyclipping CONFIG REQUIRED)
@@ -1033,7 +1033,7 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
TARGET_LINK_LIBRARIES(assimp
polyclipping::polyclipping
- irrXML::irrXML
+ Irrlicht
minizip::minizip
ZLIB::ZLIB
kubazip::kubazip
diff --git a/code/X3D/FIReader.cpp b/code/X3D/FIReader.cpp
index 31d9aba..2c96052 100644
--- a/code/X3D/FIReader.cpp
+++ b/code/X3D/FIReader.cpp
@@ -654,8 +654,8 @@ public:
return currentNodeType;
}
- virtual int getAttributeCount() const /*override*/ {
- return static_cast<int>(attributes.size());
+ virtual unsigned int getAttributeCount() const /*override*/ {
+ return static_cast<unsigned int>(attributes.size());
}
virtual const char* getAttributeName(int idx) const /*override*/ {
@@ -1733,7 +1733,7 @@ public:
return reader->getNodeType();
}
- virtual int getAttributeCount() const /*override*/ {
+ virtual unsigned int getAttributeCount() const /*override*/ {
return reader->getAttributeCount();
}
diff --git a/include/assimp/irrXMLWrapper.h b/include/assimp/irrXMLWrapper.h
index 77cfd5e..ba584a0 100644
--- a/include/assimp/irrXMLWrapper.h
+++ b/include/assimp/irrXMLWrapper.h
@@ -133,8 +133,8 @@ public:
// ----------------------------------------------------------------------------------
//! Returns size of file in bytes
- virtual int getSize() {
- return (int)data.size();
+ virtual long getSize() const override {
+ return (long)data.size();
}
private:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 453fdff..3a02956 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,7 +132,6 @@ OPTION ( IGNORE_GIT_HASH
find_package(Stb REQUIRED)
include_directories(${Stb_INCLUDE_DIR})
-find_package(irrXML CONFIG REQUIRED)
find_package(utf8cpp CONFIG REQUIRED)
link_libraries(utf8cpp)
find_package(RapidJSON CONFIG REQUIRED)
@@ -388,7 +387,7 @@ ENDIF( BUILD_DOCS )
# Look for system installed irrXML
IF ( SYSTEM_IRRXML )
- FIND_PACKAGE( irrXML REQUIRED )
+ FIND_PACKAGE( irrlicht CONFIG REQUIRED )
ENDIF( SYSTEM_IRRXML )
# Search for external dependencies, and build them from source if not found
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index f5553e5..5cffa0c 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -862,7 +862,7 @@ SET( Extra_SRCS
SOURCE_GROUP( Extra FILES ${Extra_SRCS})
# irrXML
- find_package(irrXML CONFIG REQUIRED)
+ find_package(irrlicht CONFIG REQUIRED)
# polyclipping
find_package(polyclipping CONFIG REQUIRED)
@@ -1033,7 +1033,7 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
TARGET_LINK_LIBRARIES(assimp
polyclipping::polyclipping
- irrXML::irrXML
+ Irrlicht
minizip::minizip
ZLIB::ZLIB
kubazip::kubazip
diff --git a/code/X3D/FIReader.cpp b/code/X3D/FIReader.cpp
index 525a084..0cbca48 100644
--- a/code/X3D/FIReader.cpp
+++ b/code/X3D/FIReader.cpp
@@ -654,8 +654,8 @@ public:
return currentNodeType;
}
- virtual int getAttributeCount() const /*override*/ {
- return static_cast<int>(attributes.size());
+ virtual unsigned int getAttributeCount() const /*override*/ {
+ return static_cast<unsigned int>(attributes.size());
}
virtual const char* getAttributeName(int idx) const /*override*/ {
@@ -1733,7 +1733,7 @@ public:
return reader->getNodeType();
}
- virtual int getAttributeCount() const /*override*/ {
+ virtual unsigned int getAttributeCount() const /*override*/ {
return reader->getAttributeCount();
}
diff --git a/include/assimp/irrXMLWrapper.h b/include/assimp/irrXMLWrapper.h
index 77cfd5e..ba584a0 100644
--- a/include/assimp/irrXMLWrapper.h
+++ b/include/assimp/irrXMLWrapper.h
@@ -133,8 +133,8 @@ public:
// ----------------------------------------------------------------------------------
//! Returns size of file in bytes
- virtual int getSize() {
- return (int)data.size();
+ virtual long getSize() const override {
+ return (long)data.size();
}
private:

View File

@ -1,4 +1,5 @@
Source: utfcpp
Version: 3.1.2
Port-Version: 1
Homepage: https://github.com/nemtrif/utfcpp
Description: UTF-8 with C++ in a Portable Way
Description: UTF-8 with C++ in a Portable Way

View File

@ -0,0 +1,36 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ac1646..c081d3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,6 @@ endif()
if(UTF8_TESTS)
enable_testing()
- add_subdirectory(extern/gtest)
+ find_package(GTest CONFIG REQUIRED)
add_subdirectory(tests)
endif()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 06e0d7e..4ee6dd8 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -15,16 +15,16 @@ add_executable(noexceptionstests
target_link_libraries(negative PRIVATE utf8::cpp)
target_link_libraries(cpp11 PRIVATE
utf8::cpp
- gtest_main
+ GTest::gtest_main
)
target_link_libraries(apitests PRIVATE
utf8::cpp
- gtest_main
+ GTest::gtest_main
)
target_link_libraries(noexceptionstests PRIVATE
utf8::cpp
- gtest_main
+ GTest::gtest_main
)
target_compile_options(noexceptionstests PUBLIC -fno-exceptions)

View File

@ -4,8 +4,27 @@ vcpkg_from_github(
REF v3.1.2
SHA512 d43df19d9e8652291f1301a326ec0d592bad43d6ecf9086947037f0ae0c1e70c2d96082c48066639e2b7c57c0ea0e4782d6b215d017cf96a4c73ff3a15feec75
HEAD_REF master
PATCHES fix-test.patch
)
file(COPY ${SOURCE_PATH}/source/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DUTF8_INSTALL=ON
-DUTF8_SAMPLES=OFF
-DUTF8_TESTS=OFF
)
file(INSTALL ${SOURCE_PATH}/source/utf8.h DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_install_cmake()
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/utf8cpp)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/utf8cpp TARGET_PATH share/utf8cpp)
endif()
# Header only
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)