Make the GTK development libraries a build requirement on Linux and remove the ENABLE_GTK #ifdefs in main.cpp

This commit is contained in:
Robert Knight 2011-08-31 12:44:03 +01:00
parent cb412f4619
commit cc387031d7
2 changed files with 6 additions and 12 deletions

View File

@ -11,12 +11,13 @@ endif()
include(UsePkgConfig)
pkgconfig(gtk+-2.0 GTK2_INCLUDE_DIR GTK2_LINK_DIR GTK2_LINK_FLAGS GTK2_CFLAGS)
option(ENABLE_GTK ON)
if (UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if (ENABLE_GTK)
if (LINUX)
include_directories(${GTK2_INCLUDE_DIR})
add_definitions(${GTK2_CFLAGS})
add_definitions(-DENABLE_GTK)
add_library(updatergtk SHARED UpdateDialogGtk.cpp UpdateDialogGtk.h)
target_link_libraries(updatergtk ${GTK2_LINK_FLAGS})
endif()
@ -64,7 +65,7 @@ if (UNIX)
set(SOURCES ${SOURCES} UpdateDialogAscii.cpp)
endif()
if (ENABLE_GTK)
if (LINUX)
# embed the GTK helper library into the updater binary.
# At runtime it will be extracted and loaded if the
# GTK libraries are available

View File

@ -9,9 +9,7 @@
#include "tinythread.h"
#if defined(PLATFORM_LINUX)
#if defined(ENABLE_GTK)
#include "UpdateDialogGtkWrapper.h"
#endif
#include "UpdateDialogGtkWrapper.h"
#include "UpdateDialogAscii.h"
#endif
@ -99,7 +97,6 @@ int main(int argc, char** argv)
#ifdef PLATFORM_LINUX
void runWithUi(int argc, char** argv, UpdateInstaller* installer)
{
#ifdef ENABLE_GTK
UpdateDialogAscii asciiDialog;
UpdateDialogGtkWrapper dialog;
bool useGtk = dialog.init(argc,argv);
@ -118,10 +115,6 @@ void runWithUi(int argc, char** argv, UpdateInstaller* installer)
dialog.exec();
}
updaterThread.join();
#else
// no UI available - do a silent install
installer->run();
#endif
}
#endif