mirror of https://github.com/WerWolv/ImHex
build: remove IMHEX_PLUGINS_IN_SHARE option + only allow AppImage to load plugins from inside itself
Rationale: The `IMHEX_PLUGINS_IN_SHARE` is a hack to prevent the appimage from loading plugin from system imhex installation, like /usr/lib/imhex/ In reality, I do not think people compile plugins specifically for the AppImage (plugins must be compiled for the specific imhex & compiler version the imhex binary is used), and this lets us remove the hack
This commit is contained in:
parent
07b6fa0e2e
commit
49bbe7dc77
|
|
@ -29,7 +29,6 @@ option(IMHEX_REPLACE_DWARF_WITH_PDB "Remove DWARF information from binaries
|
||||||
option(IMHEX_STRICT_WARNINGS "Enable most available warnings and treat them as errors" ON )
|
option(IMHEX_STRICT_WARNINGS "Enable most available warnings and treat them as errors" ON )
|
||||||
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
|
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
|
||||||
## Plugins
|
## Plugins
|
||||||
option(IMHEX_PLUGINS_IN_SHARE "Put the plugins in share/imhex/plugins instead of lib[..]/imhex/plugins (Linux only)" OFF)
|
|
||||||
option(IMHEX_STATIC_LINK_PLUGINS "Statically link all plugins into the main executable" OFF)
|
option(IMHEX_STATIC_LINK_PLUGINS "Statically link all plugins into the main executable" OFF)
|
||||||
option(IMHEX_ENABLE_PLUGIN_TESTS "Enable building plugin tests" ON )
|
option(IMHEX_ENABLE_PLUGIN_TESTS "Enable building plugin tests" ON )
|
||||||
option(IMHEX_INCLUDE_PLUGINS "Semicolon-separated list of plugins to include in the build (empty = build all)" "" )
|
option(IMHEX_INCLUDE_PLUGINS "Semicolon-separated list of plugins to include in the build (empty = build all)" "" )
|
||||||
|
|
|
||||||
|
|
@ -175,15 +175,11 @@ macro(detectOS)
|
||||||
endif()
|
endif()
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if(IMHEX_PLUGINS_IN_SHARE)
|
|
||||||
set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins")
|
|
||||||
else()
|
|
||||||
set(PLUGINS_INSTALL_LOCATION "${CMAKE_INSTALL_LIBDIR}/imhex/plugins")
|
set(PLUGINS_INSTALL_LOCATION "${CMAKE_INSTALL_LIBDIR}/imhex/plugins")
|
||||||
|
|
||||||
# Add System plugin location for plugins to be loaded from
|
# Add System plugin location for plugins to be loaded from
|
||||||
# IMPORTANT: This does not work for Sandboxed or portable builds such as the Flatpak or AppImage release
|
# IMPORTANT: This does not work for Sandboxed or portable builds such as the Flatpak or AppImage release
|
||||||
add_compile_definitions(SYSTEM_PLUGINS_LOCATION="${CMAKE_INSTALL_FULL_LIBDIR}/imhex")
|
add_compile_definitions(SYSTEM_PLUGINS_LOCATION="${CMAKE_INSTALL_FULL_LIBDIR}/imhex")
|
||||||
endif()
|
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "Unknown / unsupported system!")
|
message(FATAL_ERROR "Unknown / unsupported system!")
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,9 @@ CC=gcc-14 CXX=g++-14 cmake -G "Ninja" \
|
||||||
-DIMHEX_COMMIT_HASH_LONG="${GIT_COMMIT_HASH}" \
|
-DIMHEX_COMMIT_HASH_LONG="${GIT_COMMIT_HASH}" \
|
||||||
-DIMHEX_COMMIT_BRANCH="${GIT_BRANCH}" \
|
-DIMHEX_COMMIT_BRANCH="${GIT_BRANCH}" \
|
||||||
-DIMHEX_ENABLE_LTO=${LTO} \
|
-DIMHEX_ENABLE_LTO=${LTO} \
|
||||||
-DIMHEX_PLUGINS_IN_SHARE=ON \
|
|
||||||
-DIMHEX_BUNDLE_PLUGIN_SDK=OFF \
|
-DIMHEX_BUNDLE_PLUGIN_SDK=OFF \
|
||||||
|
`# To prevent using a libdir with an architecture-specific name` \
|
||||||
|
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||||
/imhex
|
/imhex
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,13 @@ namespace hex::paths {
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::fs::path> getPluginPaths() {
|
static std::vector<std::fs::path> getPluginPaths() {
|
||||||
|
// If running from an AppImage, only allow loaded plugins from inside it
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
if(const char* appdir = std::getenv("APPDIR")) { // check for AppImage environment
|
||||||
|
return {std::string(appdir) + "/usr/lib/imhex"};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::vector<std::fs::path> paths = getDataPaths(true);
|
std::vector<std::fs::path> paths = getDataPaths(true);
|
||||||
|
|
||||||
// Add the system plugin directory to the path if one was provided at compile time
|
// Add the system plugin directory to the path if one was provided at compile time
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue