-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
52 lines (44 loc) · 1.5 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
cmake_minimum_required(VERSION 3.5)
project(tinybtc)
set(CMAKE_C_STANDARD 11)
if (CMAKE_BUILD_TYPE MATCHES Release)
list(APPEND cflags -Ofast -flto)
else()
list(APPEND cflags -Ofast -march=native)
list(APPEND cflags -Wall -Wextra -Wpedantic -Werror)
list(APPEND cflags -Wno-unused-function -Wno-unused-parameter)
endif(CMAKE_BUILD_TYPE MATCHES Release)
message("C flags: ${cflags}")
add_subdirectory(deps/libuv)
add_subdirectory(deps/leveldb)
include_directories(src)
include_directories(deps/)
include_directories(deps/libuv/include)
include_directories(deps/leveldb/include)
include_directories(deps/openssl/include)
file(GLOB SOURCES ${SOURCES} "src/*.c")
file(GLOB SOURCES ${SOURCES} "src/messages/*.c")
file(GLOB SOURCES ${SOURCES} "src/test/*.c")
file(GLOB SOURCES ${SOURCES} "src/utils/*.c")
add_executable(tinybtc ${SOURCES})
target_compile_options(tinybtc PRIVATE ${cflags})
target_link_libraries(tinybtc uv)
target_link_libraries(tinybtc leveldb)
target_link_libraries(tinybtc ${CMAKE_CURRENT_SOURCE_DIR}/deps/openssl/libcrypto.a)
add_custom_command(
TARGET tinybtc PRE_BUILD
COMMAND mkdir -p
${CMAKE_CURRENT_BINARY_DIR}/fixtures/
)
add_custom_command(
TARGET tinybtc PRE_BUILD
COMMAND cp -R
${CMAKE_CURRENT_SOURCE_DIR}/src/test/fixtures/*.dat
${CMAKE_CURRENT_BINARY_DIR}/fixtures/
)
add_custom_command(
TARGET tinybtc PRE_BUILD
COMMAND cp -R
${CMAKE_CURRENT_SOURCE_DIR}/src/genesis.dat
${CMAKE_CURRENT_BINARY_DIR}/
)