-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·120 lines (109 loc) · 3.84 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Copyright 2022-present Contributors to the colorpicker project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/mikaelsundell/colorpicker
cmake_minimum_required (VERSION 3.27)
set (project_name "Colorpicker")
project (${project_name})
# packages
set (qt6_modules Core PrintSupport Gui Widgets)
find_package (Qt6 COMPONENTS ${qt6_modules} CONFIG REQUIRED)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
set (CMAKE_AUTOUIC ON)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
find_package (OpenCV CONFIG REQUIRED)
find_package (Lcms2 REQUIRED)
# app
set (app_name "Color Picker")
# sources
set (app_sources
colorpicker.cpp
colorpicker.mm
colorpicker.h
colorwheel.cpp
colorwheel.h
dragger.h
dragger.cpp
editor.h
editor.cpp
eventfilter.h
eventfilter.cpp
icctransform.h
icctransform.cpp
label.h
label.cpp
mac.mm
mac.h
main.cpp
picker.h
picker.cpp
about.ui
editor.ui
colorpicker.ui
colorpicker.qrc
)
# iccprofiles
file (GLOB app_iccprofiles
"iccprofiles/*.icc"
)
# resources
file (GLOB app_resources
"resources/*.icns"
"resources/*.icc"
"resources/*.css"
"resources/App*.png"
)
# bundle
set (bundle_sources
"${CMAKE_SOURCE_DIR}/resources/MacOSXBundle.plist.in"
)
# source groups
source_group("ICC Files" FILES ${app_iccprofiles})
source_group("Resouce Files" FILES ${app_resources})
if (APPLE)
set (MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.mikaelsundell.colorpicker")
set (MACOSX_BUNDLE_EXECUTABLE_NAME ${app_name})
set (MACOSX_BUNDLE_INFO_STRING ${app_name})
set (MACOSX_BUNDLE_BUNDLE_NAME ${app_name})
set (MACOSX_BUNDLE_ICON_FILE AppIcon.icns)
set (MACOSX_BUNDLE_LONG_VERSION_STRING "1.1.0")
set (MACOSX_BUNDLE_SHORT_VERSION_STRING "1.1.0")
set (MACOSX_BUNDLE_BUNDLE_VERSION ${MACOSX_BUNDLE_LONG_VERSION_STRING})
set (MACOSX_BUNDLE_COPYRIGHT "Copyright 2022-present Contributors to the ${app_name} project")
set (MACOSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET})
set (CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")
set_source_files_properties(${app_iccprofiles} PROPERTIES MACOSX_PACKAGE_LOCATION "ICCProfiles")
set_source_files_properties(${app_resources} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable ("Colorpicker" MACOSX_BUNDLE ${app_sources} ${app_resources} ${app_iccprofiles})
# definitions
add_definitions(-DMACOSX_BUNDLE_BUNDLE_NAME="${MACOSX_BUNDLE_BUNDLE_NAME}")
add_definitions(-DMACOSX_BUNDLE_GUI_IDENTIFIER="${MACOSX_BUNDLE_GUI_IDENTIFIER}")
add_definitions(-DMACOSX_BUNDLE_COPYRIGHT="${MACOSX_BUNDLE_COPYRIGHT}")
add_definitions(-DMACOSX_BUNDLE_LONG_VERSION_STRING="${MACOSX_BUNDLE_LONG_VERSION_STRING}")
add_definitions(-DGITHUBURL="https://github.com/mikaelsundell/colorpicker")
set_target_properties(${project_name} PROPERTIES
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}"
XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET}
MACOSX_BUNDLE_INFO_PLIST ${bundle_sources}
)
if (NOT PROVISIONING_PROFILE STREQUAL "")
set_target_properties(${project_name} PROPERTIES
XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "${PROVISIONING_PROFILE}"
)
endif()
set_target_properties(${project_name} PROPERTIES
OUTPUT_NAME ${app_name}
)
target_compile_options (${project_name} PRIVATE -Wno-deprecated-register)
target_include_directories (${project_name} PRIVATE ${LCMS2_INCLUDE_DIR})
target_link_libraries (${project_name}
Qt6::Core Qt6::PrintSupport Qt6::Gui Qt6::Widgets
opencv_core
opencv_imgproc
opencv_imgcodecs
${LCMS2_LIBRARY}
"-framework CoreFoundation"
"-framework AppKit")
else ()
message (WARNING "${project_name} is a Mac program, will not be built.")
endif ()