forked from debreate/debreate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
129 lines (108 loc) · 2.61 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
cmake_minimum_required(VERSION 3.5)
project(Debreate NONE)
find_package(PythonInterp 2.7 REQUIRED)
#include(FindPythonInterp)
#find_package(Gettext)
include(FindGettext)
set(DATA_ROOT "share")
set(DATA_DIR "${DATA_ROOT}/debreate")
set(APPS_DIR "${DATA_ROOT}/applications")
set(BITMAPS_DIR "${DATA_ROOT}/bitmaps")
# Make Python interpreter alterable
if(PYTHONINTERP_FOUND)
set(PYTHON_EXE ${PYTHON_EXECUTABLE})
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHON_EXECUTABLE ${PYTHON_EXE} CACHE FILEPATH "The Python interpreter")
endif()
option(
INSTALL_MENU_LAUNCHER
"Installs a .desktop file for executing Debreate from the system menu"
ON
)
option(
CONFIGURE_MIME_TYPES
"Associates .dbp & .dbpz project files with Debreate"
ON
)
set(
EXECUTABLE_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
# Executable script
install(
FILES init.py
DESTINATION ${DATA_DIR}
PERMISSIONS ${EXECUTABLE_PERMISSIONS}
)
install(
FILES main.py command_line.py
DESTINATION ${DATA_DIR}
)
install(
DIRECTORY dbr f_export fields globals input startup system ui wiz_bin wiz_src
DESTINATION ${DATA_DIR}
FILES_MATCHING
PATTERN *.py
)
# FIXME: Not all docs should be installed
install(
DIRECTORY bitmaps docs templates
DESTINATION ${DATA_DIR}
)
if(INSTALL_MENU_LAUNCHER)
install(
FILES data/debreate.desktop
DESTINATION ${APPS_DIR}
)
install(
FILES bitmaps/icon/64/logo.png
DESTINATION ${BITMAPS_DIR}
RENAME debreate.png
)
endif()
# Gettext locales
if(GETTEXT_FOUND)
option(
INSTALL_LOCALE_FILES
"Installs Gettext translation files to system locale directory"
ON
)
if(INSTALL_LOCALE_FILES)
install(
DIRECTORY locale
DESTINATION share
FILES_MATCHING
PATTERN *.mo
)
endif()
else()
message("Gettext not found, can't create locale files")
endif()
if(CONFIGURE_MIME_TYPES)
message("CONFIGURE_MIME_TYPES:\tON")
else()
message("CONFIGURE_MIME_TYPES:\tOFF")
endif()
# Write the Debreate executable
file(
WRITE "${CMAKE_BINARY_DIR}/bin/debreate"
"#!/bin/sh"
"\n\n${CMAKE_INSTALL_PREFIX}/${DATA_DIR}/init.py $@"
)
install(
FILES "${CMAKE_BINARY_DIR}/bin/debreate"
DESTINATION bin
PERMISSIONS ${EXECUTABLE_PERMISSIONS}
)
# Write the "INSTALLED" file
set(FILE_installed "${CMAKE_BINARY_DIR}/data/INSTALLED")
file(
WRITE "${FILE_installed}"
"prefix=${CMAKE_INSTALL_PREFIX}"
)
install(
FILES "${FILE_installed}"
DESTINATION "${DATA_DIR}"
)