mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 17:41:09 +08:00
[vcpkg] Support \share\<port>\usage to handle libraries which are found through built-in Find Modules.
This commit is contained in:
parent
468e9e70e6
commit
1b2f75be94
@ -342,3 +342,5 @@ move_to_manual_link(boost_test_exec_monitor)
|
||||
move_to_manual_link(boost_prg_exec_monitor)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
5
ports/boost/usage
Normal file
5
ports/boost/usage
Normal file
@ -0,0 +1,5 @@
|
||||
The package boost is compatible with built-in CMake targets:
|
||||
|
||||
find_package(Boost REQUIRED [COMPONENTS <libs>...])
|
||||
target_link_libraries(main PRIVATE ${Boost_LIBRARIES})
|
||||
target_include_directories(main PRIVATE ${Boost_INCLUDE_DIRS})
|
@ -36,3 +36,5 @@ file(WRITE ${CURRENT_PACKAGES_DIR}/include/bzlib.h "${BZLIB_H}")
|
||||
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bzip2)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/bzip2/LICENSE ${CURRENT_PACKAGES_DIR}/share/bzip2/copyright)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
4
ports/bzip2/usage
Normal file
4
ports/bzip2/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package bzip2 is compatible with built-in CMake targets:
|
||||
|
||||
find_package(BZip2 REQUIRED)
|
||||
target_link_libraries(main PRIVATE BZip2::BZip2)
|
@ -73,3 +73,5 @@ endif()
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/include/curl/curl.h "${CURL_H}")
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
5
ports/curl/usage
Normal file
5
ports/curl/usage
Normal file
@ -0,0 +1,5 @@
|
||||
The package curl is compatible with built-in CMake targets:
|
||||
|
||||
find_package(CURL REQUIRED)
|
||||
target_link_libraries(main PRIVATE ${CURL_LIBRARIES})
|
||||
target_include_directories(main PRIVATE ${CURL_INCLUDE_DIRS})
|
@ -53,4 +53,5 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freeglut)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/freeglut/COPYING ${CURRENT_PACKAGES_DIR}/share/freeglut/copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_copy_pdbs()
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
4
ports/freeglut/usage
Normal file
4
ports/freeglut/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package freeglut is compatible with built-in CMake targets:
|
||||
|
||||
find_package(GLUT REQUIRED)
|
||||
target_link_libraries(main PRIVATE GLUT::GLUT)
|
@ -58,3 +58,4 @@ file(COPY
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/freetype/LICENSE.TXT ${CURRENT_PACKAGES_DIR}/share/freetype/copyright)
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
5
ports/freetype/usage
Normal file
5
ports/freetype/usage
Normal file
@ -0,0 +1,5 @@
|
||||
The package freetype is compatible with built-in CMake targets:
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
target_link_libraries(main PRIVATE ${FREETYPE_LIBRARIES})
|
||||
target_include_directories(main PRIVATE ${FREETYPE_INCLUDE_DIRS})
|
@ -48,4 +48,5 @@ vcpkg_copy_pdbs()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glew RENAME copyright)
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glew RENAME copyright)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
4
ports/glew/usage
Normal file
4
ports/glew/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package glew is compatible with built-in CMake targets:
|
||||
|
||||
find_package(GLEW REQUIRED)
|
||||
target_link_libraries(main PRIVATE GLEW::GLEW)
|
@ -60,3 +60,5 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock_main.lib)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
6
ports/gtest/usage
Normal file
6
ports/gtest/usage
Normal file
@ -0,0 +1,6 @@
|
||||
The package gtest is compatible with built-in CMake targets:
|
||||
|
||||
enable_testing()
|
||||
find_package(GTest REQUIRED)
|
||||
target_link_libraries(main PRIVATE GTest::GTest GTest::Main)
|
||||
add_test(AllTestsInMain main)
|
@ -53,3 +53,4 @@ file(COPY
|
||||
)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/copyright)
|
||||
vcpkg_copy_pdbs()
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
5
ports/libjpeg-turbo/usage
Normal file
5
ports/libjpeg-turbo/usage
Normal file
@ -0,0 +1,5 @@
|
||||
The package libjpeg-turbo is compatible with built-in CMake targets:
|
||||
|
||||
find_package(JPEG REQUIRED)
|
||||
target_link_libraries(main PRIVATE ${JPEG_LIBRARIES})
|
||||
target_include_directories(main PRIVATE ${JPEG_INCLUDE_DIR})
|
@ -57,3 +57,5 @@ file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpn
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpng/LICENSE ${CURRENT_PACKAGES_DIR}/share/libpng/copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
4
ports/libpng/usage
Normal file
4
ports/libpng/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package libpng is compatible with built-in CMake targets:
|
||||
|
||||
find_package(PNG REQUIRED)
|
||||
target_link_libraries(main PRIVATE PNG::PNG)
|
@ -90,3 +90,5 @@ file(INSTALL
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
@ -145,3 +145,5 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
4
ports/openssl/usage
Normal file
4
ports/openssl/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package openssl is compatible with built-in CMake targets:
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
@ -33,4 +33,6 @@ endif()
|
||||
|
||||
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
|
4
ports/zlib/usage
Normal file
4
ports/zlib/usage
Normal file
@ -0,0 +1,4 @@
|
||||
The package zlib is compatible with built-in CMake targets:
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(main PRIVATE ZLIB::ZLIB)
|
@ -565,6 +565,17 @@ namespace vcpkg::Install
|
||||
|
||||
auto& fs = paths.get_filesystem();
|
||||
|
||||
auto usage_file = paths.installed / bpgh.spec.triplet().canonical_name() / "share" / bpgh.spec.name() / "usage";
|
||||
if (fs.exists(usage_file))
|
||||
{
|
||||
auto maybe_contents = fs.read_contents(usage_file);
|
||||
if (auto p_contents = maybe_contents.get())
|
||||
{
|
||||
System::println(*p_contents);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto files = fs.read_lines(paths.listfile_path(bpgh));
|
||||
if (auto p_lines = files.get())
|
||||
{
|
||||
@ -595,10 +606,10 @@ namespace vcpkg::Install
|
||||
}
|
||||
else if (library_targets.size() <= 4)
|
||||
{
|
||||
System::println("\nThe package %s provides CMake targets:\n"
|
||||
System::println("The package %s provides CMake targets:\n"
|
||||
"\n"
|
||||
" find_package(%s REQUIRED)\n"
|
||||
" target_link_libraries(main PRIVATE %s)",
|
||||
" target_link_libraries(main PRIVATE %s)\n",
|
||||
bpgh.spec,
|
||||
path.parent_path().filename().u8string(),
|
||||
Strings::join(" ", library_targets));
|
||||
@ -607,11 +618,11 @@ namespace vcpkg::Install
|
||||
{
|
||||
auto omitted = library_targets.size() - 4;
|
||||
library_targets.erase(library_targets.begin() + 4, library_targets.end());
|
||||
System::println("\nThe package %s provides CMake targets:\n"
|
||||
System::println("The package %s provides CMake targets:\n"
|
||||
"\n"
|
||||
" find_package(%s REQUIRED)\n"
|
||||
" # Note: %d targets were omitted\n"
|
||||
" target_link_libraries(main PRIVATE %s)",
|
||||
" target_link_libraries(main PRIVATE %s)\n",
|
||||
bpgh.spec,
|
||||
path.parent_path().filename().u8string(),
|
||||
omitted,
|
||||
@ -712,7 +723,7 @@ namespace vcpkg::Install
|
||||
|
||||
const InstallSummary summary = perform(action_plan, keep_going, paths, status_db);
|
||||
|
||||
System::println("\nTotal elapsed time: %s", summary.total_elapsed_time);
|
||||
System::println("\nTotal elapsed time: %s\n", summary.total_elapsed_time);
|
||||
|
||||
if (keep_going == KeepGoing::YES)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user