build: Make SDK not try to link to unbundled libraries
This commit is contained in:
parent
c402d58685
commit
ff48d37598
@ -20,6 +20,8 @@ add_subdirectory(lib/third_party/imgui)
|
||||
add_subdirectory_if_exists(lib/third_party/fmt)
|
||||
add_subdirectory_if_exists(lib/third_party/nlohmann_json)
|
||||
|
||||
set(FMT_LIBRARIES fmt::fmt-header-only)
|
||||
|
||||
add_subdirectory(lib/external/libwolv)
|
||||
|
||||
set(LIBPL_BUILD_CLI_AS_EXECUTABLE OFF)
|
||||
|
@ -35,7 +35,6 @@ set(LIBIMHEX_SOURCES
|
||||
source/helpers/patches.cpp
|
||||
source/helpers/encoding_file.cpp
|
||||
source/helpers/logger.cpp
|
||||
source/helpers/stacktrace.cpp
|
||||
source/helpers/tar.cpp
|
||||
source/helpers/debugging.cpp
|
||||
|
||||
@ -64,8 +63,6 @@ if (APPLE)
|
||||
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES} source/helpers/utils_macos.m)
|
||||
endif ()
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
|
||||
if (IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(libimhex IMPORTED SHARED GLOBAL)
|
||||
set(LIBIMHEX_LIBRARY_TYPE INTERFACE)
|
||||
@ -79,6 +76,7 @@ else()
|
||||
set(LIBIMHEX_LIBRARY_TYPE PUBLIC)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(libimhex PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
set_target_properties(libimhex PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
enableUnityBuild(libimhex)
|
||||
setupCompilerFlags(libimhex)
|
||||
@ -108,7 +106,7 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
target_link_libraries(libimhex PRIVATE microtar libpl plcli libpl-gen libwolv ${FMT_LIBRARIES} ${NFD_LIBRARIES} magic dl ${IMGUI_LIBRARIES} ${NLOHMANN_JSON_LIBRARIES} ${MBEDTLS_LIBRARIES} ${LIBBACKTRACE_LIBRARIES} ${JTHREAD_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} ${IMGUI_LIBRARIES} LLVMDemangle)
|
||||
target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${NLOHMANN_JSON_LIBRARIES} ${IMGUI_LIBRARIES})
|
||||
|
||||
set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
|
||||
|
||||
|
@ -32,16 +32,16 @@ namespace hex::log {
|
||||
[[maybe_unused]] void printPrefix(FILE *dest, const fmt::text_style &ts, const std::string &level, const char *projectName);
|
||||
|
||||
[[maybe_unused]] void print(const fmt::text_style &ts, const std::string &level, const std::string &fmt, auto && ... args) {
|
||||
std::scoped_lock lock(impl::g_loggerMutex);
|
||||
std::scoped_lock lock(g_loggerMutex);
|
||||
|
||||
auto dest = impl::getDestination();
|
||||
auto dest = getDestination();
|
||||
printPrefix(dest, ts, level, IMHEX_PROJECT_NAME);
|
||||
|
||||
auto message = fmt::format(fmt::runtime(fmt), args...);
|
||||
fmt::print(dest, "{}\n", message);
|
||||
fflush(dest);
|
||||
|
||||
impl::getLogEntries().push_back({ IMHEX_PROJECT_NAME, level, std::move(message) });
|
||||
getLogEntries().push_back({ IMHEX_PROJECT_NAME, level, std::move(message) });
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace hex::log::impl {
|
||||
|
||||
fmt::print(dest, "[{0:%H:%M:%S}] ", now);
|
||||
|
||||
if (impl::isRedirected())
|
||||
if (isRedirected())
|
||||
fmt::print(dest, "{0} ", level);
|
||||
else
|
||||
fmt::print(dest, ts, "{0} ", level);
|
||||
|
2
lib/third_party/HashLibPlus
vendored
2
lib/third_party/HashLibPlus
vendored
@ -1 +1 @@
|
||||
Subproject commit a5195f258444c0e9727755f5632d38e0061dee82
|
||||
Subproject commit 44ad8618900bf118f6534e923cff6da028c0e2cf
|
@ -3,6 +3,7 @@ project(main)
|
||||
add_executable(main ${APPLICATION_TYPE}
|
||||
source/main.cpp
|
||||
source/crash_handlers.cpp
|
||||
source/stacktrace.cpp
|
||||
|
||||
source/window/window.cpp
|
||||
source/window/win_window.cpp
|
||||
@ -16,6 +17,7 @@ add_executable(main ${APPLICATION_TYPE}
|
||||
source/messaging/win.cpp
|
||||
source/messaging/web.cpp
|
||||
|
||||
|
||||
source/init/splash_window.cpp
|
||||
source/init/tasks.cpp
|
||||
|
||||
@ -50,9 +52,9 @@ set_target_properties(main PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../..
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
target_compile_definitions(main PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
|
||||
target_link_libraries(main PRIVATE libromfs-imhex libimhex libwolv libpl plcli libpl-gen ${FMT_LIBRARIES})
|
||||
target_link_libraries(main PRIVATE libromfs-imhex libimhex libwolv libpl plcli libpl-gen ${FMT_LIBRARIES} LLVMDemangle)
|
||||
if (WIN32)
|
||||
target_link_libraries(main PRIVATE usp10 wsock32 ws2_32 Dwmapi.lib)
|
||||
else ()
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
#include <hex/helpers/stacktrace.hpp>
|
||||
|
||||
#include <wolv/utils/string.hpp>
|
||||
|
||||
@ -14,6 +13,7 @@
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <stacktrace.hpp>
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
|
||||
#include <csignal>
|
||||
@ -153,7 +153,9 @@ namespace hex::crash {
|
||||
|
||||
// Setup functions to handle signals, uncaught exception, or similar stuff that will crash ImHex
|
||||
void setupCrashHandlers() {
|
||||
// Register signal handlers
|
||||
stacktrace::initialize();
|
||||
|
||||
// Register signal handlers
|
||||
{
|
||||
#define HANDLE_SIGNAL(name) \
|
||||
std::signal(name, [](int signalNumber) { \
|
||||
|
@ -247,7 +247,7 @@ namespace {
|
||||
*/
|
||||
int main(int argc, char **argv) {
|
||||
Window::initNative();
|
||||
hex::crash::setupCrashHandlers();
|
||||
crash::setupCrashHandlers();
|
||||
|
||||
if (argc > 1) {
|
||||
handleCommandLineInterface(argc, argv);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <hex/helpers/stacktrace.hpp>
|
||||
#include <stacktrace.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
|
||||
#include <array>
|
@ -14,7 +14,6 @@
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/stacktrace.hpp>
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <hex/ui/popup.hpp>
|
||||
@ -46,8 +45,6 @@ namespace hex {
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
Window::Window() {
|
||||
stacktrace::initialize();
|
||||
|
||||
constexpr static auto openEmergencyPopup = [](const std::string &title){
|
||||
TaskManager::doLater([title] {
|
||||
for (const auto &provider : ImHexApi::Provider::getProviders())
|
||||
|
@ -4,7 +4,7 @@ add_executable(updater
|
||||
source/main.cpp
|
||||
)
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
target_compile_definitions(updater PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
target_link_libraries(updater PRIVATE libimhex wolv::io ${FMT_LIBRARIES})
|
||||
add_dependencies(main updater)
|
||||
|
||||
|
@ -118,6 +118,7 @@ add_imhex_plugin(
|
||||
ui
|
||||
${JTHREAD_LIBRARIES}
|
||||
plcli
|
||||
LLVMDemangle
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
|
@ -1,9 +1,9 @@
|
||||
project(unit_tests)
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
|
||||
add_custom_target(unit_tests DEPENDS helpers algorithms)
|
||||
|
||||
add_subdirectory(common)
|
||||
target_compile_definitions(tests_common PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
|
||||
add_subdirectory(helpers)
|
||||
add_subdirectory(algorithms)
|
||||
|
Loading…
Reference in New Issue
Block a user