forked from phw/peek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
118 lines (99 loc) · 3.3 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
project("peek" C)
cmake_minimum_required(VERSION 2.6)
set (PEEK_VERSION_MAJOR 0)
set (PEEK_VERSION_MINOR 7)
set (PEEK_VERSION_PATCH 2)
set (XDG_APPS_INSTALL_DIR share/applications)
set (GettextTranslate_GMO_BINARY TRUE)
set (GettextTranslate_ALL TRUE)
set (LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
# Include macros for Vala and GLib
list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
)
include(CTest)
include(FindVala)
include(UseVala)
include(GResource)
include(GettextTranslate)
# Check dependencies
find_package(Vala 0.22 REQUIRED)
find_package(PkgConfig)
pkg_check_modules(GTK REQUIRED gtk+-3.0>=3.14)
add_definitions(${GTK_CFLAGS} ${GTK_CFLAGS_OTHER})
link_libraries(${GTK_LIBRARIES})
link_directories(${GTK_LIBRARY_DIRS})
pkg_check_modules(GLIB2 REQUIRED glib-2.0>=2.38)
pkg_check_modules(CAIRO REQUIRED cairo)
pkg_check_modules(GMODULE REQUIRED gmodule-2.0)
# 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
)
# Compile Vala to C
vala_precompile(VALA_C
src/main.vala
src/application.vala
src/application-window.vala
src/about-dialog.vala
src/preferences-dialog.vala
src/desktop-integration.vala
src/recording/screen-recorder.vala
src/recording/recording-area.vala
src/recording/command-line-screen-recorder.vala
#src/recording/avconv-screen-recorder.vala
src/recording/ffmpeg-screen-recorder.vala
PACKAGES
gtk+-3.0
posix
CUSTOM_VAPIS
src/vapi/config.vapi
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(-DVERSION="${PEEK_VERSION_MAJOR}.${PEEK_VERSION_MINOR}.${PEEK_VERSION_PATCH}")
add_definitions(-Wno-deprecated-declarations)
add_executable(${PROJECT_NAME} ${VALA_C} ${GLIB_RESOURCES})
# Installation
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
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 "Peek - an animated GIF recorder")
set(CPACK_PACKAGE_VENDOR "")
set(CPACK_PACKAGE_CONTACT "Philipp Wolfer <[email protected]>")
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 (>= 3.14), libglib2.0-0 (>= 2.38), ffmpeg, imagemagick")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_SECTION "video")
include(CPack)