From 727bdba9a3765a181cb6be9cb1f6aa01f2c2b5df Mon Sep 17 00:00:00 2001 From: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> Date: Fri, 19 Aug 2022 10:15:25 +1000 Subject: [PATCH] [inih] Upgrade from r51 to r56 (#25879) * [ports/inih/{portfile.cmake,vcpkg.json}] Upgrade from r51 to r56 * [ports/inih] Upgrade to latest vcpkg recommendations * [ports/inih/CMakeLists.txt] Export targets (following `ports/openctm/CMakeLists.txt` template) * Thomas1664's nitpicks agreed on by BillyONeal. * Fix vcpkg_cmake_config_fixup call and add usage. * Hook up with_INIReader * Version DB oops Co-authored-by: Billy Robert O'Neal III --- ports/inih/CMakeLists.txt | 59 ++++++++++++++++++++++++++++++++------ ports/inih/portfile.cmake | 32 +++++++++++++++------ ports/inih/vcpkg.json | 22 ++++++++++++-- ports/minio-cpp/vcpkg.json | 8 +++++- versions/baseline.json | 6 ++-- versions/i-/inih.json | 5 ++++ versions/m-/minio-cpp.json | 5 ++++ 7 files changed, 112 insertions(+), 25 deletions(-) diff --git a/ports/inih/CMakeLists.txt b/ports/inih/CMakeLists.txt index 6601e543af3..184c0c4f81e 100644 --- a/ports/inih/CMakeLists.txt +++ b/ports/inih/CMakeLists.txt @@ -1,15 +1,56 @@ -project(inih) +cmake_minimum_required(VERSION 3.19) +project( + inih + VERSION 56 + LANGUAGES C CXX) -set(SOURCES ini.c cpp/INIReader.cpp) -set(HEADERS ini.h cpp/INIReader.h) +set(Header_Files "ini.h") +set(Source_Files "ini.c") -add_library(inih ${SOURCES}) +# TODO: Put this as vcpkg-feature before `project(` so can do `LANGUAGES C` if false +option(with_INIReader "build the C++ library" OFF) +if (with_INIReader) + list(APPEND Header_Files "cpp/INIReader.h") + list(APPEND Source_Files "cpp/INIReader.cpp") +endif (with_INIReader) + +add_library("${PROJECT_NAME}" "${Header_Files}" "${Source_Files}") + +include(GNUInstallDirs) +target_include_directories( + "${PROJECT_NAME}" + PUBLIC + "$" + "$" +) +target_compile_features("${PROJECT_NAME}" PRIVATE c_std_90) +set_target_properties("${PROJECT_NAME}" PROPERTIES C_VISIBILITY_PRESET hidden + PUBLIC_HEADER "${Header_Files}") install( - TARGETS inih - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + TARGETS "${PROJECT_NAME}" + EXPORT "unofficial-${PROJECT_NAME}Config" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -install(FILES ${HEADERS} DESTINATION include) +include(CMakePackageConfigHelpers) +set(VERSION_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}ConfigVersion.cmake") +write_basic_package_version_file( + "${VERSION_FILE_PATH}" + VERSION "${PROJECT_VERSION}" + COMPATIBILITY SameMajorVersion +) +install(FILES "${VERSION_FILE_PATH}" DESTINATION "share/unofficial-${PROJECT_NAME}") + +install(FILES ${Header_Files} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + +install( + EXPORT "unofficial-${PROJECT_NAME}Config" + FILE "unofficial-${PROJECT_NAME}Config.cmake" + NAMESPACE "unofficial::${PROJECT_NAME}::" + DESTINATION "share/unofficial-${PROJECT_NAME}") + +export(PACKAGE "${PROJECT_NAME}") diff --git a/ports/inih/portfile.cmake b/ports/inih/portfile.cmake index 471b35f8677..de15f762906 100644 --- a/ports/inih/portfile.cmake +++ b/ports/inih/portfile.cmake @@ -3,20 +3,34 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO benhoyt/inih - REF d7f465792c0c7686b50ed45c9a435394ae418d3e # r51 - SHA512 f3b621225933d74e9b130957aab1d55a82f06fd836aace439f9192a393d82a446e9f2152bb617a73a1dc681a821fc31d217c41f38c8ef8eeef7ad64c3e274b5d + REF 5e1d9e2625842dddb3f9c086a50f22e4f45dfc2b # r56 + SHA512 477a66643f6636a5826a1206c6588a12827e24a4a2609e11f0695888998e2bfcba8bdb2240c561404ee675bf4c72e85d7d008a1fbddb142c0d263b413de8d358 HEAD_REF master ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_check_features( + OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + cpp with_INIReader ) -vcpkg_install_cmake() +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} +) -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/inih RENAME copyright) +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-inih) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" [=[ +inih provides CMake targets: + find_package(unofficial-inih CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::inih::inih) +]=]) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/inih/vcpkg.json b/ports/inih/vcpkg.json index 5b137dcba4b..5b76e98e6a3 100644 --- a/ports/inih/vcpkg.json +++ b/ports/inih/vcpkg.json @@ -1,6 +1,22 @@ { "name": "inih", - "version-string": "51", - "port-version": 1, - "description": "Simple .INI file parser" + "version": "56", + "description": "Simple .INI file parser", + "homepage": "https://github.com/benhoyt/inih", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "cpp": { + "description": "Build the C++ library" + } + } } diff --git a/ports/minio-cpp/vcpkg.json b/ports/minio-cpp/vcpkg.json index 22e330ca656..b207d4fa67d 100644 --- a/ports/minio-cpp/vcpkg.json +++ b/ports/minio-cpp/vcpkg.json @@ -1,13 +1,19 @@ { "name": "minio-cpp", "version": "0.1.1", + "port-version": 1, "description": "The MinIO C++ Client SDK provides simple APIs to access any Amazon S3 compatible object storage", "homepage": "https://github.com/minio/minio-cpp", "license": "Apache-2.0", "supports": "!windows & !uwp", "dependencies": [ "curlpp", - "inih", + { + "name": "inih", + "features": [ + "cpp" + ] + }, "nlohmann-json", "openssl", "pugixml", diff --git a/versions/baseline.json b/versions/baseline.json index 6d967889aa6..2f88646d7b4 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3021,8 +3021,8 @@ "port-version": 1 }, "inih": { - "baseline": "51", - "port-version": 1 + "baseline": "56", + "port-version": 0 }, "iniparser": { "baseline": "2020-04-06", @@ -4618,7 +4618,7 @@ }, "minio-cpp": { "baseline": "0.1.1", - "port-version": 0 + "port-version": 1 }, "minisat-master-keying": { "baseline": "2.3.6", diff --git a/versions/i-/inih.json b/versions/i-/inih.json index ef0781ca21a..000f4f53b8b 100644 --- a/versions/i-/inih.json +++ b/versions/i-/inih.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ccae9a4d18198ac2d9303cac12c4dbb1fbe0bf24", + "version": "56", + "port-version": 0 + }, { "git-tree": "de1d85a0ea62e95bd096ecff062115646742cf1e", "version-string": "51", diff --git a/versions/m-/minio-cpp.json b/versions/m-/minio-cpp.json index 50ef5890e0c..345558d6ef7 100644 --- a/versions/m-/minio-cpp.json +++ b/versions/m-/minio-cpp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0c6bcc87e2a8548708c11f3e7c3148f1004d3146", + "version": "0.1.1", + "port-version": 1 + }, { "git-tree": "8442cf19a35307cd48476abbf05e85194509c7a2", "version": "0.1.1",