Cocos2d-x: zapcc ready! Using zapcc with CMake build

I recently found zapcc: superfast clang-based C/C++ compiler and checked it with cocos2d-x and it works perfectly! Zapcc is

  • 2-4x faster than clang on first build
  • 20-50x faster than clang on cached build

It is quite impressive, isn’t it? There is guide how to use it with cmake build:

  1. Install it from binary package or source code: download from https://www.zapcc.com/ or get using git:

git clone https://github.com/yrnkrn/zapcc.git

  1. Run cmake with addicional arguments:

-DCMAKE_CXX_COMPILER=zapcc++ -DCMAKE_C_COMPILER=zapcc

P.S.: zapcc++ is symlink to zapcc but act a bit different way (addictional linkage flags).
Enjoy fast builds!

UPD: you may notice huge memory usage. In this case:

  1. Find file named zapccs.config in directory, where all other zapcc binaries are installed.
  2. Change value in [MaxMemory] directive to something smaller (to co-cexist with other programs on 8GB ond four CPU cores I personally use 512). This value is in MBs.

zapcc requires more RAM than clang:

@v2003 How much RAM do you have?

8GB (have some plans abuot upgrading to 16GB, but not critical). In file zapccs.config (in binary directory, near all other zapcc executables) there is a value named [MaxMemory]. By deafult, it is set to 1000. For comfort builds on my linux (with chrome, KDevelop and few other greedy programs) in four threads (for 4 CPU cores) I reduce it to 512 (MB).

Have you tried to use this on any other platforms besides Linux?

Unfortunately, I didn’t. But I’ll be glad if someone will do it! Process should be really simillar.

I’d be happy to try on macOS

From Github README:

Which operating systems is supported?
zapcc builds on Linux x64, Visual C++, mingw-w64 and MacOS. It was thoroughly tested on Linux x64 only, the rest are experimental.

1 Like