mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-24 00:41:49 +01:00
externals: allow user to use system inih (#7073)
This commit is contained in:
parent
4c59443ed2
commit
956b0868fd
@ -100,6 +100,7 @@ option(USE_SYSTEM_JSON "Use the system JSON (nlohmann-json3) package (instead of
|
||||
option(USE_SYSTEM_DYNARMIC "Use the system dynarmic (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_FMT "Use the system fmt (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_XBYAK "Use the system xbyak (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_INIH "Use the system inih (instead of the bundled one)" OFF)
|
||||
|
||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||
message(STATUS "Using Precompiled Headers.")
|
||||
|
8
externals/CMakeLists.txt
vendored
8
externals/CMakeLists.txt
vendored
@ -126,7 +126,13 @@ set(BUILD_EXTERNAL OFF CACHE BOOL "")
|
||||
add_subdirectory(glslang)
|
||||
|
||||
# inih
|
||||
add_subdirectory(inih)
|
||||
if(USE_SYSTEM_INIH)
|
||||
find_package(inih REQUIRED COMPONENTS inih inir)
|
||||
add_library(inih INTERFACE)
|
||||
target_link_libraries(inih INTERFACE inih::inih inih::inir)
|
||||
else()
|
||||
add_subdirectory(inih)
|
||||
endif()
|
||||
|
||||
# MicroProfile
|
||||
add_library(microprofile INTERFACE)
|
||||
|
63
externals/cmake-modules/Findinih.cmake
vendored
Normal file
63
externals/cmake-modules/Findinih.cmake
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
if(NOT inih_FOUND)
|
||||
# Inih includes both a base library and INIReader
|
||||
# We must link against both to avoid linker errors.
|
||||
|
||||
pkg_check_modules(INIR_TEMP INIReader)
|
||||
pkg_check_modules(INIH_TEMP inih)
|
||||
|
||||
|
||||
find_path(INIR_INCLUDE_DIR NAMES INIReader.h
|
||||
PATHS
|
||||
${INIR_TEMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_path(INIH_INCLUDE_DIR NAMES ini.h
|
||||
PATHS
|
||||
${INIH_TEMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/use/local/include
|
||||
)
|
||||
|
||||
find_library(INIR_LIBRARIES NAMES INIReader
|
||||
PATHS
|
||||
${INIR_TEMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
find_library(INIH_LIBRARIES NAMES inih
|
||||
PATHS
|
||||
${INIH_TEMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(INIR_INCLUDE_DIR AND INIH_INCLUDE_DIR AND INIR_LIBRARIES AND INIH_LIBRARIES)
|
||||
set(inih_FOUND TRUE CACHE INTERNAL "Found inih library")
|
||||
message(STATUS "Found inih ${INIR_INCLUDE_DIR} ${INIH_INCLUDE_DIR} ${INIR_LIBRARIES} ${INIH_LIBRARIES}")
|
||||
else()
|
||||
set(inih_FOUND FALSE CACHE INTERNAL "Found inih library")
|
||||
message(STATUS "Inih not found.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(inih_FOUND AND NOT TARGET inih::inir OR NOT TARGET inih::inih)
|
||||
add_library(inih::inir INTERFACE IMPORTED)
|
||||
set_target_properties(inih::inir PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INIR_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${INIR_LIBRARIES}"
|
||||
IMPORTED_LOCATION "${INIR_LIBRARIES}"
|
||||
)
|
||||
|
||||
add_library(inih::inih INTERFACE IMPORTED)
|
||||
set_target_properties(inih::inih PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INIH_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${INIH_LIBRARES}"
|
||||
IMPORTED_LOCATION ${INIH_LIBRARIES}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
2
externals/inih/CMakeLists.txt
vendored
2
externals/inih/CMakeLists.txt
vendored
@ -6,4 +6,4 @@ add_library(inih
|
||||
)
|
||||
|
||||
create_target_directory_groups(inih)
|
||||
target_include_directories(inih INTERFACE .)
|
||||
target_include_directories(inih INTERFACE ./inih/cpp)
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <inih/cpp/INIReader.h>
|
||||
#include <INIReader.h>
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/backend.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
#include <INIReader.h>
|
||||
#include <SDL.h>
|
||||
#include <inih/cpp/INIReader.h>
|
||||
#include "citra/config.h"
|
||||
#include "citra/default_ini.h"
|
||||
#include "common/file_util.h"
|
||||
|
Loading…
Reference in New Issue
Block a user