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

Don't strictly require inih #490

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +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_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 All @@ -30,7 +31,6 @@ set(LCF_SOURCES
src/dbarray.cpp
src/dbstring_struct.cpp
src/encoder.cpp
src/inireader.cpp
src/ldb_equipment.cpp
src/ldb_eventcommand.cpp
src/ldb_parameters.cpp
Expand Down Expand Up @@ -202,7 +202,6 @@ set(LCF_HEADERS
src/lcf/encoder.h
src/lcf/enum_tags.h
src/lcf/flag_set.h
src/lcf/inireader.h
src/lcf/ldb/reader.h
src/lcf/lmt/reader.h
src/lcf/lmu/reader.h
Expand Down Expand Up @@ -294,6 +293,17 @@ set(LCF_HEADERS
src/lcf/third_party/string_view.h
)

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

add_library(lcf ${LCF_SOURCES} ${LCF_HEADERS})

# IDE source grouping
Expand Down Expand Up @@ -344,8 +354,12 @@ set_property(TARGET lcf PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
set_property(TARGET lcf PROPERTY EXPORT_NAME liblcf)

# inih
find_package(inih REQUIRED)
target_link_libraries(lcf inih::inih)
if (LCF_SUPPORT_INIH)
find_package(inih REQUIRED)
target_link_libraries(lcf inih::inih)
else()
message(STATUS "inih is disabled. This component is required when building EasyRPG Player.")
endif ()

# icu
set(LCF_SUPPORT_ICU 0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Documentation is available at the documentation wiki: https://wiki.easyrpg.org

## Requirements

- [inih] for INI file reading. (required)
- [inih] for INI file reading. (required when building EasyRPG Player)
- [Expat] for XML reading support.
- [ICU] for character encoding detection and conversion (recommended).
- [ICU] for character encoding detection and conversion (recommended). When disabled only Windows-1252 is supported.


## Source code
Expand Down
4 changes: 3 additions & 1 deletion builds/cmake/liblcf-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ include(CMakeFindDependencyMacro)
# Required to find our installed Findinih.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

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

if(@LCF_SUPPORT_ICU@ EQUAL 1)
find_dependency(ICU COMPONENTS i18n uc data REQUIRED)
Expand Down
Loading