forked from Zerocoin/libzerocoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
186 lines (158 loc) · 4.09 KB
/
CMakeLists.txt
File metadata and controls
186 lines (158 loc) · 4.09 KB
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
# Copyright 2013 Corgan Labs
# This file is part of the Zerocoin project
# See LICENSE file or http://opensource.org/licenses/MIT for terms
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. This is bad practice.")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
#
# Setup overall project
#
cmake_minimum_required(VERSION 2.8)
project(zerocoin)
# Appended to CMAKE_INSTALL_PREFIX
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
#
# Project-wide package dependencies
#
# Find and configure the Boost C++ libraries
include(BoostConfig)
# Find and configure OpenSSL crypto library
include(FindOpenSSL)
#
# Project-wide directory settings
#
set(BITCOIN_BIGNUM_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/bitcoin_bignum)
#
# Project-wide installation settings
#
set(ZEROCOIN_INCLUDE_DIR include/zerocoin)
set(ZEROCOIN_BIN_DIR bin)
set(ZEROCOIN_LIB_DIR lib)
#
# pkg-config substitution variables
#
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" prefix)
file(TO_NATIVE_PATH "\${prefix}" exec_prefix)
file(TO_NATIVE_PATH "\${exec_prefix}/${ZEROCOIN_LIB_DIR}" libdir)
file(TO_NATIVE_PATH "\${prefix}/${ZEROCOIN_INCLUDE_DIR}" includedir)
#
# Add individual directories to project
#
#add_subdirectory(foo)
#
# Create uninstall target
#
configure_file(
${CMAKE_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY)
add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
########################################################################
# Shared library generation libzerocoin.so
########################################################################
#
# Tell compiler where to search for include files
#
include_directories(
${BITCOIN_BIGNUM_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
)
#
# Tell linker where to look for library files
#
link_directories(
${Boost_LIBRARY_DIRS}
)
#
# List of libraries to link in
#
list(APPEND zerocoin_libs
${Boost_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARY}
)
#
# List of source files to compile
#
list(APPEND zerocoin_sources
Accumulator.cpp
AccumulatorProofOfKnowledge.cpp
Coin.cpp
CoinSpend.cpp
Commitment.cpp
ParamGeneration.cpp
Params.cpp
SerialNumberSignatureOfKnowledge.cpp
SpendMetaData.cpp
)
#
# Create shared library libzerocoin.so
#
add_library(zerocoin SHARED ${zerocoin_sources})
target_link_libraries(zerocoin ${zerocoin_libs})
#
# Install shared library
#
install(TARGETS zerocoin
LIBRARY DESTINATION ${ZEROCOIN_LIB_DIR}
)
#
# Install header files
#
install(FILES
bitcoin_bignum/allocators.h
bitcoin_bignum/bignum.h
bitcoin_bignum/clientversion.h
bitcoin_bignum/compat.h
bitcoin_bignum/hash.h
bitcoin_bignum/netbase.h
bitcoin_bignum/serialize.h
bitcoin_bignum/uint256.h
bitcoin_bignum/version.h
DESTINATION ${ZEROCOIN_INCLUDE_DIR}/bitcoin_bignum
)
install(FILES
Accumulator.h
AccumulatorProofOfKnowledge.h
Coin.h
CoinSpend.h
Commitment.h
ParamGeneration.h
Params.h
SerialNumberSignatureOfKnowledge.h
SpendMetaData.h
Zerocoin.h
DESTINATION ${ZEROCOIN_INCLUDE_DIR}
)
#
# Create pkg-config file
#
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/zerocoin.pc.in
${CMAKE_CURRENT_BINARY_DIR}/zerocoin.pc
@ONLY)
#
# Install pkg-config file
#
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/zerocoin.pc
DESTINATION ${ZEROCOIN_LIB_DIR}/pkgconfig
)
########################################################################
# Executable files
########################################################################
add_executable(paramgen paramgen.cpp)
target_link_libraries(paramgen zerocoin)
add_executable(benchmark Benchmark.cpp)
target_link_libraries(benchmark zerocoin)
add_executable(test Tests.cpp)
target_link_libraries(test zerocoin)
add_executable(tutorial Tutorial.cpp)
target_link_libraries(tutorial zerocoin)