CMake, STB_Image +GLFW (For windows)


Hi everyone.

I have been busy the last few days playing with cocos2d-x, I have achieved quite a lot and would to share what I have achieved.

I have created CMake files which work so far with Windows (Generating visual studio projects) and Linux, I will update to support OSX over the weekend, after that I am going to add support for Android and iOS.
If you are not aware, CMake files make compiling the same project on multiple platforms a LOT easier as you are only keeping 1 CMake file up to date instead of a Solution/Project for every platform you are developing on/for.

I have replaced the dependencies on libJpeg and LibPNG with STB_Image and STB_Image_Writer which provide enough functionality for games without all the overhead.

I have modified the Linux target removing all Linux specific code and replacing it with GLFW equivalents, from that I have created a new Platform called PC. Currently this supports Linux and Windows using GLFW (It’s a modified version of the Linux code) AND it uses native OpenglGL (Not OpenglES) therefore removing the dependency on the PowerVR dll libraries and opens up the potential of distributing on Windows (and Linux) and very soon I will have this ported to OSX (When I get access to a mac)

Here is a link to my project:

This will require CMake, to compile follow these steps:

Create a new directory in the helloworld directory and change to it
Then run: “cmake …/”
If you are on Linux then you can just Run make
If you are on windows then there will be a Visual Studio solution generated in the current directory
From that point you can build the project

The output of the project will end up in the Output subdirectory.

What kind of interest is there in these modifications?



Just noticed a thread on the windows part of the forums about GLFW +GLee for windows! Seems I was a week late :slight_smile:

Hopefully my other additions will be of some use!


Very cool.
I hope you can pull a request by github after you adding support for iOS, Android and MAC.


Want CMake! :slight_smile: