blob: a574f33117a52f69fc23eaf2ec05ae8321ce9923 (
plain)
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
|
project(libcsync)
set(CMAKE_AUTOMOC TRUE)
# global needed variables
set(APPLICATION_NAME "ocsync")
set(LIBRARY_VERSION ${MIRALL_VERSION})
set(LIBRARY_SOVERSION "0")
# add definitions
include(DefineCMakeDefaults)
include(DefinePlatformDefaults)
include(DefineCompilerFlags)
include(DefineOptions.cmake)
include(DefineInstallationPaths)
# add macros
include(MacroAddPlugin)
include(MacroCopyFile)
find_package(SQLite3 3.8.0 REQUIRED)
include(ConfigureChecks.cmake)
include(../common/common.cmake)
if (MEM_NULL_TESTS)
add_definitions(-DCSYNC_MEM_NULL_TESTS)
endif (MEM_NULL_TESTS)
# Statically include sqlite
set(CSYNC_PUBLIC_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/std
${CMAKE_SOURCE_DIR}
CACHE INTERNAL "csync public include directories"
)
set(CSYNC_PRIVATE_INCLUDE_DIRS
${SQLITE3_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
)
set(CSYNC_LIBRARY
ocsync
CACHE INTERNAL "ocsync library"
)
set(CSYNC_LINK_LIBRARIES
${CSYNC_REQUIRED_LIBRARIES}
${SQLITE3_LIBRARIES}
)
# Specific option for builds tied to servers that do not support renaming extensions
set(NO_RENAME_EXTENSION 0 CACHE BOOL "Do not issue rename if the extension changes")
if(NO_RENAME_EXTENSION)
add_definitions(-DNO_RENAME_EXTENSION)
endif()
set(csync_SRCS
csync.cpp
csync_exclude.cpp
csync_log.cpp
csync_time.c
csync_util.cpp
csync_misc.cpp
csync_update.cpp
csync_reconcile.cpp
csync_rename.cpp
vio/csync_vio.cpp
std/c_alloc.c
std/c_path.c
std/c_string.c
std/c_time.c
std/c_utf8.cpp
)
if (WIN32)
list(APPEND csync_SRCS
vio/csync_vio_local_win.cpp
)
else()
list(APPEND csync_SRCS
vio/csync_vio_local_unix.cpp
)
endif()
if(NOT HAVE_ASPRINTF AND NOT HAVE___MINGW_ASPRINTF)
list(APPEND csync_SRCS std/asprintf.c)
endif()
configure_file(csync_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/csync_version.h)
# Statically include sqlite
if (USE_OUR_OWN_SQLITE3)
list(APPEND csync_SRCS ${SQLITE3_SOURCE})
if (WIN32)
# We want to export sqlite symbols from the ocsync DLL without
# having to patch both sqlite3.h and the amalgation sqlite3.c,
# so do the import/export magic manually through the build system.
remove_definitions(-DSQLITE_API=__declspec\(dllimport\))
add_definitions(-DSQLITE_API=__declspec\(dllexport\))
endif()
endif()
add_library(${CSYNC_LIBRARY} SHARED ${common_SOURCES} ${csync_SRCS})
#add_library(${CSYNC_LIBRARY}_static STATIC ${csync_SRCS})
target_include_directories(
${CSYNC_LIBRARY}
PUBLIC ${CSYNC_PUBLIC_INCLUDE_DIRS}
PRIVATE ${CSYNC_PRIVATE_INCLUDE_DIRS}
)
generate_export_header( ${CSYNC_LIBRARY}
EXPORT_MACRO_NAME OCSYNC_EXPORT
EXPORT_FILE_NAME ocsynclib.h
)
target_link_libraries(${CSYNC_LIBRARY} ${CSYNC_LINK_LIBRARIES})
#target_link_libraries(${CSYNC_LIBRARY}_static ${CSYNC_LINK_LIBRARIES})
if(ZLIB_FOUND)
target_link_libraries(${CSYNC_LIBRARY} ZLIB::ZLIB)
endif(ZLIB_FOUND)
find_package(Qt5Core REQUIRED)
qt5_use_modules(${CSYNC_LIBRARY} Core Concurrent)
# For src/common/utility_mac.cpp
if (APPLE)
find_library(FOUNDATION_LIBRARY NAMES Foundation)
find_library(CORESERVICES_LIBRARY NAMES CoreServices)
target_link_libraries(${CSYNC_LIBRARY} ${FOUNDATION_LIBRARY} ${CORESERVICES_LIBRARY})
endif()
set_target_properties(
${CSYNC_LIBRARY}
PROPERTIES
VERSION
${LIBRARY_VERSION}
SOVERSION
${LIBRARY_SOVERSION}
RUNTIME_OUTPUT_DIRECTORY
${BIN_OUTPUT_DIRECTORY}
)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
INSTALL(
TARGETS
${CSYNC_LIBRARY}
LIBRARY DESTINATION
${LIB_INSTALL_DIR}
ARCHIVE DESTINATION
${LIB_INSTALL_DIR}
RUNTIME DESTINATION
${BIN_INSTALL_DIR}
)
else()
INSTALL(
TARGETS
${CSYNC_LIBRARY}
LIBRARY DESTINATION
${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE}
ARCHIVE DESTINATION
${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE}
RUNTIME DESTINATION
${BIN_INSTALL_DIR}/${APPLICATION_EXECUTABLE}
)
endif()
configure_file(config_csync.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_csync.h)
|