diff --git a/BUILD-Windows.md b/BUILD-Windows.md index 06f5bf0..95b6bae 100644 --- a/BUILD-Windows.md +++ b/BUILD-Windows.md @@ -1,6 +1,66 @@ -# Build +# Build (Windows) -*Refer to [readme](dependencies/README-Windows.md) for setting up the dependencies.* +To build the dependencies & the project itself, The following must be installed: +- Microsoft Visual Studio 2019 (VS2019) +- CMake + + +## Dependencies + +> For each dependency, CMD is assumed to be in the directory of `dependencies`. So, the first command is always changing into the directory which contains the dependency. + + +> **NOTE:** If you want to compile Libpqxx or install PostgreSQL locally, your OS username should NOT contain non-ASCII characters (e.g. Chinese characters). A workaround is to create a new administrator account whose username consists of only ASCII characters. + + +### [Boost](https://www.boost.org/) + +CMD: +``` +cd boost +bootstrap +b2 +``` + + +### [Crypto++](https://cryptopp.com/) + +1. Go to `cryptopp`. +2. Use VS2019 to open `cryptest.sln`. +3. For `Debug` `x64` configuration, open `Properties` of `cryptlib` project. In `C/C++` `Code Generation`, set `Runtime Library` to `Multithreading Debug DLL (/MDd)`. +4. For `Release` `x64` configuration, open `Properties` of `cryptlib` project. In `C/C++` `Code Generation`, set `Runtime Library` to `Multithreading DLL (/MD)`. +5. `Batch Build` `Debug` AND `Release` `x64` of `cryptlib`. + + +### [PostgreSQL 14.0](https://www.postgresql.org/) + +*The database may not be installed locally. You should be able to connect to it.* + +1. Use this [link](https://get.enterprisedb.com/postgresql/postgresql-14.0-1-windows-x64-binaries.zip) to download the binaries. +2. Unzip the zip archive here. It should be named `pgsql` and contains `bin`, `include` and `lib`. + + +### [Libpqxx](https://github.com/jtv/libpqxx) + +1. Go to `libpqxx`. +2. Use `cmake-gui`: + - `Browse Source...` and `Browse Build...` to the root directory of `libpqxx`. + - `Add Entry`: `PostgreSQL_INCLUDE_DIR` (`PATH`) = `../../pgsql/include` + - `Add Entry`: `PostgreSQL_LIBRARY` (`FILEPATH`) = `../../pgsql/lib/libpq` + - `Configure`: Use default settings (`VS2019` `x64`). + - `Generate` +3. Use VS2019 to open `libpqxx.sln`. +4. `Batch Build` `Debug` AND `Release` `x64` of `pqxx`. + + +### [inja](https://github.com/pantor/inja) + +*Nothing should be done...* + + +## Sample Project: `WebApp` + +> Now we should go back to the root directory. Use VS2019 to open `WebApp/WebApp.sln`, which is a sample project. Remember to properly configure the database and `config.json` before you `Run` the project. diff --git a/BUILD-ubuntu.md b/BUILD-ubuntu.md index 098bfbe..d692970 100644 --- a/BUILD-ubuntu.md +++ b/BUILD-ubuntu.md @@ -1,6 +1,56 @@ -# Build +# Build (Ubuntu) -*Refer to [readme](dependencies/README-ubuntu.md) for setting up the dependencies.* +To build the dependencies & the project itself, The following must be installed: +- g++ +- make +- CMake + + +## Dependencies + +> For each dependency, shell is assumed to be in the directory of `dependencies`. So, the first command is always changing into the directory which contains the dependency. + + +### [Boost](https://www.boost.org/) +shell: +``` +cd boost +./bootstrap +./b2 +sudo ./b2 install +``` + + +### [Crypto++](https://cryptopp.com/) +shell: + +``` +cd cryptopp +make +``` + + +### [PostgreSQL](https://www.postgresql.org/) +**The database should be installed locally.** + + +### [Libpqxx](https://github.com/jtv/libpqxx) +shell: +``` +cd libpqxx +./configure +make +``` + + +### [inja](https://github.com/pantor/inja) + +*Nothing should be done...* + + +## Sample Project: `WebApp` + +> Now we should go back to the root directory. shell: ``` diff --git a/README.md b/README.md index c55380f..8451efc 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ### Hello, World! -[`hello.cpp`](examples/hello.cpp): +[`examples/hello.cpp`](examples/hello.cpp): ```C++ #include #include @@ -36,7 +36,7 @@ By default, `bserv` listens to `8080`. When you make a request (of any type) to ### Routing -[`routing.cpp`](examples/routing.cpp): +[`examples/routing.cpp`](examples/routing.cpp): ```C++ #include #include diff --git a/dependencies/README-Windows.md b/dependencies/README-Windows.md deleted file mode 100644 index 9cade4a..0000000 --- a/dependencies/README-Windows.md +++ /dev/null @@ -1,56 +0,0 @@ -# Dependencies - - -To build the dependencies & the project itself, The following must be installed: -- Microsoft Visual Studio 2019 (VS2019) -- CMake - -For each dependency, CMD is assumed to be in the directory of `dependencies`. So, the first command is always changing into the directory which contains the dependency. - - -> **If you want to compile Libpqxx or install PostgreSQL locally, your OS username should NOT contain non-ASCII characters (e.g. Chinese characters). A workaround is to create a new administrator account whose username consists of only ASCII characters.** - - -## [Boost](https://www.boost.org/) - -CMD: -``` -cd boost -bootstrap -b2 -``` - - -## [Crypto++](https://cryptopp.com/) - -1. Go to `cryptopp`. -2. Use VS2019 to open `cryptest.sln`. -3. For `Debug` `x64` configuration, open `Properties` of `cryptlib` project. In `C/C++` `Code Generation`, set `Runtime Library` to `Multithreading Debug DLL (/MDd)`. -4. For `Release` `x64` configuration, open `Properties` of `cryptlib` project. In `C/C++` `Code Generation`, set `Runtime Library` to `Multithreading DLL (/MD)`. -5. `Batch Build` `Debug` AND `Release` `x64` of `cryptlib`. - - -# [PostgreSQL 14.0](https://www.postgresql.org/) - -*The database may not be installed locally. You should be able to connect to it.* - -1. Use this [link](https://get.enterprisedb.com/postgresql/postgresql-14.0-1-windows-x64-binaries.zip) to download the binaries. -2. Unzip the zip archive here. It should be named `pgsql` and contains `bin`, `include` and `lib`. - - -# [Libpqxx](https://github.com/jtv/libpqxx) - -1. Go to `libpqxx`. -2. Use `cmake-gui`: - - `Browse Source...` and `Browse Build...` to the root directory of `libpqxx`. - - `Add Entry`: `PostgreSQL_INCLUDE_DIR` (`PATH`) = `../../pgsql/include` - - `Add Entry`: `PostgreSQL_LIBRARY` (`FILEPATH`) = `../../pgsql/lib/libpq` - - `Configure`: Use default settings (`VS2019` `x64`). - - `Generate` -3. Use VS2019 to open `libpqxx.sln`. -4. `Batch Build` `Debug` AND `Release` `x64` of `pqxx`. - - -# [inja](https://github.com/pantor/inja) - -*Nothing should be done...* diff --git a/dependencies/README-ubuntu.md b/dependencies/README-ubuntu.md deleted file mode 100644 index 5414379..0000000 --- a/dependencies/README-ubuntu.md +++ /dev/null @@ -1,46 +0,0 @@ -# Dependencies (Ubuntu) - - -To build the dependencies & the project itself, The following must be installed: -- g++ -- make -- CMake - -For each dependency, shell is assumed to be in the directory of `dependencies`. So, the first command is always changing into the directory which contains the dependency. - - -## [Boost](https://www.boost.org/) -shell: -``` -cd boost -./bootstrap -./b2 -sudo ./b2 install -``` - - -## [Crypto++](https://cryptopp.com/) -shell: - -``` -cd cryptopp -make -``` - - -# [PostgreSQL](https://www.postgresql.org/) -**The database should be installed locally.** - - -# [Libpqxx](https://github.com/jtv/libpqxx) -shell: -``` -cd libpqxx -./configure -make -``` - - -# [inja](https://github.com/pantor/inja) - -*Nothing should be done...*