aboutsummaryrefslogtreecommitdiff
path: root/ports/fastcdr
diff options
context:
space:
mode:
authorReyzal <reyzal@163.com>2018-03-10 18:59:43 +0800
committerRobert Schumacher <roschuma@microsoft.com>2018-03-10 02:59:43 -0800
commit667f34314f8a6edcb01c1bba72a9dc07ccd6a21c (patch)
tree738522e43f1307c996dd39619c3bc79fef670e2d /ports/fastcdr
parenta870f5dce852445698ee17dea4e9bd18c51a4e8b (diff)
downloadvcpkg-667f34314f8a6edcb01c1bba72a9dc07ccd6a21c.tar.gz
vcpkg-667f34314f8a6edcb01c1bba72a9dc07ccd6a21c.zip
Add port quirc (#2949)
* fixed SHA512 sum of the package realsense2 * Add port quirc for #2899 * Add port FastCDR for #2953
Diffstat (limited to 'ports/fastcdr')
-rw-r--r--ports/fastcdr/CONTROL3
-rw-r--r--ports/fastcdr/install-cmake.patch26
-rw-r--r--ports/fastcdr/portfile.cmake45
3 files changed, 74 insertions, 0 deletions
diff --git a/ports/fastcdr/CONTROL b/ports/fastcdr/CONTROL
new file mode 100644
index 000000000..dfd04bf06
--- /dev/null
+++ b/ports/fastcdr/CONTROL
@@ -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.
diff --git a/ports/fastcdr/install-cmake.patch b/ports/fastcdr/install-cmake.patch
new file mode 100644
index 000000000..0eff05063
--- /dev/null
+++ b/ports/fastcdr/install-cmake.patch
@@ -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
diff --git a/ports/fastcdr/portfile.cmake b/ports/fastcdr/portfile.cmake
new file mode 100644
index 000000000..91362f3b2
--- /dev/null
+++ b/ports/fastcdr/portfile.cmake
@@ -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)