Remove deprecated rexy::static_string. Add pkg-config to CMake for librexy
This commit is contained in:
parent
b4723459b2
commit
4ea29e5789
@ -1,6 +1,8 @@
|
||||
project(librcw)
|
||||
cmake_minimum_required(VERSION 3.0.2)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
find_package(PkgConfig)
|
||||
|
||||
set(librcw_VERSION_STRING "000003000L")
|
||||
set(librcw_VERSION_MAJOR 0)
|
||||
@ -15,16 +17,21 @@ option(ENABLE_PROFILING "Enable asan" OFF)
|
||||
option(BUILD_TESTS "Enable testing" OFF)
|
||||
mark_as_advanced(ENABLE_PROFILING)
|
||||
|
||||
pkg_check_modules(LIBREXY REQUIRED librexy)
|
||||
|
||||
set(LIBREXY_REAL_LIBRARIES ${LIBREXY_LIBRARIES})
|
||||
list(TRANSFORM LIBREXY_REAL_LIBRARIES PREPEND "-l")
|
||||
|
||||
set(SOURCE_LIST "src/async.cpp" "src/curl_easy_handle.cpp" "src/curl_header_list.cpp" "src/httpint.cpp" "src/read_write_cback.cpp" "src/response.cpp" "src/sync.cpp" "src/types.cpp")
|
||||
if(ENABLE_SHARED)
|
||||
add_library(rcw SHARED ${SOURCE_LIST})
|
||||
set_target_properties(rcw PROPERTIES SOVERSION "${librcw_VERSION_MAJOR}.${librcw_VERSION_MINOR}")
|
||||
set(LIBRCW_LIBFLAGS "-lrcw")
|
||||
target_link_libraries(rcw "-lcurl -lrexy -lpthread")
|
||||
target_link_libraries(rcw "-lcurl -lpthread ${LIBREXY_LINK_LIBRARIES}")
|
||||
else()
|
||||
add_library(rcw STATIC ${SOURCE_LIST})
|
||||
set(LIBRCW_LIBFLAGS "-lrcw -lcurl -lrexy -lpthread")
|
||||
target_link_libraries(rcw "-lcurl -lrexy -lpthread")
|
||||
set(LIBRCW_LIBFLAGS "-lrcw -lcurl -lpthread ${LIBREXY_REAL_LIBRARIES}")
|
||||
target_link_libraries(rcw "-lcurl -lpthread ${LIBREXY_LINK_LIBRARIES}")
|
||||
endif()
|
||||
set_target_properties(rcw PROPERTIES VERSION "${librcw_VERSION_MAJOR}.${librcw_VERSION_MINOR}.${librcw_VERSION_REVISION}")
|
||||
|
||||
@ -38,7 +45,8 @@ if(BUILD_TESTS)
|
||||
endif()
|
||||
|
||||
set(LIBRCW_PUBLIC_HEADERS "include/async.hpp" "include/curl_easy_handle.hpp" "include/curl_header_list.hpp" "include/httpint.hpp" "include/rcw.hpp" "include/read_write_cback.hpp" "include/response.hpp" "include/string.hpp" "include/sync.hpp" "include/types.hpp")
|
||||
target_compile_options(rcw PRIVATE -Wall -Wextra -pedantic -std=c++17)
|
||||
target_compile_options(rcw PRIVATE -Wall -Wextra -pedantic -std=c++17 ${LIBREXY_CFLAGS_OTHER})
|
||||
target_include_directories(rcw PUBLIC ${LIBREXY_INCLUDE_DIRS})
|
||||
|
||||
install(TARGETS rcw
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#include "httpint.hpp"
|
||||
#include "string.hpp"
|
||||
|
||||
#include <rexy/string_view.hpp>
|
||||
|
||||
namespace rcw{
|
||||
|
||||
class response
|
||||
@ -31,7 +33,7 @@ namespace rcw{
|
||||
size_t elapsed_time_us; //CURLINFO_TOTAL_TIME_T
|
||||
size_t uploaded_bytes; //CURLINFO_SIZE_UPLOAD_T
|
||||
size_t downloaded_bytes; //CURLINFO_SIZE_DOWNLOAD_T
|
||||
rexy::static_string<const char> content_type; //CURLINFO_CONTENT_TYPE
|
||||
rexy::string_view content_type; //CURLINFO_CONTENT_TYPE
|
||||
int liberror = 0;
|
||||
|
||||
string text;
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#define RCW_TYPES_HPP
|
||||
|
||||
#include <cstdlib> //size_t
|
||||
#include <rexy/string.hpp>
|
||||
#include <rexy/string_view.hpp>
|
||||
|
||||
namespace rcw{
|
||||
|
||||
@ -34,14 +34,14 @@ namespace rcw{
|
||||
class url
|
||||
{
|
||||
public:
|
||||
rexy::static_string<char> data;
|
||||
rexy::string_view data;
|
||||
|
||||
explicit url(const char*, size_t len = 0);
|
||||
};
|
||||
class body
|
||||
{
|
||||
public:
|
||||
rexy::static_string<char> data;
|
||||
rexy::string_view data;
|
||||
|
||||
explicit body(const char*, size_t len = 0);
|
||||
};
|
||||
|
||||
@ -144,7 +144,7 @@ namespace rcw{
|
||||
curl_easy_getinfo(m_curl, CURLINFO_SIZE_DOWNLOAD_T, &x);
|
||||
retval.downloaded_bytes = x;
|
||||
curl_easy_getinfo(m_curl, CURLINFO_CONTENT_TYPE, &y);
|
||||
retval.content_type = rexy::static_string<char>(y);
|
||||
retval.content_type = rexy::string_view(y);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user