Skip to content

Commit

Permalink
Use matching naming scheme, add ini to configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
Antidote committed Jan 7, 2025
1 parent 6964f71 commit 90ac4e8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(MiscUtils)

# Compilation options
option(BUILD_SHARED_LIBS "Build shared library, disable for building the static library (default: ON)" ON)
option(LIBLCF_WITH_INIH "INI parsing support (inih, required when building EasyRPG Player, default: ON)" ON)
option(LIBLCF_WITH_INI "INI parsing support (inih, required when building EasyRPG Player, default: ON)" ON)
option(LIBLCF_WITH_ICU "ICU encoding handling (when disabled only windows-1252 is supported, default: ON)" ON)
option(LIBLCF_WITH_XML "XML reading support (expat, default: ON)" ON)
option(LIBLCF_UPDATE_MIMEDB "Whether to run update-mime-database after install (default: ON)" ON)
Expand Down Expand Up @@ -293,15 +293,15 @@ set(LCF_HEADERS
src/lcf/third_party/string_view.h
)

set(LCF_SUPPORT_INIH 0)
if(LIBLCF_WITH_INIH)
set(LCF_SUPPORT_INI 0)
if(LIBLCF_WITH_INI)
list(APPEND LCF_SOURCES
src/inireader.cpp
)
list(APPEND LCF_HEADERS
src/lcf/inireader.h
)
set(LCF_SUPPORT_INIH 1)
set(LCF_SUPPORT_INI 1)
endif()

add_library(lcf ${LCF_SOURCES} ${LCF_HEADERS})
Expand Down Expand Up @@ -354,7 +354,7 @@ set_property(TARGET lcf PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
set_property(TARGET lcf PROPERTY EXPORT_NAME liblcf)

# inih
if (LCF_SUPPORT_INIH)
if (LCF_SUPPORT_INI)
find_package(inih REQUIRED)
target_link_libraries(lcf inih::inih)
else()
Expand Down
2 changes: 1 addition & 1 deletion builds/cmake/liblcf-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(CMakeFindDependencyMacro)
# Required to find our installed Findinih.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

if(@LCF_SUPPORT_INIH@)
if(@LCF_SUPPORT_INI@)
find_dependency(inih REQUIRED)
endif()

Expand Down
2 changes: 1 addition & 1 deletion builds/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
#define LCF_SUPPORT_XML @LCF_SUPPORT_XML@

/* Enable INI reading support (INIH ) */
#define LCF_SUPPORT_INIH @LCF_SUPPORT_INIH@
#define LCF_SUPPORT_INI @LCF_SUPPORT_INI@
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ AS_IF([test "x$enable_xml" != "xno"],[
])
AM_CONDITIONAL(SUPPORT_XML,[test $LCF_SUPPORT_XML == 1])

AC_SUBST([LCF_SUPPORT_INI],[0])
AC_ARG_ENABLE([ini],[AS_HELP_STRING([--disable-ini],[Disable INI reading support (inih) [default=no]])])
AS_IF([test "x$enable_ini" != "xno"],[
AX_PKG_CHECK_MODULES([EXPAT],[],[ini >= 2.1],[LCF_SUPPORT_INI=1])
])
AM_CONDITIONAL(SUPPORT_INI,[test $LCF_SUPPORT_INI == 1])

# Tools
AC_ARG_ENABLE([tools],[AS_HELP_STRING([--disable-tools],[Do not build and install the tools [default=no]])])
AM_CONDITIONAL(ENABLE_TOOLS,[test "x$enable_tools" != "xno"])
Expand Down
2 changes: 1 addition & 1 deletion src/lcf/reader_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace ReaderUtil {
* @return list of encodings or empty if not detected
*/
std::vector<std::string> DetectEncodings(StringView string);
#if LCF_SUPPORT_INIH
#if LCF_SUPPORT_INI
/**
* Returns the encoding set in the ini file.
*
Expand Down
2 changes: 1 addition & 1 deletion src/reader_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ std::vector<std::string> ReaderUtil::DetectEncodings(StringView string) {
return encodings;
}

#if LCF_SUPPORT_INIH
#if LCF_SUPPORT_INI
std::string ReaderUtil::GetEncoding(StringView ini_file) {
INIReader ini(ToString(ini_file));
if (ini.ParseError() != -1) {
Expand Down
2 changes: 1 addition & 1 deletion tools/lcf2xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void PrintReaderError(const std::string data)
int ReaderWriteToFile(const std::string& in, const std::string& out, FileTypes in_type, lcf::EngineVersion engine, std::string encoding)
{
std::string path = GetPath(in) + "/";
#if LCF_SUPPORT_INIH
#if LCF_SUPPORT_INI
if (encoding.empty()) {
#ifdef _WIN32
encoding = lcf::ReaderUtil::GetEncoding(path + "RPG_RT.ini");
Expand Down

0 comments on commit 90ac4e8

Please sign in to comment.