diff --git a/CMakeLists.txt b/CMakeLists.txt index f0cbf341..c05d2cc3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/README.md b/README.md index 732e4802..58dd86aa 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/Insight/Insight.cpp b/src/Insight/Insight.cpp index 120dc856..d273a84a 100644 --- a/src/Insight/Insight.cpp +++ b/src/Insight/Insight.cpp @@ -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(); qRegisterMetaType>(); - 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(); /*