fix after mergin - CMakeLists.txt for MacOS

This commit is contained in:
Yuriy Puchkov
2021-02-17 16:14:00 +02:00
parent 3b9fb6aeca
commit 45f8752188
3 changed files with 36 additions and 30 deletions

View File

@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.13)
# cmake_policy(SET CMP0076 OLD)
set(FLAMESHOT_VERSION 0.8.5.10)
set(FLAMESHOT_VERSION 0.9.0)
# Flameshot-org
#set(GIT_API_URL "https://api.github.com/repos/flameshot-org/flameshot/releases/latest")
set(GIT_API_URL "https://api.github.com/repos/flameshot-org/flameshot/releases/latest")
# Namecheap
set(GIT_API_URL "https://api.github.com/repos/namecheap/flameshot/releases/latest")
# set(GIT_API_URL "https://api.github.com/repos/namecheap/flameshot/releases/latest")
# TODO - fix it for all linux distros
# find_package (Git)
@@ -31,35 +31,37 @@ set(GIT_API_URL "https://api.github.com/repos/namecheap/flameshot/releases/lates
#endif ()
project(
flameshot
VERSION ${FLAMESHOT_VERSION}
LANGUAGES CXX)
flameshot
VERSION ${FLAMESHOT_VERSION}
LANGUAGES CXX)
set(PROJECT_NAME_CAPITALIZED "Flameshot")
# This can be read from ${PROJECT_NAME} after project() is called
if (APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
# # Required to generate MOC
# add_subdirectory(external/QHotkey)
endif()
# Configuration options
set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32)
set(DEFAULT_RUN_IN_PLACE TRUE)
# For Windows RC file.
add_definitions(-DFLAMESHOT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR})
add_definitions(-DFLAMESHOT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR})
add_definitions(-DFLAMESHOT_VERSION_BUGFIX=${CMAKE_PROJECT_VERSION_PATCH})
add_definitions(-DFLAMESHOT_VERSION_BUILD=1)
add_definitions(-DFLAMESHOT_VERSION_STRING="${PROJECT_VERSION}")
set(DEFAULT_RUN_IN_PLACE TRUE)
# For Windows RC file.
add_definitions(-DFLAMESHOT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR})
add_definitions(-DFLAMESHOT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR})
add_definitions(-DFLAMESHOT_VERSION_BUGFIX=${CMAKE_PROJECT_VERSION_PATCH})
add_definitions(-DFLAMESHOT_VERSION_BUILD=1)
add_definitions(-DFLAMESHOT_VERSION_STRING="${PROJECT_VERSION}")
elseif(APPLE)
set(Qt5_DIR "$(brew --prefix qt5)/lib/cmake/Qt5/" CACHE PATH "directory where Qt5Config.cmake exists.")
set(CMAKE_MACOSX_BUNDLE ON)
set(CMAKE_MACOSX_RPATH ON)
endif()
set(RUN_IN_PLACE
${DEFAULT_RUN_IN_PLACE}
CACHE BOOL "Run directly in source directory structure")
${DEFAULT_RUN_IN_PLACE}
CACHE BOOL "Run directly in source directory structure")
option(GENERATE_TS "Regenerate translation source files" OFF)
@@ -84,20 +86,20 @@ enable_sanitizers(project_options)
# allow for static analysis options include(cmake/StaticAnalyzers.cmake)
set(QAPPLICATION_CLASS
QApplication
CACHE STRING "Inheritance class for SingleApplication")
QApplication
CACHE STRING "Inheritance class for SingleApplication")
add_subdirectory(external/singleapplication)
if(USE_EXTERNAL_SPDLOG)
find_package(spdlog REQUIRED)
message(STATUS "Using external spdlog library")
find_package(spdlog REQUIRED)
message(STATUS "Using external spdlog library")
else()
add_subdirectory(external/spdlog)
add_subdirectory(external/spdlog)
endif()
IF (APPLE)
if (APPLE)
add_subdirectory(external/QHotkey)
ENDIF ()
endif()
add_subdirectory(src)
# CPack
@@ -107,9 +109,9 @@ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_HOMEPAGE_URL "https://flameshot.org")
set(CPACK_PACKAGE_CONTACT "flameshot-org developers <info@flameshot.org>")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/data/img/app/org.flameshot.Flameshot.svg") # TODO: Can any generator make
# use of this?
# use of this?
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") # TODO: Where is this used? Do we need a better
# source?
# source?
if(WIN32)
# Include all dynamically linked runtime libraries such as MSVCRxxx.dll

View File

@@ -33,11 +33,11 @@ else()
set(SRC_FILES ${SRC_FILES} qhotkey_x11.cpp)
endif()
add_library(QHotkey ${SRC_FILES} ${MOC_HEADERS})
add_library(QHotkey::QHotkey ALIAS QHotkey)
target_link_libraries(QHotkey ${LIBS})
add_library(qhotkey ${SRC_FILES} ${MOC_HEADERS})
add_library(QHotkey::QHotkey ALIAS qhotkey)
target_link_libraries(qhotkey ${LIBS})
target_include_directories(QHotkey
target_include_directories(qhotkey
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)

View File

@@ -40,6 +40,11 @@ if (APPLE)
COMMAND bash "-c" "rm -R flameshot.iconset"
)
execute_process(
# copy icon from cache generated on the localhost if generation on CI failed
COMMAND bash "-c" "[[ -r 'flameshot.icns' ]] || cp ../packaging/macos/flameshot.icns ./"
)
# Set application icon
set(MACOSX_BUNDLE_ICON_FILE flameshot.icns)
@@ -61,7 +66,6 @@ if (WIN32)
endif ()
endif ()
add_subdirectory(cli)
add_subdirectory(config)
add_subdirectory(core)
@@ -188,7 +192,7 @@ endif ()
target_compile_definitions(flameshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}")
target_compile_definitions(flameshot PRIVATE APP_VERSION="v${PROJECT_VERSION}")
target_compile_definitions(flameshot PRIVATE IMGUR_CLIENT_ID="313baf0c7b4d3ff")
target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
#target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
target_compile_definitions(flameshot PRIVATE FLAMESHOT_APP_VERSION_URL="${GIT_API_URL}")
foreach (FILE ${QM_FILES})