-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
328 lines (286 loc) · 12.3 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
cmake_minimum_required(VERSION 3.5)
include(CryptoNoteWallet.cmake)
include(src/QREncode.cmake)
project(${CN_PROJECT_NAME})
execute_process(COMMAND git log -1 --pretty=format:%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REVISION)
set (CRYPTONOTE_LIB Cryptonote)
include_directories(${CMAKE_BINARY_DIR}
src
src/libqrencode
cli/include
cli/src)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
if(WIN32)
set(Boost_USE_STATIC_RUNTIME OFF)
else(WIN32)
set(Boost_USE_STATIC_RUNTIME ON)
endif(WIN32)
find_package(Boost 1.55 REQUIRED COMPONENTS date_time filesystem program_options regex serialization system thread chrono)
if ((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54))
message(SEND_ERROR "Boost version 1.54 is unsupported, more details are available here http://goo.gl/RrCFmA")
endif ()
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
set(VERSION "")
configure_file("cli/src/version.h.in" "version.h")
configure_file("src/CryptoNoteWalletConfig.h.in" "CryptoNoteWalletConfig.h")
add_definitions(-DVERSION=\"${CN_VERSION}\")
add_definitions(-DGIT_REVISION=\"${GIT_REVISION}\")
set(CMAKE_AUTOMOC ON)
set(CRYPTONOTE_SOURCES
cli/src/Common/Base58.cpp
cli/src/Common/CommandLine.cpp
cli/src/Common/Util.cpp
cli/src/Common/StringTools.cpp
cli/src/Common/JsonValue.cpp
cli/src/Common/ConsoleTools.cpp
cli/src/Common/MemoryInputStream.cpp
cli/src/Common/PathTools.cpp
cli/src/Common/StdInputStream.cpp
cli/src/Common/StdOutputStream.cpp
cli/src/Common/StreamTools.cpp
cli/src/Common/StringOutputStream.cpp
cli/src/Common/StringView.cpp
cli/src/Common/VectorOutputStream.cpp
cli/src/crypto/blake256.c
cli/src/crypto/chacha8.c
cli/src/crypto/crypto-ops-data.c
cli/src/crypto/crypto-ops.c
cli/src/crypto/crypto.cpp
cli/src/crypto/groestl.c
cli/src/crypto/hash-extra-blake.c
cli/src/crypto/hash-extra-groestl.c
cli/src/crypto/hash-extra-jh.c
cli/src/crypto/hash-extra-skein.c
cli/src/crypto/hash.c
cli/src/crypto/jh.c
cli/src/crypto/keccak.c
cli/src/crypto/oaes_lib.c
cli/src/crypto/random.c
cli/src/crypto/skein.c
cli/src/crypto/slow-hash.c
cli/src/crypto/slow-hash.cpp
cli/src/crypto/tree-hash.c
cli/src/CryptoNoteCore/BlockchainIndices.cpp
cli/src/CryptoNoteCore/BlockchainMessages.cpp
cli/src/CryptoNoteCore/BlockIndex.cpp
cli/src/CryptoNoteCore/CoreConfig.cpp
cli/src/CryptoNoteCore/CryptoNoteBasic.cpp
cli/src/CryptoNoteCore/CryptoNoteTools.cpp
cli/src/CryptoNoteCore/Currency.cpp
cli/src/CryptoNoteCore/MinerConfig.cpp
cli/src/CryptoNoteCore/Transaction.cpp
cli/src/CryptoNoteCore/Account.cpp
cli/src/CryptoNoteCore/Blockchain.cpp
cli/src/CryptoNoteCore/Checkpoints.cpp
cli/src/CryptoNoteCore/CryptoNoteBasicImpl.cpp
cli/src/CryptoNoteCore/Core.cpp
cli/src/CryptoNoteCore/CryptoNoteFormatUtils.cpp
cli/src/CryptoNoteCore/CryptoNoteSerialization.cpp
cli/src/CryptoNoteCore/Difficulty.cpp
cli/src/CryptoNoteCore/IBlock.cpp
cli/src/CryptoNoteCore/Miner.cpp
cli/src/CryptoNoteCore/TransactionExtra.cpp
cli/src/CryptoNoteCore/TransactionPool.cpp
cli/src/CryptoNoteCore/TransactionPrefixImpl.cpp
cli/src/CryptoNoteCore/TransactionUtils.cpp
cli/src/InProcessNode/InProcessNode.cpp
cli/src/InProcessNode/InProcessNodeErrors.cpp
cli/src/NodeRpcProxy/NodeErrors.cpp
cli/src/NodeRpcProxy/NodeRpcProxy.cpp
cli/src/P2p/NetNodeConfig.cpp
cli/src/Serialization/BinaryInputStreamSerializer.cpp
cli/src/Serialization/BinaryOutputStreamSerializer.cpp
cli/src/Serialization/JsonInputValueSerializer.cpp
cli/src/Serialization/JsonOutputStreamSerializer.cpp
cli/src/Serialization/KVBinaryInputStreamSerializer.cpp
cli/src/Serialization/KVBinaryOutputStreamSerializer.cpp
cli/src/Serialization/SerializationOverloads.cpp
cli/src/Transfers/BlockchainSynchronizer.cpp
cli/src/Transfers/SynchronizationState.cpp
cli/src/Transfers/TransfersConsumer.cpp
cli/src/Transfers/TransfersContainer.cpp
cli/src/Transfers/TransfersSubscription.cpp
cli/src/Transfers/TransfersSynchronizer.cpp
cli/src/Wallet/LegacyKeysImporter.cpp
cli/src/Wallet/WalletAsyncContextCounter.cpp
cli/src/Wallet/WalletErrors.cpp
cli/src/Wallet/WalletSerializationV1.cpp
cli/src/Wallet/WalletSerializationV2.cpp
cli/src/Wallet/WalletUtils.cpp
cli/src/WalletLegacy/KeysStorage.cpp
cli/src/WalletLegacy/WalletLegacy.cpp
cli/src/WalletLegacy/WalletHelper.cpp
cli/src/WalletLegacy/WalletLegacySerializer.cpp
cli/src/WalletLegacy/WalletLegacySerialization.cpp
cli/src/WalletLegacy/WalletTransactionSender.cpp
cli/src/WalletLegacy/WalletUnconfirmedTransactions.cpp
cli/src/WalletLegacy/WalletUserTransactionsCache.cpp
cli/src/System/ContextGroup.cpp
cli/src/System/Event.cpp
cli/src/System/EventLock.cpp
cli/src/System/InterruptedException.cpp
cli/src/System/Ipv4Address.cpp
cli/src/System/TcpStream.cpp
cli/src/HTTP/HttpRequest.cpp
cli/src/HTTP/HttpParser.cpp
cli/src/HTTP/HttpParserErrorCodes.cpp
cli/src/HTTP/HttpResponse.cpp
cli/src/Rpc/HttpClient.cpp
cli/src/Rpc/JsonRpc.cpp
cli/src/P2p/NetNode.cpp
cli/src/P2p/LevinProtocol.cpp
cli/src/P2p/NetNodeConfig.cpp
cli/src/P2p/PeerListManager.cpp
cli/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp
cli/src/Logging/ILogger.cpp
cli/src/Logging/LoggerGroup.cpp
cli/src/Logging/CommonLogger.cpp
cli/src/Logging/LoggerManager.cpp
cli/src/Logging/FileLogger.cpp
cli/src/Logging/StreamLogger.cpp
cli/src/Logging/ConsoleLogger.cpp
cli/src/Logging/LoggerMessage.cpp
cli/src/Logging/LoggerRef.cpp
cli/src/BlockchainExplorer/BlockchainExplorer.cpp
cli/src/BlockchainExplorer/BlockchainExplorerDataBuilder.cpp
cli/src/BlockchainExplorer/BlockchainExplorerErrors.cpp
)
file(GLOB_RECURSE SOURCES src/*.cpp)
file(GLOB_RECURSE HEADERS src/*.h)
file(GLOB_RECURSE FORMS src/gui/ui/*.ui)
file(GLOB_RECURSE Mnemonics cli/src/mnemonics/*)
set(QRC src/resources.qrc)
qt5_wrap_ui(UIS ${FORMS})
qt5_add_resources(RCC ${QRC})
if (WIN32)
if (NOT MSVC)
message(FATAL_ERROR "Only MSVC is supported on this platform")
endif ()
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DSTATICLIB)
include_directories(cli/src/platform/msc)
set(PLATFORM_DIR Windows)
set(BUILD_PLATFORM WIN32)
set(BUILD_RESOURCES src/cryptonotewallet.rc)
set(QTMAIN Qt5::WinMain)
elseif (UNIX)
# set(CRYPTONOTE_SOURCES ${CRYPTONOTE_SOURCES} cryptonote/external/miniupnpc/minissdpc.c)
if (APPLE)
enable_language(ASM)
file(GLOB_RECURSE OBJC_SOURCES src/*.mm)
set(SOURCES ${SOURCES} ${OBJC_SOURCES})
set(PLATFORM_DIR OSX)
set(MACOSX_BUNDLE_INFO_STRING "Prosus GUI wallet")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}")
set(MACOSX_BUNDLE_BUNDLE_NAME "ProsusMoney")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "$${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}")
find_package(Qt5PrintSupport REQUIRED)
include_directories(/usr/include/malloc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -std=c++11 -stdlib=libc++")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -maes -D_DARWIN_C_SOURCE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework OpenGL -framework CoreFoundation -framework Carbon -framework IOKit -L/usr/lib")
set(MACOSX_BUNDLE_ICON_FILE cryptonote.icns)
set(APPLICATION_ICON src/images/cryptonote.icns)
set_source_files_properties(${APPLICATION_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(BUILD_PLATFORM MACOSX_BUNDLE)
set(BUILD_RESOURCES ${APPLICATION_ICON})
GET_TARGET_PROPERTY(QT_LIB_DIR "${Qt5Widgets_LIBRARIES}" LOCATION)
GET_FILENAME_COMPONENT(QT_LIB_DIR "${QT_LIB_DIR}" PATH)
else(APPLE)
set(PLATFORM_DIR Linux)
list(REMOVE_ITEM HEADERS ${CMAKE_SOURCE_DIR}/src/gui/macdockiconhandler.h)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -std=c++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -std=c11")
endif (APPLE)
endif ()
include_directories(cli/src/Platform/${PLATFORM_DIR})
include_directories(cli/src/Platform/Posix)
file(GLOB PLATFORM_SOURCES cli/src/Platform/${PLATFORM_DIR}/System/*)
set(CRYPTONOTE_SOURCES ${CRYPTONOTE_SOURCES} ${PLATFORM_SOURCES})
add_library(${CRYPTONOTE_LIB} STATIC ${CRYPTONOTE_SOURCES})
add_library(Mnemonics ${Mnemonics})
set_target_properties(${CRYPTONOTE_LIB} PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE)
target_link_libraries(${CRYPTONOTE_LIB} ${Boost_LIBRARIES})
set_target_properties(Mnemonics PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE)
target_link_libraries(Mnemonics ${Boost_LIBRARIES})
add_executable(${PROJECT_NAME} ${BUILD_PLATFORM} ${BUILD_RESOURCES} ${SOURCES} ${HEADERS} ${UIS} ${RCC})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE)
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${QTMAIN} ${CRYPTONOTE_LIB} ${QRENCODE_LIB} Mnemonics)
if (APPLE)
qt5_use_modules(${PROJECT_NAME} PrintSupport)
elseif (UNIX)
target_link_libraries(${PROJECT_NAME} -lpthread)
elseif (WIN32)
target_link_libraries(${PROJECT_NAME} Imm32 Iphlpapi Winmm)
endif (APPLE)
qt5_use_modules(${PROJECT_NAME} Widgets Gui Network)
# Installation
set(CPACK_PACKAGE_NAME ${CN_PROJECT_NAME})
set(CPACK_PACKAGE_VERSION ${CN_VERSION})
set(CPACK_PACKAGE_VENDOR "prosus-project")
set(CPACK_PACKAGE_CONTACT "http://prosus.money")
set(CPACK_STRIP_FILES ON)
if (APPLE)
set(CPACK_GENERATOR DragNDrop)
install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION .)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${VERSION_RELEASE}")
elseif (UNIX)
find_program(RPMBUILD rpmbuild)
install(PROGRAMS build/${PROJECT_NAME} DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES src/prosuswallet.desktop DESTINATION share/applications)
install(FILES src/images/cryptonote.png DESTINATION share/pixmaps RENAME prosus.png)
install(FILES copyright DESTINATION share/doc/prosus)
if (NOT RPMBUILD)
set(CPACK_GENERATOR DEB)
set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set(CPACK_SYSTEM_NAME 64-bit)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_SECTION Office)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Prosus wallet
Prosus is a decentralized, privacy oriented peer-to-peer
cryptocurrency. It is open-source, nobody owns or controls Prosus
and everyone can take part.")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${VERSION_RELEASE}${CPACK_SYSTEM_NAME}")
else()
set(CPACK_GENERATOR RPM)
set(CPACK_SYSTEM_NAME x86_64)
set(CPACK_RPM_PACKAGE_RELEASE ${VERSION_RELEASE})
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_RPM_PACKAGE_GROUP Office)
set(CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase >= 5.3.2, qt5-qtbase-gui >= 5.3.2")
set(CPACK_RPM_PACKAGE_SUMMARY "Prosus wallet")
set(CPACK_RPM_PACKAGE_DESCRIPTION " __ Prosus Money __
Prosus is a decentrilized, privacy oriented peer-to-peer
cryptocurrency. It is open-source, nobody owns or controls Prosus
and everyone can take part.")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${VERSION_RELEASE}${CPACK_SYSTEM_NAME}")
endif ()
elseif (WIN32)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION .)
set(CPACK_GENERATOR ZIP)
endif (APPLE)
include(CPack)
set (FILES_TO_TRANSLATE )
set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCES} ${HEADERS} ${FORMS} PARENT_SCOPE)
#----------
file (GLOB TRANSLATIONS_FILES src/languages/*.ts)
option (UPDATE_TRANSLATIONS "Actualizando traducciones en src/languages/*.ts")
if (UPDATE_TRANSLATIONS)
qt5_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
else (UPDATE_TRANSLATIONS)
qt5_add_translation(QM_FILES ${TRANSLATIONS_FILES})
endif (UPDATE_TRANSLATIONS)
add_custom_target (translations_target DEPENDS ${QM_FILES})
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/src/languages)
# prevent the generated files from being deleted during make clean
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)
#----------