forked from martinrotter/rssguard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
port build system to cmake (martinrotter#615)
- Loading branch information
jan Anja
authored
Jan 31, 2022
1 parent
5bd740c
commit d17bdc5
Showing
18 changed files
with
946 additions
and
1,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
cmake_minimum_required(VERSION 3.9.0) | ||
|
||
project(rssguard VERSION 4.1.2 LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
option(USE_WEBENGINE "Use QtWebEngine for embedded web browser" ON) | ||
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(REVISION_FROM_GIT "Get revision using `git rev-parse`" OFF) | ||
|
||
set(FEEDLY_CLIENT_ID "" CACHE STRING "Feedly client ID") | ||
set(FEEDLY_CLIENT_SECRET "" CACHE STRING "Feedly client secret") | ||
|
||
set(GMAIL_CLIENT_ID "" CACHE STRING "GMail client ID") | ||
set(GMAIL_CLIENT_SECRET "" CACHE STRING "GMail client secret") | ||
|
||
set(INOREADER_CLIENT_ID "" CACHE STRING "Inoreader client ID") | ||
set(INOREADER_CLIENT_SECRET "" CACHE STRING "Inoreader client secret") | ||
|
||
find_package(QT NAMES Qt6 Qt5 REQUIRED) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS | ||
Core | ||
Gui | ||
LinguistTools | ||
Network | ||
Qml | ||
Sql | ||
Widgets | ||
Xml | ||
) | ||
|
||
if(QT_VERSION_MAJOR EQUAL 6) | ||
find_package(Qt6 COMPONENTS Core5Compat REQUIRED) | ||
endif() | ||
|
||
if(USE_WEBENGINE) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WebEngineWidgets REQUIRED) | ||
add_compile_definitions(USE_WEBENGINE) | ||
endif() | ||
|
||
if(NOT OS2) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Multimedia REQUIRED) | ||
macro(qt_add_resources) | ||
qt_add_big_resources(${ARGN}) | ||
endmacro() | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE AND NOT ANDROID) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) | ||
endif() | ||
|
||
if(NOT FEEDLY_CLIENT_ID STREQUAL "" AND NOT FEEDLY_CLIENT_SECRET STREQUAL "") | ||
add_compile_definitions( | ||
FEEDLY_OFFICIAL_SUPPORT | ||
FEEDLY_CLIENT_ID="${FEEDLY_CLIENT_ID}" | ||
FEEDLY_CLIENT_SECRET="${FEEDLY_CLIENT_SECRET}" | ||
) | ||
else() | ||
message(STATUS "Feedly client ID/secret variables are not set. Disabling official support") | ||
endif() | ||
|
||
if(NOT GMAIL_CLIENT_ID STREQUAL "" AND NOT GMAIL_CLIENT_SECRET STREQUAL "") | ||
add_compile_definitions( | ||
GMAIL_OFFICIAL_SUPPORT | ||
GMAIL_CLIENT_ID="${GMAIL_CLIENT_ID}" | ||
GMAIL_CLIENT_SECRET="${GMAIL_CLIENT_SECRET}" | ||
) | ||
else() | ||
message(STATUS "GMail client ID/secret variables are not set. Disabling official support") | ||
endif() | ||
|
||
if(NOT INOREADER_CLIENT_ID STREQUAL "" AND NOT INOREADER_CLIENT_SECRET STREQUAL "") | ||
add_compile_definitions( | ||
INOREADER_OFFICIAL_SUPPORT | ||
INOREADER_CLIENT_ID="${INOREADER_CLIENT_ID}" | ||
INOREADER_CLIENT_SECRET="${INOREADER_CLIENT_SECRET}" | ||
) | ||
else() | ||
message(STATUS "Inoreader client ID/secret variables are not set. Disabling official support") | ||
endif() | ||
|
||
set(APP_NAME "RSS Guard") | ||
set(APP_AUTHOR "") | ||
set(APP_COPYRIGHT "") | ||
set(APP_REVERSE_NAME "com.github.rssguard") | ||
set(TYPEINFO "????") | ||
|
||
if(REVISION_FROM_GIT AND EXISTS "${CMAKE_SOURCE_DIR}/.git") | ||
execute_process(COMMAND "git rev-parse --short HEAD" | ||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | ||
OUTPUT_VARIABLE APP_REVISION | ||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
else() | ||
set(APP_REVISION "") | ||
endif() | ||
|
||
if(NOT USE_WEBENGINE) | ||
set(APP_REVISION "${APP_REVISION}-nowebengine") | ||
endif() | ||
|
||
add_compile_definitions( | ||
APP_AUTHOR="Martin Rotter" | ||
APP_DONATE_URL="https://martinrotter.github.io/donate" | ||
APP_EMAIL="[email protected]" | ||
APP_LONG_NAME="${APP_NAME} ${CMAKE_PROJECT_VERSION}" | ||
APP_LOW_H_NAME=".${CMAKE_PROJECT_NAME}" | ||
APP_LOW_NAME="${CMAKE_PROJECT_NAME}" | ||
APP_NAME="${APP_NAME}" | ||
APP_REVISION="${APP_REVISON}" | ||
APP_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" | ||
APP_SYSTEM_VERSION="${CMAKE_SYSTEM_PROCESSOR}" | ||
APP_URL="https://github.com/martinrotter/rssguard" | ||
APP_URL_DOCUMENTATION="https://github.com/martinrotter/rssguard/blob/master/resources/docs/Documentation.md" | ||
APP_URL_ISSUES="https://github.com/martinrotter/rssguard/issues" | ||
APP_URL_ISSUES_NEW="https://github.com/martinrotter/rssguard/issues/new" | ||
APP_USERAGENT="${APP_NAME}/${CMAKE_PROJECT_VERSION}" | ||
APP_VERSION="${CMAKE_PROJECT_VERSION}" | ||
|
||
QT_USE_QSTRINGBUILDER | ||
QT_USE_FAST_CONCATENATION | ||
QT_USE_FAST_OPERATOR_PLUS | ||
UNICODE _UNICODE | ||
) | ||
|
||
if(UNIX) | ||
add_compile_options(-fPIC) | ||
endif() | ||
|
||
if(APPLE) | ||
add_compile_options(-stdlib=libc++) | ||
add_link_options(-stdlib=libc++) | ||
endif() | ||
|
||
if(${FORCE_COLORED_OUTPUT}) | ||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
add_compile_options(-fdiagnostics-color=always) | ||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | ||
add_compile_options(-fcolor-diagnostics) | ||
endif() | ||
endif() | ||
|
||
if(WIN32) | ||
configure_file( | ||
resources/rssguard.rc.in | ||
${CMAKE_BINARY_DIR}/rssguard.rc | ||
NEWLINE_STYLE WIN32 | ||
) | ||
configure_file( | ||
resources/nsis/NSIS.definitions.nsh.in | ||
${CMAKE_BINARY_DIR}/NSIS.definitions.nsh | ||
) | ||
file(COPY resources/nsis/NSIS.template.in DESTINATION ${CMAKE_BINARY_DIR}) | ||
file(COPY resources/graphics/${CMAKE_PROJECT_NAME}.ico DESTINATION ${CMAKE_BINARY_DIR}) | ||
elseif(APPLE) | ||
configure_file( | ||
resources/macosx/Info.plist.in | ||
${CMAKE_BINARY_DIR}/Info.plist | ||
) | ||
endif() | ||
|
||
add_subdirectory(localization) | ||
add_subdirectory(src/librssguard) | ||
add_subdirectory(src/rssguard) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
set(TS_FILES | ||
qtbase_cs.ts | ||
qtbase_da.ts | ||
qtbase_de.ts | ||
qtbase_es.ts | ||
qtbase_fi.ts | ||
qtbase_fr.ts | ||
qtbase_he.ts | ||
qtbase_it.ts | ||
qtbase_ja.ts | ||
qtbase_lt.ts | ||
qtbase_pl.ts | ||
qtbase_pt_BR.ts | ||
qtbase_pt_PT.ts | ||
qtbase_ru.ts | ||
qtbase_sv.ts | ||
qtbase_uk.ts | ||
qtbase_zh_CN.ts | ||
qtbase_zh_TW.ts | ||
rssguard_cs.ts | ||
rssguard_da.ts | ||
rssguard_de.ts | ||
rssguard_en_GB.ts | ||
rssguard_en.ts | ||
rssguard_es.ts | ||
rssguard_fi.ts | ||
rssguard_fr.ts | ||
rssguard_gl.ts | ||
rssguard_he.ts | ||
rssguard_id.ts | ||
rssguard_it.ts | ||
rssguard_ja.ts | ||
rssguard_lt.ts | ||
rssguard_nl.ts | ||
rssguard_pl.ts | ||
rssguard_pt_BR.ts | ||
rssguard_pt_PT.ts | ||
rssguard_ru.ts | ||
rssguard_sv.ts | ||
rssguard_uk.ts | ||
rssguard_zh_CN.ts | ||
rssguard_zh_TW.ts | ||
) | ||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
||
if(UPDATE_TRANSLATIONS) | ||
qt_create_translation(QM_FILES | ||
"${CMAKE_SOURCE_DIR}/src" ${TS_FILES} | ||
OPTIONS -no-obsolete | ||
) | ||
else() | ||
qt_add_translation(QM_FILES | ||
${TS_FILES} | ||
OPTIONS -compress | ||
) | ||
endif() | ||
|
||
add_custom_target(update_qm DEPENDS ${QM_FILES}) |
Oops, something went wrong.