drop gui support - cmake

This commit is contained in:
lukas 2021-02-01 17:28:07 +01:00
parent 2b00bc61cf
commit 17a3722d7a
2 changed files with 3 additions and 80 deletions

View File

@ -19,7 +19,6 @@ SET(LIB_METHOD STATIC) #SHARED / STATIC
option(BUILD_DOC "Build documentation" ON) # additional dependency for Doxygen option(BUILD_DOC "Build documentation" ON) # additional dependency for Doxygen
option(PACKAGING "Allow Packaging to <exe>, <deb> or <rpm>" ON) # additional dependencies for RPMbuild,dpkg or NSIS option(PACKAGING "Allow Packaging to <exe>, <deb> or <rpm>" ON) # additional dependencies for RPMbuild,dpkg or NSIS
option(TESTS "Build Tests" ON) # additional dependencies for GTEST - to build tests option(TESTS "Build Tests" ON) # additional dependencies for GTEST - to build tests
option(GUI "Build GUI elements" ON) # additional dependencies to QT libraries needed
option(WinBuild "cross compile for Windows Platform" OFF) option(WinBuild "cross compile for Windows Platform" OFF)
# helper variables # helper variables
@ -98,14 +97,6 @@ message(STATUS "Config of Libraries")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS) conan_basic_setup(TARGETS)
if (${GUI})
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Find the QtWidgets library
find_package(Qt5 REQUIRED COMPONENTS Widgets)
endif ()
include_directories(inc) include_directories(inc)
# include the library headers created by conan # include the library headers created by conan
@ -155,35 +146,7 @@ add_library(libdynuiprefresher ${LIB_METHOD}
add_executable(${Application_Name} src/main.cpp) add_executable(${Application_Name} src/main.cpp)
# LINK generated LIBS # # LINK generated LIBS #
target_link_libraries(${Application_Name} libdynuiprefresher api CONAN_PKG::libcurl CONAN_PKG::LibConfig) target_link_libraries(${Application_Name} libdynuiprefresher api CONAN_PKG::libcurl CONAN_PKG::libconfig)
if (${GUI})
set(QT5_LIBRARIES Qt5::Widgets Qt5::PrintSupport Qt5::Sql)
set(UI_SOURCES
src/gui/mainwindow.ui
)
#
# Generate necessary headers from .ui files. (qmake lets `uic` do this job.)
# hint from [Cross-platform Qt5 project using cmake](http://stackoverflow.com/questions/21174586/cross-platform-qt5-project-using-cmake)
#
qt5_wrap_ui(UI_GENERATED_HEADERS ${UI_SOURCES})
add_executable(${Application_Name}-gui
src/maingui.cpp
src/gui/MainWindow.cpp
inc/gui/MainWindow.h
${UI_GENERATED_HEADERS})
if (${WinBuild})
# hide console window when starting ui on windows
set_target_properties(${Application_Name}-gui PROPERTIES LINK_FLAGS "-mwindows")
endif ()
# LINK generated LIBS #
target_link_libraries(${Application_Name}-gui -lpthread libdynuiprefresher api CONAN_PKG::libcurl CONAN_PKG::LibConfig Qt5::Widgets)
endif ()
# setting install targets # setting install targets
IF (NOT ${WinBuild}) IF (NOT ${WinBuild})
@ -199,14 +162,6 @@ IF (NOT ${WinBuild})
FILES service/${Application_Name}.service FILES service/${Application_Name}.service
DESTINATION lib/systemd/system DESTINATION lib/systemd/system
COMPONENT ${Application_Name}) COMPONENT ${Application_Name})
if (${GUI})
# install binaries
install(
TARGETS ${Application_Name}-gui
DESTINATION usr/bin
COMPONENT ${Application_Name}gui)
endif ()
ELSE () ELSE ()
# INSTALL to Windows SYSTEM # # INSTALL to Windows SYSTEM #
@ -232,37 +187,6 @@ ELSE ()
${LIBBINARYPATH}/libconfig++-11.dll ${LIBBINARYPATH}/libconfig++-11.dll
DESTINATION . DESTINATION .
COMPONENT ${Application_Name}) COMPONENT ${Application_Name})
if (${GUI})
# install binaries
set_target_properties(${Application_Name}-gui PROPERTIES SUFFIX ".exe")
install(
TARGETS ${Application_Name}-gui
DESTINATION .
COMPONENT ${Application_Name}gui)
# install .dll dependencies
install(FILES
${LIBBINARYPATH}/Qt5Widgets.dll
${LIBBINARYPATH}/Qt5Core.dll
${LIBBINARYPATH}/Qt5Gui.dll
${LIBBINARYPATH}/iconv.dll
${LIBBINARYPATH}/libpcre2-16-0.dll
${LIBBINARYPATH}/libpng16-16.dll
${LIBBINARYPATH}/libharfbuzz-0.dll
${LIBBINARYPATH}/libglib-2.0-0.dll
${LIBBINARYPATH}/libintl-8.dll
${LIBBINARYPATH}/libpcre-1.dll
${LIBBINARYPATH}/libbz2-1.dll
${LIBBINARYPATH}/libfreetype-6.dll
DESTINATION .
COMPONENT ${Application_Name}gui)
install(FILES
/usr/${TOOLCHAIN_PREFIX}/sys-root/mingw/lib/qt5/plugins/platforms/qwindows.dll
DESTINATION ./platforms
COMPONENT ${Application_Name}gui)
endif ()
ENDIF () ENDIF ()
if (${PACKAGING}) if (${PACKAGING})

View File

@ -1,8 +1,7 @@
[requires] [requires]
libcurl/7.72.0 libcurl/7.72.0
qt/5.15.1@bincrafters/stable openssl/1.1.1i
openssl/1.1.1h libconfig/1.7.2
LibConfig/1.7.2@LibConfig/stable
[generators] [generators]
cmake cmake