Stop rebuilding everything everytime (#73)

This commit is contained in:
Michael Legleux
2022-01-04 13:40:23 -08:00
committed by GitHub
parent 5544783903
commit aa65d1669d
2 changed files with 28 additions and 30 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
build/
.python-version

View File

@@ -1,70 +1,69 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/boostorg/beast
#
set(CMAKE_VERBOSE_MAKEFILE TRUE)
project(clio)
cmake_minimum_required(VERSION 3.16)
set (CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-narrowing")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT}))
set (BOOST_ROOT $ENV{BOOST_ROOT})
endif ()
file (TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT)
if((NOT DEFINED BOOST_ROOT) AND(DEFINED ENV{BOOST_ROOT}))
set(BOOST_ROOT $ENV{BOOST_ROOT})
endif()
file(TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT)
FIND_PACKAGE( Boost 1.75 COMPONENTS filesystem log_setup log thread system REQUIRED )
find_package( Boost 1.75 COMPONENTS filesystem log_setup log thread system REQUIRED )
message("Boost libraries: ${Boost_LIBRARIES}")
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
FetchContent_MakeAvailable(googletest)
enable_testing()
include(GoogleTest)
add_executable (clio_server
add_executable(clio_server
src/main.cpp
)
add_executable (clio_tests
add_executable(clio_tests
unittests/main.cpp
)
add_library(clio)
include_directories(src)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps")
include(ExternalProject)
message("Current binary dir: ${CMAKE_CURRENT_BINARY_DIR}")
message("Module path: ${CMAKE_MODULE_PATH}")
set(FETCHCONTENT_QUIET FALSE)
set(NIH_CACHE_ROOT "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "")
FetchContent_Declare(rippled
GIT_REPOSITORY https://github.com/cjcobb23/rippled.git
GIT_TAG clio
)
FetchContent_MakeAvailable(rippled)
target_link_libraries(clio PUBLIC xrpl_core grpc_pbufs)
add_dependencies(clio xrpl_core)
add_dependencies(clio grpc_pbufs)
get_target_property(grpc_includes grpc_pbufs INCLUDE_DIRECTORIES)
message("GRPC includes: ${grpc_includes}")
message("Proto includes: ${proto_includes}")
message("Source dir: ${SOURCE_DIR}")
INCLUDE_DIRECTORIES(${grpc_includes})
INCLUDE_DIRECTORIES(${SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${SOURCE_DIR}/include)
include_directories(${grpc_includes})
include_directories(${SOURCE_DIR}/src)
include_directories(${SOURCE_DIR}/include)
get_target_property(xrpl_core_includes xrpl_core INCLUDE_DIRECTORIES)
message("XRPL core includes: ${xrpl_core_includes}")
INCLUDE_DIRECTORIES(${xrpl_core_includes})
include_directories(${xrpl_core_includes})
include(cassandra)
include(Postgres)
target_sources(clio PRIVATE
## Backend
src/backend/CassandraBackend.cpp
@@ -113,12 +112,9 @@ target_sources(clio PRIVATE
# Utility
src/rpc/handlers/Random.cpp)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${Boost_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
TARGET_LINK_LIBRARIES(clio PUBLIC ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(clio_server PUBLIC clio)
TARGET_LINK_LIBRARIES(clio_tests PUBLIC clio gtest_main)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${Boost_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(clio PUBLIC ${Boost_LIBRARIES})
target_link_libraries(clio_server PUBLIC clio)
target_link_libraries(clio_tests PUBLIC clio gtest_main)
gtest_discover_tests(clio_tests)