From b312224c7b0a4ce1acade1ac9d03f16a8aee6a44 Mon Sep 17 00:00:00 2001 From: chausner <15180557+chausner@users.noreply.github.com> Date: Wed, 13 Oct 2021 23:39:39 +0200 Subject: [fastrtps] Update to 2.4.0 (#20645) * Update fastrtps to 2.4.0 * Update CI baseline * Fix installation of fast-discovery-server.exe tool * Update git-tree hash * Another fix * Update git-tree hash * Use vcpkg_replace_string Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * Fix indentation * Update git-tree hash * Remove double quotes * update version * Disable symlinks * Update git-tree hash Co-authored-by: chausner Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Jonliu1993 <13720414433@163.com> --- ports/fastrtps/disable-symlink.patch | 16 +++++++ ports/fastrtps/fix-find-package-asio.patch | 12 ++++++ ports/fastrtps/portfile.cmake | 67 +++++++++++++++++++++++++----- ports/fastrtps/vcpkg.json | 13 ++++-- versions/baseline.json | 4 +- versions/f-/fastrtps.json | 5 +++ 6 files changed, 102 insertions(+), 15 deletions(-) create mode 100644 ports/fastrtps/disable-symlink.patch create mode 100644 ports/fastrtps/fix-find-package-asio.patch diff --git a/ports/fastrtps/disable-symlink.patch b/ports/fastrtps/disable-symlink.patch new file mode 100644 index 000000000..a35558a19 --- /dev/null +++ b/ports/fastrtps/disable-symlink.patch @@ -0,0 +1,16 @@ +Normally, the build script attempts to create a symlink to fast-discovery-server on Windows +and only falls back to a batch file if the necessary administrator privileges are not available. +Since symlinks do not work well with vcpkg binary caching, +we force the build script to create a batch file in any case. +diff --git a/tools/fds/CMakeLists.txt b/tools/fds/CMakeLists.txt +--- a/tools/fds/CMakeLists.txt ++++ b/tools/fds/CMakeLists.txt +@@ -124,7 +124,7 @@ if(NOT BUILD_SHARED_LIBS) + if( WIN32 ) + # Use powershell to generate the link + install( +- CODE "execute_process( COMMAND PowerShell -Command \"if( test-path ${PROJECT_NAME}.exe -PathType Leaf ) { rm ${PROJECT_NAME}.exe } ; New-Item -ItemType SymbolicLink -Target $ -Path ${PROJECT_NAME}.exe \" ERROR_QUIET RESULTS_VARIABLE SYMLINK_FAILED WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}\") \n if( SYMLINK_FAILED ) \n message(STATUS \"Windows requires admin installation rights to create symlinks. A bat script will be provided instead.\") \n set(FAST_SERVER_BINARY_NAME $) \n configure_file(${CMAKE_CURRENT_LIST_DIR}/fast-discovery-server.bat.in ${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}/${PROJECT_NAME}.bat @ONLY) \n endif()" ++ CODE "set(FAST_SERVER_BINARY_NAME $) \n configure_file(${CMAKE_CURRENT_LIST_DIR}/fast-discovery-server.bat.in ${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}/${PROJECT_NAME}.bat @ONLY) \n" + COMPONENT discovery) + else() + # Use ln to create the symbolic link. We remove the version from the file name but keep the debug suffix diff --git a/ports/fastrtps/fix-find-package-asio.patch b/ports/fastrtps/fix-find-package-asio.patch new file mode 100644 index 000000000..4592311e2 --- /dev/null +++ b/ports/fastrtps/fix-find-package-asio.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -141,7 +141,7 @@ if(NOT BUILD_SHARED_LIBS) + endif() + + eprosima_find_package(fastcdr REQUIRED) +-eprosima_find_thirdparty(Asio asio VERSION 1.10.8) ++find_package(asio CONFIG REQUIRED) + eprosima_find_thirdparty(TinyXML2 tinyxml2) + + find_package(foonathan_memory REQUIRED) diff --git a/ports/fastrtps/portfile.cmake b/ports/fastrtps/portfile.cmake index 9f72b5d6f..48342bd53 100644 --- a/ports/fastrtps/portfile.cmake +++ b/ports/fastrtps/portfile.cmake @@ -1,22 +1,69 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO eProsima/Fast-DDS - REF 40568fa4784e846f95c461608d43a2b57eaef55b # v2.0.1 - SHA512 a0cb48713a41ba3562c98dfc176508779e70e35b573428ac0a74c74254aa34c583bd545169f3a3961172bfc9e7bb14d08b5d56569e176fe8248d714bec5813a4 + REF v2.4.0 + SHA512 2E9C0378AF86DD657391D577F6951096DD45970A2C4D9C384EE5A452A1DD129E6E0AED91E0B908A35A04CAF979253700560561D34082DA81FE737FE104C149AF HEAD_REF master + PATCHES + fix-find-package-asio.patch + disable-symlink.patch ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets(CONFIG_PATH share/fastrtps/cmake TARGET_PATH share/fastrtps) +vcpkg_cmake_config_fixup(CONFIG_PATH share/fastrtps/cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +if(VCPKG_TARGET_IS_WINDOWS) + # copy tools from "bin" to "tools" folder + foreach(TOOL "fast-discovery-server-1.0.0.exe" "fast-discovery-server.bat" "fastdds.bat" "ros-discovery.bat") + file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/${TOOL}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${TOOL}") + endforeach() -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) + # remove tools from debug builds + foreach(TOOL "fast-discovery-serverd-1.0.0.exe" "fast-discovery-server.bat" "fastdds.bat" "ros-discovery.bat") + if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL}") + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL}") + endif() + endforeach() + + # adjust paths in batch files + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/fastdds.bat" "%dir%\\..\\tools\\fastdds\\fastdds.py" "%dir%\\..\\fastdds\\fastdds.py") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/ros-discovery.bat" "%dir%\\..\\tools\\fastdds\\fastdds.py" "%dir%\\..\\fastdds\\fastdds.py") + + vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") +elseif(VCPKG_TARGET_IS_LINUX) + # copy tools from "bin" to "tools" folder + foreach(TOOL "fast-discovery-server-1.0.0" "fast-discovery-server" "fastdds" "ros-discovery") + file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/${TOOL}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${TOOL}") + endforeach() + + # replace symlink by a copy because symlinks do not work well together with vcpkg binary caching + file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/${PORT}/fast-discovery-server") + file(INSTALL "${CURRENT_PACKAGES_DIR}/tools/${PORT}/fast-discovery-server-1.0.0" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}" RENAME "fast-discovery-server") + + # remove tools from debug builds + foreach(TOOL "fast-discovery-serverd-1.0.0" "fast-discovery-server" "fastdds" "ros-discovery") + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL}") + endforeach() + + # adjust paths in batch files + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/fastdds" "$dir/../tools/fastdds/fastdds.py" "$dir/../fastdds/fastdds.py") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/ros-discovery" "$dir/../tools/fastdds/fastdds.py" "$dir/../fastdds/fastdds.py") +endif() + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/fastrtps/vcpkg.json b/ports/fastrtps/vcpkg.json index c214822af..6c846645c 100644 --- a/ports/fastrtps/vcpkg.json +++ b/ports/fastrtps/vcpkg.json @@ -1,7 +1,6 @@ { "name": "fastrtps", - "version-string": "2.0.1", - "port-version": 1, + "version": "2.4.0", "description": "Eprosima Fast RTPS is a C++ implementation of the RTPS (Real Time Publish Subscribe) protocol, which provides publisher-subscriber communications over unreliable transports such as UDP, as defined and maintained by the Object Management Group (OMG) consortium.", "homepage": "https://www.eprosima.com/", "dependencies": [ @@ -9,6 +8,14 @@ "fastcdr", "foonathan-memory", "openssl", - "tinyxml2" + "tinyxml2", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } ] } diff --git a/versions/baseline.json b/versions/baseline.json index d759b6c87..3666faf8b 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2081,8 +2081,8 @@ "port-version": 0 }, "fastrtps": { - "baseline": "2.0.1", - "port-version": 1 + "baseline": "2.4.0", + "port-version": 0 }, "fbgemm": { "baseline": "2021-03-18", diff --git a/versions/f-/fastrtps.json b/versions/f-/fastrtps.json index f137e607c..c8285d3e1 100644 --- a/versions/f-/fastrtps.json +++ b/versions/f-/fastrtps.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "54873b953029cdd41ffee26b13af0c661de41462", + "version": "2.4.0", + "port-version": 0 + }, { "git-tree": "d48d4af7b7082b1a162b136643f6d51dd5b8beba", "version-string": "2.0.1", -- cgit v1.2.3