From d53320bc16835e9d459c21461b982d28aebd32b4 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Mon, 25 May 2020 22:25:36 -0700 Subject: [PATCH 1/2] [cpputest] Move library to manual-link --- ports/cpputest/CONTROL | 2 +- ports/cpputest/instal-manual-link.patch | 28 +++++++++++++++++++++++++ ports/cpputest/portfile.cmake | 6 +++--- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 ports/cpputest/instal-manual-link.patch diff --git a/ports/cpputest/CONTROL b/ports/cpputest/CONTROL index cecf6e22181f42..7d08408292aef4 100644 --- a/ports/cpputest/CONTROL +++ b/ports/cpputest/CONTROL @@ -1,4 +1,4 @@ Source: cpputest -Version: 2019-9-16 +Version: 2019-9-16-1 Homepage: https://github.com/cpputest/cpputest Description: CppUTest unit testing and mocking framework for C/C++. \ No newline at end of file diff --git a/ports/cpputest/instal-manual-link.patch b/ports/cpputest/instal-manual-link.patch new file mode 100644 index 00000000000000..7a9bab64c410a4 --- /dev/null +++ b/ports/cpputest/instal-manual-link.patch @@ -0,0 +1,28 @@ +diff --git a/src/CppUTest/CMakeLists.txt b/src/CppUTest/CMakeLists.txt +index 6b950d5..a1132d9 100644 +--- a/src/CppUTest/CMakeLists.txt ++++ b/src/CppUTest/CMakeLists.txt +@@ -72,7 +72,7 @@ if (WIN32) + endif (WIN32) + install(TARGETS CppUTest + EXPORT CppUTestTargets +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTest" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTest") +diff --git a/src/CppUTestExt/CMakeLists.txt b/src/CppUTestExt/CMakeLists.txt +index 01fcf70..16ce279 100644 +--- a/src/CppUTestExt/CMakeLists.txt ++++ b/src/CppUTestExt/CMakeLists.txt +@@ -52,7 +52,7 @@ set_target_properties(CppUTestExt PROPERTIES + PUBLIC_HEADER "${CppUTestExt_headers}") + install(TARGETS CppUTestExt + EXPORT CppUTestTargets +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTestExt" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTestExt") diff --git a/ports/cpputest/portfile.cmake b/ports/cpputest/portfile.cmake index 904f1d0b12dea5..b2569aacdc05aa 100644 --- a/ports/cpputest/portfile.cmake +++ b/ports/cpputest/portfile.cmake @@ -1,5 +1,3 @@ -include(vcpkg_common_functions) - vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( @@ -8,7 +6,9 @@ vcpkg_from_github( REF 4699da9942a1bdcc33e2a8c8a48e863b0f18188e SHA512 6f588691f1b4092b3be8167ab09f3a4a64c34715ac9397210724121d161024a43b12a88198b02b0cc8da7d72406670daaf375bb64cc4cf92c8bd2479e7a881bc HEAD_REF master - PATCHES fix-arm-build-error.patch + PATCHES + fix-arm-build-error.patch + instal-manual-link.patch ) vcpkg_configure_cmake( From 349ab87534620fe0f0bc8a18974bbd66885310d3 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Wed, 27 May 2020 02:36:09 -0700 Subject: [PATCH 2/2] [cpputest] Replace move patch to codes --- ports/cpputest/instal-manual-link.patch | 28 ------------------------- ports/cpputest/portfile.cmake | 27 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 29 deletions(-) delete mode 100644 ports/cpputest/instal-manual-link.patch diff --git a/ports/cpputest/instal-manual-link.patch b/ports/cpputest/instal-manual-link.patch deleted file mode 100644 index 7a9bab64c410a4..00000000000000 --- a/ports/cpputest/instal-manual-link.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/CppUTest/CMakeLists.txt b/src/CppUTest/CMakeLists.txt -index 6b950d5..a1132d9 100644 ---- a/src/CppUTest/CMakeLists.txt -+++ b/src/CppUTest/CMakeLists.txt -@@ -72,7 +72,7 @@ if (WIN32) - endif (WIN32) - install(TARGETS CppUTest - EXPORT CppUTestTargets -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTest" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTest") -diff --git a/src/CppUTestExt/CMakeLists.txt b/src/CppUTestExt/CMakeLists.txt -index 01fcf70..16ce279 100644 ---- a/src/CppUTestExt/CMakeLists.txt -+++ b/src/CppUTestExt/CMakeLists.txt -@@ -52,7 +52,7 @@ set_target_properties(CppUTestExt PROPERTIES - PUBLIC_HEADER "${CppUTestExt_headers}") - install(TARGETS CppUTestExt - EXPORT CppUTestTargets -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/manual-link - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTestExt" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CppUTestExt") diff --git a/ports/cpputest/portfile.cmake b/ports/cpputest/portfile.cmake index b2569aacdc05aa..4745ea469588aa 100644 --- a/ports/cpputest/portfile.cmake +++ b/ports/cpputest/portfile.cmake @@ -8,7 +8,6 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-arm-build-error.patch - instal-manual-link.patch ) vcpkg_configure_cmake( @@ -27,6 +26,32 @@ if (EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/CppUTest) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/CppUTest) endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) + file(GLOB CPPUTEST_LIBS ${CURRENT_PACKAGES_DIR}/lib/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) + file(COPY ${CPPUTEST_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link) + file(REMOVE ${CPPUTEST_LIBS}) + + file(READ ${CURRENT_PACKAGES_DIR}/share/CppUTest/CppUTestTargets-release.cmake RELEASE_CONFIG) + # Replace CppUTestExt first + string(REPLACE "\${_IMPORT_PREFIX}/lib/" + "\${_IMPORT_PREFIX}/lib/manual-link/" RELEASE_CONFIG "${RELEASE_CONFIG}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/CppUTest/CppUTestTargets-release.cmake "${RELEASE_CONFIG}") +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link) + file(GLOB CPPUTEST_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) + file(COPY ${CPPUTEST_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link) + file(REMOVE ${CPPUTEST_LIBS}) + + file(READ ${CURRENT_PACKAGES_DIR}/share/CppUTest/CppUTestTargets-debug.cmake DEBUG_CONFIG) + # Replace CppUTestExt first + string(REPLACE "\${_IMPORT_PREFIX}/debug/lib/" + "\${_IMPORT_PREFIX}/debug/lib/manual-link/" DEBUG_CONFIG "${DEBUG_CONFIG}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/CppUTest/CppUTestTargets-debug.cmake "${DEBUG_CONFIG}") +endif() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)