mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
[iniparser] Add new port (#10710)
* [iniparser] Add new port * [iniparser] Fix build errors on UWP * [iniparser] Move linkage check before code downloading
This commit is contained in:
parent
bb7ccc4b90
commit
6717e1b9d0
54
ports/iniparser/CMakeLists.txt
Normal file
54
ports/iniparser/CMakeLists.txt
Normal file
@ -0,0 +1,54 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(iniparser LANGUAGES C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
|
||||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
|
||||
|
||||
# iniparser.pc
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(datarootdir ${prefix}/${CMAKE_INSTALL_DATAROOTDIR})
|
||||
set(datadir ${prefix}/${CMAKE_INSTALL_DATADIR})
|
||||
|
||||
configure_file(iniparser.pc ${CMAKE_CURRENT_BINARY_DIR}/iniparser.pc)
|
||||
|
||||
set(iniparser_sources
|
||||
src/dictionary.c
|
||||
src/iniparser.c
|
||||
)
|
||||
|
||||
add_library(iniparser ${iniparser_sources})
|
||||
|
||||
target_include_directories(iniparser
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
target_compile_definitions(iniparser
|
||||
PRIVATE
|
||||
$<$<C_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
|
||||
)
|
||||
|
||||
install(TARGETS iniparser EXPORT unofficial-iniparser-config)
|
||||
|
||||
install(
|
||||
EXPORT unofficial-iniparser-config
|
||||
NAMESPACE unofficial::iniparser::
|
||||
DESTINATION share/unofficial-iniparser
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
||||
install(
|
||||
FILES src/dictionary.h src/iniparser.h
|
||||
DESTINATION include
|
||||
)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/iniparser.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||
)
|
4
ports/iniparser/CONTROL
Normal file
4
ports/iniparser/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: iniparser
|
||||
Version: 2020-04-06
|
||||
Homepage: ndevilla.free.fr/iniparser
|
||||
Description: C library for parsing INI-style files
|
26
ports/iniparser/portfile.cmake
Normal file
26
ports/iniparser/portfile.cmake
Normal file
@ -0,0 +1,26 @@
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO ndevilla/iniparser
|
||||
REF f858275f7f307eecba84c2f5429483f9f28007f8
|
||||
SHA512 48c80b2163f86d8ca0f3253128d8528214e2f0680b4bceb686180c01b29cd2a0c3b9d6e7156a8e28649b14bc1d8a51b34c2d3d258013b35f69aaf6c3ded9ecdc
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
win32_ssize_t.patch
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
29
ports/iniparser/win32_ssize_t.patch
Normal file
29
ports/iniparser/win32_ssize_t.patch
Normal file
@ -0,0 +1,29 @@
|
||||
diff --git a/src/dictionary.c b/src/dictionary.c
|
||||
index cb7ccd4..7985ab3 100644
|
||||
--- a/src/dictionary.c
|
||||
+++ b/src/dictionary.c
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#include <unistd.h>
|
||||
|
||||
/** Maximum value size for integers and doubles. */
|
||||
#define MAXVALSZ 1024
|
||||
diff --git a/src/dictionary.h b/src/dictionary.h
|
||||
index d04b6ce..929ae17 100644
|
||||
--- a/src/dictionary.h
|
||||
+++ b/src/dictionary.h
|
||||
@@ -21,7 +21,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#ifdef _MSC_VER
|
||||
+#include <BaseTsd.h>
|
||||
+typedef SSIZE_T ssize_t;
|
||||
+#else
|
||||
#include <unistd.h>
|
||||
+#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
Loading…
x
Reference in New Issue
Block a user