Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inih] Upgrade from r51 to r56 #25879

Merged
merged 9 commits into from
Aug 19, 2022
59 changes: 50 additions & 9 deletions ports/inih/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
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}"
)

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}")

install(FILES ${HEADERS} DESTINATION include)
export(PACKAGE "${PROJECT_NAME}")
24 changes: 15 additions & 9 deletions ports/inih/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@ 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_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_install_cmake()
vcpkg_cmake_install()
BillyONeal marked this conversation as resolved.
Show resolved Hide resolved
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-inih)

file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/inih RENAME copyright)
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/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/include")
17 changes: 14 additions & 3 deletions ports/inih/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
"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
}
]
}
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3009,8 +3009,8 @@
"port-version": 1
},
"inih": {
"baseline": "51",
"port-version": 1
"baseline": "56",
"port-version": 0
},
"iniparser": {
"baseline": "2020-04-06",
Expand Down
5 changes: 5 additions & 0 deletions versions/i-/inih.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a9efba782a9aa1f1969f4ef7eef5efb89cd8391a",
"version": "56",
"port-version": 0
},
{
"git-tree": "de1d85a0ea62e95bd096ecff062115646742cf1e",
"version-string": "51",
Expand Down