diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a8666078..3511a4e5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,14 +1,14 @@
find_package(
- Qt5
- CONFIG
- REQUIRED
- Core
- Gui
- Widgets
- Network
- Svg
- DBus
- LinguistTools)
+ Qt5
+ CONFIG
+ REQUIRED
+ Core
+ Gui
+ Widgets
+ Network
+ Svg
+ DBus
+ LinguistTools)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@@ -48,18 +48,18 @@ if (APPLE)
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable(flameshot MACOSX_BUNDLE main.cpp ${APP_ICON_MACOSX})
-else()
+else ()
add_executable(flameshot)
-endif()
+endif ()
add_executable(Flameshot::flameshot ALIAS flameshot)
-if(WIN32)
- set_property(TARGET flameshot PROPERTY WIN32_EXECUTABLE true)
- if(MSVC)
- target_compile_options(flameshot PRIVATE /source-charset:utf-8)
- endif()
-endif()
+if (WIN32)
+ set_property(TARGET flameshot PROPERTY WIN32_EXECUTABLE true)
+ if (MSVC)
+ target_compile_options(flameshot PRIVATE /source-charset:utf-8)
+ endif ()
+endif ()
add_subdirectory(cli)
@@ -70,84 +70,84 @@ add_subdirectory(widgets)
add_subdirectory(tools)
set(FLAMESHOT_TS_FILES
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ca.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_cs.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_de_DE.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_es.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_eu.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_fr.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_hu.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_it_IT.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ja.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ka.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ko.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_nl.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_nl_NL.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_pl.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_pt_BR.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ru.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sk.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sr_SP.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sv_SE.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_tr.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_uk.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_CN.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_HK.ts
- ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_TW.ts)
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ca.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_cs.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_de_DE.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_es.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_eu.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_fr.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_hu.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_it_IT.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ja.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ka.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ko.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_nl.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_nl_NL.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_pl.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_pt_BR.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ru.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sk.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sr_SP.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sv_SE.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_tr.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_uk.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_CN.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_HK.ts
+ ${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_TW.ts)
-if(GENERATE_TS)
- qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${FLAMESHOT_TS_FILES})
-else()
- qt5_add_translation(QM_FILES ${FLAMESHOT_TS_FILES})
-endif()
+if (GENERATE_TS)
+ qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${FLAMESHOT_TS_FILES})
+else ()
+ qt5_add_translation(QM_FILES ${FLAMESHOT_TS_FILES})
+endif ()
target_sources(
- flameshot
- PRIVATE # ${CMAKE_CURRENT_SOURCE_DIR}/../external/singleapplication/singleapplication.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_utils.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_wheel.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include/color_wheel.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/../data/graphics.qrc
- ${CMAKE_CURRENT_SOURCE_DIR}/../data/flameshot.rc # windows binary icon resource file
- ${QM_FILES}
- main.cpp)
+ flameshot
+ PRIVATE # ${CMAKE_CURRENT_SOURCE_DIR}/../external/singleapplication/singleapplication.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_utils.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_wheel.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include/color_wheel.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/../data/graphics.qrc
+ ${CMAKE_CURRENT_SOURCE_DIR}/../data/flameshot.rc # windows binary icon resource file
+ ${QM_FILES}
+ main.cpp)
target_include_directories(
- flameshot
- PUBLIC $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $
- $)
+ flameshot
+ PUBLIC $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $
+ $)
target_link_libraries(
flameshot
@@ -168,20 +168,22 @@ if (APPLE)
)
endif ()
-set(USE_OPENSSL FALSE)
-if(ENABLE_OPENSSL)
- find_package(OpenSSL)
- if(OPENSSL_FOUND)
- message(STATUS "OpenSSL support enabled.")
- set(USE_OPENSSL TRUE)
- endif()
-else()
- mark_as_advanced(CLEAR OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
-endif()
+if (WIN32)
+ set(USE_OPENSSL FALSE)
+ if (ENABLE_OPENSSL)
+ find_package(OpenSSL)
+ if (OPENSSL_FOUND)
+ message(STATUS "OpenSSL support enabled.")
+ set(USE_OPENSSL TRUE)
+ endif ()
+ else ()
+ mark_as_advanced(CLEAR OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
+ endif ()
-if(NOT USE_OPENSSL)
- message(WARNING "OpenSSL is required to upload screenshots")
-endif()
+ if (NOT USE_OPENSSL)
+ message(WARNING "OpenSSL is required to upload screenshots")
+ endif ()
+endif ()
target_compile_definitions(flameshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}")
target_compile_definitions(flameshot PRIVATE APP_VERSION="v${PROJECT_VERSION}")
@@ -189,14 +191,14 @@ target_compile_definitions(flameshot PRIVATE IMGUR_CLIENT_ID="313baf0c7b4d3ff")
target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
target_compile_definitions(flameshot PRIVATE FLAMESHOT_APP_VERSION_URL="${GIT_API_URL}")
-foreach(FILE ${QM_FILES})
- get_filename_component(F_NAME ${FILE} NAME)
- add_custom_command(
- TARGET flameshot
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${F_NAME}
+foreach (FILE ${QM_FILES})
+ get_filename_component(F_NAME ${FILE} NAME)
+ add_custom_command(
+ TARGET flameshot
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${F_NAME}
${CMAKE_CURRENT_BINARY_DIR}/translations/${F_NAME})
-endforeach()
+endforeach ()
# ######################################################################################################################
# Installation instructions
@@ -212,42 +214,42 @@ install(TARGETS flameshot
# Install desktop files, completion and dbus files
configure_file(${CMAKE_SOURCE_DIR}/data/desktopEntry/package/org.flameshot.Flameshot.desktop
- ${CMAKE_CURRENT_BINARY_DIR}/share/applications/org.flameshot.Flameshot.desktop COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/applications/org.flameshot.Flameshot.desktop COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/appdata/org.flameshot.Flameshot.metainfo.xml
- ${CMAKE_CURRENT_BINARY_DIR}/share/metainfo/org.flameshot.Flameshot.metainfo.xml COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/metainfo/org.flameshot.Flameshot.metainfo.xml COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/shell-completion/flameshot
- ${CMAKE_CURRENT_BINARY_DIR}/share/bash-completion/completions/flameshot COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/bash-completion/completions/flameshot COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/shell-completion/flameshot
- ${CMAKE_CURRENT_BINARY_DIR}/share/zsh/site-functions/_flameshot COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/zsh/site-functions/_flameshot COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.flameshot.Flameshot.xml
- ${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/interfaces/org.flameshot.Flameshot.xml COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/interfaces/org.flameshot.Flameshot.xml COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.flameshot.Flameshot.service.in
- ${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/services/org.flameshot.Flameshot.service)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/services/org.flameshot.Flameshot.service)
# Install Icons
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/48x48/apps/org.flameshot.Flameshot.png
- ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/48x48/apps/org.flameshot.Flameshot.png COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/48x48/apps/org.flameshot.Flameshot.png COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/128x128/apps/org.flameshot.Flameshot.png
- ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/128x128/apps/org.flameshot.Flameshot.png COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/128x128/apps/org.flameshot.Flameshot.png COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/scalable/apps/org.flameshot.Flameshot.svg
- ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/scalable/apps/org.flameshot.Flameshot.svg COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/scalable/apps/org.flameshot.Flameshot.svg COPYONLY)
# Install icon with both names
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/48x48/apps/flameshot.png
- ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/48x48/apps/flameshot.png COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/48x48/apps/flameshot.png COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/128x128/apps/flameshot.png
- ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/128x128/apps/flameshot.png COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/128x128/apps/flameshot.png COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/scalable/apps/flameshot.svg
- ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/scalable/apps/flameshot.svg COPYONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/scalable/apps/flameshot.svg COPYONLY)
# Install assets
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/share/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR})
@@ -256,44 +258,44 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/share/ DESTINATION ${CMAKE_INSTALL
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/flameshot/translations)
# windeployqt
-if(WIN32)
- if(EXISTS $ENV{QTDIR}/bin/windeployqt.exe)
- if(CMAKE_BUILD_TYPE MATCHES Release)
- set(BINARIES_TYPE --release)
- else()
- set(BINARIES_TYPE --debug)
- endif()
+if (WIN32)
+ if (EXISTS $ENV{QTDIR}/bin/windeployqt.exe)
+ if (CMAKE_BUILD_TYPE MATCHES Release)
+ set(BINARIES_TYPE --release)
+ else ()
+ set(BINARIES_TYPE --debug)
+ endif ()
- add_custom_command(
- TARGET flameshot
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff
- COMMAND
- $ENV{QTDIR}/bin/windeployqt.exe ${BINARIES_TYPE} --no-translations --compiler-runtime --no-system-d3d-compiler
- --no-angle --no-webkit2 --no-quick-import --dir ${CMAKE_BINARY_DIR}/windeployqt_stuff $
- # copy translations manually QM_FILES
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/src/translations
- ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations)
+ add_custom_command(
+ TARGET flameshot
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff
+ COMMAND
+ $ENV{QTDIR}/bin/windeployqt.exe ${BINARIES_TYPE} --no-translations --compiler-runtime --no-system-d3d-compiler
+ --no-angle --no-webkit2 --no-quick-import --dir ${CMAKE_BINARY_DIR}/windeployqt_stuff $
+ # copy translations manually QM_FILES
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/src/translations
+ ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations)
- install(DIRECTORY ${CMAKE_BINARY_DIR}/windeployqt_stuff/ DESTINATION bin)
+ install(DIRECTORY ${CMAKE_BINARY_DIR}/windeployqt_stuff/ DESTINATION bin)
- if(ENABLE_OPENSSL)
- if(EXISTS $ENV{OPENSSL_ROOT_DIR}/bin)
- install(
- DIRECTORY $ENV{OPENSSL_ROOT_DIR}/bin/
- DESTINATION bin
- FILES_MATCHING
- PATTERN "*.dll")
- else()
- message(WARNING "Unable to find OpenSSL dlls.")
- endif()
- endif()
+ if (ENABLE_OPENSSL)
+ if (EXISTS $ENV{OPENSSL_ROOT_DIR}/bin)
+ install(
+ DIRECTORY $ENV{OPENSSL_ROOT_DIR}/bin/
+ DESTINATION bin
+ FILES_MATCHING
+ PATTERN "*.dll")
+ else ()
+ message(WARNING "Unable to find OpenSSL dlls.")
+ endif ()
+ endif ()
- else()
- message("Unable to find executable QTDIR/bin/windeployqt.")
- endif()
-endif()
+ else ()
+ message("Unable to find executable QTDIR/bin/windeployqt.")
+ endif ()
+endif ()
# macdeployqt
if (APPLE)