forked from XDagger/xdag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
163 lines (144 loc) · 4.57 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
cmake_minimum_required(VERSION 3.7)
# Use a different compiler
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
# it must be done before any language is set (before project|enable_language command)
# set(CMAKE_C_COMPILER "gcc-7")
# set(CMAKE_CXX_COMPILER "g++-7")
# usually avoid this by using environment variables:
# mkdir build-gcc && cd build-gcc && CC=gcc-7 CXX=g++-7 cmake ..
project(daggercoin)
enable_language(C ASM)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "-std=gnu11 -O3 -g -Wall -Wmissing-prototypes -Wno-unused-result")
#set(CMAKE_C_FLAGS "-std=gnu11 -O3 -DDFSTOOLS -DCHEATCOIN -DNDEBUG -g -lpthread -lcrypto -lssl -lm -Wall -Wmissing-prototypes -Wno-unused-result")
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl/include/openssl")
find_package(OpenSSL REQUIRED)
set(BUILD_DIR "/Users/dx/study/xdag/xdagread/xdag/client") #设置编译目录,也就是Makefile文件所在目录
include_directories(
${OPENSSL_INCLUDE_DIR}
)
#add_subdirectory(test/test_address)
#add_subdirectory(test/test_block)
#set(DAGGER_SOURCES
# cheatcoin/address.c
# cheatcoin/block.c
# cheatcoin/crypt.c
# cheatcoin/hash.c
# cheatcoin/log.c
# cheatcoin/main.c
# cheatcoin/memory.c
# cheatcoin/netdb.c
# cheatcoin/pool.c
# cheatcoin/sha256.c
# cheatcoin/storage.c
# cheatcoin/sync.c
# cheatcoin/transport.c
# cheatcoin/wallet.c
# dnet/dnet_crypt.c
# dnet/dnet_database.c
# dnet/dnet_main.c
# dnet/dnet_threads.c
# dnet/dnet_connection.c
# dnet/dnet_stream.c
# dnet/dnet_packet.c
# dnet/dnet_command.c
# dnet/dnet_log.c
# dnet/dnet_files.c
# dnet/dnet_tap.c
# dus/programs/dfstools/source/dfslib/dfslib_crypt.c
# dus/programs/dfstools/source/dfslib/dfslib_random.c
# dus/programs/dfstools/source/dfslib/dfslib_string.c
# dus/programs/dfstools/source/lib/dfsrsa.c
# dus/programs/dar/source/lib/crc_c.c
# )
#set(DAGGER_HEADERS
# cheatcoin/address.h
# cheatcoin/block.h
# cheatcoin/crypt.h
# cheatcoin/hash.h
# cheatcoin/log.h
# cheatcoin/main.h
# cheatcoin/memory.h
# cheatcoin/netdb.h
# cheatcoin/pool.h
# cheatcoin/sha256.h
# cheatcoin/state.h
# cheatcoin/storage.h
# cheatcoin/sync.h
# cheatcoin/transport.h
# cheatcoin/wallet.h
# dnet/dnet_crypt.h
# dnet/dnet_database.h
# dnet/dnet_history.h
# dnet/dnet_threads.h
# dnet/dnet_connection.h
# dnet/dnet_stream.h
# dnet/dnet_packet.h
# dnet/dnet_command.h
# dnet/dnet_log.h
# dnet/dnet_files.h
# dnet/dnet_tap.h
# dnet/dthread.h
# dus/programs/dfstools/source/dfslib/dfslib_crypt.h
# dus/programs/dfstools/source/dfslib/dfslib_random.h
# dus/programs/dfstools/source/dfslib/dfslib_string.h
# dus/programs/dfstools/source/dfslib/dfslib_types.h
# dus/programs/dfstools/source/include/dfsrsa.h
# dus/programs/dar/source/include/crc.h
# ldus/source/include/ldus/atomic.h
# ldus/source/include/ldus/list.h
# ldus/source/include/ldus/rbtree.h
# )
file(GLOB_RECURSE DAGGER_SOURCES
*.c
)
file(GLOB_RECURSE DAGGER_HEADERS
*.h
)
set(SHA256_LINUX_ASM_SOURCES
client/sha256-mb-x86_64.s
client/x86_64cpuid.s
)
set(SHA256_MAC_ASM_SOURCES
client/sha256-mb-x86_64-mac.s
client/x86_64cpuid-mac.s
)
OPTION(DEBUG
"Build the project using debugging code"
OFF)
if(DEBUG)
MESSAGE("Adding Debug flag...")
SET(CMAKE_BUILD_TYPE Debug)
MESSAGE("Build type is " ${CMAKE_BUILD_TYPE})
else()
add_definitions(-DNDEBUG)
endif(DEBUG)
add_definitions(-DDFSTOOLS)
add_definitions(-DCHEATCOIN)
add_definitions(-DSHA256_USE_OPENSSL_TXFM)
add_definitions(-DSHA256_OPENSSL_MBLOCK)
if(APPLE)
add_executable(
${PROJECT_NAME}
${DAGGER_HEADERS}
${DAGGER_SOURCES}
${SHA256_MAC_ASM_SOURCES}
)
else(UNIX)
add_executable(
${PROJECT_NAME}
${DAGGER_HEADERS}
${DAGGER_SOURCES}
${SHA256_LINUX_ASM_SOURCES}
)
endif()
target_link_libraries(${PROJECT_NAME} m pthread crypto ssl)
add_executable(
cgi_stats
client/statsdaemon.c
)
add_executable(
cgi_block
client/block.cgi.c
)
add_custom_target(xdag COMMAND make -C ${BUILD_DIR}) #最关键的就是这句, 设置外部编译文件而不是使用CMakeLists.txt