Saturday, November 26, 2022
HomeGame DevelopmentHome windows workflows - C++ - Cocos Boards

Home windows workflows – C++ – Cocos Boards


Every little thing should go right into a “CMakeLists.txt”, whether or not you add the .cpp/.h to the foundation CMakeLists file, otherwise you break it up and add CMakeLists.txt to sub-directories, and reference them from the foundation one, it’s completely as much as you.

When you make any adjustments to CMakeLists.txt, you have to do one in every of two issues, both re-run the cmake command in a console window to re-create the Visible Studio resolution and undertaking information, or proper click on the “ZERO_CHECK” undertaking and construct that (which ought to do the identical factor as operating the cmake command by way of the CLI). If for any purpose you get errors, then chances are high you’ve up to date one thing that requires you to delete the [build_folder]/CMakeCache.txt file, after which re-do one of many above steps.

Android Studio doesn’t require you to manually run cmake, because it handles that job mechanically inside the IDE once you do a gradle sync.

For Xcode, it’s the identical course of as Home windows, the place you manually have to run the cmake command to recreate the undertaking information on any adjustments to “CMakeLists.txt”.

To save lots of myself time, I simply created a batch file and put it within the root listing of my undertaking, and after I have to, I merely run it to re-run cmake and refresh the construct folder.

For instance, to create a Visible studio 2019 (x86/Win32) resolution in a listing named “build-win32”:

IF EXIST .build-win32 GOTO RUNCMAKE
mkdir build-win32
:RUNCMAKE
cmake -S . -B build-win32 -G "Visible Studio 16 2019" -Tv142 -A Win32

For Visible Studio 2022, you are able to do this:

IF EXIST .build-win32 GOTO RUNCMAKE
mkdir build-win32
:RUNCMAKE
cmake -S . -B build-win32 -G "Visible Studio 17 2022" -A Win32

In case you put the above code in one thing like “vs-run-cmake.bat” or comparable, drop that file in your undertaking folder. Simply run this file any time you make adjustments to “CMakeLists.txt” to refresh the VS resolution information.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments