Skip to content

dyu/cpp-build-example

Repository files navigation

Originally derived from https://github.com/sazzer/cpp-build-systems

Static libs by default to work on windows (only buck does not run on windows)

Linux

Install g++ (4.9 or higher)

Windows

Install vc build tools 2015.

Exec this before running the builds.

call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64

Tool-specific requirements

Go to their homepage and install the their respective dependencies.

mkdir meson-out && cd meson-out
meson .. --buildtype release
ninja
ninja test

# run
./executable
9k bfg9000-out
cd bfg9000-out
ninja
ninja test

# run
./executable
mkdir cmake-out && cd cmake-out
conan install .. --build missing
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja
ninja test

# run
./bin/executable
buck build //:executable
buck test //:shared_gtest

# run
./buck-out/gen/executable

Very similar to bazel with a few differences

Setup

Download the binary appropriate for your platform and add it to your exec PATH.

# print out your gn version (At the time of this writing, mine was 446079)
gn --version

# import the cross-platform build config/toolchain template
git clone --depth 1 --single-branch -b master https://github.com/dyu/gn-build build

Linux

gn gen gn-out --args='gcc_cc="gcc" gcc_cxx="g++" is_debug=false is_clang=false is_official_build=true'

Windows

gn gen gn-out --args="visual_studio_path=\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\" visual_studio_version=\"2015\" is_debug=false is_clang=false is_official_build=true"
ninja -C gn-out

# run
./gn-out/executable