mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Further improve interfacing with external plugins
This commit is contained in:
2
lib/external/libwolv
vendored
2
lib/external/libwolv
vendored
Submodule lib/external/libwolv updated: a58bc52eb6...7e90fc85ed
@@ -103,11 +103,11 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
||||
endif ()
|
||||
|
||||
target_link_libraries(libimhex PRIVATE microtar libwolv ${NFD_LIBRARIES} magic dl ${NLOHMANN_JSON_LIBRARIES} ${MBEDTLS_LIBRARIES} ${JTHREAD_LIBRARIES})
|
||||
target_link_libraries(libimhex PRIVATE microtar libwolv ${NFD_LIBRARIES} magic dl ${MBEDTLS_LIBRARIES} ${JTHREAD_LIBRARIES})
|
||||
target_link_libraries(libimhex PUBLIC libpl ${IMGUI_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} imgui_all_includes ${FMT_LIBRARIES})
|
||||
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} nlohmann_json imgui_all_includes ${FMT_LIBRARIES})
|
||||
|
||||
set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
|
||||
|
||||
|
||||
@@ -96,15 +96,18 @@ namespace hex {
|
||||
public:
|
||||
PluginManager() = delete;
|
||||
|
||||
static bool load();
|
||||
static bool load(const std::fs::path &pluginFolder);
|
||||
static void unload();
|
||||
static void reload();
|
||||
static void initializeNewPlugins();
|
||||
static void addLoadPath(const std::fs::path &path);
|
||||
|
||||
static void addPlugin(const std::string &name, PluginFunctions functions);
|
||||
|
||||
static std::list<Plugin> &getPlugins();
|
||||
static std::vector<std::fs::path> &getPluginPaths();
|
||||
static std::vector<std::fs::path> &getPluginLoadPaths();
|
||||
|
||||
static bool isPluginLoaded(const std::fs::path &path);
|
||||
};
|
||||
|
||||
@@ -226,6 +226,18 @@ namespace hex {
|
||||
#endif
|
||||
}
|
||||
|
||||
void PluginManager::addLoadPath(const std::fs::path& path) {
|
||||
getPluginLoadPaths().emplace_back(path);
|
||||
}
|
||||
|
||||
|
||||
bool PluginManager::load() {
|
||||
bool success = true;
|
||||
for (const auto &loadPath : getPluginLoadPaths())
|
||||
success = PluginManager::load(loadPath) && success;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool PluginManager::load(const std::fs::path &pluginFolder) {
|
||||
@@ -295,6 +307,12 @@ namespace hex {
|
||||
return pluginPaths;
|
||||
}
|
||||
|
||||
std::vector<std::fs::path> &PluginManager::getPluginLoadPaths() {
|
||||
static std::vector<std::fs::path> pluginPaths;
|
||||
|
||||
return pluginPaths;
|
||||
}
|
||||
|
||||
bool PluginManager::isPluginLoaded(const std::fs::path &path) {
|
||||
return std::ranges::any_of(getPlugins(), [&path](const Plugin &plugin) {
|
||||
return plugin.getPath().filename() == path.filename();
|
||||
|
||||
1
lib/third_party/nlohmann_json/CMakeLists.txt
vendored
1
lib/third_party/nlohmann_json/CMakeLists.txt
vendored
@@ -6,3 +6,4 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
add_library(nlohmann_json INTERFACE)
|
||||
|
||||
target_include_directories(nlohmann_json INTERFACE include)
|
||||
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json)
|
||||
Reference in New Issue
Block a user