/
CMakeLists.txt
108 lines (83 loc) · 2.27 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
## Build poppler ##
## Basic variables ##
include_directories (
"${PROJECT_BINARY_DIR}/src"
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/src/util"
${xournalpp_INCLUDE_DIRS}
)
# Build xournal-thumbnailer as it doesn't need CXX_FLAGS from below
add_subdirectory (xoj-preview-extractor)
# Used for both util and xournalpp targets
add_definitions (-g -Wreturn-type -Wuninitialized -Wunused-value -Wunused-variable)
if (WIN32)
# optimize for size (the Windows .exe is really big)
set (xournalpp_LDFLAGS ${xournalpp_LDFLAGS} "-Os -s")
elseif (APPLE)
# Nothing to do for APPLE
else ()
add_definitions (-rdynamic)
endif ()
option (DEBUG_COMPILE "Pass -Wall to CXX_FLAGS" OFF)
mark_as_advanced (FORCE DEBUG_COMPILE)
if (DEBUG_COMPILE)
add_definitions (-Wall)
endif (DEBUG_COMPILE)
if (DEV_ENABLE_GCOV)
add_definitions (--coverage)
endif (DEV_ENABLE_GCOV)
# Used to compile xournalpp and xournalpp-test
set (xournalpp_LDFLAGS
util
${xournalpp_LDFLAGS}
)
## Build util lib ##
add_subdirectory (util)
## Sources ##
# These dirs are xournalpp only so it's safe to add then recursively
unset (xournalpp_SOURCES_RECURSE)
file (GLOB_RECURSE xournalpp_SOURCES_RECURSE
control/*.cpp
enums/*.cpp
gui/*.cpp
io/*.cpp
model/*.cpp
plugin/*.cpp
undo/*.cpp
view/*.cpp
)
# Here GLOB_RECURSE wouldn't be safe
unset (xournalpp_SOURCES)
file (GLOB xournalpp_SOURCES
pdf/base/*.cpp
)
# Concatenate SOURCES lists
set (xournalpp_SOURCES ${xournalpp_SOURCES_RECURSE} ${xournalpp_SOURCES})
unset (xournalpp_SOURCES_RECURSE)
file (GLOB xournalpp_SOURCES_RECURSE
pdf/popplerapi/*.cpp
)
# Concatenate SOURCES lists
set (xournalpp_SOURCES ${xournalpp_SOURCES_RECURSE} ${xournalpp_SOURCES})
unset (xournalpp_SOURCES_RECURSE)
## Core library ##
# Used for xournalpp and xournalpp-test
add_library (xournalpp-core OBJECT ${xournalpp_SOURCES})
add_dependencies (xournalpp-core util)
## xournalpp main program ##
add_executable (xournalpp
$<TARGET_OBJECTS:xournalpp-core>
Xournalpp.cpp
)
add_dependencies (xournalpp
xournalpp-core
util
)
target_link_libraries (xournalpp ${xournalpp_LDFLAGS})
install (TARGETS xournalpp
RUNTIME DESTINATION bin
COMPONENT xournalpp
)
if (ENABLE_CPPUNIT)
add_subdirectory (${CMAKE_SOURCE_DIR}/test ${CMAKE_BINARY_DIR}/test)
endif (ENABLE_CPPUNIT)