reduce code duplication in build system
- get rid of qmake project file - provide CMake modules for common tasks - provide templates for *.desktop files
This commit is contained in:
parent
aa880c3ed5
commit
9cf5656efe
209
CMakeLists.txt
209
CMakeLists.txt
|
@ -20,6 +20,7 @@ set(SRC_FILES
|
|||
resources/resources.cpp
|
||||
resources/qtutilsicons.qrc
|
||||
)
|
||||
|
||||
set(WIDGETS_HEADER_FILES
|
||||
aboutdialog/aboutdialog.h
|
||||
enterpassworddialog/enterpassworddialog.h
|
||||
|
@ -68,8 +69,16 @@ set(WIDGETS_UI_FILES
|
|||
paletteeditor/paletteeditor.ui
|
||||
)
|
||||
|
||||
set(CMAKE_MODULE_FILES
|
||||
cmake/modules/QtConfig.cmake
|
||||
cmake/modules/QtGuiConfig.cmake
|
||||
cmake/modules/JsProviderConfig.cmake
|
||||
cmake/modules/WebViewProviderConfig.cmake
|
||||
)
|
||||
|
||||
# meta data
|
||||
set(META_PROJECT_NAME qtutilities)
|
||||
set(META_PROJECT_VARNAME QT_UTILITIES)
|
||||
set(META_APP_NAME "Qt Utilities")
|
||||
set(META_APP_AUTHOR "Martchus")
|
||||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||
|
@ -79,109 +88,10 @@ set(META_VERSION_MINOR 0)
|
|||
set(META_VERSION_PATCH 0)
|
||||
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
||||
|
||||
# stringification of meta data
|
||||
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
|
||||
set(META_APP_NAME_STR "\"${META_APP_NAME}\"")
|
||||
set(META_APP_AUTHOR_STR "\"${META_APP_AUTHOR}\"")
|
||||
set(META_APP_URL_STR "\"${META_APP_URL}\"")
|
||||
set(META_APP_DESCRIPTION_STR "\"${META_APP_DESCRIPTION}\"")
|
||||
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
||||
set(META_APP_VERSION_STR "\"${META_APP_VERSION}\"")
|
||||
# required to include CMake modules from own project directory
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" "${CMAKE_MODULE_PATH}")
|
||||
|
||||
# define project
|
||||
project(${META_PROJECT_NAME})
|
||||
|
||||
# add configuration header
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/resources/config.h.in"
|
||||
"${PROJECT_BINARY_DIR}/resources/config.h"
|
||||
)
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
|
||||
# add windows resource file
|
||||
if(MINGW)
|
||||
# create windows rc file from template
|
||||
set(WINDOWS_EXT "dll")
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/resources/windows.rc.in"
|
||||
"${PROJECT_BINARY_DIR}/resources/windows.rc"
|
||||
)
|
||||
# set windres as resource compiler
|
||||
set(RES_FILES "${PROJECT_BINARY_DIR}/resources/windows.rc")
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||
enable_language(RC)
|
||||
endif(MINGW)
|
||||
|
||||
# remove library prefix when building with mingw-w64 (just for consistancy with qmake)
|
||||
if(MINGW)
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
endif(MINGW)
|
||||
|
||||
# read cached variables
|
||||
set(WIDGETS_GUI "yes" CACHE STRING "enables/disables Qt Widgets specific features: yes (default) or no")
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
message(STATUS "Building with Qt Widgets specific features.")
|
||||
elseif(${WIDGETS_GUI} STREQUAL "no")
|
||||
message(STATUS "Building WITHOUT Qt Widgets specific features.")
|
||||
else()
|
||||
message(FATAL_ERROR "Specification whether to build Qt Widgets specific features is invalid (must be either yes or no).")
|
||||
endif()
|
||||
set(GUI_QTQUICK "yes" CACHE STRING "enables/disables building Qt Quick specific features: yes (default) or no")
|
||||
if(${GUI_QTQUICK} STREQUAL "yes")
|
||||
message(STATUS "Building with Qt Quick specific features.")
|
||||
elseif(${GUI_QTQUICK} STREQUAL "no")
|
||||
message(STATUS "Building WITHOUT Qt Quick specific features.")
|
||||
else()
|
||||
message(FATAL_ERROR "Specification whether to build Qt Quick specific features is invalid (must be either yes or no).")
|
||||
endif()
|
||||
|
||||
# enable Qt Widgets specific features
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
add_definitions(
|
||||
-DGUI_QTWIDGETS
|
||||
-DMODEL_UNDO_SUPPORT
|
||||
)
|
||||
endif()
|
||||
|
||||
# enable Qt Quick specific features
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
add_definitions(
|
||||
-DGUI_QTQUICK
|
||||
)
|
||||
endif()
|
||||
|
||||
# disable new ABI (can't catch ios_base::failure with new ABI)
|
||||
add_definitions(
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
)
|
||||
|
||||
# enable code for debugging
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-DDEBUG_BUILD)
|
||||
message(STATUS "Debug build enabled.")
|
||||
endif()
|
||||
|
||||
# check required Qt 5 modules
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
endif()
|
||||
|
||||
# enable moc, uic and rcc
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# stuff which is only required when linking against Qt Widgets
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
set(WIDGETS_STUFF ${GUI_TYPE} ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${WIDGETS_UI_FILES} ${QM_FILES} ${RES_FILES})
|
||||
endif()
|
||||
|
||||
# executable and linking
|
||||
add_library(${META_PROJECT_NAME} SHARED ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_STUFF} ${RES_FILES} ${WINDOWS_ICON_PATH})
|
||||
# configure platform specific capslock detection
|
||||
if(WIN32)
|
||||
# WinAPI provides functions required for capslock detection
|
||||
add_definitions(-DPLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
||||
|
@ -189,91 +99,18 @@ else()
|
|||
# X11 can provide functions required for capslock detection under non-Windows environments
|
||||
find_package(X11)
|
||||
if(X11_FOUND)
|
||||
list(APPEND LIBRARIES ${X11_LIBRARIES})
|
||||
add_definitions(-DPLATFORM_SPECIFIC_CAPSLOCK_DETECTION -DX_AVAILABLE)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(${META_PROJECT_NAME} c++utilities Qt5::Core Qt5::Widgets ${X11_LIBRARIES})
|
||||
set_target_properties(${META_PROJECT_NAME} PROPERTIES
|
||||
VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}
|
||||
SOVERSION ${META_VERSION_MAJOR}
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
if(MINGW)
|
||||
# enable static library when building with mingw-w64
|
||||
add_library(${META_PROJECT_NAME}_static STATIC ${HEADER_FILES} ${SRC_FILES} ${RES_FILES} ${WINDOWS_ICON_PATH})
|
||||
target_link_libraries(${META_PROJECT_NAME}_static c++utilities Qt5::Core Qt5::Widgets ${X11_LIBRARIES})
|
||||
set_target_properties(${META_PROJECT_NAME}_static PROPERTIES
|
||||
VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}
|
||||
SOVERSION ${META_VERSION_MAJOR}
|
||||
OUTPUT_NAME ${META_PROJECT_NAME}
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
endif(MINGW)
|
||||
|
||||
# add install target
|
||||
install(TARGETS ${META_PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin
|
||||
COMPONENT binary
|
||||
LIBRARY DESTINATION lib
|
||||
COMPONENT binary
|
||||
ARCHIVE DESTINATION lib
|
||||
COMPONENT binary
|
||||
)
|
||||
if(MINGW)
|
||||
install(TARGETS ${META_PROJECT_NAME}_static
|
||||
RUNTIME DESTINATION bin
|
||||
COMPONENT binary
|
||||
LIBRARY DESTINATION lib
|
||||
COMPONENT binary
|
||||
ARCHIVE DESTINATION lib
|
||||
COMPONENT binary
|
||||
)
|
||||
endif(MINGW)
|
||||
foreach(HEADER_FILE ${HEADER_FILES})
|
||||
get_filename_component(HEADER_DIR ${HEADER_FILE} DIRECTORY)
|
||||
install(
|
||||
FILES ${HEADER_FILE}
|
||||
DESTINATION include/${META_PROJECT_NAME}/${HEADER_DIR}
|
||||
COMPONENT header
|
||||
)
|
||||
endforeach()
|
||||
if(NOT TARGET install-binary)
|
||||
add_custom_target(install-binary
|
||||
DEPENDS ${META_PROJECT_NAME}
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=binary -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
endif()
|
||||
if(NOT TARGET install-header)
|
||||
add_custom_target(install-header
|
||||
DEPENDS ${META_PROJECT_NAME}
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=header -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
endif()
|
||||
if(NOT TARGET install-mingw-w64)
|
||||
add_custom_target(install-mingw-w64
|
||||
DEPENDS install-binary install-header
|
||||
)
|
||||
endif()
|
||||
if(NOT TARGET install-binary-strip)
|
||||
add_custom_target(install-binary-strip
|
||||
DEPENDS ${META_PROJECT_NAME}
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_COMPONENT=binary -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
endif()
|
||||
if(NOT TARGET install-mingw-w64-importlib-strip)
|
||||
add_custom_target(install-mingw-w64-importlib-strip
|
||||
DEPENDS install-binary-strip
|
||||
COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" --strip-unneeded "${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.dll.a"
|
||||
)
|
||||
endif()
|
||||
if(NOT TARGET install-mingw-w64-staticlib-strip)
|
||||
add_custom_target(install-mingw-w64-staticlib-strip
|
||||
DEPENDS install-binary-strip
|
||||
COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" -g "${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.a"
|
||||
)
|
||||
endif()
|
||||
if(NOT TARGET install-mingw-w64-strip)
|
||||
add_custom_target(install-mingw-w64-strip
|
||||
DEPENDS install-binary-strip install-mingw-w64-importlib-strip install-mingw-w64-staticlib-strip install-header
|
||||
)
|
||||
endif()
|
||||
# find c++utilities
|
||||
find_package(c++utilities REQUIRED)
|
||||
use_cpp_utilities()
|
||||
|
||||
# include modules to apply configuration
|
||||
include(BasicConfig)
|
||||
include(QtGuiConfig)
|
||||
include(QtConfig)
|
||||
include(WindowsResources)
|
||||
include(LibraryTarget)
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# determines the JavaScript provider (either Qt Script or Qt Declarative)
|
||||
|
||||
set(JS_PROVIDER "auto" CACHE STRING "specifies the JavaScript provider: auto (default), qml, script or none")
|
||||
if(${JS_PROVIDER} STREQUAL "auto")
|
||||
find_package(Qt5Script)
|
||||
if(Qt5Script_FOUND)
|
||||
set(JS_PROVIDER Qt5::Script)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_SCRIPT")
|
||||
message(STATUS "No JavaScript provider explicitly specified, defaulting to Qt Script.")
|
||||
else()
|
||||
find_package(Qt5Qml REQUIRED)
|
||||
set(JS_PROVIDER Qt5::Qml)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_JSENGINE")
|
||||
message(STATUS "No JavaScript provider explicitly specified, defaulting to Qt QML.")
|
||||
endif()
|
||||
else()
|
||||
if(${JS_PROVIDER} STREQUAL "script")
|
||||
find_package(Qt5Script REQUIRED)
|
||||
set(JS_PROVIDER Qt5::Script)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_SCRIPT")
|
||||
message(STATUS "Using Qt Script as JavaScript provider.")
|
||||
elseif(${JS_PROVIDER} STREQUAL "qml")
|
||||
find_package(Qt5Qml REQUIRED)
|
||||
set(JS_PROVIDER Qt5::Qml)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_JSENGINE")
|
||||
message(STATUS "Using Qt QML as JavaScript provider.")
|
||||
elseif(${JS_PROVIDER} STREQUAL "none")
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}NO_JSENGINE")
|
||||
message(STATUS "JavaScript provider has been disabled.")
|
||||
else()
|
||||
message(FATAL_ERROR "The specified JavaScript provider '${JS_PROVIDER}' is unknown.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND LIBRARIES ${JS_PROVIDER})
|
|
@ -0,0 +1,66 @@
|
|||
# applies Qt specific configuration
|
||||
# for GUI applications, QtGuiAppConfig must be included before
|
||||
# after including this module, AppTarget must be included
|
||||
|
||||
# add the Core module as it is always required
|
||||
# also add additional Qt/KF modules which must have been specified before if required
|
||||
# the Gui/Widgets/Quick modules should be added by including QtGuiAppConfig
|
||||
set(QT_MODULES Core ${ADDITIONAL_QT_MODULES})
|
||||
set(KF_MODULES ${ADDITIONAL_KF_MODULES})
|
||||
|
||||
# enable lrelease and add install target for localization
|
||||
if(TS_FILES)
|
||||
message(STATUS "Project has translations which will be released.")
|
||||
|
||||
# the LinguistTools module is required
|
||||
# (but not add it to QT_MODULES because we don't link against it)
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
|
||||
# adds the translations and a target for it
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
add_custom_target(${META_PROJECT_NAME}_translations ALL DEPENDS ${QM_FILES})
|
||||
|
||||
# add installs and install target for translations
|
||||
install(FILES ${QM_FILES}
|
||||
DESTINATION share/${META_PROJECT_NAME}/translations
|
||||
COMPONENT localization
|
||||
)
|
||||
if(NOT TARGET install-localization)
|
||||
set(LOCALIZATION_TARGET "install-localization")
|
||||
add_custom_target(${LOCALIZATION_TARGET}
|
||||
DEPENDS ${META_PROJECT_NAME}_translations
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=localization -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check whether D-Bus interfaces need to be processed
|
||||
if(DBUS_FILES)
|
||||
message(STATUS "Project has D-Bus interface declarations which will be processed.")
|
||||
# the D-Bus Qt module is required
|
||||
list(APPEND QT_MODULES DBus)
|
||||
endif()
|
||||
|
||||
# actually find the required Qt/KF modules
|
||||
foreach(QT_MODULE ${QT_MODULES})
|
||||
find_package(Qt5${QT_MODULE} REQUIRED)
|
||||
list(APPEND LIBRARIES Qt5::${QT_MODULE})
|
||||
endforeach()
|
||||
|
||||
foreach(KF_MODULE ${KF_MODULES})
|
||||
find_package(KF5${KF_MODULE} REQUIRED)
|
||||
list(APPEND LIBRARIES KF5::${KF_MODULE})
|
||||
endforeach()
|
||||
|
||||
# generate DBus interfaces
|
||||
if(DBUS_FILES)
|
||||
qt5_add_dbus_interfaces(SRC_FILES ${DBUS_FILES})
|
||||
endif()
|
||||
|
||||
# enable moc, uic and rcc
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
endif()
|
|
@ -0,0 +1,48 @@
|
|||
# after including this module, AppConfig must be included
|
||||
|
||||
# enable Qt Widgets GUI
|
||||
set(WIDGETS_GUI "yes" CACHE STRING "enables/disables building the Qt Widgets GUI: yes (default) or no")
|
||||
if(${WIDGETS_GUI} STREQUAL "yes")
|
||||
add_definitions(
|
||||
-DGUI_QTWIDGETS
|
||||
-DMODEL_UNDO_SUPPORT
|
||||
)
|
||||
list(APPEND WIDGETS_FILES ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${WIDGETS_RES_FILES} ${WIDGETS_UI_FILES})
|
||||
if(WIDGETS_FILES)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Widgets)
|
||||
message(STATUS "Building with Qt Widgets GUI.")
|
||||
else()
|
||||
message(STATUS "Qt Widgets GUI is not available.")
|
||||
endif()
|
||||
elseif(${WIDGETS_GUI} STREQUAL "no")
|
||||
message(STATUS "Building WITHOUT Qt Widgets GUI.")
|
||||
else()
|
||||
message(FATAL_ERROR "Specification whether to build with Qt Widgets GUI is invalid (must be either yes or no).")
|
||||
endif()
|
||||
|
||||
# enable Qt Quick GUI
|
||||
set(QUICK_GUI "yes" CACHE STRING "enables/disables building the Qt Quick GUI: yes (default) or no")
|
||||
if(${QUICK_GUI} STREQUAL "yes")
|
||||
add_definitions(
|
||||
-DGUI_QTQUICK
|
||||
)
|
||||
list(APPEND QML_FILES ${QML_HEADER_FILES} ${QML_SRC_FILES} ${QML_RES_FILES})
|
||||
if(QML_FILES)
|
||||
list(APPEND ADDITIONAL_QT_MODULES Quick)
|
||||
message(STATUS "Building with Qt Quick GUI.")
|
||||
else()
|
||||
message(STATUS "Qt Quick GUI is not available.")
|
||||
endif()
|
||||
elseif(${QUICK_GUI} STREQUAL "no")
|
||||
message(STATUS "Building WITHOUT Qt Quick GUI.")
|
||||
else()
|
||||
message(FATAL_ERROR "Specification whether to build with Qt Quick GUI is invalid (must be either yes or no).")
|
||||
endif()
|
||||
|
||||
# set "GUI-type" to WIN32 to hide console under windows
|
||||
if(WIN32)
|
||||
if(${WIDGETS_GUI} STREQUAL "yes" or ${QUICK_GUI} STREQUAL "yes")
|
||||
list(APPEND QT_MODULES Gui)
|
||||
set(GUI_TYPE WIN32)
|
||||
endif()
|
||||
endif()
|
|
@ -0,0 +1,35 @@
|
|||
# determines the web view provider (either Qt WebKit or Qt WebEngine)
|
||||
|
||||
set(WEBVIEW_PROVIDER "auto" CACHE STRING "specifies the web view provider: auto (default), webkit, webengine or none")
|
||||
if(${WEBVIEW_PROVIDER} STREQUAL "auto")
|
||||
find_package(Qt5WebKitWidgets)
|
||||
if(Qt5WebKitWidgets_FOUND)
|
||||
set(WEBVIEW_PROVIDER Qt5::WebKitWidgets)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBKIT")
|
||||
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebKit.")
|
||||
else()
|
||||
find_package(Qt5WebEngineWidgets REQUIRED)
|
||||
set(WEBVIEW_PROVIDER Qt5::WebEngineWidgets)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBENGINE")
|
||||
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebEngine.")
|
||||
endif()
|
||||
else()
|
||||
if(${WEBVIEW_PROVIDER} STREQUAL "webkit")
|
||||
find_package(Qt5WebKitWidgets REQUIRED)
|
||||
set(WEBVIEW_PROVIDER Qt5::WebKitWidgets)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBKIT")
|
||||
message(STATUS "Using Qt WebKit as webview provider.")
|
||||
elseif(${WEBVIEW_PROVIDER} STREQUAL "webengine")
|
||||
find_package(Qt5WebEngineWidgets REQUIRED)
|
||||
set(WEBVIEW_PROVIDER Qt5::WebEngineWidgets)
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBENGINE")
|
||||
message(STATUS "Using Qt WebEngine as webview provider.")
|
||||
elseif(${WEBVIEW_PROVIDER} STREQUAL "none")
|
||||
set(JS_DEFINITION "-D${META_PROJECT_NAME}NO_WEBVIEW")
|
||||
message(STATUS "Webview has been disabled.")
|
||||
else()
|
||||
message(FATAL_ERROR "The specified web view provider '${WEBVIEW_PROVIDER}' is unknown.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND LIBRARIES ${WEBVIEW_PROVIDER})
|
103
general.pri
103
general.pri
|
@ -1,103 +0,0 @@
|
|||
# specify build directories for moc, object and rcc files
|
||||
MOC_DIR = ./moc
|
||||
OBJECTS_DIR = ./obj
|
||||
RCC_DIR = ./res
|
||||
|
||||
# compiler flags: enable C++11
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
QMAKE_LFLAGS += -std=c++11
|
||||
|
||||
# disable new ABI (can't catch ios_base::failure with new ABI)
|
||||
DEFINES += _GLIBCXX_USE_CXX11_ABI=0
|
||||
|
||||
# variables to check target architecture
|
||||
win32-g++:QMAKE_TARGET.arch = $$QMAKE_HOST.arch
|
||||
win32-g++-32:QMAKE_TARGET.arch = x86
|
||||
win32-g++-64:QMAKE_TARGET.arch = x86_64
|
||||
linux-g++:QMAKE_TARGET.arch = $$QMAKE_HOST.arch
|
||||
linux-g++-32:QMAKE_TARGET.arch = x86
|
||||
linux-g++-64:QMAKE_TARGET.arch = x86_64
|
||||
|
||||
# determine and print target prefix
|
||||
targetprefix = $$(TARGET_PREFIX)
|
||||
message("Using target prefix \"$${targetprefix}\".")
|
||||
|
||||
# print install root
|
||||
message("Using install root \"$$(INSTALL_ROOT)\".")
|
||||
|
||||
# set target
|
||||
CONFIG(debug, debug|release) {
|
||||
TARGET = $${targetprefix}$${projectname}d
|
||||
} else {
|
||||
TARGET = $${targetprefix}$${projectname}
|
||||
}
|
||||
|
||||
# add defines for meta data
|
||||
DEFINES += "APP_METADATA_AVAIL"
|
||||
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
|
||||
DEFINES += "'APP_NAME=\"$${appname}\"'"
|
||||
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"
|
||||
DEFINES += "'APP_URL=\"$${appurl}\"'"
|
||||
DEFINES += "'APP_VERSION=\"$${VERSION}\"'"
|
||||
|
||||
# configure Qt modules and defines
|
||||
mobile {
|
||||
DEFINES += CONFIG_MOBILE
|
||||
} else:desktop {
|
||||
DEFINES += CONFIG_DESKTOP
|
||||
} else:android {
|
||||
CONFIG += mobile
|
||||
DEFINES += CONFIG_MOBILE
|
||||
} else {
|
||||
CONFIG += desktop
|
||||
DEFINES += CONFIG_DESKTOP
|
||||
}
|
||||
no-gui {
|
||||
QT -= gui
|
||||
DEFINES += GUI_NONE
|
||||
guiqtquick || guiqtwidgets {
|
||||
error("Can not use no-gui with guiqtquick or guiqtwidgets.")
|
||||
} else {
|
||||
message("Configured for no GUI support.")
|
||||
}
|
||||
} else {
|
||||
QT += gui
|
||||
mobile {
|
||||
CONFIG += guiqtquick
|
||||
}
|
||||
desktop {
|
||||
CONFIG += guiqtwidgets
|
||||
}
|
||||
}
|
||||
guiqtquick {
|
||||
message("Configured for Qt Quick GUI support.")
|
||||
QT += quick
|
||||
CONFIG(debug, debug|release) {
|
||||
CONFIG += qml_debug
|
||||
}
|
||||
DEFINES += GUI_QTQUICK
|
||||
}
|
||||
guiqtwidgets {
|
||||
message("Configured for Qt widgets GUI support.")
|
||||
QT += widgets
|
||||
DEFINES += GUI_QTWIDGETS
|
||||
DEFINES += MODEL_UNDO_SUPPORT
|
||||
}
|
||||
|
||||
# configuration for cross compliation with mingw-w64
|
||||
win32 {
|
||||
QMAKE_TARGET_PRODUCT = "$${appname}"
|
||||
QMAKE_TARGET_COPYRIGHT = "by $${appauthor}"
|
||||
}
|
||||
mingw-w64-manualstrip-dll {
|
||||
QMAKE_POST_LINK=$${CROSS_COMPILE}strip --strip-unneeded ./release/$(TARGET); \
|
||||
$${CROSS_COMPILE}strip --strip-unneeded ./release/lib$(TARGET).a
|
||||
}
|
||||
mingw-w64-manualstrip-exe {
|
||||
QMAKE_POST_LINK=$${CROSS_COMPILE}strip --strip-unneeded ./release/$(TARGET)
|
||||
}
|
||||
mingw-w64-noversion {
|
||||
TARGET_EXT = ".dll"
|
||||
TARGET_VERSION_EXT = ""
|
||||
CONFIG += skip_target_version_ext
|
||||
}
|
123
qtutilities.pro
123
qtutilities.pro
|
@ -1,123 +0,0 @@
|
|||
# meta data
|
||||
projectname = qtutilities
|
||||
appname = "Qt Utilities"
|
||||
appauthor = Martchus
|
||||
QMAKE_TARGET_DESCRIPTION = "Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models."
|
||||
VERSION = 3.1.1
|
||||
|
||||
# include ../../common.pri when building as part of a subdirs project; otherwise include general.pri
|
||||
!include(../../common.pri) {
|
||||
!include(./general.pri) {
|
||||
error("Couldn't find the common.pri or the general.pri file!")
|
||||
}
|
||||
}
|
||||
|
||||
# basic configuration: shared library
|
||||
TEMPLATE = lib
|
||||
QT += core gui
|
||||
CONFIG += shared
|
||||
|
||||
# enable platform specific capslock detection (for password dialog)
|
||||
CONFIG(noplatformspecificcapslockdetection, noplatformspecificcapslockdetection|platformspecificcapslockdetection) {
|
||||
DEFINES -= PLATFORM_SPECIFIC_CAPSLOCK_DETECTION
|
||||
} else {
|
||||
DEFINES += PLATFORM_SPECIFIC_CAPSLOCK_DETECTION
|
||||
}
|
||||
|
||||
# add project files
|
||||
HEADERS += \
|
||||
resources/resources.h \
|
||||
models/checklistmodel.h \
|
||||
resources/qtconfigarguments.h \
|
||||
misc/dialogutils.h \
|
||||
misc/desktoputils.h \
|
||||
misc/xmlparsermacros.h \
|
||||
misc/undefxmlparsermacros.h \
|
||||
misc/trylocker.h \
|
||||
misc/adoptlocker.h
|
||||
|
||||
SOURCES += resources/resources.cpp \
|
||||
models/checklistmodel.cpp \
|
||||
resources/qtconfigarguments.cpp \
|
||||
misc/dialogutils.cpp \
|
||||
misc/desktoputils.cpp
|
||||
|
||||
contains(DEFINES, GUI_QTWIDGETS) {
|
||||
HEADERS += \
|
||||
aboutdialog/aboutdialog.h \
|
||||
enterpassworddialog/enterpassworddialog.h \
|
||||
settingsdialog/optioncategorymodel.h \
|
||||
settingsdialog/settingsdialog.h \
|
||||
settingsdialog/optioncategory.h \
|
||||
settingsdialog/optionpage.h \
|
||||
settingsdialog/optioncategoryfiltermodel.h \
|
||||
widgets/clearlineedit.h \
|
||||
widgets/iconbutton.h \
|
||||
widgets/buttonoverlay.h \
|
||||
widgets/clearcombobox.h \
|
||||
widgets/clearspinbox.h \
|
||||
widgets/clearplaintextedit.h
|
||||
|
||||
SOURCES += \
|
||||
aboutdialog/aboutdialog.cpp \
|
||||
enterpassworddialog/enterpassworddialog.cpp \
|
||||
settingsdialog/optioncategorymodel.cpp \
|
||||
settingsdialog/settingsdialog.cpp \
|
||||
settingsdialog/optionpage.cpp \
|
||||
settingsdialog/optioncategory.cpp \
|
||||
settingsdialog/optioncategoryfiltermodel.cpp \
|
||||
widgets/clearlineedit.cpp \
|
||||
widgets/iconbutton.cpp \
|
||||
widgets/buttonoverlay.cpp \
|
||||
widgets/clearcombobox.cpp \
|
||||
widgets/clearspinbox.cpp \
|
||||
widgets/clearplaintextedit.cpp
|
||||
|
||||
FORMS += \
|
||||
aboutdialog/aboutdialog.ui \
|
||||
enterpassworddialog/enterpassworddialog.ui \
|
||||
settingsdialog/settingsdialog.ui
|
||||
}
|
||||
|
||||
RESOURCES += \
|
||||
resources/qtutilsicons.qrc
|
||||
|
||||
OTHER_FILES += \
|
||||
README.md \
|
||||
LICENSE \
|
||||
CMakeLists.txt \
|
||||
resources/config.h.in \
|
||||
resources/windows.rc.in
|
||||
|
||||
|
||||
# add libs
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -lc++utilitiesd
|
||||
} else {
|
||||
LIBS += -lc++utilities
|
||||
}
|
||||
contains(DEFINES, PLATFORM_SPECIFIC_CAPSLOCK_DETECTION) {
|
||||
x11 {
|
||||
LIBS += -lX11
|
||||
DEFINES += X_AVAILABLE
|
||||
}
|
||||
}
|
||||
|
||||
# installs
|
||||
mingw-w64-install {
|
||||
target.path = $$(INSTALL_ROOT)
|
||||
target.extra = install -m755 -D $${OUT_PWD}/release/lib$(TARGET).a $$(INSTALL_ROOT)/lib/lib$(TARGET).a
|
||||
INSTALLS += target
|
||||
dlltarget.path = $$(INSTALL_ROOT)
|
||||
dlltarget.extra = install -m755 -D $${OUT_PWD}/release/$(TARGET) $$(INSTALL_ROOT)/bin/$(TARGET)
|
||||
INSTALLS += dlltarget
|
||||
} else {
|
||||
target.path = $$(INSTALL_ROOT)/lib
|
||||
INSTALLS += target
|
||||
}
|
||||
for(dir, $$list(aboutdialog enterpassworddialog models resources settingsdialog widgets misc)) {
|
||||
eval(inc_$${dir} = $${dir})
|
||||
inc_$${dir}.path = $$(INSTALL_ROOT)/include/$$projectname/$${dir}
|
||||
inc_$${dir}.files = $${dir}/*.h
|
||||
INSTALLS += inc_$${dir}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef APP_METADATA_AVAIL
|
||||
#define APP_METADATA_AVAIL
|
||||
#define PROJECT_NAME @META_PROJECT_NAME_STR@
|
||||
#define APP_NAME @META_APP_NAME_STR@
|
||||
#define APP_VERSION @META_APP_VERSION_STR@
|
||||
#define APP_AUTHOR @META_APP_AUTHOR_STR@
|
||||
#define APP_URL @META_APP_URL_STR@
|
||||
#define APP_DESCRIPTION @META_APP_DESCRIPTION_STR@
|
||||
#endif // APP_METADATA_AVAIL
|
|
@ -1,40 +0,0 @@
|
|||
# if defined(UNDER_CE)
|
||||
# include <winbase.h>
|
||||
# else
|
||||
# include <windows.h>
|
||||
# endif
|
||||
|
||||
@WINDOWS_ICON_RC_ENTRY@
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @META_VERSION_MAJOR@,@META_VERSION_MINOR@,@META_VERSION_PATCH@,0
|
||||
PRODUCTVERSION @META_VERSION_MAJOR@,@META_VERSION_MINOR@,@META_VERSION_PATCH@,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "@META_APP_AUTHOR@\0"
|
||||
VALUE "FileDescription", "@META_APP_DESCRIPTION@\0"
|
||||
VALUE "FileVersion", "@META_APP_VERSION@\0"
|
||||
VALUE "LegalCopyright", "by @META_APP_AUTHOR@\0"
|
||||
VALUE "OriginalFilename", "@META_PROJECT_NAME@.@WINDOWS_EXT@\0"
|
||||
VALUE "ProductName", "@META_APP_NAME@\0"
|
||||
VALUE "ProductVersion", "@META_APP_VERSION@\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 1200
|
||||
END
|
||||
END
|
||||
/* End of Version info */
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include <c++utilities/io/path.h>
|
||||
|
||||
#ifndef SEARCH_PATH_SEP_CHAR
|
||||
# error "wtf"
|
||||
#endif
|
||||
|
||||
#include <qtutilities/misc/desktoputils.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
|
Loading…
Reference in New Issue