cmake to 2-space indenting

This commit is contained in:
Martin Rotter 2022-01-31 10:41:17 +01:00
parent 0592213271
commit f904f14dfe
5 changed files with 713 additions and 650 deletions

View file

@ -1,6 +1,64 @@
#################################################################
#
# For license of this file, see <project-root-folder>/LICENSE.md.
#
# This is RSS Guard compilation script for cmake.
#
# Usage (out of source build type, we have two side by side folders:
# empty "build-dir" and RSS Guard repository "rssguard-dir"):
# a) DEBUG build for testing.
# cd build-dir
# cmake -DCMAKE_BUILD_TYPE="Debug" ../rssguard-dir/
# cmake --build .
# cmake --install .
#
# b) RELEASE build for production use.
# cd build-dir
# cmake -DCMAKE_BUILD_TYPE="Release" ../rssguard-dir/
# cmake --build .
# cmake --install .
#
# Variables:
# USE_WEBENGINE - if specified, then QtWebEngine module for internal web browser is used.
# Otherwise simple text component is used and some features will be disabled.
# Default value is "false". If QtWebEngine is installed during compilation, then
# value of this variable is tweaked automatically.
# {FEEDLY,GMAIL,INOREADER}_CLIENT_ID - preconfigured OAuth cliend ID.
# {FEEDLY,GMAIL,INOREADER}_CLIENT_SECRET - preconfigured OAuth cliend SECRET.
#
# Other information:
# - supports Windows, Linux, macOS, OS/2, Android,
# - Qt 5.9.0 or newer is required,
# - cmake 3.9.0 or newer is required,
# - if you wish to make packages for Windows, then you must initialize all submodules within repository before compilation,
# - C++ 11/17 is required.
#
# Building on OS/2:
# RSS Guard can run on OS/2 and if you want to compile it by yourself, you need to make sure that
# your OS/2 distro is up-to-date and you have all dependencies installed: os2-base, all gcc-* packages,
# libc and libcx up-to-date, kbuild-make, ash, binutils, all relevant qt5-* packages.
#
# After your dependecies are installed, then you can compile via standard `qmake -> make -> make install` steps
# and package with: 7z.exe a -t7z -mmt -mx9 "rssguard.7z" "<build-folder\src\rssguard\app\*" command.
#
# Authors and contributors:
# - Martin Rotter (project leader),
# - Elbert Pol (OS/2-related contributions),
# - CyberTailor (cmake-related contributions.
#
#################################################################
cmake_minimum_required(VERSION 3.9.0) cmake_minimum_required(VERSION 3.9.0)
project(rssguard VERSION 4.1.2 LANGUAGES CXX) # Global variables describing the project.
set(APP_NAME "RSS Guard")
set(APP_AUTHOR "Martin Rotter")
set(APP_COPYRIGHT "\\251 2011-2022 ${APP_AUTHOR}")
set(APP_REVERSE_NAME "com.github.rssguard")
set(APP_VERSION "4.2.0")
set(TYPEINFO "????")
project(rssguard VERSION ${APP_VERSION} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -10,10 +68,14 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
option(USE_WEBENGINE "Use QtWebEngine for embedded web browser" ON) option(USE_WEBENGINE "Use QtWebEngine for embedded web browser" ON)
option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source" OFF) option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source" OFF)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only)" OFF) option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only)" OFF)
option(REVISION_FROM_GIT "Get revision using `git rev-parse`" OFF) option(REVISION_FROM_GIT "Get revision using `git rev-parse`" ON)
set(FEEDLY_CLIENT_ID "" CACHE STRING "Feedly client ID") set(FEEDLY_CLIENT_ID "" CACHE STRING "Feedly client ID")
set(FEEDLY_CLIENT_SECRET "" CACHE STRING "Feedly client secret") set(FEEDLY_CLIENT_SECRET "" CACHE STRING "Feedly client secret")
@ -86,12 +148,6 @@ else()
message(STATUS "Inoreader client ID/secret variables are not set. Disabling official support") message(STATUS "Inoreader client ID/secret variables are not set. Disabling official support")
endif() endif()
set(APP_NAME "RSS Guard")
set(APP_AUTHOR "Martin Rotter")
set(APP_COPYRIGHT "(C) 2011-2022 ${APP_AUTHOR}")
set(APP_REVERSE_NAME "com.github.rssguard")
set(TYPEINFO "????")
if(REVISION_FROM_GIT AND EXISTS "${CMAKE_SOURCE_DIR}/.git") if(REVISION_FROM_GIT AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND "git rev-parse --short HEAD" execute_process(COMMAND "git rev-parse --short HEAD"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
@ -107,8 +163,8 @@ if(NOT USE_WEBENGINE)
endif() endif()
add_compile_definitions( add_compile_definitions(
APP_AUTHOR="Martin Rotter" APP_AUTHOR="${APP_AUTHOR}"
APP_DONATE_URL="https://martinrotter.github.io/donate" APP_DONATE_URL="https://github.com/sponsors/martinrotter"
APP_EMAIL="rotter.martinos@gmail.com" APP_EMAIL="rotter.martinos@gmail.com"
APP_LONG_NAME="${APP_NAME} ${CMAKE_PROJECT_VERSION}" APP_LONG_NAME="${APP_NAME} ${CMAKE_PROJECT_VERSION}"
APP_LOW_H_NAME=".${CMAKE_PROJECT_NAME}" APP_LOW_H_NAME=".${CMAKE_PROJECT_NAME}"
@ -127,7 +183,8 @@ add_compile_definitions(
QT_USE_QSTRINGBUILDER QT_USE_QSTRINGBUILDER
QT_USE_FAST_CONCATENATION QT_USE_FAST_CONCATENATION
QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_OPERATOR_PLUS
UNICODE _UNICODE UNICODE
_UNICODE
) )
if(UNIX) if(UNIX)
@ -153,10 +210,12 @@ if(WIN32)
${CMAKE_BINARY_DIR}/rssguard.rc ${CMAKE_BINARY_DIR}/rssguard.rc
NEWLINE_STYLE WIN32 NEWLINE_STYLE WIN32
) )
configure_file( configure_file(
resources/nsis/NSIS.definitions.nsh.in resources/nsis/NSIS.definitions.nsh.in
${CMAKE_BINARY_DIR}/NSIS.definitions.nsh ${CMAKE_BINARY_DIR}/NSIS.definitions.nsh
) )
file(COPY resources/nsis/NSIS.template.in DESTINATION ${CMAKE_BINARY_DIR}) file(COPY resources/nsis/NSIS.template.in DESTINATION ${CMAKE_BINARY_DIR})
file(COPY resources/graphics/${CMAKE_PROJECT_NAME}.ico DESTINATION ${CMAKE_BINARY_DIR}) file(COPY resources/graphics/${CMAKE_PROJECT_NAME}.ico DESTINATION ${CMAKE_BINARY_DIR})
elseif(APPLE) elseif(APPLE)

View file

@ -1,16 +1,18 @@
# Collect all .ts files.
FILE(GLOB TS_FILES *.ts) FILE(GLOB TS_FILES *.ts)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}") set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}")
# Update .ts file and/or just generate .qm files.
if(UPDATE_TRANSLATIONS) if(UPDATE_TRANSLATIONS)
qt_create_translation(QM_FILES qt_create_translation(QM_FILES
"${CMAKE_SOURCE_DIR}/src" ${TS_FILES} "${CMAKE_SOURCE_DIR}/src" ${TS_FILES}
OPTIONS -no-obsolete OPTIONS "-no-obsolete"
) )
else() else()
qt_add_translation(QM_FILES qt_add_translation(QM_FILES
${TS_FILES} ${TS_FILES}
OPTIONS -compress OPTIONS "-compress"
) )
endif() endif()

