-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
137 lines (112 loc) · 4.47 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
project("gablabel" C)
cmake_minimum_required(VERSION 2.8)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
#
# Application information
#
set(PACKAGE_NAME ${PROJECT_NAME})
set(PACKAGE_VERSION_MAJOR "0")
set(PACKAGE_VERSION_MINOR "1")
set(PACKAGE_VERSION_PATCH "1")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(PACKAGE_STRING "Gablabel ${PACKAGE_VERSION}")
set (GETTEXT_PACKAGE ${PROJECT_NAME})
#
# Directories
#
set (DATADIR_ROOT "${CMAKE_INSTALL_PREFIX}/share")
set (DATADIR "${DATADIR_ROOT}/gablabel")
set(LOCALEDIR "${DATADIR_ROOT}/locale")
add_custom_target (uninstall "${CMAKE_COMMAND}" -P
"${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake")
#
# config.h
#
configure_file (${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
add_definitions(-include config.h)
#
# Data
#
file (GLOB _datafiles "${CMAKE_CURRENT_SOURCE_DIR}/data/gablabel/*")
install (FILES ${_datafiles} DESTINATION "share/gablabel")
#
# i18n
#
find_package (Gettext REQUIRED)
file (GLOB _translations ${CMAKE_SOURCE_DIR}/po/*.po)
GETTEXT_CREATE_TRANSLATIONS (${CMAKE_SOURCE_DIR}/po/${PROJECT_NAME}.pot ALL ${_translations})
#
# Install internationalized desktop file
#
install(CODE "execute_process(COMMAND intltool-merge -d po \"${CMAKE_SOURCE_DIR}/data/gablabel.desktop.in\" \"${CMAKE_BINARY_DIR}/gablabel.desktop\" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_QUIET)")
install(CODE "message (STATUS \"Generating translated gablabel.desktop\")")
install(FILES ${CMAKE_BINARY_DIR}/gablabel.desktop DESTINATION "share/applications")
#
# Source Code
#
find_package(PkgConfig)
pkg_check_modules(DEPS REQUIRED gobject-2.0 glib-2.0 gio-2.0 gtk+-2.0 webkit-1.0 appindicator-0.1 gee-1.0 x11 gdk-x11-2.0)
add_definitions(${DEPS_CFLAGS})
link_libraries(${DEPS_LIBRARIES})
link_directories(${DEPS_LIBRARY_DIRS})
find_package(Vala REQUIRED)
include(ValaVersion)
ensure_vala_version("0.11.0" MINIMUM)
set(VALA_SRC
src/Application.vala
src/MainWindow.vala
src/StatusIconManager.vala
src/TranslatorWebView.vala
src/KeyBindingManager.vala
src/PreferencesDialogManager.vala
)
include(ValaPrecompile)
vala_precompile(VALA_C
${VALA_SRC}
PACKAGES
config
gee-1.0
gdk-x11-2.0
x11
webkit-1.0
gtk+-2.0
appindicator-0.1
OPTIONS
--vapidir "${CMAKE_SOURCE_DIR}/vapi"
)
add_executable(gablabel ${VALA_C})
target_link_libraries(gablabel -lm)
target_link_libraries(gablabel ${LIBS})
install(TARGETS gablabel RUNTIME DESTINATION bin)
#
# GSettings Schema
#
include(GSettings)
add_schema("data/es.nohal.Gablabel.gschema.xml")
#
# Icons
#
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/16.png" DESTINATION "share/icons/hicolor/16x16/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/22.png" DESTINATION "share/icons/hicolor/22x22/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/24.png" DESTINATION "share/icons/hicolor/24x24/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/32.png" DESTINATION "share/icons/hicolor/32x32/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/36.png" DESTINATION "share/icons/hicolor/36x36/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/64.png" DESTINATION "share/icons/hicolor/64x64/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/96.png" DESTINATION "share/icons/hicolor/96x96/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/256.png" DESTINATION "share/icons/hicolor/256x256/apps" RENAME gablabel.png)
install(FILES "${CMAKE_SOURCE_DIR}/data/icons/scalable.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME gablabel.svg)
#
# Packaging
#
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Damián Nohales")
SET(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gablabel text translator\n Gablabel is a simplified and improved interface for Google Translator that's allows you to translate text into many languages.")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
SET(CPACK_DEBIAN_PACKAGE_SECTION "utils")
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/eagleoneraptor/gablabel")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libglib2.0-0 (>= 2.24.0), libgtk2.0-0 (>= 2.20.0), libgee2 (>= 0.6.0), libx11-6, libwebkitgtk-1.0-0, libappindicator1")
INCLUDE(CPack)