From 353fb376effad7de723dac7046f1c64ed5312f5d Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Tue, 4 Apr 2017 15:09:09 +0200 Subject: [PATCH] Turn the launcher UI into a shared library This enables the re-use of some of its widgets in the QtCreator integration. Based on pull request #314 --- app/CMakeLists.txt | 2 +- launcher/app/CMakeLists.txt | 2 +- launcher/ui/CMakeLists.txt | 31 +++++++++++++++++++++++-------- launcher/ui/launcherwindow.h | 4 +++- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index cab9a32d17..9c231bae70 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -14,7 +14,7 @@ if(APPLE) ${QT_QTGUI_LIBRARIES} gammaray_common gammaray_launcher - gammaray_launcher_ui_internal + gammaray_launcher_ui gammaray_client ) diff --git a/launcher/app/CMakeLists.txt b/launcher/app/CMakeLists.txt index 0e7fcbf0aa..cf88cd6ac6 100644 --- a/launcher/app/CMakeLists.txt +++ b/launcher/app/CMakeLists.txt @@ -7,7 +7,7 @@ add_executable(gammaray-launcher WIN32 ${gammaray_launcher_ui_srcs}) target_link_libraries(gammaray-launcher ${QT_QTGUI_LIBRARIES} gammaray_common - gammaray_launcher_ui_internal + gammaray_launcher_ui ) gammaray_embed_info_plist(gammaray-launcher ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in) diff --git a/launcher/ui/CMakeLists.txt b/launcher/ui/CMakeLists.txt index b0b98f03bf..0bc0440022 100644 --- a/launcher/ui/CMakeLists.txt +++ b/launcher/ui/CMakeLists.txt @@ -1,4 +1,4 @@ -set(gammaray_launcher_ui_internal_srcs +set(gammaray_launcher_ui_srcs ${CMAKE_SOURCE_DIR}/ui/searchlinecontroller.cpp promolabel.cpp launcherwindow.cpp @@ -11,12 +11,12 @@ set(gammaray_launcher_ui_internal_srcs probeabimodel.cpp ) if(NOT WIN32) - list(APPEND gammaray_launcher_ui_internal_srcs processlist_unix.cpp) + list(APPEND gammaray_launcher_ui_srcs processlist_unix.cpp) else() - list(APPEND gammaray_launcher_ui_internal_srcs processlist_win.cpp) + list(APPEND gammaray_launcher_ui_srcs processlist_win.cpp) endif() -qt4_wrap_ui(gammaray_launcher_ui_internal_srcs +qt4_wrap_ui(gammaray_launcher_ui_srcs attachdialog.ui launcherwindow.ui launchpage.ui @@ -24,10 +24,12 @@ qt4_wrap_ui(gammaray_launcher_ui_internal_srcs connectpage.ui ) -add_library(gammaray_launcher_ui_internal STATIC ${gammaray_launcher_ui_internal_srcs}) -target_compile_definitions(gammaray_launcher_ui_internal PRIVATE GAMMARAY_UI_STATIC_DEFINE) -target_include_directories(gammaray_launcher PUBLIC $) -target_link_libraries(gammaray_launcher_ui_internal +add_library(gammaray_launcher_ui SHARED ${gammaray_launcher_ui_srcs}) +generate_export_header(gammaray_launcher_ui) +set_target_properties(gammaray_launcher PROPERTIES ${GAMMARAY_DEFAULT_LIBRARY_PROPERTIES}) + +target_include_directories(gammaray_launcher PUBLIC $) +target_link_libraries(gammaray_launcher_ui LINK_PUBLIC gammaray_launcher @@ -38,3 +40,16 @@ target_link_libraries(gammaray_launcher_ui_internal ${QT_QTNETWORK_LIBRARIES} gammaray_ui ) + +install(TARGETS gammaray_launcher_ui EXPORT GammaRayTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) + +ecm_generate_pri_file(BASE_NAME GammaRayLauncherUi + LIB_NAME gammaray_launcher_ui + DEPS "core gui GammaRayLauncher" + FILENAME_VAR PRI_FILENAME + INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR} +) +install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) +if(MSVC) + install(FILES "$/$" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug RelWithDebInfo) +endif() diff --git a/launcher/ui/launcherwindow.h b/launcher/ui/launcherwindow.h index a468f026eb..c98b51ea43 100644 --- a/launcher/ui/launcherwindow.h +++ b/launcher/ui/launcherwindow.h @@ -29,6 +29,8 @@ #ifndef GAMMARAY_LAUNCHERWINDOW_H #define GAMMARAY_LAUNCHERWINDOW_H +#include "gammaray_launcher_ui_export.h" + #include namespace GammaRay { @@ -37,7 +39,7 @@ namespace Ui { class LauncherWindow; } -class LauncherWindow : public QDialog +class GAMMARAY_LAUNCHER_UI_EXPORT LauncherWindow : public QDialog { Q_OBJECT public: