File: CMakeLists.txt

package info (click to toggle)
peek 1.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,768 kB
  • sloc: xml: 234; sh: 85; python: 69; makefile: 14
file content (223 lines) | stat: -rw-r--r-- 7,031 bytes parent folder | download | duplicates (2)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
project("peek" C)
cmake_minimum_required(VERSION 2.6)

set (PEEK_VERSION_MAJOR 1)
set (PEEK_VERSION_MINOR 5)
set (PEEK_VERSION_PATCH 1)

# Get full Peek version
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
  find_package(Git)
  if(GIT_FOUND)
    execute_process(
      COMMAND ${GIT_EXECUTABLE} describe --tags
      WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
      OUTPUT_VARIABLE "PEEK_VERSION_FULL"
      ERROR_QUIET
      OUTPUT_STRIP_TRAILING_WHITESPACE)
    if(NOT PEEK_VERSION_FULL)
      execute_process(
        COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
        OUTPUT_VARIABLE "GIT_REVISION"
        ERROR_QUIET
        OUTPUT_STRIP_TRAILING_WHITESPACE)
      set(PEEK_VERSION_FULL "${PEEK_VERSION_MAJOR}.${PEEK_VERSION_MINOR}.${PEEK_VERSION_PATCH}-${GIT_REVISION}")
    endif()
  endif()
endif()

if(NOT PEEK_VERSION_FULL)
  set(PEEK_VERSION_FULL "${PEEK_VERSION_MAJOR}.${PEEK_VERSION_MINOR}.${PEEK_VERSION_PATCH}")
endif()
message(STATUS "Peek version: ${PEEK_VERSION_FULL}" )

# Include macros for Vala and GLib
list(APPEND CMAKE_MODULE_PATH
  ${CMAKE_SOURCE_DIR}/cmake
)

include(GNUInstallDirs)
include(CTest)
include(FindVala)
include(UseVala)
include(GResource)

set (GettextTranslate_GMO_BINARY TRUE)
set (GettextTranslate_ALL TRUE)
if (NOT DEFINED LOCALEDIR)
  set (LOCALEDIR ${CMAKE_INSTALL_FULL_LOCALEDIR})
endif ()
include(GettextTranslate)

# Check dependencies
find_package(Vala 0.22 REQUIRED)

find_package(PkgConfig)
set(REQUIRE_GTK "3.20")
pkg_check_modules(GTK REQUIRED gtk+-3.0>=${REQUIRE_GTK})
pkg_check_modules(CAIRO REQUIRED cairo)
pkg_check_modules(GIO REQUIRED gio-2.0>=2.42)
pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.38)
pkg_check_modules(GMODULE REQUIRED gmodule-2.0)
pkg_check_modules(KEYBINDER keybinder-3.0)

add_definitions(${GTK_CFLAGS} ${GTK_CFLAGS_OTHER})
link_libraries(${GTK_LIBRARIES})
link_libraries(${KEYBINDER_LIBRARIES})
link_directories(${GTK_LIBRARY_DIRS})

# compile glib resource files to c code
configure_file (
  "${PROJECT_SOURCE_DIR}/ui/about.ui.in"
  "${PROJECT_SOURCE_DIR}/ui/about.ui"
  )

GLIB_COMPILE_RESOURCES(GLIB_RESOURCES
  SOURCE
    ui/${PROJECT_NAME}.gresource.xml
)

set(VALA_DEFINITIONS "")
set(VALA_CUSTOM_VAPIS "")

list(APPEND VALA_CUSTOM_VAPIS "src/vapi/config.vapi")

if(NOT CMAKE_BUILD_TYPE STREQUAL Release)
  message (STATUS "Debug build")
  list(APPEND VALA_DEFINITIONS "DEBUG")
endif()

if(${KEYBINDER_FOUND})
  list(APPEND VALA_DEFINITIONS "HAS_KEYBINDER")
  list(APPEND VALA_CUSTOM_VAPIS "src/vapi/keybinder-3.0.vapi")
endif()

# Check for GTK features
if(${GTK_VERSION} VERSION_EQUAL "3.20" OR ${GTK_VERSION} VERSION_GREATER "3.20")
  message(STATUS "Compiling with features for GTK >= 3.20")
  set(REQUIRE_GTK "3.20")

  if(ENABLE_FILECHOOSERNATIVE OR DISABLE_OPEN_FILE_MANAGER)
    message(STATUS "Compiling with Gtk.FileChooserNative")
    list(APPEND VALA_DEFINITIONS "HAS_GTK_FILECHOOSERNATIVE")
  endif()