View file

@ -19,7 +19,7 @@ BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "040904e4" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "@APP_AUTHOR@" VALUE "CompanyName", "@APP_AUTHOR@"

View file

@ -380,7 +380,7 @@ set(SOURCES
services/tt-rss/ttrssserviceroot.h services/tt-rss/ttrssserviceroot.h
) )
# Add mimesis # Add mimesis.
list(APPEND SOURCES list(APPEND SOURCES
3rd-party/mimesis/mimesis.cpp 3rd-party/mimesis/mimesis.cpp
3rd-party/mimesis/mimesis.hpp 3rd-party/mimesis/mimesis.hpp
@ -388,7 +388,7 @@ list(APPEND SOURCES
3rd-party/mimesis/quoted-printable.hpp 3rd-party/mimesis/quoted-printable.hpp
) )
# Add boolinq # Add boolinq.
list(APPEND SOURCES list(APPEND SOURCES
3rd-party/boolinq/boolinq.h 3rd-party/boolinq/boolinq.h
) )
@ -407,6 +407,7 @@ endif()
if(USE_WEBENGINE) if(USE_WEBENGINE)
list(APPEND SOURCES list(APPEND SOURCES
# WebEngine-based web (and message) browser.
gui/reusable/discoverfeedsbutton.cpp gui/reusable/discoverfeedsbutton.cpp
gui/reusable/discoverfeedsbutton.h gui/reusable/discoverfeedsbutton.h
gui/reusable/locationlineedit.cpp gui/reusable/locationlineedit.cpp
@ -420,7 +421,7 @@ if(USE_WEBENGINE)
network-web/webpage.cpp network-web/webpage.cpp
network-web/webpage.h network-web/webpage.h
# Add AdBlock sources # Add AdBlock sources.
network-web/adblock/adblockdialog.cpp network-web/adblock/adblockdialog.cpp
network-web/adblock/adblockdialog.h network-web/adblock/adblockdialog.h
network-web/adblock/adblockicon.cpp network-web/adblock/adblockicon.cpp
@ -437,6 +438,7 @@ if(USE_WEBENGINE)
) )
else() else()
list(APPEND SOURCES list(APPEND SOURCES
# Lite non-WebEngine message browser.
gui/messagetextbrowser.cpp gui/messagetextbrowser.cpp
gui/messagetextbrowser.h gui/messagetextbrowser.h
gui/messagebrowser.cpp gui/messagebrowser.cpp

View file

@ -44,7 +44,7 @@ if(WIN32)
install(FILES ${CMAKE_SOURCE_DIR}/resources/graphics/${CMAKE_PROJECT_NAME}.ico install(FILES ${CMAKE_SOURCE_DIR}/resources/graphics/${CMAKE_PROJECT_NAME}.ico
DESTINATION . DESTINATION .
) )
install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources/scripts/redist install(DIRECTORY ${CMAKE_SOURCE_DIR}/resources/scripts/redist/
DESTINATION . DESTINATION .
FILES_MATCHING PATTERN "*.dll" FILES_MATCHING PATTERN "*.dll"
) )