-
Notifications
You must be signed in to change notification settings - Fork 62
/
CMakeLists.txt
232 lines (184 loc) · 6.25 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
# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*-
cmake_minimum_required(VERSION 2.8.11)
# Project name
project(notekit)
# This setting is useful for providing JSON file used by CodeLite for code completion
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CONFIGURATION_NAME "Release")
set(CL_WORKSPACE_DIRECTORY .)
# Set default locations
set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/${CL_WORKSPACE_DIRECTORY}/cmake-build-${CONFIGURATION_NAME}/output)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY})
# Projects
# Top project
# Define some variables
set(PROJECT_notekit_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/")
#{{{{ User Code 1
option (HAVE_LASEM "Use lasem-0.6 library to render LaTeX math" OFF)
set (LASEM_PATH "${CMAKE_CURRENT_LIST_DIR}/lasem/" CACHE STRING "Base path for lasem-0.6")
option (HAVE_CLATEXMATH "Use cLaTeXMath to render LaTeX math" OFF)
set (CLATEXMATH_PATH "${CMAKE_CURRENT_LIST_DIR}/cLaTeXMath/" CACHE STRING "Base path for cLaTeXMath")
option (MIGRATE_LEGACY_SETTINGS "Migrate settings from legacy config file" ON)
set(DEFAULT_SETTINGS_PROVIDER "json" CACHE STRING "GSettings backend")
set_property(CACHE DEFAULT_SETTINGS_PROVIDER PROPERTY STRINGS json gio)
set (LATEX_COMMENT_START "<!--")
set (LATEX_COMMENT_END "-->")
if (HAVE_LASEM)
include_directories("${LASEM_PATH}/src/")
set (LATEX_COMMENT_START "")
set (LATEX_COMMENT_END "")
endif (HAVE_LASEM)
if (HAVE_CLATEXMATH)
include_directories("${CLATEXMATH_PATH}/src/")
set (LATEX_COMMENT_START "")
set (LATEX_COMMENT_END "")
find_package(PkgConfig)
# due to
# https://github.com/NanoMichael/cLaTeXMath/pull/68
# https://github.com/NanoMichael/cLaTeXMath/pull/70
# we have to link tinyxml2 manually now
pkg_check_modules(tinyxml2 tinyxml2)
endif (HAVE_CLATEXMATH)
configure_file (
"${CMAKE_CURRENT_LIST_DIR}/config.h.in"
"${CMAKE_CURRENT_LIST_DIR}/config.h"
)
configure_file (
"${CMAKE_CURRENT_LIST_DIR}/sourceview/markdown.lang.in"
"${CMAKE_CURRENT_LIST_DIR}/sourceview/markdown.lang"
)
execute_process (COMMAND pkg-config gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/gnome/com.github.blackhole89.notekit.gschema.xml ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
if (_schemas_invalid)
message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
endif (_schemas_invalid)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/data/gschemas.compiled"
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/gnome"
COMMAND
"${_glib_comple_schemas}"
ARGS
"${CMAKE_CURRENT_LIST_DIR}/gnome"
"--targetdir=${CMAKE_CURRENT_LIST_DIR}/data"
DEPENDS
"${CMAKE_CURRENT_LIST_DIR}/gnome/com.github.blackhole89.notekit.gschema.xml"
VERBATIM
)
add_custom_target(schema SOURCES "${CMAKE_CURRENT_LIST_DIR}/data/gschemas.compiled")
#}}}}
include_directories(
.
.
)
# Compiler options
execute_process(COMMAND
pkg-config --cflags gtkmm-3.0
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_1)
execute_process(COMMAND
pkg-config --cflags gtksourceviewmm-3.0
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_2)
execute_process(COMMAND
pkg-config --cflags jsoncpp
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_3)
execute_process(COMMAND
pkg-config --cflags fontconfig
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_4)
add_definitions(${CL_VAR_1})
add_definitions(${CL_VAR_2})
add_definitions(${CL_VAR_3})
add_definitions(${CL_VAR_4})
add_definitions(-std=c++17)
add_definitions(-O2)
add_definitions(-Wall)
add_definitions(
-DNDEBUG
)
# Linker options
execute_process(COMMAND
pkg-config --libs gtkmm-3.0
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_5)
execute_process(COMMAND
pkg-config --libs gtksourceviewmm-3.0
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_6)
execute_process(COMMAND
pkg-config --libs jsoncpp
OUTPUT_VARIABLE
CL_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(STRIP ${CL_TMP_VAR} CL_VAR_7)
set(LINK_OPTIONS ${CL_VAR_5})
set(LINK_OPTIONS ${LINK_OPTIONS} ${CL_VAR_6})
set(LINK_OPTIONS ${LINK_OPTIONS} ${CL_VAR_7})
if(WIN32)
# Resource options
endif(WIN32)
# Library path
link_directories(
.
)
# Define the CXX sources
set ( CXX_SRCS
${CMAKE_CURRENT_LIST_DIR}/settings.cpp
${CMAKE_CURRENT_LIST_DIR}/mainwindow.cpp
${CMAKE_CURRENT_LIST_DIR}/main.cpp
${CMAKE_CURRENT_LIST_DIR}/navigation.cpp
${CMAKE_CURRENT_LIST_DIR}/imagewidgets.cpp
${CMAKE_CURRENT_LIST_DIR}/notebook.cpp
${CMAKE_CURRENT_LIST_DIR}/drawing.cpp
${CMAKE_CURRENT_LIST_DIR}/about.cpp
)
set_source_files_properties(
${CXX_SRCS} PROPERTIES COMPILE_FLAGS
" -std=c++17 -pthread -pthread -O2 -Wall")
if(WIN32)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> ${RC_OPTIONS} -O coff -i <SOURCE> -o <OBJECT>")
endif(WIN32)
#{{{{ User Code 2
if (HAVE_LASEM)
set(LINK_OPTIONS -L${LASEM_PATH}/src/.libs/ -l:liblasem-0.6.a ${LINK_OPTIONS})
endif (HAVE_LASEM)
if (HAVE_CLATEXMATH)
set(LINK_OPTIONS -L${CLATEXMATH_PATH}/ -l:libLaTeX.a -l${tinyxml2_LIBRARIES} ${LINK_OPTIONS})
endif (HAVE_CLATEXMATH)
#}}}}
add_executable(notekit ${RC_SRCS} ${CXX_SRCS} ${C_SRCS})
target_link_libraries(notekit ${LINK_OPTIONS})
target_link_libraries(notekit
z
fontconfig
)
#{{{{ User Code 3
if (HAVE_LASEM)
target_link_libraries(notekit xml2)
endif (HAVE_LASEM)
if (HAVE_CLATEXMATH)
target_link_libraries(notekit fontconfig)
endif (HAVE_CLATEXMATH)
add_dependencies(notekit schema)
install(TARGETS notekit DESTINATION bin)
install(DIRECTORY data DESTINATION share/notekit)
install(DIRECTORY sourceview DESTINATION share/notekit)
#}}}}