endif()

if(${GTK_VERSION} VERSION_EQUAL "3.22" OR ${GTK_VERSION} VERSION_GREATER "3.22")
  message(STATUS "Compiling with features for GTK >= 3.22")
  set(REQUIRE_GTK "3.22")
  list(APPEND VALA_DEFINITIONS "HAS_GTK_SHORTCUT_LABEL")
  list(APPEND VALA_DEFINITIONS "HAS_GTK_SHOW_URI_ON_WINDOW")
endif()

# Flags for disabling certain features
if(DISABLE_GNOME_SHELL)
  message(STATUS "GNOME Shell recorder disabled by configuration")
  list(APPEND VALA_DEFINITIONS "DISABLE_GNOME_SHELL")
endif()

if(DISABLE_OPEN_FILE_MANAGER)
  message(STATUS "File manager integration disabled by configuration")
  list(APPEND VALA_DEFINITIONS "DISABLE_OPEN_FILE_MANAGER")
endif()

# Compile Vala to C
vala_precompile(VALA_C
    src/main.vala
    src/application.vala
    src/desktop-integration.vala
    src/defaults.vala
    src/errordomain.vala
    src/gtk-helper.vala
    src/utils.vala
    src/dbus/freedesktop-dbus.vala
    src/dbus/freedesktop-filemanager.vala
    src/dbus/gnome-shell-screencast.vala
    src/post-processing/cli-post-processor.vala
    src/post-processing/extract-frames-post-processor.vala
    src/post-processing/ffmpeg-post-processor.vala
    src/post-processing/gifski-post-processor.vala
    src/post-processing/post-processing-pipeline.vala
    src/post-processing/post-processor.vala
    src/recording/base-screen-recorder.vala
    src/recording/cli-screen-recorder.vala
    src/recording/ffmpeg-screen-recorder.vala
    src/recording/ffmpeg.vala
    src/recording/gnome-shell-dbus-recorder.vala
    src/recording/recording-area.vala
    src/recording/recording-config.vala
    src/recording/screen-recorder-factory.vala
    src/recording/screen-recorder.vala
    src/ui/about-dialog.vala
    src/ui/application-window.vala
    src/ui/set-window-size-dialog.vala
    src/ui/error-dialog.vala
    src/ui/preferences-dialog.vala
    src/ui/shortcut-label.vala
  PACKAGES
    gtk+-3.0
    posix
  DEFINITIONS
    ${VALA_DEFINITIONS}
  CUSTOM_VAPIS
    ${VALA_CUSTOM_VAPIS}
  GENERATE_HEADER
    application
  OPTIONS
    --target-glib=2.38
    --use-header
    --gresources=${CMAKE_SOURCE_DIR}/ui/${PROJECT_NAME}.gresource.xml
)

# Compile C code
add_definitions(-DGETTEXT_PACKAGE="${PROJECT_NAME}")
add_definitions(-DLOCALEDIR="${LOCALEDIR}")
add_definitions(-DVERSION="${PEEK_VERSION_FULL}")
add_definitions(-Wno-deprecated-declarations)
add_definitions(-Wno-incompatible-pointer-types)
add_definitions(-Wformat)
add_definitions(-Wformat-security)
add_executable(${PROJECT_NAME} ${VALA_C} ${GLIB_RESOURCES})

# Installation
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})

add_subdirectory(data)
add_subdirectory(po)

if(BUILD_TESTS)
  add_subdirectory(tests)
else()
  add_subdirectory(tests EXCLUDE_FROM_ALL)
endif()

# Uninstall target
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)

add_custom_target(uninstall
  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

# CPack configuration
set(CPACK_GENERATOR "DEB")
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/package.txt)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple screen recorder with an easy to use interface")
set(CPACK_PACKAGE_VENDOR "")
set(CPACK_PACKAGE_CONTACT "Philipp Wolfer <ph.wolfer@gmail.com>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${PEEK_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PEEK_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PEEK_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Peek")

set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-3-0 (>= ${REQUIRE_GTK}), libglib2.0-0 (>= 2.38), libkeybinder-3.0-0, ffmpeg (>= 3), gstreamer1.0-plugins-good (>= 1.2)")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "gstreamer1.0-plugins-ugly")
set(CPACK_DEBIAN_PACKAGE_SUGGESTS "gifski")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_SECTION "video")

include(CPack)