Add libcorrect (#28032)

This commit is contained in:
Siyuan Ren 2022-11-29 04:36:48 +08:00 committed by GitHub
parent 4eaa3d2118
commit ab310f1df8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,54 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e8e07e..1e8355d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,8 +31,6 @@ else()
endif()
endif(MSVC)
-find_library(FEC fec)
-CHECK_LIBRARY_EXISTS(FEC dotprod "" HAVE_LIBFEC)
if(NOT CMAKE_CROSSCOMPILING)
# Check if host machine can compile with SSE 4.1 intrinsic
@@ -72,12 +70,13 @@ if(HAVE_SSE)
else()
set(correct_obj_files $<TARGET_OBJECTS:correct-reed-solomon> $<TARGET_OBJECTS:correct-convolutional>)
endif()
-add_library(correct SHARED ${correct_obj_files})
-add_library(correct_static ${correct_obj_files})
-set_target_properties(correct_static PROPERTIES OUTPUT_NAME "correct")
+if (BUILD_SHARED_LIBS)
+ add_library(correct SHARED ${correct_obj_files})
+else()
+ add_library(correct ${correct_obj_files})
+endif()
if(HAVE_SSE)
target_compile_definitions(correct PUBLIC HAVE_SSE=1)
- target_compile_definitions(correct_static PUBLIC HAVE_SSE=1)
endif()
add_subdirectory(util)
@@ -85,18 +84,8 @@ add_subdirectory(tests)
add_subdirectory(tools)
# add_subdirectory(benchmarks)
-install(TARGETS correct correct_static
- DESTINATION lib)
+install(TARGETS correct
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
install(FILES ${INSTALL_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
-
-add_library(fec_shim_static EXCLUDE_FROM_ALL src/fec_shim.c ${correct_obj_files})
-set_target_properties(fec_shim_static PROPERTIES OUTPUT_NAME "fec")
-add_library(fec_shim_shared SHARED EXCLUDE_FROM_ALL src/fec_shim.c ${correct_obj_files})
-set_target_properties(fec_shim_shared PROPERTIES OUTPUT_NAME "fec")
-add_custom_target(fec-shim-h COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/include/fec_shim.h ${PROJECT_BINARY_DIR}/include/fec.h)
-add_custom_target(shim DEPENDS fec_shim_static fec_shim_shared fec-shim-h)
-
-install(TARGETS fec_shim_static fec_shim_shared
- DESTINATION lib
- OPTIONAL)
-install(FILES ${PROJECT_BINARY_DIR}/include/fec.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include" OPTIONAL)

View File

@ -0,0 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO quiet/libcorrect
REF f5a28c74fba7a99736fe49d3a5243eca29517ae9
SHA512 1367834c2a081e007b3eeeacb5bbe912617cce97cbd19d43193078f352fef103a54f030ef61a2def4ab7517476cf6be5d6a1736e43ae84913fe84a56340b69ce
HEAD_REF master
PATCHES fix-ninja.patch
)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")
vcpkg_cmake_install()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

View File

@ -0,0 +1,17 @@
{
"name": "libcorrect",
"version-date": "2018-10-11",
"description": "libcorrect is a library for Forward Error Correction",
"homepage": "https://github.com/quiet/libcorrect",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -3632,6 +3632,10 @@
"baseline": "1.4.1",
"port-version": 2
},
"libcorrect": {
"baseline": "2018-10-11",
"port-version": 0
},
"libcpplocate": {
"baseline": "2.3.0",
"port-version": 0

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "3f2ef3266828a1332359d747a80bb46da933c773",
"version-date": "2018-10-11",
"port-version": 0
}
]
}