Skip to content

Commit 5f5372e

Browse files
committed
Merge branch 'master' into unix_socket
2 parents f8aece3 + 90579e9 commit 5f5372e

36 files changed

Lines changed: 534 additions & 187 deletions

.github/workflows/build_and_test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
matrix:
2525
os: [ ubuntu-latest,
2626
windows-latest,
27-
ubuntu-20.04,
2827
macos-latest,
28+
ubuntu-20.04,
2929
macos-11
3030
]
3131
# ubuntu-18.04 does not work due to compile error on asio
@@ -55,21 +55,24 @@ jobs:
5555
if [ "$RUNNER_OS" == "Windows" ]; then
5656
cmake \
5757
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
58-
-DCROW_FEATURES="ssl;compression" \
58+
-DCROW_ENABLE_SSL=ON \
59+
-DCROW_ENABLE_COMPRESSION=ON \
5960
-DCROW_AMALGAMATE=ON \
6061
-DCROW_BUILD_TESTS=ON \
6162
-B build
6263
elif [ "$RUNNER_OS" == "macOS" ]; then
6364
LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
6465
CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" \
6566
cmake \
66-
-DCROW_FEATURES="ssl;compression" \
67+
-DCROW_ENABLE_SSL=ON \
68+
-DCROW_ENABLE_COMPRESSION=ON \
6769
-DCROW_AMALGAMATE=ON \
6870
-DCROW_BUILD_TESTS=ON \
6971
-B build
7072
else
7173
cmake \
72-
-DCROW_FEATURES="ssl;compression" \
74+
-DCROW_ENABLE_SSL=ON \
75+
-DCROW_ENABLE_COMPRESSION=ON \
7376
-DCROW_AMALGAMATE=ON \
7477
-DCROW_BUILD_TESTS=ON \
7578
-B build

.github/workflows/doxygen-gh-pages.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ jobs:
3333
run: |
3434
git config --global user.name Docs deploy
3535
git config --global user.email docs@dummy.bot.com
36-
- name: run mike
37-
run: mike deploy master
38-
- name: Deploy 🚀
39-
uses: JamesIves/github-pages-deploy-action@v4
40-
with:
41-
folder: site # The folder the action should deploy.
42-
target-folder: master # deploy to versioned directory
36+
- name: run mike (Deploy 🚀)
37+
run: |
38+
git fetch origin gh-pages --depth=1
39+
mike deploy master --push

CMakeLists.txt

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ option(CROW_BUILD_EXAMPLES "Build the examples in the project" ${CROW_I
4646
option(CROW_BUILD_TESTS "Build the tests in the project" ${CROW_IS_MAIN_PROJECT})
4747
option(CROW_AMALGAMATE "Combine all headers into one" OFF)
4848
option(CROW_INSTALL "Add install step for Crow" ON )
49+
option(CROW_USE_BOOST "Use Boost.Asio for Crow" OFF)
50+
51+
option(CROW_ENABLE_SSL "Enable Crow's SSL feature for supporting https" OFF)
52+
option(CROW_ENABLE_COMPRESSION "Enable Crow's Compression feature for supporting compressed http content" OFF)
4953

50-
# Possible values: ssl, compression
51-
option(CROW_FEATURES "Enable features extending Crow's abilities" "")
5254

5355
#####################################
5456
# Define Targets
@@ -62,22 +64,30 @@ target_include_directories(Crow
6264
$<INSTALL_INTERFACE:include>
6365
)
6466

65-
find_package(asio REQUIRED)
66-
67-
target_link_libraries(Crow
68-
INTERFACE
69-
asio::asio
70-
)
67+
if(CROW_USE_BOOST)
68+
find_package(Boost 1.64 COMPONENTS system date_time REQUIRED)
69+
target_link_libraries(Crow
70+
INTERFACE
71+
Boost::boost Boost::system Boost::date_time
72+
)
73+
target_compile_definitions(Crow INTERFACE CROW_USE_BOOST)
74+
else()
75+
find_package(asio REQUIRED)
76+
target_link_libraries(Crow
77+
INTERFACE
78+
asio::asio
79+
)
80+
endif()
7181

7282
target_compile_definitions(Crow INTERFACE "")
7383

74-
if("compression" IN_LIST CROW_FEATURES)
84+
if(CROW_ENABLE_COMPRESSION)
7585
find_package(ZLIB REQUIRED)
7686
target_link_libraries(Crow INTERFACE ZLIB::ZLIB)
7787
target_compile_definitions(Crow INTERFACE CROW_ENABLE_COMPRESSION)
7888
endif()
7989

80-
if("ssl" IN_LIST CROW_FEATURES)
90+
if(CROW_ENABLE_SSL)
8191
find_package(OpenSSL REQUIRED)
8292
target_link_libraries(Crow INTERFACE OpenSSL::SSL)
8393
target_compile_definitions(Crow INTERFACE CROW_ENABLE_SSL)
@@ -110,11 +120,11 @@ if(CROW_BUILD_TESTS)
110120
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest
111121
)
112122

113-
if(NOT "compression" IN_LIST CROW_FEATURES)
114-
message(STATUS "Compression tests are omitted. (Configure with CROW_FEATURES containing 'compression' to enable them)")
123+
if(NOT CROW_ENABLE_COMPRESSION)
124+
message(STATUS "Compression tests are omitted. (Configure with CROW_ENABLE_COMPRESSION to enable them)")
115125
endif()
116-
if(NOT "ssl" IN_LIST CROW_FEATURES)
117-
message(STATUS "SSL tests are omitted. (Configure with CROW_FEATURES containing 'ssl' to enable them)")
126+
if(NOT CROW_ENABLE_SSL)
127+
message(STATUS "SSL tests are omitted. (Configure with CROW_ENABLE_SSL to enable them)")
118128
else()
119129
if(NOT MSVC)
120130
add_test(

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ SHOW_FILES = YES
772772
# Folder Tree View (if specified).
773773
# The default value is: YES.
774774

775-
SHOW_NAMESPACES = NO
775+
SHOW_NAMESPACES = YES
776776

777777
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
778778
# doxygen should invoke to get the current version for each file (typically from

cmake/CrowConfig.cmake.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ if(NOT DEFINED CROW_FEATURES)
1414
set(CROW_FEATURES ${CROW_INSTALLED_FEATURES})
1515
endif()
1616

17-
if("compression" IN_LIST CROW_FEATURES)
17+
if(CROW_ENABLE_COMPRESSION)
1818
find_dependency(ZLIB)
1919
endif()
2020

21-
if("ssl" IN_LIST CROW_FEATURES)
21+
if(CROW_ENABLE_SSL)
2222
find_dependency(OpenSSL)
2323
endif()
2424

@@ -38,12 +38,12 @@ endif()
3838
list(REMOVE_ITEM _CROW_ILL "ZLIB::ZLIB" "OpenSSL::SSL")
3939
list(REMOVE_ITEM _CROW_ICD "CROW_ENABLE_SSL" "CROW_ENABLE_COMPRESSION")
4040

41-
if("compression" IN_LIST CROW_FEATURES)
41+
if(CROW_ENABLE_COMPRESSION)
4242
list(APPEND _CROW_ILL "ZLIB::ZLIB")
4343
list(APPEND _CROW_ICD "CROW_ENABLE_COMPRESSION")
4444
endif()
4545

46-
if("ssl" IN_LIST CROW_FEATURES)
46+
if(CROW_ENABLE_SSL)
4747
list(APPEND _CROW_ILL "OpenSSL::SSL")
4848
list(APPEND _CROW_ICD "CROW_ENABLE_SSL")
4949
endif()

docs/getting_started/a_simple_webpage.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Hello World is a good start, but what if you want something a bit more fancy.. Something like an HTML document saying "Hello World". If that's what you want, follow along:
22

33
## Basic Webpage
4-
Let's start our webpage with.. well.. a webpage. But before we create a webpage we need to place it somewhere Crow recognizes, for now this directory is going to be called `templates`, but we can [change it later](../../guides/templating/#page).
4+
Let's start our webpage with.. well.. a webpage. But before we create a webpage we need to place it somewhere Crow recognizes, for now this directory is going to be called `templates`, but we can [change it later](../guides/templating.md#page).
55

66
Once our `templates` folder is created, we can create our HTML document inside it, let's call it `fancypage.html`.
77

@@ -80,13 +80,17 @@ Once the code is done compiling, if we call `http://localhost:18080/` we get our
8080

8181
!!! note
8282

83-
Compilation instructions are available for [Linux](../setup/linux#compiling-your-project), [MacOS](../setup/macos#compiling-using-a-compiler-directly), and [Windows](../setup/windows#getting-and-compiling-crow)
83+
Compilation instructions are available for
84+
[Linux](setup/linux.md#compiling-your-project),
85+
[MacOS](setup/macos.md#compiling-using-a-compiler-directly),
86+
and
87+
[Windows](setup/windows.md#getting-and-compiling-crow)
8488

8589

8690
## Template Webpage with a variable
8791
But we can make things even more exciting, we can greet a user by their name instead!!
8892

89-
Let's start with our webpage, and modify it with a little bit of [mustache](../../guides/templating) syntax:
93+
Let's start with our webpage, and modify it with a little bit of [mustache](../guides/templating.md) syntax:
9094
``` html title="templates/fancypage.html" hl_lines="4"
9195
<!DOCTYPE html>
9296
<html>
@@ -121,9 +125,9 @@ int main()
121125

122126
1. We are adding a `string` variable to the URL and a counterpart (`std::string name`) to our route - this can be anything the user wants.
123127
2. We are using `load()` instead of `load_text()` since we have an actual variable now.
124-
3. We are creating a new [context](../../guides/templating/#context) containing the `person` variable from our template and the `name` we got from the URL.
128+
3. We are creating a new [context](../guides/templating.md#context) containing the `person` variable from our template and the `name` we got from the URL.
125129
4. We are using `render(ctx)` to apply our context to the template.
126130

127131
Now (after compiling the code and running the executable a second time) calling `http://localhost:18080/Bob` should return a webpage containing "Hello Bob!". **We did it!**
128132

129-
For more details on templates and HTML pages in Crow please go [here](../../guides/templating/)
133+
For more details on templates and HTML pages in Crow please go [here](../guides/templating.md)

docs/getting_started/setup/linux.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ You can also download the `crow_all.h` file and simply include that into your pr
4545

4646
!!! note
4747

48-
While building you can set the `CROW_FEATURES` variable (as a `;` separated list). You can use an argument such as `-DCROW_FEATURES="ssl;compression"`.
48+
While building you can set:
49+
the `CROW_ENABLE_SSL` variable to enable the support for https
50+
the `CROW_ENABLE_COMPRESSION` variable to enable the support for http compression
4951

5052
!!! note
5153

@@ -83,7 +85,10 @@ target_link_libraries(your_project PUBLIC Crow::Crow)
8385
From there CMake should handle compiling and linking your project.
8486
!!! note
8587

86-
For optional features like HTTP Compression or HTTPS you can set the `CROW_FEATURES` variable using lines such as `set(CROW_FEATURES "ssl;compression")`, `set(CROW_FEATURES ssl compression)`, or `set(CROW_FEATURES ssl)`.
88+
For optional features like HTTP Compression or HTTPS you can set
89+
90+
the `CROW_ENABLE_SSL` variable to enable the support for https
91+
the `CROW_ENABLE_COMPRESSION` variable to enable the support for http compression
8792

8893
### Directly using a compiler
8994
All you need to do is run the following command:

docs/getting_started/setup/macos.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ This will generate a `crow_all.h` file which you can use in the following steps
6161
4. `make -j12`
6262
!!! note
6363

64-
You can add options like `-DCROW_FEATURES="ssl;compression"` or `-DCROW_AMALGAMATE` to `cmake ..` to build optional tests/examples for HTTP Compression or HTTPS.
64+
You can add options like `-DCROW_ENABLE_COMPRESSION=ON`
65+
or `-DCROW_ENABLE_SSL=ON`
66+
or `-DCROW_AMALGAMATE`
67+
to `cmake ..` to build optional tests/examples for HTTP Compression or HTTPS.
6568

6669
## Compiling using a compiler directly
6770
All you need to do is run the following command:

docs/getting_started/your_first_application.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main()
1616
}
1717
```
1818
The App (or SimpleApp) class organizes all the different parts of Crow and provides the developer (you) a simple interface to interact with these parts.
19-
For more information, please go [here](../../guides/app).
19+
For more information, please go [here](../guides/app.md).
2020

2121
## 3. Adding routes
2222
Once you have your app, the next step is to add routes (or endpoints). You can do so with the `CROW_ROUTE` macro.
@@ -25,7 +25,7 @@ CROW_ROUTE(app, "/")([](){
2525
return "Hello world";
2626
});
2727
```
28-
For more details on routes, please go [here](../../guides/routes).
28+
For more details on routes, please go [here](../guides/routes.md).
2929
3030
## 4. Running the app
3131
Once you're happy with how you defined all your routes, you're going to want to instruct Crow to run your app. This is done using the `run()` method.
@@ -56,6 +56,9 @@ int main()
5656
}
5757
```
5858

59-
You then need to compile your code on your [Linux](../setup/linux#compiling-your-project), [MacOS](../setup/macos#compiling-using-a-compiler-directly), or [Windows](../setup/windows#getting-and-compiling-crow) machine
59+
You then need to compile your code on your
60+
[Linux](setup/linux.md#compiling-your-project),
61+
[MacOS](setup/macos.md#compiling-using-a-compiler-directly), or
62+
[Windows](setup/windows.md#getting-and-compiling-crow) machine
6063

6164
After building your `.cpp` file and running the resulting executable, you should be able to access your endpoint at [http://localhost:18080](http://localhost:18080). Opening this URL in your browser will show a white screen with "Hello world" typed on it.

docs/guides/app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ app.bindaddr("192.168.1.2")
3434

3535
<br><br>
3636

37-
For more info on middlewares, check out [this page](../middleware).<br><br>
37+
For more info on middlewares, check out [this page](middleware.md).<br><br>
3838
For more info on what functions are available to a Crow app, go [here](../reference/classcrow_1_1_crow.html).

0 commit comments

Comments
 (0)