Skip to content

Commit 4af2745

Browse files
author
Krzysztof Okupski
committed
Revised build files
1 parent 8bce7e6 commit 4af2745

File tree

4 files changed

+42
-10
lines changed

4 files changed

+42
-10
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ before_script:
1616
- cd build
1717
- cmake ..
1818

19-
script: make
19+
script:
20+
- make
2021

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ SET(MINOR_VERSION 0)
77

88
# Add source directory
99
ADD_SUBDIRECTORY(src/api)
10-
ADD_SUBDIRECTORY(src/jsonrpc)
1110

12-
# ADD_SUBDIRECTORY(test)
11+
FIND_PACKAGE(Boost COMPONENTS unit_test_framework)
12+
IF(Boost_FOUND)
13+
ADD_SUBDIRECTORY(src/test)
14+
ENDIF()
1315

1416
# Set package settings
1517
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

src/api/CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@ SET(CMAKE_CXX_FLAGS "-std=c++11 -g -Wall")
55
FILE(GLOB bitcoinapi_header ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
66
FILE(GLOB bitcoinapi_source ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
77

8+
# Add jsonrpc directory
9+
ADD_SUBDIRECTORY(jsonrpc)
10+
811
# Set target libraries
912
ADD_LIBRARY(bitcoinapi SHARED ${bitcoinapi_source})
1013
ADD_LIBRARY(bitcoinapi_static STATIC ${bitcoinapi_source})
1114

12-
# Add boost header include
13-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
14-
1515
# Set output name of static library
1616
SET_TARGET_PROPERTIES(bitcoinapi_static PROPERTIES OUTPUT_NAME bitcoinapi)
1717

18-
# Set version number of both libraries
19-
SET(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
20-
SET_TARGET_PROPERTIES(bitcoinapi bitcoinapi_static PROPERTIES VERSION "${VERSION_STRING}" SOVERSION "${VERSION_MAJOR}")
21-
2218
# Link the library with jsonrpc libs
2319
TARGET_LINK_LIBRARIES(bitcoinapi jsonrpc)
2420
TARGET_LINK_LIBRARIES(bitcoinapi_static jsonrpc)

src/api/jsonrpc/CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Set compiler settings
2+
SET(CMAKE_CXX_FLAGS "-std=c++11 -g -Wall")
3+
SET(CMAKE_C_FLAGS "-Wall")
4+
5+
# Require curl to be present
6+
FIND_PACKAGE(Threads REQUIRED)
7+
FIND_PACKAGE(CURL REQUIRED)
8+
9+
# Find header and source files
10+
FILE(GLOB jsonrpc_header ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
11+
FILE(GLOB connector_header ${CMAKE_CURRENT_SOURCE_DIR}/connectors/*.h)
12+
FILE(GLOB jsoncpp_header ${CMAKE_CURRENT_SOURCE_DIR}/json/*.h)
13+
FILE(GLOB_RECURSE jsonrpc_source ${CMAKE_CURRENT_SOURCE_DIR}/*.c*)
14+
15+
# Set target libraries
16+
ADD_LIBRARY(jsonrpc SHARED ${jsonrpc_source})
17+
ADD_LIBRARY(jsonrpc_static STATIC ${jsonrpc_source})
18+
19+
# Set output name of static library
20+
SET_TARGET_PROPERTIES(jsonrpc_static PROPERTIES OUTPUT_NAME jsonrpc)
21+
22+
# Link the library with dependencies
23+
TARGET_LINK_LIBRARIES(jsonrpc pthread dl curl)
24+
TARGET_LINK_LIBRARIES(jsonrpc_static pthread dl curl)
25+
26+
# Install to appropriate destinations
27+
INSTALL(FILES ${jsonrpc_header} DESTINATION include/jsonrpc)
28+
INSTALL(FILES ${connector_header} DESTINATION include/jsonrpc/connectors)
29+
INSTALL(FILES ${jsoncpp_header} DESTINATION include/jsonrpc/json)
30+
31+
INSTALL(TARGETS jsonrpc jsonrpc_static
32+
LIBRARY DESTINATION lib
33+
ARCHIVE DESTINATION lib)

0 commit comments

Comments
 (0)