Disabled RPATH and runtime loading of distributed Qt binaries for debug builds

This commit is contained in:
Nav
2021-04-25 16:20:30 +01:00
parent 9d2b5b2f0a
commit 2e0bf9eb24
3 changed files with 21 additions and 6 deletions

View File

@@ -26,12 +26,19 @@ find_package(Qt5Xml)
find_package(Qt5Svg)
find_package(Qt5UiTools)
# CMAKE_SKIP_BUILD_RPATH needs to be set to true to use Gammaray during development
set(CMAKE_SKIP_BUILD_RPATH false)
set(CMAKE_BUILD_RPATH_USE_ORIGIN true)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
set(CMAKE_BUILD_RPATH ${CMAKE_INSTALL_RPATH})
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_compile_definitions(BLOOM_DEBUG_BUILD)
# CMAKE_SKIP_BUILD_RPATH needs to be set to true to use Gammaray during development.
# This is because the distributed Qt binaries may not be compatible with the local installation of Gammaray
set(CMAKE_SKIP_BUILD_RPATH true)
endif()
add_executable(Bloom
src/main.cpp
src/Generated/resources.cpp
@@ -159,10 +166,6 @@ target_link_options(
PUBLIC [=[-Wl,--disable-new-dtags]=] #,--verbose
)
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_compile_definitions(BLOOM_DEBUG_BUILD)
endif()
if (${ENABLE_SANITIZERS})
message(WARNING "Sanitizers have been enabled")

View File

@@ -120,5 +120,9 @@ sudo nano /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
cd /path/to/Bloom;
cmake --build ./build/cmake-build-debug --target clean;
```
- To use Gammaray for GUI debugging, be sure to build Bloom with the debug configuration. Your local installation of
Gammaray will likely be incompatible with the distributed Qt binaries, which ld will use if you've built with the
release config. Building with the debug config will disable the RPATH and prevent Qt from loading any plugins from
the distribution directory.
More documentation to follow.

View File

@@ -51,7 +51,10 @@ void Insight::startup() {
std::string qtAppName = "Bloom";
char* appArguments[] = {qtAppName.data()};
auto appArgCount = 1;
#ifndef BLOOM_DEBUG_BUILD
QCoreApplication::addLibraryPath(QString::fromStdString(Application::getApplicationDirPath() + "/plugins"));
#endif
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
this->application = new QApplication(appArgCount, appArguments);
@@ -61,7 +64,12 @@ void Insight::startup() {
qRegisterMetaType<Bloom::Targets::TargetState>();
qRegisterMetaType<std::map<int, Bloom::Targets::TargetPinState>>();
this->mainWindow.init(*(this->application), targetDescriptor, this->insightConfig, this->environmentConfig.targetConfig);
this->mainWindow.init(
*(this->application),
targetDescriptor,
this->insightConfig,
this->environmentConfig.targetConfig
);
this->mainWindow.show();
/*