mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 13:32:50 +08:00
show warning on MSVC (#29075)
This commit is contained in:
parent
cdf1f4db96
commit
e69dd972ba
@ -1,16 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index cc49726..25d6ff1 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -10,6 +10,11 @@ OPTION( TEST "Built unit tests" OFF )
|
||||
|
||||
SET( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
|
||||
|
||||
+if (MSVC)
|
||||
+ # Allow deprecated functions
|
||||
+ add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
+endif()
|
||||
+
|
||||
SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
|
||||
SET ( ly_src_dir ${ly_base_dir}/source )
|
||||
SET ( ly_inc_dir ${ly_base_dir}/include )
|
@ -1,62 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 50442cd..fdc82f2 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -28,24 +28,32 @@ LIST ( SORT ly_unittest_sources )
|
||||
INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
|
||||
|
||||
# this creates the static library (.a)
|
||||
+if (NOT BUILD_SHARED_LIBS)
|
||||
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
||||
SET_TARGET_PROPERTIES( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
|
||||
-
|
||||
+else()
|
||||
# this creates the shared library (.so)
|
||||
ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
|
||||
SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
|
||||
SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
|
||||
-
|
||||
+endif()
|
||||
# this creates the conversion tool
|
||||
ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
|
||||
-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
-
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
+ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_shared} )
|
||||
+else()
|
||||
+ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
+endif()
|
||||
|
||||
INCLUDE ( FindJPEG )
|
||||
if (JPEG_FOUND)
|
||||
- include_directories( ${JPEG_INCLUDE_DIR} )
|
||||
- target_link_libraries( ${ly_lib_shared} PUBLIC ${JPEG_LIBRARY} )
|
||||
- target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
|
||||
+ include_directories( ${JPEG_INCLUDE_DIR})
|
||||
+ if( BUILD_SHARED_LIBS)
|
||||
+ target_link_libraries(${ly_lib_shared} PUBLIC ${JPEG_LIBRARY})
|
||||
+ else()
|
||||
+ target_link_libraries(${ly_lib_static} PUBLIC ${JPEG_LIBRARY})
|
||||
+ endif()
|
||||
+ target_link_libraries(yuvconvert ${JPEG_LIBRARY})
|
||||
add_definitions( -DHAVE_JPEG )
|
||||
endif()
|
||||
|
||||
@@ -88,11 +96,13 @@ endif()
|
||||
|
||||
|
||||
# install the conversion tool, .so, .a, and all the header files
|
||||
-INSTALL ( TARGETS yuvconvert DESTINATION bin )
|
||||
+INSTALL ( TARGETS yuvconvert DESTINATION tools )
|
||||
INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
|
||||
-INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
||||
-INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
||||
-
|
||||
+if (NOT BUILD_SHARED_LIBS)
|
||||
+ INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
||||
+else()
|
||||
+ INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
||||
+endif()
|
||||
INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
|
||||
|
||||
# create the .deb and .rpm packages using cpack
|
89
ports/libyuv/fix-cmakelists.patch
Normal file
89
ports/libyuv/fix-cmakelists.patch
Normal file
@ -0,0 +1,89 @@
|
||||
Subject: [PATCH] patch cmakelist for vcpkg
|
||||
---
|
||||
Index: CMakeLists.txt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt (revision 010dea8ba4158896e5608a52dd4372ca7f57cdca)
|
||||
+++ b/CMakeLists.txt (revision da9ae4ff969b9722ce90b800d514fa26ad1fdf87)
|
||||
@@ -2,18 +2,21 @@
|
||||
# Originally created for "roxlu build system" to compile libyuv on windows
|
||||
# Run with -DTEST=ON to build unit tests
|
||||
|
||||
+CMAKE_MINIMUM_REQUIRED( VERSION 3.12)
|
||||
+
|
||||
PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
|
||||
-CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
|
||||
OPTION( TEST "Built unit tests" OFF )
|
||||
|
||||
+SET( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
|
||||
+
|
||||
SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
|
||||
SET ( ly_src_dir ${ly_base_dir}/source )
|
||||
SET ( ly_inc_dir ${ly_base_dir}/include )
|
||||
SET ( ly_tst_dir ${ly_base_dir}/unit_test )
|
||||
SET ( ly_lib_name yuv )
|
||||
SET ( ly_lib_static ${ly_lib_name} )
|
||||
-SET ( ly_lib_shared ${ly_lib_name}_shared )
|
||||
|
||||
+FILE ( GLOB_RECURSE ly_include_files ${ly_inc_dir}/libyuv/*.h )
|
||||
FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
|
||||
LIST ( SORT ly_source_files )
|
||||
|
||||
@@ -28,27 +31,20 @@
|
||||
|
||||
# this creates the static library (.a)
|
||||
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
||||
-
|
||||
-# this creates the shared library (.so)
|
||||
-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
|
||||
-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
|
||||
-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
|
||||
-if(WIN32)
|
||||
- SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" )
|
||||
-endif()
|
||||
+SET_TARGET_PROPERTIES ( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
|
||||
|
||||
# this creates the conversion tool
|
||||
-ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
|
||||
-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
+ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
|
||||
+TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
|
||||
# this creates the yuvconstants tool
|
||||
-ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
|
||||
-TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
|
||||
+ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
|
||||
+TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
|
||||
|
||||
find_package ( JPEG )
|
||||
if (JPEG_FOUND)
|
||||
- include_directories( ${JPEG_INCLUDE_DIR} )
|
||||
- target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} )
|
||||
+ include_directories( ${JPEG_INCLUDE_DIR})
|
||||
+ target_link_libraries(${ly_lib_static} PUBLIC ${JPEG_LIBRARY})
|
||||
add_definitions( -DHAVE_JPEG )
|
||||
endif()
|
||||
|
||||
@@ -87,14 +83,13 @@
|
||||
target_link_libraries(libyuv_unittest gflags)
|
||||
add_definitions(-DLIBYUV_USE_GFLAGS)
|
||||
endif()
|
||||
-endif()
|
||||
+endif()
|
||||
|
||||
-
|
||||
# install the conversion tool, .so, .a, and all the header files
|
||||
-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
|
||||
-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
|
||||
-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
||||
-INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
|
||||
+INSTALL ( TARGETS yuvconvert DESTINATION tools )
|
||||
+INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
|
||||
+INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
||||
+INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
|
||||
|
||||
# create the .deb and .rpm packages using cpack
|
||||
INCLUDE ( CM_linux_packages.cmake )
|
@ -1,61 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ed4948f..5b4e112 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -2,10 +2,14 @@
|
||||
# Originally created for "roxlu build system" to compile libyuv on windows
|
||||
# Run with -DTEST=ON to build unit tests
|
||||
|
||||
-PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
+CMAKE_POLICY( SET CMP0022 NEW )
|
||||
+
|
||||
+PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
|
||||
OPTION( TEST "Built unit tests" OFF )
|
||||
|
||||
+SET( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
|
||||
+
|
||||
SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
|
||||
SET ( ly_src_dir ${ly_base_dir}/source )
|
||||
SET ( ly_inc_dir ${ly_base_dir}/include )
|
||||
@@ -14,6 +18,7 @@ SET ( ly_lib_name yuv )
|
||||
SET ( ly_lib_static ${ly_lib_name} )
|
||||
SET ( ly_lib_shared ${ly_lib_name}_shared )
|
||||
|
||||
+FILE ( GLOB_RECURSE ly_include_files ${ly_inc_dir}/libyuv/*.h )
|
||||
FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
|
||||
LIST ( SORT ly_source_files )
|
||||
|
||||
@@ -24,6 +29,7 @@ INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
|
||||
|
||||
# this creates the static library (.a)
|
||||
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
||||
+SET_TARGET_PROPERTIES( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
|
||||
|
||||
# this creates the shared library (.so)
|
||||
ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
|
||||
@@ -38,6 +44,7 @@ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
INCLUDE ( FindJPEG )
|
||||
if (JPEG_FOUND)
|
||||
include_directories( ${JPEG_INCLUDE_DIR} )
|
||||
+ target_link_libraries( ${ly_lib_shared} PUBLIC ${JPEG_LIBRARY} )
|
||||
target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
|
||||
add_definitions( -DHAVE_JPEG )
|
||||
endif()
|
||||
@@ -81,10 +88,12 @@ endif()
|
||||
|
||||
|
||||
# install the conversion tool, .so, .a, and all the header files
|
||||
-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
|
||||
-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
|
||||
-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
||||
-INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
|
||||
+INSTALL ( TARGETS yuvconvert DESTINATION bin )
|
||||
+INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
|
||||
+INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
||||
+INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
||||
+
|
||||
+INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
|
||||
|
||||
# create the .deb and .rpm packages using cpack
|
||||
INCLUDE ( CM_linux_packages.cmake )
|
@ -3,18 +3,18 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
URL https://chromium.googlesource.com/libyuv/libyuv
|
||||
REF 287158925b0e03ea4499a18b4e08478c5781541b #2021-4-15
|
||||
REF 0faf8dd0e004520a61a603a4d2996d5ecc80dc3f
|
||||
# Check https://chromium.googlesource.com/libyuv/libyuv/+/refs/heads/main/include/libyuv/version.h for a version!
|
||||
PATCHES
|
||||
fix_cmakelists.patch
|
||||
fix-build-type.patch
|
||||
deprecated-warning.patch
|
||||
fix-cmakelists.patch
|
||||
)
|
||||
|
||||
set(POSTFIX d)
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
${BUILD_OPTIONS}
|
||||
OPTIONS_DEBUG
|
||||
-DCMAKE_DEBUG_POSTFIX=${POSTFIX}
|
||||
-DCMAKE_DEBUG_POSTFIX=d
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
@ -25,8 +25,14 @@ vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/libyuv)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/libyuv/convert.h "#ifdef HAVE_JPEG" "#if 1")
|
||||
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/libyuv/convert_argb.h "#ifdef HAVE_JPEG" "#if 1")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/libyuv-config.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT} COPYONLY)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/libyuv-config.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT} COPYONLY)
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
if (VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
message(WARNING "Use MSVC to compile libyuv results in a very slow library. (https://github.com/microsoft/vcpkg/issues/28446)")
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage-msvc" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "usage")
|
||||
else ()
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
endif ()
|
4
ports/libyuv/usage
Normal file
4
ports/libyuv/usage
Normal file
@ -0,0 +1,4 @@
|
||||
libyuv provides CMake targets:
|
||||
|
||||
find_package(libyuv CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE yuv)
|
9
ports/libyuv/usage-msvc
Normal file
9
ports/libyuv/usage-msvc
Normal file
@ -0,0 +1,9 @@
|
||||
libyuv provides CMake targets:
|
||||
|
||||
find_package(libyuv CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE yuv)
|
||||
|
||||
# WARNING
|
||||
# You are using MSVC to compile libyuv, which results in a very slow library.
|
||||
# MSVC won't compile any of the acceleration codes.
|
||||
# See workarounds: https://github.com/microsoft/vcpkg/issues/28446
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "libyuv",
|
||||
"version-date": "2021-04-15",
|
||||
"port-version": 1,
|
||||
"version": "1857",
|
||||
"description": "libyuv is an open source project that includes YUV scaling and conversion functionality",
|
||||
"homepage": "https://chromium.googlesource.com/libyuv/libyuv",
|
||||
"license": null,
|
||||
"dependencies": [
|
||||
"libjpeg-turbo",
|
||||
{
|
||||
@ -13,6 +13,10 @@
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -4613,8 +4613,8 @@
|
||||
"port-version": 3
|
||||
},
|
||||
"libyuv": {
|
||||
"baseline": "2021-04-15",
|
||||
"port-version": 1
|
||||
"baseline": "1857",
|
||||
"port-version": 0
|
||||
},
|
||||
"libzen": {
|
||||
"baseline": "0.4.39",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "ee4cbd8592c2d5f3fd77c1478b679bc00671b316",
|
||||
"version": "1857",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "ca463baa9f197bedced2b6ad24977d4ba928c0f2",
|
||||
"version-date": "2021-04-15",
|
||||
|
Loading…
Reference in New Issue
Block a user