[Guide] Compiling Cocos2d-x with CLion

it works, thanks.
is anybody know how to import sdkbox and his plugins (in case of android project)?

Could someone update this guide to latest Cocos2d-x-3.12 ?
Thanks

Here is an updated guide how to setup CLion devenv on Windows for Cocos2d-x v3.13.1

Download MSYS2 64

from here: http://repo.msys2.org/distrib/msys2-x86_64-latest.exe
Install it (c:\msys64\ - i will refer this path, if you choose another one - update paths correspondingly).

Run MSYS2, and execute following commands, restarting it after each command:

pacman -Sy --noconfirm pacman
pacman -Syu --noconfirm
pacman -Su --noconfirm

Run MSYS2 MinGW 64-bit and paste following command (you can copy&paste all following commands at once):

pacman -Sy --noconfirm --force \
    git \
    mingw-w64-x86_64-cmake \
    mingw-w64-x86_64-toolchain \
    mingw-w64-x86_64-gcc \
    mingw-w64-x86_64-gdb \
    mingw-w64-x86_64-libvorbis \
    mingw-w64-x86_64-openal \
    mingw-w64-x86_64-openssl \
    mingw-w64-x86_64-glew \
    mingw-w64-x86_64-glfw \
    mingw-w64-x86_64-pkg-config \
    mingw-w64-x86_64-freetype \
    mingw-w64-x86_64-mpg123 \
    mingw-w64-x86_64-glew \
    mingw-w64-x86_64-libwebp \
    mingw-w64-x86_64-libtiff \
    mingw-w64-x86_64-libjpeg \
    mingw-w64-x86_64-libpng \
    mingw-w64-x86_64-curl \
    mingw-w64-x86_64-zlib

mkdir $TMP/cocos2dx_installation	
cd $TMP/cocos2dx_installation
git clone https://github.com/warmcat/libwebsockets.git libwebsockets
cd libwebsockets
git checkout v2.0-stable
mkdir _build
cd _build
cmake -DLWS_WITHOUT_TESTAPPS=ON -DLWS_USE_BUNDLED_ZLIB=OFF -G "MinGW Makefiles" ..
cmake -DLWS_WITHOUT_TESTAPPS=ON -DLWS_USE_BUNDLED_ZLIB=OFF -G "MinGW Makefiles" ..
mingw32-make
mingw32-make install DESTDIR=./install
mkdir /mingw64/lib/cmake/libwebsockets
cp ./install/Program\ Files\ \(x86\)/libwebsockets/lib/*     /mingw64/lib
cp ./install/Program\ Files\ \(x86\)/libwebsockets/include/* /mingw64/include
cp ./install/Program\ Files\ \(x86\)/libwebsockets/bin/*     /mingw64/bin
cp ./install/Program\ Files\ \(x86\)/libwebsockets/cmake/*   /mingw64/lib/cmake
cp ./install/Program\ Files\ \(x86\)/libwebsockets/cmake/*   /mingw64/lib/cmake/libwebsockets
cd ../..
git clone https://github.com/slembcke/Chipmunk2D.git Chipmunk2D
cd Chipmunk2D
git checkout tags/Chipmunk-7.0.1
sed -i "s/\#include <sys\/sysctl.h>//g" src/cpHastySpace.c
mkdir _build
cd _build
cmake -DBUILD_DEMOS=OFF -DBUILD_SHARED=ON -DBUILD_STATIC=ON -G "MinGW Makefiles" ..
cmake -DBUILD_DEMOS=OFF -DBUILD_SHARED=ON -DBUILD_STATIC=ON -G "MinGW Makefiles" ..
mingw32-make
mingw32-make install DESTDIR=./install
cp ./install/Program\ Files\ \(x86\)/chipmunk/lib/*     /mingw64/lib
cp -r ./install/Program\ Files\ \(x86\)/chipmunk/include/* /mingw64/include
cp ./install/Program\ Files\ \(x86\)/chipmunk/bin/*     /mingw64/bin
cd ../../..
rm -rf $TMP/cocos2dx_installation
exit

Update your project CMakeLists.txt:

set( USE_SOURCES_EXTERNAL ON CACHE BOOL "Use some libraries from cocos2dx externals" )
add_subdirectory(${COCOS2D_ROOT}) # this line already exists in your project

Setup CLion

Set CLion MinGW location to: C:\msys64\mingw64
Set CLion CMake location to: C:\msys64\mingw64\bin\cmake.exe

This way you will have fully setup MinGW environment for cocos2dx + CLion.

P.S. If you want to use bullet+recast - update their sources according posts above.


Bonus


Disable default physics engine - Chipmunk

If you don’t want to use Chipmunk physics engine (for example you use bullet+recast or Box2D)

set( USE_BULLET OFF CACHE BOOL "Turn off Bullet (3d physics)" )
add_subdirectory(${COCOS2D_ROOT}) # this line already exists in your project
add_definitions(-DCC_USE_PHYSICS=0)

Disable 3D physics & path-finding for 2D-only game - Bullet+Recast

If you don’t want to use 3D physics & path-finding (for example 2D game) to shorten compile time:

set( USE_BULLET OFF CACHE BOOL "Turn off Bullet (3d physics)" )
set( USE_RECAST OFF CACHE BOOL "Turn off Recast (3d pathfinding)" )
add_subdirectory(${COCOS2D_ROOT}) # this line already exists in your project

Enable C++ physics engine - Box2D

If you want to use Box2D (don’t forget to disable Chipmunk if it’s not used):

SET( USE_BOX2D ON CACHE BOOL "Turn on Box2D for 2D physics" )
add_subdirectory(${COCOS2D_ROOT}) # this line already exists in your project


###Don’t forget to invalidate project after any changes to CMakeLists.txt in CLion.

Very nice, thank you!