2021-04-15 17:39:45 +00:00
option ( SUBMODULE_CHECK "Enables checking that vendored library submodules are up to date" ON )
if ( SUBMODULE_CHECK )
find_package ( Git )
if ( GIT_FOUND )
function ( check_submodule relative_path )
execute_process ( COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR } / ${ relative_path } OUTPUT_VARIABLE localHead )
execute_process ( COMMAND git rev-parse "HEAD:external/${relative_path}" WORKING_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR } OUTPUT_VARIABLE checkedHead )
string ( COMPARE EQUAL "${localHead}" "${checkedHead}" upToDate )
if ( upToDate )
message ( STATUS "Submodule 'external/${relative_path}' is up-to-date" )
else ( )
message ( FATAL_ERROR "Submodule 'external/${relative_path}' is not up-to-date. Please update with\ngit submodule update --init --recursive\nor run cmake with -DSUBMODULE_CHECK=OFF" )
endif ( )
endfunction ( )
message ( STATUS "Checking submodules" )
check_submodule ( nlohmann )
check_submodule ( cxxopts )
check_submodule ( ghc-filesystem )
check_submodule ( date )
check_submodule ( pybind11 )
check_submodule ( sqlite_orm )
check_submodule ( oxen-mq )
2022-02-17 18:44:31 +00:00
check_submodule ( oxen-encoding )
2021-04-15 17:39:45 +00:00
check_submodule ( uvw )
check_submodule ( cpr )
2021-03-08 17:25:22 +00:00
check_submodule ( ngtcp2 )
2021-04-15 17:39:45 +00:00
endif ( )
endif ( )
if ( WITH_HIVE )
add_subdirectory ( pybind11 EXCLUDE_FROM_ALL )
endif ( )
set ( JSON_BuildTests OFF CACHE INTERNAL "" )
add_subdirectory ( nlohmann EXCLUDE_FROM_ALL )
add_subdirectory ( cxxopts EXCLUDE_FROM_ALL )
add_subdirectory ( date EXCLUDE_FROM_ALL )
add_library ( sqlite_orm INTERFACE )
target_include_directories ( sqlite_orm SYSTEM INTERFACE sqlite_orm/include )
if ( NOT TARGET sqlite3 )
add_library ( sqlite3 INTERFACE )
pkg_check_modules ( SQLITE3 REQUIRED IMPORTED_TARGET sqlite3 )
target_link_libraries ( sqlite3 INTERFACE PkgConfig::SQLITE3 )
endif ( )
target_link_libraries ( sqlite_orm INTERFACE sqlite3 )
add_library ( uvw INTERFACE )
target_include_directories ( uvw INTERFACE uvw/src )
target_link_libraries ( uvw INTERFACE libuv )
2021-09-10 18:09:55 +00:00
# ngtcp2 needs some massaging to build nicely:
include ( ngtcp2_lib )
add_ngtcp2_lib ( )
2021-05-14 17:07:44 +00:00
2021-04-15 17:39:45 +00:00
# cpr configuration. Ideally we'd just do this via add_subdirectory, but cpr's cmake requires
# 3.15+, and we target lower than that (and this is fairly simple to build).
2021-09-20 20:16:46 +00:00
if ( WITH_BOOTSTRAP )
2021-09-30 14:43:06 +00:00
if ( NOT BUILD_STATIC_DEPS )
find_package ( CURL REQUIRED COMPONENTS HTTP HTTPS SSL )
2021-04-15 17:39:45 +00:00
2021-09-30 14:43:06 +00:00
# CURL::libcurl wasn't added to FindCURL until cmake 3.12, so add it if necessary
if ( CMAKE_VERSION VERSION_LESS 3.12 AND NOT TARGET CURL::libcurl )
add_library ( libcurl UNKNOWN IMPORTED GLOBAL )
set_target_properties ( libcurl PROPERTIES
I M P O R T E D _ L O C A T I O N $ { C U R L _ L I B R A R I E S }
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S " $ { C U R L _ I N C L U D E _ D I R S } " )
add_library ( CURL_libcurl INTERFACE )
target_link_libraries ( CURL_libcurl INTERFACE libcurl )
add_library ( CURL::libcurl ALIAS CURL_libcurl )
endif ( )
2021-04-15 17:39:45 +00:00
endif ( )
2021-09-30 14:43:06 +00:00
file ( GLOB cpr_sources ${ conf_depends } cpr/cpr/*.cpp )
2021-04-15 17:39:45 +00:00
2021-09-30 14:43:06 +00:00
add_library ( cpr STATIC EXCLUDE_FROM_ALL ${ cpr_sources } )
target_link_libraries ( cpr PUBLIC CURL::libcurl )
target_include_directories ( cpr PUBLIC cpr/include )
target_compile_definitions ( cpr PUBLIC CPR_CURL_NOSIGNAL )
add_library ( cpr::cpr ALIAS cpr )
2021-09-20 20:16:46 +00:00
endif ( )