mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 12:57:59 +08:00
[libyuv] Fix static build issue (#12338)
* [libyuv] Fix static build issue * Update the patch and replace the definition i headers file
This commit is contained in:
parent
0b78ddc14b
commit
5a4e2c0484
@ -1,4 +1,6 @@
|
|||||||
Source: libyuv
|
Source: libyuv
|
||||||
Version: fec9121-2
|
Version: fec9121
|
||||||
|
Port-Version: 3
|
||||||
|
Homepage: https://chromium.googlesource.com/libyuv/libyuv
|
||||||
Build-Depends: libjpeg-turbo
|
Build-Depends: libjpeg-turbo
|
||||||
Description: libyuv is an open source project that includes YUV scaling and conversion functionality.
|
Description: libyuv is an open source project that includes YUV scaling and conversion functionality.
|
||||||
|
@ -1,53 +1,62 @@
|
|||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
index 097434b..8f8864f 100644
|
index 50442cd..fdc82f2 100644
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -28,21 +28,25 @@ LIST ( SORT ly_unittest_sources )
|
@@ -28,24 +28,32 @@ LIST ( SORT ly_unittest_sources )
|
||||||
INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
|
INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
|
||||||
|
|
||||||
# this creates the static library (.a)
|
# this creates the static library (.a)
|
||||||
+if (NOT BUILD_SHARED_LIBS)
|
+if (NOT BUILD_SHARED_LIBS)
|
||||||
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
||||||
SET_TARGET_PROPERTIES( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
|
SET_TARGET_PROPERTIES( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
|
||||||
-
|
-
|
||||||
+else()
|
+else()
|
||||||
# this creates the shared library (.so)
|
# this creates the shared library (.so)
|
||||||
ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
|
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 OUTPUT_NAME "${ly_lib_name}" )
|
||||||
SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
|
SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
|
||||||
-
|
-
|
||||||
+endif()
|
+endif()
|
||||||
# this creates the conversion tool
|
# this creates the conversion tool
|
||||||
ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
|
ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
|
||||||
-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||||
-
|
-
|
||||||
+if (BUILD_SHARED_LIBS)
|
+if (BUILD_SHARED_LIBS)
|
||||||
+ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_shared} )
|
+ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_shared} )
|
||||||
+else()
|
+else()
|
||||||
+ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
+ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||||
+endif()
|
+endif()
|
||||||
|
|
||||||
INCLUDE ( FindJPEG )
|
INCLUDE ( FindJPEG )
|
||||||
-if (JPEG_FOUND)
|
if (JPEG_FOUND)
|
||||||
+if (JPEG_FOUND AND BUILD_SHARED_LIBS)
|
- include_directories( ${JPEG_INCLUDE_DIR} )
|
||||||
include_directories( ${JPEG_INCLUDE_DIR} )
|
- target_link_libraries( ${ly_lib_shared} PUBLIC ${JPEG_LIBRARY} )
|
||||||
target_link_libraries( ${ly_lib_shared} PUBLIC ${JPEG_LIBRARY} )
|
- target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
|
||||||
target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
|
+ include_directories( ${JPEG_INCLUDE_DIR})
|
||||||
@@ -88,11 +92,13 @@ endif()
|
+ if( BUILD_SHARED_LIBS)
|
||||||
|
+ target_link_libraries(${ly_lib_shared} PUBLIC ${JPEG_LIBRARY})
|
||||||
|
+ else()
|
||||||
# install the conversion tool, .so, .a, and all the header files
|
+ target_link_libraries(${ly_lib_static} PUBLIC ${JPEG_LIBRARY})
|
||||||
-INSTALL ( TARGETS yuvconvert DESTINATION bin )
|
+ endif()
|
||||||
+INSTALL ( TARGETS yuvconvert DESTINATION tools )
|
+ target_link_libraries(yuvconvert ${JPEG_LIBRARY})
|
||||||
INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
|
add_definitions( -DHAVE_JPEG )
|
||||||
-INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
endif()
|
||||||
-INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
|
||||||
-
|
@@ -88,11 +96,13 @@ endif()
|
||||||
+if (NOT BUILD_SHARED_LIBS)
|
|
||||||
+ INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
|
||||||
+else()
|
# install the conversion tool, .so, .a, and all the header files
|
||||||
+ INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
-INSTALL ( TARGETS yuvconvert DESTINATION bin )
|
||||||
+endif()
|
+INSTALL ( TARGETS yuvconvert DESTINATION tools )
|
||||||
INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
|
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 )
|
||||||
# create the .deb and .rpm packages using cpack
|
-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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
find_dependency(JPEG REQUIRED)
|
find_dependency(JPEG)
|
||||||
|
|
||||||
set(libyuv_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
|
set(libyuv_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/libyuv-targets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/libyuv-targets.cmake")
|
||||||
|
@ -25,5 +25,8 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/libyuv)
|
|||||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
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/libyuv COPYONLY)
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/libyuv-config.cmake ${CURRENT_PACKAGES_DIR}/share/libyuv COPYONLY)
|
||||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user