Manual (PDF, Simplified Chinese)
scaffold is a cross-platform toy web framework. I develop it for finishing my C++ course.
Inspired by Express, scaffold is a minimal and flexible C++ web application framework that provides a set of features for web and mobile applications, and provides a thin layer of fundamental web application features.
To build this project, cmake, make and a proper C++ compiler is required. The compiler should at least support C++11 standard.
I use macOS 10.12.5 for developing and Fedora 25 for testing. With the help of cesanta/mongoose, scaffold can run on various operating systems and hardware architectures.
- cesanta/mongoose (included in this repo)
- miloyip/rapidjson (not included in this repo)
- openssl/openssl (optional, not included in this repo)
- Boost C++ Libraries (optional, not included in this repo)
- MySQL Connector/C++ (optional, not included in this repo)
To solve these dependencies:
- Mongoose: do nothing.
- RapidJSON: use package manager, or get the source from GitHub.
- OpenSSL: use package manager, usually.
- Boost C++ Libraries: use package manager, or download from the website.
- MySQL Connector/C++: please build from source! packages downloaded from official website may crash your program!
Firstly, we need to build the scaffold library.
-
Clone the repository.
git clone https://github.com/Bokjan/scaffold
-
Create a directory for building.
cd scaffold mkdir build && cd build
All the following commands run under
/path/to/scaffold/build. -
Run CMake to configure the project.
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
If you don't need HTTPS support, add a definition when configuring.
cmake .. -DDISABLE_SSL=1
Note that
OpenSSLis required (byMongoose).You can set environment variables. For example, you specify
clang++as the C++ compiler by setting theCXXenvironment variable as following:CXX=clang++ cmake ..
You can specify the root directory where program files will install by defining
CMAKE_INSTALL_PREFIX(default:/usr/local). If you would like to installscaffoldin/home/bokjan/install, run:cmake .. -DCMAKE_INSTALL_PREFIX=/home/bokjan/install
-
Build and install.
make && make installAdd
VERBOSE=1to display the programs invoked bymake:VERBOSE=1 make.
After running make install, library (both static and dynamic) and headers are installed. You can build web applications with scaffold now. Make sure the environment variables are configured properly.
Following are some demonstrations of specifying the path:
- Using command line (dynamic linking)
g++ -o app app.cpp -I/path/to/headers -L/path/to/libraries -lscaffold
- Using CMake (static linking)
INCLUDE_DIRECTORIES(/path/to/headers) FIND_LIBRARY(LIBSCAFFOLD_STATIC libscaffold.a /path/to/libraries) TARGET_LINK_LIBRARIES(${LIBSCAFFOLD_STATIC})
- Using SCons (dynamic linking)
Env = Environment() Env.Append(LIBS = ['scaffold']) Env.Append(CPPPATH = ['/path/to/headers']) Env.Append(LIBPATH = ['/path/to/libraries'])
- License: GNU General Public License v2.0