libcopp  1.1.0
INSTALL

libcopp use cmake to generate makefile and switch build tools.

Prerequisites

Unix

Windows

Install with vcpkg

1. clone and setup vcpkg(See more detail on https://github.com/Microsoft/vcpkg)

1 git clone https://github.com/Microsoft/vcpkg.git
2 cd vcpkg
3 
4 PS> .\bootstrap-vcpkg.bat
5 Linux:~/$ ./bootstrap-vcpkg.sh

2. install libcopp

1 PS> .\vcpkg install libcopp
2 Linux:~/$ ./vcpkg install libcopp

Custom Build

1. clone and make a build directory

1 git clone --single-branch --depth=1 -b master https://github.com/owt5008137/libcopp.git
2 mkdir libcopp/build && cd libcopp/build

2. run cmake command

1 # cmake <libcopp dir> [options...]
2 cmake .. -DLIBCOPP_FCONTEXT_USE_TSX=YES -DPROJECT_ENABLE_UNITTEST=YES -DPROJECT_ENABLE_SAMPLE=YES

3. make libcopp

1 cmake --build . --config RelWithDebInfo # or make [options] when using Makefile

4. run test/sample/benchmark [optional]

1 # Run test => Required: PROJECT_ENABLE_UNITTEST=YES
2 cmake --build . --config RelWithDebInfo --target run_test # or make run_test when using Makefile
3 # Run sample => Required: PROJECT_ENABLE_SAMPLE=YES
4 cmake --build . --config RelWithDebInfo --target run_sample # or make run_sample when using Makefile
5 # Run benchmark => Required: PROJECT_ENABLE_SAMPLE=YES
6 cmake --build . --config RelWithDebInfo --target benchmark # or make benchmark when using Makefile

5. install [optional]

1 cmake --build . --config RelWithDebInfo --target install # or make install when using Makefile

Or you can just copy include directory and libcopp.a in lib or lib64 into your project to use it.

CMake Options

Options can be cmake options. such as set compile toolchains, source directory or options of libcopp that control build actions. libcopp options are listed below:

Option Description
BUILD_SHARED_LIBS=YES|NO [default=NO] Build dynamic library.
LIBCOPP_ENABLE_SEGMENTED_STACKS=YES|NO [default=NO] Enable split stack supported context.(it's only availabe in linux and gcc 4.7.0 or upper)
LIBCOPP_ENABLE_VALGRIND=YES|NO [default=YES] Enable valgrind supported context.
PROJECT_ENABLE_UNITTEST=YES|NO [default=NO] Build unit test.
PROJECT_ENABLE_SAMPLE=YES|NO [default=NO] Build samples.
PROJECT_DISABLE_MT=YES|NO [default=NO] Disable multi-thread support.
LIBCOTASK_ENABLE=YES|NO [default=YES] Enable build libcotask.
LIBCOPP_FCONTEXT_USE_TSX=YES|NO [default=NO] Enable Intel Transactional Synchronisation Extensions (TSX).
GTEST_ROOT=[path] set gtest library install prefix path
BOOST_ROOT=[path] set Boost.Test library install prefix path