Add port quirc (#2949)

* fixed SHA512 sum of the package realsense2

* Add port quirc for #2899

* Add port FastCDR for #2953
This commit is contained in:
Reyzal 2018-03-10 18:59:43 +08:00 committed by Robert Schumacher
parent a870f5dce8
commit 667f34314f
7 changed files with 163 additions and 0 deletions

3
ports/fastcdr/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: fastcdr
Version: 1.0.6-1
Description: eProsima FastCDR is a C++ library that provides two serialization mechanisms. One is the standard CDR serialization mechanism, while the other is a faster implementation that modifies the standard.

View File

@ -0,0 +1,26 @@
diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
index 46d6f20..5d73ec5 100644
--- a/src/cpp/CMakeLists.txt
+++ b/src/cpp/CMakeLists.txt
@@ -139,7 +139,12 @@ if(MSVC OR MSVC_IDE)
set(DIR_EXTENSION "/${MSVC_ARCH}")
endif()
- install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_static
+ if(BUILD_SHARED_LIBS)
+ set(PROJECT_TARGETS ${PROJECT_NAME})
+ else()
+ set(PROJECT_TARGETS ${PROJECT_NAME}_static)
+ endif()
+ install(TARGETS ${PROJECT_TARGETS}
EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION ${BIN_INSTALL_DIR}${DIR_EXTENSION}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}${DIR_EXTENSION}
@@ -147,7 +152,6 @@ if(MSVC OR MSVC_IDE)
COMPONENT libraries_${MSVC_ARCH}
)
- export(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_static FILE ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Targets.cmake)
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION ${LIB_INSTALL_DIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake
COMPONENT cmake

View File

@ -0,0 +1,45 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO eProsima/Fast-CDR
REF v1.0.6
SHA512 80861ff6a0283e1398306e081fe70d7d185f980e5714ae51864cae012b8f79719efa24e7f41025b2bfb2052cb2a3098436c75a38407f8f5a331593cb91868fb2
HEAD_REF master
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/install-cmake.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DLICENSE_INSTALL_DIR=share/fastcdr
-DCMAKE_DISABLE_FIND_PACKAGE_GTest=ON
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/fastcdr/cmake)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/lib/fastcdr ${CURRENT_PACKAGES_DIR}/debug/lib/fastcdr)
# always build static and share library default
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(READ ${CURRENT_PACKAGES_DIR}/include/fastcdr/eProsima_auto_link.h EPROSIMA_AUTO_LINK_H)
string(REPLACE "#define EPROSIMA_LIB_PREFIX \"lib\"" "#define EPROSIMA_LIB_PREFIX" EPROSIMA_AUTO_LINK_H "${EPROSIMA_AUTO_LINK_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/fastcdr/eProsima_auto_link.h "${EPROSIMA_AUTO_LINK_H}")
else()
file(READ ${CURRENT_PACKAGES_DIR}/include/fastcdr/config.h FASTCDR_H)
string(REPLACE "#define _FASTCDR_CONFIG_H_" "#define _FASTCDR_CONFIG_H_\r\n#define FASTCDR_DYN_LINK" FASTCDR_H "${FASTCDR_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/fastcdr/config.h "${FASTCDR_H}")
endif()
# Handle copyright
file(COPY ${SOURCE_PATH}/license DESTINATION ${CURRENT_PACKAGES_DIR}/share/fastcdr)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/fastcdr/license ${CURRENT_PACKAGES_DIR}/share/fastcdr/copyright)

View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.8)
project(quirc C)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_library(quirc
lib/decode.c
lib/identify.c
lib/quirc.c
lib/version_db.c
)
install(TARGETS quirc
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(FILES ${PROJECT_SOURCE_DIR}/lib/quirc.h DESTINATION include)

3
ports/quirc/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: quirc
Version: 1.0-1
Description: quirc is one of the C library available for scanning QR Codes

View File

@ -0,0 +1,36 @@
From 1c1ceecb70ad76751f0b573937380525d7643a87 Mon Sep 17 00:00:00 2001
From: reyzal <reyzal@163.com>
Date: Sun, 4 Mar 2018 12:09:34 +0800
Subject: [PATCH] for msvc
---
lib/identify.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/identify.c b/lib/identify.c
index bf7bd94..cd16b0a 100644
--- a/lib/identify.c
+++ b/lib/identify.c
@@ -196,9 +196,9 @@ static void threshold(struct quirc *q)
threshold_s = THRESHOLD_S_MIN;
for (y = 0; y < q->h; y++) {
- int row_average[q->w];
+ int *row_average = malloc(q->w * sizeof(int));
- memset(row_average, 0, sizeof(row_average));
+ memset(row_average, 0, q->w * sizeof(int));
for (x = 0; x < q->w; x++) {
int w, u;
@@ -229,6 +229,7 @@ static void threshold(struct quirc *q)
}
row += q->w;
+ free(row_average);
}
}
--
2.7.3.windows.1

View File

@ -0,0 +1,31 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO dlbeer/quirc
REF v1.0
SHA512 a556b08f2e2c710648b342fd06a855aa577b2b8c047c45a1c47cf54cde9963faf612978afba80bfd60a6f4f63156566f549ea303f09ed6e5348c1c30f5d77c13
HEAD_REF master
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/quirc-1.0
PATCHES
${CMAKE_CURRENT_LIST_DIR}/patch-for-msvc.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(COPY ${SOURCE_PATH}/license DESTINATION ${CURRENT_PACKAGES_DIR}/share/quirc)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/quirc/license ${CURRENT_PACKAGES_DIR}/share/quirc/copyright)