forked from lthn/blockchain
Refactor CMake configuration to link lthn_api library with daemon and update include directories
This commit is contained in:
parent
073f3db1aa
commit
3ac4f170d4
2 changed files with 17 additions and 16 deletions
|
|
@ -164,7 +164,7 @@ target_link_libraries(currency_core config lmdb mdbx)
|
|||
|
||||
add_executable(daemon ${DAEMON} ${P2P} ${CURRENCY_PROTOCOL})
|
||||
add_dependencies(daemon version)
|
||||
target_link_libraries(daemon rpc stratum currency_core crypto common miniupnpc::miniupnpc ZLIB::ZLIB ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
target_link_libraries(daemon rpc stratum currency_core crypto common miniupnpc::miniupnpc ZLIB::ZLIB ethash lthn::api ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
ENABLE_SHARED_PCH(daemon DAEMON)
|
||||
ENABLE_SHARED_PCH_EXECUTABLE(daemon)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,42 +16,43 @@ else()
|
|||
message(FATAL_ERROR "Could not find oatpp-swagger")
|
||||
endif()
|
||||
|
||||
add_library(lthn_api INTERFACE)
|
||||
add_library(lthn_api ApiServer.cpp)
|
||||
add_library(lthn::api ALIAS lthn_api)
|
||||
|
||||
# Add the current directory for API headers and the main src directory for core headers
|
||||
target_include_directories(lthn_api INTERFACE
|
||||
target_include_directories(lthn_api PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${oatpp_INCLUDE_DIRS}
|
||||
${oatpp-swagger_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
include_directories(${oatpp_INCLUDE_DIRS})
|
||||
include_directories(${oatpp-swagger_INCLUDE_DIRS})
|
||||
target_link_libraries(lthn_api PUBLIC
|
||||
oatpp::oatpp
|
||||
oatpp::oatpp-swagger
|
||||
)
|
||||
|
||||
# Add P2P and currency_protocol sources directly to the executable, like the main daemon does
|
||||
add_executable(lethean-api main.cpp ApiServer.cpp ${P2P} ${CURRENCY_PROTOCOL})
|
||||
target_compile_definitions(lthn_api PUBLIC -DOATPP_SWAGGER_RES_PATH="${oatpp-swagger_INCLUDE_DIRS}/../bin/oatpp-swagger/res")
|
||||
|
||||
# Explicitly add the project's main src directory to the executable's include paths
|
||||
target_include_directories(lethean-api PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
# Link against the correct, existing library targets
|
||||
target_link_libraries(lethean-api
|
||||
#add_executable(lethean-api main.cpp)
|
||||
#
|
||||
#target_include_directories(lethean-api PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
target_link_libraries(lthn_api
|
||||
PRIVATE
|
||||
config
|
||||
lthn::api
|
||||
rpc
|
||||
stratum
|
||||
currency_core
|
||||
crypto
|
||||
common
|
||||
config
|
||||
ethash
|
||||
oatpp::oatpp
|
||||
oatpp::oatpp-swagger
|
||||
${Boost_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
ZLIB::ZLIB
|
||||
)
|
||||
|
||||
add_definitions(-DOATPP_SWAGGER_RES_PATH="${oatpp-swagger_INCLUDE_DIRS}/../bin/oatpp-swagger/res")
|
||||
#add_subdirectory(tests)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue