switch back to boost::filesystem to avoid the requirement of c++17
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Dependencies
|
||||
|
||||
* [Boost 1.66+](https://www.boost.org/) (asio, system, date_time)
|
||||
* [Boost 1.66+](https://www.boost.org/) (asio, system, date_time, filesystem)
|
||||
* [OpenSSL](https://www.openssl.org/) (for HTTPS, optional)
|
||||
* [Zlib](https://www.zlib.net/) (for GZIP compression, optional)
|
||||
* [Googletest/gtest](https://github.com/google/googletest) (for automation and unit tests, optional)
|
||||
|
||||
+6
-23
@@ -2,8 +2,6 @@
|
||||
|
||||
_For Ubuntu based Linux distributions._
|
||||
|
||||
_NOTE: The usage of C++17 `filesystem` library requires GCC to be version 8 and above. It means that Webcc will not compile on Ubuntu LTS 18.04._
|
||||
|
||||
## Install Build Essential
|
||||
|
||||
```
|
||||
@@ -12,9 +10,7 @@ sudo apt install build-essential
|
||||
|
||||
## Install CMake
|
||||
|
||||
```
|
||||
sudo apt install cmake
|
||||
```
|
||||
Please refer to https://apt.kitware.com/.
|
||||
|
||||
## Install Zlib & OpenSSL
|
||||
|
||||
@@ -26,11 +22,11 @@ sudo apt install zlib1g-dev libssl-dev
|
||||
|
||||
Download the `.tar.bz2` or `.tar.gz` from [here](https://www.boost.org/users/download/#live).
|
||||
|
||||
Unpack and go into the directory (suppose Boost version is 1.70):
|
||||
Unpack and go into the directory (suppose Boost version is 1.74):
|
||||
|
||||
```
|
||||
tar -xzf boost_1_70_0.tar.bz2
|
||||
cd boost_1_70_0
|
||||
tar -xzf boost_1_74_0.tar.bz2
|
||||
cd boost_1_74_0
|
||||
```
|
||||
|
||||
Run `bootstrap.sh` to generate `b2`:
|
||||
@@ -44,7 +40,7 @@ You can change install prefix with `--prefix` (default is `/usr/local`, need `su
|
||||
Build and install:
|
||||
|
||||
```
|
||||
sudo ./b2 --with-system --with-date_time variant=debug link=static threading=multi -j4 install
|
||||
sudo ./b2 --with-system --with-date_time --with-filesystem variant=debug link=static threading=multi -j4 install
|
||||
```
|
||||
|
||||
Notes:
|
||||
@@ -91,7 +87,7 @@ cmake -G"Unix Makefiles" \
|
||||
-DWEBCC_ENABLE_GZIP=1 \
|
||||
-DWEBCC_ENABLE_AUTOTEST=OFF \
|
||||
-DWEBCC_ENABLE_UNITTEST=OFF \
|
||||
-DWEBCC_ENABLE_EXAMPLES=OFF \
|
||||
-DWEBCC_ENABLE_EXAMPLES=ON \
|
||||
..
|
||||
```
|
||||
|
||||
@@ -108,16 +104,3 @@ make -j4
|
||||
```
|
||||
|
||||
The number after `-j` depends on how many CPU cores you have. You can just ignore `-j` option.
|
||||
|
||||
Install the libraries:
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
If `WEBCC_ENABLE_AUTOTEST` was `ON`, you can run the automation test:
|
||||
|
||||
```
|
||||
cd autotest
|
||||
./webcc_autotest
|
||||
```
|
||||
|
||||
+5
-34
@@ -12,11 +12,11 @@ Download the .dmg from [here](https://cmake.org/download/). Just double click an
|
||||
|
||||
Download the .tar.bz2 or .tar.gz from [here](https://www.boost.org/users/download/#live).
|
||||
|
||||
Unpack and go into the directory (suppose Boost version is 1.70):
|
||||
Unpack and go into the directory (suppose Boost version is 1.74):
|
||||
|
||||
```
|
||||
tar -xzf boost_1_70_0.tar.bz2
|
||||
cd boost_1_70_0
|
||||
tar -xzf boost_1_74_0.tar.bz2
|
||||
cd boost_1_74_0
|
||||
```
|
||||
|
||||
Run `bootstrap.sh` to generate `b2`:
|
||||
@@ -30,7 +30,7 @@ You can change install prefix with `--prefix` option (default is `/usr/local`, n
|
||||
Build and install:
|
||||
|
||||
```
|
||||
sudo ./b2 --with-system --with-date_time variant=debug link=static threading=multi -j4 install
|
||||
sudo ./b2 --with-system --with-date_time --with-filesystem variant=debug link=static threading=multi -j4 install
|
||||
```
|
||||
|
||||
Notes:
|
||||
@@ -53,6 +53,7 @@ The libraries are installed to `/usr/local/lib`. E.g.,
|
||||
$ ls -l /usr/local/lib/libboost*
|
||||
-rw-r--r-- 1 adam admin 540288 Apr 21 11:01 /usr/local/lib/libboost_date_time.a
|
||||
-rw-r--r-- 1 root admin 2976 Apr 21 11:01 /usr/local/lib/libboost_system.a
|
||||
...
|
||||
```
|
||||
|
||||
The headers are installed to `/usr/local/include/boost`.
|
||||
@@ -115,33 +116,3 @@ Open Terminal, go to the build directory, run `make`. E.g.,
|
||||
$ cd github/webcc_build
|
||||
$ make -j4
|
||||
```
|
||||
|
||||
There might be some warnings, just ignore them.
|
||||
|
||||
Suppose you have checked `WEBCC_ENABLE_AUTOTEST` during the configuration, you can run it now.
|
||||
|
||||
```
|
||||
$ cd autotest
|
||||
$ ./webcc_autotest
|
||||
[==========] Running 7 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 7 tests from ClientTest
|
||||
[ RUN ] ClientTest.Get_RequestFunc
|
||||
[ OK ] ClientTest.Get_RequestFunc (1066 ms)
|
||||
[ RUN ] ClientTest.Get_Shortcut
|
||||
[ OK ] ClientTest.Get_Shortcut (1844 ms)
|
||||
[ RUN ] ClientTest.Get_SSL
|
||||
[ OK ] ClientTest.Get_SSL (2158 ms)
|
||||
[ RUN ] ClientTest.Compression_Gzip
|
||||
[ OK ] ClientTest.Compression_Gzip (913 ms)
|
||||
[ RUN ] ClientTest.Compression_Deflate
|
||||
[ OK ] ClientTest.Compression_Deflate (921 ms)
|
||||
[ RUN ] ClientTest.KeepAlive
|
||||
[ OK ] ClientTest.KeepAlive (5121 ms)
|
||||
[ RUN ] ClientTest.GetImageJpeg
|
||||
[ OK ] ClientTest.GetImageJpeg (1244 ms)
|
||||
[----------] 7 tests from ClientTest (13267 ms total)
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 7 tests from 1 test case ran. (13267 ms total)
|
||||
[ PASSED ] 7 tests.
|
||||
```
|
||||
|
||||
@@ -15,12 +15,12 @@ In the prompt, `cd` to the Boost root directory. Run `bootstrap.bat` to generate
|
||||
Run `b2.exe` to start the build:
|
||||
|
||||
```
|
||||
b2 --with-system --with-date_time variant=debug variant=release link=static threading=multi address-model=64 stage
|
||||
b2 --with-system --with-date_time --with-filesystem variant=debug variant=release link=static threading=multi address-model=64 stage
|
||||
```
|
||||
|
||||
NOTE: Given `address-model=64` `b2.exe` will not build any x86 libraries.
|
||||
|
||||
As you can see, we only need to build `system` and `date_time` which are used by Asio. Asio itself is a header-only library.
|
||||
As you can see, we only need to build `system`, `date_time` and `filesystem`. Asio itself is a header-only library.
|
||||
|
||||
We don't install Boost to any other place (e.g., `C:\Boost`). We just `stage` it where it is.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user