Skip to content

Commit 54dff22

Browse files
authoredApr 15, 2024··
Merge pull request #479 from Ghabry/inih-no-vendor
Do not vendor inih
2 parents a7f3d95 + 2693b31 commit 54dff22

11 files changed

+88
-454
lines changed
 

‎.github/workflows/stable-compilation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
apt-get update
3737
apt-get install -y --no-install-recommends --no-install-suggests \
3838
ca-certificates build-essential cmake ninja-build git \
39-
libicu-dev libexpat1-dev
39+
libicu-dev libexpat1-dev libinih-dev
4040
4141
- name: Clone Repository
4242
uses: actions/checkout@v4

‎.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ build/
5050
# IntelliJ / CLion
5151
.idea/
5252

53+
# VS Code
54+
.vscode/
55+
.cache/
56+
compile_commands.json
57+
5358
# doxygen generated files
5459
/doc/
5560

@@ -72,3 +77,4 @@ test_runner*
7277

7378
# distribution archives
7479
liblcf-*.tar.*
80+

‎CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ set(LCF_SOURCES
2727
src/dbarray.cpp
2828
src/dbstring_struct.cpp
2929
src/encoder.cpp
30-
src/ini.cpp
3130
src/inireader.cpp
3231
src/ldb_equipment.cpp
3332
src/ldb_eventcommand.cpp
@@ -201,7 +200,6 @@ set(LCF_HEADERS
201200
src/lcf/encoder.h
202201
src/lcf/enum_tags.h
203202
src/lcf/flag_set.h
204-
src/lcf/ini.h
205203
src/lcf/inireader.h
206204
src/lcf/ldb/reader.h
207205
src/lcf/lmt/reader.h
@@ -343,6 +341,10 @@ set_property(TARGET lcf PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
343341
# Name of the exported library
344342
set_property(TARGET lcf PROPERTY EXPORT_NAME liblcf)
345343

344+
# inih
345+
find_package(inih REQUIRED)
346+
target_link_libraries(lcf inih::inih)
347+
346348
# icu
347349
set(LCF_SUPPORT_ICU 0)
348350
if(LIBLCF_WITH_ICU)
@@ -380,7 +382,6 @@ set_property(TARGET lcf PROPERTY SOVERSION 0)
380382

381383
# installation
382384
if(LIBLCF_ENABLE_INSTALL)
383-
384385
# pkg-config file generation
385386
set(LCF_LIBDIR ${CMAKE_INSTALL_LIBDIR})
386387
if(IS_ABSOLUTE ${LCF_LIBDIR})
@@ -441,6 +442,7 @@ if(LIBLCF_ENABLE_INSTALL)
441442
install(FILES
442443
${CMAKE_CURRENT_BINARY_DIR}/liblcf-config.cmake
443444
${CMAKE_CURRENT_BINARY_DIR}/liblcf-config-version.cmake
445+
${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules/Findinih.cmake
444446
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/liblcf
445447
)
446448

‎Makefile.am

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ liblcf_la_CXXFLAGS = \
3434
-std=gnu++17 \
3535
-fno-math-errno \
3636
$(AM_CXXFLAGS) \
37+
$(INIH_CFLAGS) \
3738
$(EXPAT_CFLAGS) \
3839
$(ICU_CFLAGS)
3940
liblcf_la_LIBADD = \
41+
$(INIH_LIBS) \
4042
$(EXPAT_LIBS) \
4143
$(ICU_LIBS)
4244
liblcf_la_LDFLAGS = \
@@ -46,7 +48,6 @@ liblcf_la_SOURCES = \
4648
src/dbarray.cpp \
4749
src/dbstring_struct.cpp \
4850
src/encoder.cpp \
49-
src/ini.cpp \
5051
src/inireader.cpp \
5152
src/ldb_equipment.cpp \
5253
src/ldb_eventcommand.cpp \
@@ -219,7 +220,6 @@ lcfinclude_HEADERS = \
219220
src/lcf/encoder.h \
220221
src/lcf/enum_tags.h \
221222
src/lcf/flag_set.h \
222-
src/lcf/ini.h \
223223
src/lcf/inireader.h \
224224
src/lcf/log_handler.h \
225225
src/lcf/reader_lcf.h \
@@ -347,10 +347,12 @@ test_runner_CPPFLAGS = \
347347
test_runner_CXXFLAGS = \
348348
-std=gnu++17 \
349349
-DDOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING=1 \
350+
$(INIH_CXXFLAGS) \
350351
$(EXPAT_CXXFLAGS) \
351352
$(ICU_CXXFLAGS)
352353
test_runner_LDADD = \
353354
liblcf.la \
355+
$(INIH_LIBS) \
354356
$(EXPAT_LIBS) \
355357
$(ICU_LIBS)
356358
test_runner_LDFLAGS = -no-install

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Documentation is available at the documentation wiki: https://wiki.easyrpg.org
1414

1515
## Requirements
1616

17+
- [inih] for INI file reading. (required)
1718
- [Expat] for XML reading support.
1819
- [ICU] for character encoding detection and conversion (recommended).
1920

‎builds/cmake/Modules/Findinih.cmake

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#.rst:
2+
# Findinih
3+
# --------
4+
#
5+
# Find the inih Library
6+
#
7+
# Imported Targets
8+
# ^^^^^^^^^^^^^^^^
9+
#
10+
# This module defines the following :prop_tgt:`IMPORTED` targets:
11+
#
12+
# ``inih::inih``
13+
# The ``inih`` library, if found.
14+
#
15+
# Result Variables
16+
# ^^^^^^^^^^^^^^^^
17+
#
18+
# This module will set the following variables in your project:
19+
#
20+
# ``INIH_INCLUDE_DIRS``
21+
# where to find inih headers.
22+
# ``INIH_LIBRARIES``
23+
# the libraries to link against to use inih.
24+
# ``INIH_FOUND``
25+
# true if the inih headers and libraries were found.
26+
27+
find_package(PkgConfig QUIET)
28+
29+
pkg_check_modules(PC_INIH QUIET libinih)
30+
31+
# Look for the header file.
32+
find_path(INIH_INCLUDE_DIR
33+
NAMES ini.h
34+
HINTS ${PC_INIH_INCLUDE_DIRS})
35+
36+
# Look for the library.
37+
# Allow INIH_LIBRARY to be set manually, as the location of the inih library
38+
if(NOT INIH_LIBRARY)
39+
find_library(INIH_LIBRARY
40+
NAMES libinih inih
41+
HINTS ${PC_INIH_LIBRARY_DIRS})
42+
endif()
43+
44+
include(FindPackageHandleStandardArgs)
45+
find_package_handle_standard_args(inih
46+
REQUIRED_VARS INIH_LIBRARY INIH_INCLUDE_DIR)
47+
48+
if(INIH_FOUND)
49+
set(INIH_INCLUDE_DIRS ${INIH_INCLUDE_DIR})
50+
51+
if(NOT INIH_LIBRARIES)
52+
set(INIH_LIBRARIES ${INIH_LIBRARIES})
53+
endif()
54+
55+
if(NOT TARGET inih::inih)
56+
add_library(inih::inih UNKNOWN IMPORTED)
57+
set_target_properties(inih::inih PROPERTIES
58+
INTERFACE_INCLUDE_DIRECTORIES "${INIH_INCLUDE_DIRS}"
59+
IMPORTED_LOCATION "${INIH_LIBRARY}")
60+
endif()
61+
endif()
62+
63+
mark_as_advanced(INIH_INCLUDE_DIR INIH_LIBRARY)

‎builds/cmake/liblcf-config.cmake.in

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
include(CMakeFindDependencyMacro)
44

5+
# Required to find our installed Findinih.cmake
6+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
7+
8+
find_dependency(inih REQUIRED)
9+
510
if(@LCF_SUPPORT_ICU@)
611
find_dependency(ICU COMPONENTS i18n uc data REQUIRED)
712
endif()

‎configure.ac

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ LT_INIT([win32-dll])
2121
AM_CONDITIONAL(CROSS_COMPILING,[test "x$cross_compiling" = "xyes"])
2222

2323
# Checks for libraries.
24+
AX_PKG_CHECK_MODULES([INIH],[],[inih],[])
25+
2426
AC_SUBST([LCF_SUPPORT_ICU],[0])
2527
AC_ARG_ENABLE([icu],[AS_HELP_STRING([--disable-icu],[Disable ICU encoding handling (only windows-1252 supported) [default=no]])])
2628
AS_IF([test "x$enable_icu" != "xno"],[

0 commit comments

Comments
 (0)