-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 08544d1
Showing
18 changed files
with
971 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
AccessModifierOffset: '-2' | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: 'true' | ||
AlignConsecutiveDeclarations: 'false' | ||
AlignEscapedNewlines: Right | ||
AlignOperands: 'true' | ||
AlignTrailingComments: 'true' | ||
AllowAllParametersOfDeclarationOnNextLine: 'false' | ||
AllowShortBlocksOnASingleLine: 'false' | ||
AllowShortCaseLabelsOnASingleLine: 'true' | ||
AllowShortFunctionsOnASingleLine: 'true' | ||
AllowShortLoopsOnASingleLine: 'true' | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: 'false' | ||
AlwaysBreakTemplateDeclarations: 'Yes' | ||
BinPackArguments: 'true' | ||
BinPackParameters: 'true' | ||
BreakAfterJavaFieldAnnotations: 'true' | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Mozilla | ||
BreakBeforeTernaryOperators: 'true' | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
BreakStringLiterals: 'true' | ||
ColumnLimit: '110' | ||
CompactNamespaces: 'false' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false' | ||
ContinuationIndentWidth: '2' | ||
Cpp11BracedListStyle: 'false' | ||
DerivePointerAlignment: 'false' | ||
FixNamespaceComments: 'true' | ||
IncludeBlocks: Regroup | ||
IndentCaseLabels: 'false' | ||
IndentPPDirectives: AfterHash | ||
IndentWidth: '2' | ||
IndentWrappedFunctionNames: 'true' | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: 'true' | ||
KeepEmptyLinesAtTheStartOfBlocks: 'false' | ||
MaxEmptyLinesToKeep: '1' | ||
NamespaceIndentation: None | ||
PointerAlignment: Left | ||
ReflowComments: 'true' | ||
SortIncludes: 'true' | ||
SortUsingDeclarations: 'true' | ||
SpaceAfterCStyleCast: 'true' | ||
SpaceAfterTemplateKeyword: 'false' | ||
SpaceBeforeAssignmentOperators: 'true' | ||
SpaceBeforeCpp11BracedList: 'false' | ||
SpaceBeforeCtorInitializerColon: 'true' | ||
SpaceBeforeInheritanceColon: 'true' | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: 'true' | ||
SpaceInEmptyParentheses: 'false' | ||
SpacesInAngles: 'false' | ||
SpacesInCStyleCastParentheses: 'false' | ||
SpacesInContainerLiterals: 'false' | ||
SpacesInParentheses: 'false' | ||
SpacesInSquareBrackets: 'false' | ||
Standard: Cpp11 | ||
TabWidth: '2' | ||
UseTab: ForIndentation | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"format": { | ||
"line_width": 110, | ||
"dangle_parens": true, | ||
"dangle_align": "prefix" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM archlinux | ||
|
||
RUN pacman -Syq --noconfirm python-pip clang git git-lfs openssh cmake ninja gcc gdb nodejs yarn | ||
RUN pip install cmakelang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "C++ Backend", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"settings": {}, | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"twxs.cmake", | ||
"ms-vscode.cmake-tools", | ||
"cheshirekow.cmake-format", | ||
"albert.TabOut", | ||
"gruntfuggly.todo-tree" | ||
], | ||
"runArgs": [ | ||
"--network=host", | ||
"--cap-add=CAP_SYS_PTRACE" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", | ||
"files.associations": { | ||
"*.ipp": "cpp", | ||
"any": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"strstream": "cpp", | ||
"barrier": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"cfenv": "cpp", | ||
"charconv": "cpp", | ||
"chrono": "cpp", | ||
"cinttypes": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"codecvt": "cpp", | ||
"compare": "cpp", | ||
"complex": "cpp", | ||
"concepts": "cpp", | ||
"condition_variable": "cpp", | ||
"coroutine": "cpp", | ||
"csetjmp": "cpp", | ||
"csignal": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"deque": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"map": "cpp", | ||
"set": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"random": "cpp", | ||
"ratio": "cpp", | ||
"regex": "cpp", | ||
"source_location": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"rope": "cpp", | ||
"slist": "cpp", | ||
"fstream": "cpp", | ||
"future": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"latch": "cpp", | ||
"limits": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"numbers": "cpp", | ||
"ostream": "cpp", | ||
"ranges": "cpp", | ||
"scoped_allocator": "cpp", | ||
"semaphore": "cpp", | ||
"shared_mutex": "cpp", | ||
"span": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"stop_token": "cpp", | ||
"streambuf": "cpp", | ||
"syncstream": "cpp", | ||
"thread": "cpp", | ||
"typeindex": "cpp", | ||
"typeinfo": "cpp", | ||
"valarray": "cpp", | ||
"variant": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project( | ||
curlio | ||
VERSION 0.1.0 | ||
DESCRIPTION "The simple glue for cURL and Boost.ASIO" | ||
HOMEPAGE_URL "https://github.com/terrakuh/curlio" | ||
LANGUAGES CXX | ||
) | ||
|
||
option(CURLIO_BUILD_EXAMPLES "The example programs." OFF) | ||
|
||
find_package(CURL REQUIRED) | ||
find_package(Threads REQUIRED) | ||
|
||
find_package(Boost) | ||
if(NOT Boost_FOUND) | ||
message(STATUS "Boost not found. Fetching from jfrog.io") | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
Boost | ||
URL https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz | ||
URL_HASH SHA256=94ced8b72956591c4775ae2207a9763d3600b30d9d7446562c552f0a14a63be7 | ||
) | ||
FetchContent_MakeAvailable(Boost) | ||
FetchContent_GetProperties(Boost SOURCE_DIR Boost_INCLUDE_DIR) | ||
find_package(Boost REQUIRED) | ||
endif() | ||
|
||
add_subdirectory(curlio) | ||
|
||
if(CURLIO_BUILD_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
# Install | ||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
${PROJECT_NAME}-config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" | ||
INSTALL_DESTINATION "${LIBRARY_INSTALL_DIR}/cmake/${PROJECT_NAME}" | ||
) | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" | ||
DESTINATION lib/cmake/${PROJECT_NAME} | ||
) | ||
|
||
# CPack | ||
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) | ||
set(CPACK_PACKAGE_CONTACT "Yunus Ayar") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") | ||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") | ||
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") | ||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") | ||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") | ||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) | ||
set(CPACK_GENERATOR DEB TGZ) | ||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "") | ||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) | ||
|
||
include(CPack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2022, Yunus Ayar | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# cULRio | ||
Simple header-only **Boost.ASIO** wrapper. | ||
|
||
## Example | ||
|
||
```cpp | ||
curlio::Session session{ service.get_executor() }; | ||
curlio::Request req; | ||
req.set_url("https://example.com"); | ||
curl_easy_setopt(req.native_handle(), CURLOPT_USERAGENT, "curl/7.80.0"); | ||
|
||
session.start(req); | ||
while (true) { | ||
char buf[4096]; | ||
auto [ec, n] = co_await req.async_read_some(buffer(buf), use_nothrow_awaitable); | ||
if (ec == error::eof) { | ||
break; | ||
} | ||
std::cout.write(buf, n); | ||
} | ||
co_await req.async_wait(use_awaitable); | ||
co_return; | ||
``` | ||
|
||
## Installation | ||
|
||
```sh | ||
git clone https://github.com/terrakuh/curlio.git | ||
cmake -S curlio -B curlio/build | ||
cmake --install curlio/build | ||
``` | ||
|
||
And then in your `CMakeLists.txt`: | ||
|
||
```cmake | ||
find_package(curlio REQUIRED) | ||
target_link_libraries(my-target PRIVATE curlio::curlio) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(CURL REQUIRED) | ||
find_dependency(Boost REQUIRED) | ||
find_dependency(Threads REQUIRED) | ||
|
||
if(NOT TARGET curlio::curlio) | ||
include("${CMAKE_CURRENT_LIST_DIR}/curlio-targets.cmake") | ||
set(curlio_FOUND TRUE) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp") | ||
|
||
add_library(curlio INTERFACE ${sources}) | ||
add_library(curlio::curlio ALIAS curlio) | ||
target_link_libraries(curlio INTERFACE CURL::libcurl Threads::Threads Boost::boost) | ||
target_include_directories(curlio BEFORE INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>") | ||
|
||
install(TARGETS curlio EXPORT ${PROJECT_NAME}-targets) | ||
install( | ||
EXPORT ${PROJECT_NAME}-targets | ||
DESTINATION lib/cmake/${PROJECT_NAME} | ||
NAMESPACE ${PROJECT_NAME}:: | ||
EXPORT_LINK_INTERFACE_LIBRARIES | ||
) | ||
install( | ||
DIRECTORY . | ||
DESTINATION include/${PROJECT_NAME} | ||
FILES_MATCHING | ||
PATTERN "*.hpp" | ||
) |
Oops, something went wrong.