-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
236 lines (184 loc) · 6.89 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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
# Copyright (C) 2019 Jimmy Aguilar Mena
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.0)
project (qemacs VERSION 5.2)
option (ENABLE_TINY "Build a very small version" OFF)
option (ENABLE_GPROF "Add gprof build flags" OFF)
option (ENABLE-ATARI "enable atari cross compile" OFF)
option (ENABLE-WIN32 "enable win32 cross compile" OFF)
option (ENABLE-CYGWIN "compile for cygwin systems" OFF)
option (ENABLE-TESTS "compile tests and test support" ON)
include (CMakeDependentOption)
include (GNUInstallDirs)
include (CheckFunctionExists)
cmake_dependent_option(ENABLE_X11
"Enable Xwindow support" ON "NOT ENABLE_TINY" OFF)
cmake_dependent_option(ENABLE_DOC
"Build documentation" ON "NOT ENABLE_TINY" OFF)
cmake_dependent_option (ENABLE_XV
"Enable Xvideo extension support" ON "ENABLE_X11" OFF)
cmake_dependent_option (ENABLE_XSHM
"Enable XShm extension support" ON "ENABLE_X11" OFF)
cmake_dependent_option (ENABLE_XFT
"Enable Xft extension support" ON "ENABLE_X11" OFF)
cmake_dependent_option (ENABLE_XRENDER
"Enable Xrender extension support" ON "ENABLE_X11" OFF)
cmake_dependent_option (ENABLE_HTML
"Disable graphical html support" ON "NOT ENABLE_TINY;NOT WIN32" OFF)
cmake_dependent_option (ENABLE_PNG
"Enable png support" ON "NOT ENABLE_TINY" OFF)
cmake_dependent_option (ENABLE_PLUGINS
"Enable plugins support" ON "NOT ENABLE_TINY;NOT WIN32" OFF)
cmake_dependent_option (ENABLE_FFMPEG
"Enable ffmpeg support" ON "NOT ENABLE_TINY" OFF)
# End command lines
set (CONFIG_HAS_TYPEOF true)
set (CONFIG_PTSNAME true)
set (QE_VERSION ${PROJECT_VERSION})
set (CONFIG_QE_PREFIX "${CMAKE_INSTALL_PREFIX}")
set (CONFIG_QE_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
set (CONFIG_QE_MANDIR "${CMAKE_INSTALL_FULL_MANDIR}")
set (CONFIG_QE_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
if (CMAKE_BUILD_TYPE STREQUAL Debug)
set (CONFIG_QE_PLUGINS_DIR "${PROJECT_BINARY_DIR}/plugins")
endif ()
add_definitions (-DHAVE_QE_CONFIG_H)
# Sources
if (ENABLE_TINY)
set (QE_DEFINITION "CONFIG_TINY")
set (SOURCES ${SOURCES} parser.c)
else ()
set (CONFIG_ALL_KMAPS true)
set (CONFIG_UNICODE_JOIN true)
if (ENABLE_PLUGINS AND CMAKE_DL_LIBS)
set (CONFIG_DLL true)
set (LIBS ${LIBS} ${CMAKE_DL_LIBS})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
endif ()
endif ()
set (CMAKE_C_FLAGS_RELEASE
"${CMAKE_C_FLAGS_RELEASE} -Wall -O2 -funsigned-char -Wno-format-zero-length")
set (CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} -Wall -g -O0 -funsigned-char -Wno-format-zero-length")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g")
if (ENABLE_GPROF)
set (CONFIG_HAVE_GPROF true)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
endif ()
if (ENABLE_PNG)
find_package (PNG)
if (PNG_FOUND)
set (CONFIG_PNG_OUTPUT true)
endif ()
endif ()
CHECK_FUNCTION_EXISTS(mmap CONFIG_MMAP)
CHECK_FUNCTION_EXISTS(putc_unlocked CONFIG_UNLOCK_PUTC)
CHECK_FUNCTION_EXISTS(fwrite_unlocked CONFIG_UNLOCK_FWRITE)
CHECK_FUNCTION_EXISTS(fputs_unlocked CONFIG_UNLOCK_FPUTS)
if (WIN32)
set (CONFIG_WIN32 true)
set (CONFIG_INIT_CALLS false)
if (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
set (CONFIG_CYGWIN true)
endif ()
else ()
set (CONFIG_INIT_CALLS true)
set (CONFIG_NETWORK true)
set (LIBS ${LIBS} m)
if (APPLE)
set (CONFIG_DARWIN true)
elseif (CMAKE_SYSTEM_NAME STREQUAL Haiku)
set (CONFIG_HAIKU true)
set (CONFIG_HTML ${ENABLE_HTML})
set (ENABLE_X11 false)
set (LIBS ${LIBS} network be stdc++)
elseif (CMAKE_SYSTEM_NAME MATCHES "BSD")
set (CONFIG_BSD true)
set (CONFIG_PTSNAME false)
endif ()
if (ENABLE_X11)
find_package (X11)
if (X11_FOUND)
include_directories ("${X11_INCLUDE_DIR}")
set (CONFIG_HTML ${ENABLE_HTML})
set (QE_X11 ${X11_LIBRARIES})
set (QE_DEFINITION "CONFIG_X11")
if (ENABLE_XV AND X11_Xv_FOUND)
set (CONFIG_XV ${X11_Xv_FOUND})
set (QE_X11 ${QE_X11} ${X11_Xv_LIB})
endif ()
if (ENABLE_XSHM AND X11_XShm_FOUND)
set (CONFIG_XSHM ${X11_XShm_FOUND})
set (QE_X11 ${QE_X11} ${X11_Xext_LIB})
endif ()
if (ENABLE_XRENDER AND X11_Xrender_FOUND)
set (CONFIG_XRENDER ${X11_Xrender_FOUND})
set (QE_X11 ${QE_X11} ${X11_Xrender_LIB})
endif ()
if (ENABLE_XFT AND X11_Xft_FOUND)
find_package(Freetype QUIET)
if (FREETYPE_FOUND)
set(CONFIG_XFT TRUE)
include_directories("${FREETYPE_INCLUDE_DIRS}")
set (QE_X11 ${QE_X11} ${X11_Xft_LIB} ${FREETYPE_LIBRARIES})
endif ()
endif()
if (CONFIG_XFT)
find_package (PkgConfig REQUIRED)
pkg_check_modules (GLIB2 glib-2.0 gio-2.0)
if (GLIB2_FOUND)
set(CONFIG_GCONFIG true)
include_directories("${GLIB2_INCLUDE_DIRS}")
link_directories("${GLIB2_LIBRARY_DIRS}")
set (QE_X11 ${QE_X11} ${GLIB2_LIBRARIES})
endif ()
endif ()
endif ()
endif ()
endif ()
add_subdirectory (src)
# Doc
if (ENABLE_DOC)
add_subdirectory (doc)
endif ()
install (FILES config.eg DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
# CPack
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY
"qemacs (qe) - a small editor with some special features")
set (CPACK_PACKAGE_DESCRIPTION
"QEmacs is an terminal-based text editor (with Emacs look&feel) with
a small size and some unique features:
* Full screen editor with an Emacs compatible key subset (including undo and
incremental search) and emacs look and feel.
* Can edit huge files (e.g. 100MBytes) without being slow by using a highly
optimized internal representation and by mmaping the file.
* Full UTF8 support, including double width chars such as ideograms, provided
you have an UTF8 VT100 emulator such as a recent xterm.
* Bidirectional editing conforming to the Unicode Bidir algorithm (for Hebrew or
Arabic).
* Can optionally contain input methods from the Yudit editor for most
languages, including Chinese CJ, Hebrew and Arabic.
* Hexadecimal editing mode with insertion and block commands. Can edit binary
files as well as text files."
)
set (CPACK_PACKAGE_HOMEPAGE_URL "https://bellard.org/qemacs/")
# RPM
set (CPACK_RPM_PACKAGE_GROUP "Editors")
include(CPack)
if (ENABLE-TESTS)
enable_testing ()
add_subdirectory (tests)
endif ()