Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added QtCreator project for Linux and Windows (MinGW) #4399

Closed
wants to merge 9 commits into from

Conversation

sergey-shambir
Copy link
Contributor

Tested on

  1. Ubuntu 13.10, 64-bit, clang compiler
  2. Ubuntu 13.10, 64-bit, GCC compiler
  3. Windows XP, 32-bit, MinGW compiler
  4. Windows 7, 64-bit, MinGW 32-bit compiler

There're no Qt5 port yet, but I'm going to add it later. Current progress is in [1], TODOs are in that commit message. Probably I should make refactoring on SimpleAudioEngine before publishing Qt5 port, because in Qt5 audio can be decoded only asynchroniously so it's better to move whole SimpleAudioEngine into separate thread for all platforms.

P.S. In game published to GooglePlay we have rare fatal Java exceptions due to non thread-safe SimpleAudioEngine in cocos2dx 2.1.4, so probably refactoring SimpleAudioEngine will be useful for Android too.

[1] sergey-shambir@be7beb8

sergey-shambir and others added 3 commits November 27, 2013 10:54
finished).

Also:
1. Fixed install_glfw.sh script to avoid conflict with glfw2 installed
with package manager.
2. Added MinGW compiler support.
@@ -35,14 +36,14 @@
wc.lpszMenuName = NULL; // We Don't Want A Menu
wc.lpszClassName = WIN_CLASS_NAME; // Set The Class Name

if (! RegisterClass(&wc)
if (! RegisterClassA(&wc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to use Ascii function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact CocosDenshion.vcxproj CharacterSet is NotSet, means that it is the Ansi version, external parameter is const char_, then do not want to convert to const wchar_, must also be Ansi version, but for Qt Creator MinGW version, identified as a version of Unicode, leading to MciPlayer is not working, so I suggest MciPlayer.cpp to Ansi version

# Default settings are fine, but some indie developers or teams may prefer to
# change them.

# By default we use Chipmunk physics engine since Box2D is unmaintained.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box2D released 2.3 in Nov.3.
Why did you say it is unmaintained?
Any link for the information?

Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll remove this note from comment.

@minggo
Copy link
Contributor

minggo commented Nov 29, 2013

@sergey-shambir
Thanks for the pull request. Awesome job.

I found that you uploaded many static libs for win32 platform. Why should use static libs? If it has to use static libs, then i think we should delete other dynamic libraries on win32.

@akof1314
Copy link
Contributor

@minggo because some external libraries is build by vc project, it can not be used on MinGW.

@minggo
Copy link
Contributor

minggo commented Nov 29, 2013

Ok, got it, but i think it is confused to put them into win32 folder. Because when a developer want to link some library, he doesn't know the difference. So i think it is better to create a new folder, such as mingw, to hold the libs.

@minggo
Copy link
Contributor

minggo commented Nov 29, 2013

And one more question: is MinGW needed for QTCreator on windows?

@sergey-shambir
Copy link
Contributor Author

It's shipped as part of QtSdk for windows, while Visual Studio should be downloaded separately and sometimes glitches (e.g. Visual Studio 2010 doesn't work with QtCreator without SP1 update). So MinGW is more reliable when need to build app with QtCreator.

@minggo
Copy link
Contributor

minggo commented Nov 29, 2013

VS2012 is required to run cocos2d-x on windows. It makes things complicated to support MinGW, because we should ship and maintain so many libs.

@akof1314
Copy link
Contributor

@minggo MinGW libraries maybe does not need add to github. Some people are interested in MinGW, then can build their own. More people, then consider adding.

@minggo
Copy link
Contributor

minggo commented Nov 29, 2013

@akof1314
Did you agree with me? We don't have to support MinGW.

@akof1314
Copy link
Contributor

@minggo recommend add QtCreator project ,except the MinGW static libraries on win32. @sergey-shambir

Now MinGW can support audio
@sergey-shambir
Copy link
Contributor Author

Ok, I'will remove MinGW static libraries and prepare project for MSVC 2012 as target compiler.

@martell
Copy link
Contributor

martell commented Nov 30, 2013

We would support Mingw64 because it can come with clang which would then work with emscripten.
Besides Visual Studio is very bloated for win32 development

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@sergey-shambir @akof1314
Thanks.

@martell
Windows and Qt are not releasing platform, we don't want to make engine too complex to be maintained. And it will slow down the developing speed, because we have to be care of so many platforms when adding a new feature.

@martell
Copy link
Contributor

martell commented Dec 2, 2013

@minggo

I understand where you are coming from.
Will you have a look at #4411 Hopefully that will make it easier.
I would consider windows mac and linux development platforms.
As you have said though Windows its not a Release platform.

We should have windows, mac, and linux running via cmake to make the development more streamlined.

I will then add in Android and IOS to cmake once you guys are happy with it
(I already have it done it for my own projects)

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@martell
It seems great. We have considered use CMake to generate all platform projects, but we wonder if CMake can meet our requirement. As you know, we use too many IDE configurations, such as share all targets in one Xcode project.

And some one suggests to use premake. It seems premake can generate Xcode project on windows. I am not familiar with premake and CMake. I don't know which one is better. Could you give some suggestion of it?

Thanks.

@martell
Copy link
Contributor

martell commented Dec 2, 2013

@minggo
CMake is a more proven system. It works on MSVC Xcode Eclipse Sublime etc
CMake would be best for Android as you can use it to do the cpp compiling rather than having a build_native.sh and build_native.cmd Have a look here https://code.google.com/p/android-cmake/ (It's used in opencv)
We could get rid of those annoying .mk files then and build and link cocos as a library rather than from source every time.

In my PR I have simplified generating Visual Studio 2010, 2012 and 2013 to a simple bat file
If you have a windows box you can test out my pull request. (recent jsoncpp changes in master branch may break it though)

My favourite part of CMake is that it generates Sublime Text Projects. :D

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@martell
Thanks for your suggestion and sharing. It sounds good to use just CMake to generate all project files.

@ricardoquesada
Copy link
Contributor

@minggo
I think it is possible to generate Xcode projects with CMake.

$ cmake -G Xcode ...

I haven't tried it myself, but apparently it works OK. We need to do some tests, though.

If we can unify everything on CMake, it would be great.

@martell
Copy link
Contributor

martell commented Dec 2, 2013

@minggo
The only issue I have with CMake is that for visual studio you have to generate seperate projects for x86 arm x64

@ricardoquesada
cmake -v will give you all generators you can use on that platform
Xcode is one of them for both IOS and MAC

I have cmake implemented for project generation in cocos2d-x 2.2 for most platforms

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@ricardoquesada
Yep, we should do more research on CMake.

@martell
Thanks for your work.

@ricardoquesada
Copy link
Contributor

@martell
thanks. sounds good!

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@martell
The reason i don't want to support MinGW is that it has to add all libs that cocos2d-x used. And we have to build library for MinGW when we add a new lib. Even worse is that we have to test for MinGW when releasing.

@martell
Copy link
Contributor

martell commented Dec 2, 2013

@minggo
I've done that already for you.
https://github.com/martell/MINGW-packages

The packages will be part of msys2 which uses pacman (like arch linux)
Any package that runs on linux will be added here.
Most of arch linux PKGBUILD files work without much change.

They don't even need to be in the cocos2d-x project.

just
pacman -S mingw-w64-i686-libglfw3 (to install)
equivalent to ubuntu's apt-get

It also has python tcl /tk etc so we don't need cygwin to run plugin-x or project-creator.py
Infact i use it for my git bash and it has shell script support so I dropped cygwin completely
thanks to alexpux :D

We should treat Mingw64 and Msys2 like linux and not windows when used together.
That will fix the Windows specific problems we have

Check it out
http://sourceforge.net/projects/msys2

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@martell
Thanks.

My question are

  • Is MinGW needed and why?
  • Will you maintain MinGW port?
  • Will you test MinGW before releasing a new version of cocos2d-x. Now we don't have auto-testing script. We have to do testing manually. It cost us much time to do testing.

@martell
Copy link
Contributor

martell commented Dec 2, 2013

@minggo

  1. MinGW is needed if we want to use gcc or clang on windows. (future emscripten target on windows)
    MSYS2 should be the system it runs on because cygwin is horrible
  2. I can maintain it.
  3. It can be built from Linux with travis.
    http://packages.ubuntu.com/lucid/mingw-w64

The Real work is in cmake.
Once CMake Works adding Mingw is a simple task.

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

@martell

MinGW is needed if we want to use gcc or clang on windows. (and for emscripten target on windows)
MSYS2 should be the system it runs on because cygwin is horrible

Why should we use gcc or clang on windows? Most developers are used to using VS for developing on windows. And now we don't need cygwin any more. As you see, we use python to build android projects. As for emscripten, i am not sure if it is valuable to support MinGW to support emscripten target on windows. But it is great to hear that you will maintain it.

It can be built from Linux with travis. MinGW is not just for windows as the host hence (Minimal gcc for Windows)

Did you mean we can test MinGW on linux?

@martell
Copy link
Contributor

martell commented Dec 2, 2013

@minggo
Why should we use gcc or clang on windows?
The second answer gives a better insight.

Did you mean we can test MinGW on linux?"

Yes we can build the Windows exe from Linux (in travis ci case ubuntu specifically)

We then can also build for Linux from Windows
We can even build Mac from both Windows or Linux

EDIT: We can build for IOS from Windows and Linux Desktops also ;)

"This is true cross platform development"

How do you do quotes on github by the way :P

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

It sounds good to build all all in one platform. But we will add auto-testing, so we have to run samples on different environments.

You can use quotes like this

>> the contests to be quoted

Add comment here.

@martell
Copy link
Contributor

martell commented Dec 2, 2013

Initially for MingW we could just use Wine http://www.winehq.org/

@minggo
Copy link
Contributor

minggo commented Dec 2, 2013

Yep, i have heard wine. But will it become too much complex?

And we should test all compilers that developer can use. For example, developers will use VS for developing, then we should test VS.

@minggo
Copy link
Contributor

minggo commented Dec 4, 2013

So, i think we should remove the static libs now.

@sergey-shambir
What's your opinion?

@martell
Copy link
Contributor

martell commented Dec 4, 2013

@minggo
glew png jpeg tiff webp glfw3 etc are all part of msys2 now in both x86 and x64 forms
http://sourceforge.net/projects/msys2/
I was talking to alexpux and he told me he is currently adding qt5 as a package to msys2

This should be very relevant here and the mingw static libs could be removed from this commit
I strongly advise leaving pacman manage the Mingw libraries instead of constantly updating them within the cocos2d-x repo

@minggo
Copy link
Contributor

minggo commented Dec 4, 2013

This should be very relevant here and the mingw static libs could be removed from this commit
I strongly advise leaving pacman manage the libraries instead of constantly updating them within the cocos2d-x repo

It would be good. As we used dpkg on ubuntu.

@martell
Copy link
Contributor

martell commented Dec 6, 2013

Just had a look through the code of this pull request.

@sergey-shambir
We don't need to add qt creator ".pro" project files because it will add even more project types.
QT creator supports cmake so #4434 should be a better fit.
I'm using it with sublime and qtcreator right now :)

Also the newer r4 headers with mingw match visual studio headers much better now so half of the mingw specific changes aren't needed any more :)

@dumganhar
Copy link

Could anyone update this PR since it could not be automatically merged?

@sergey-shambir
Copy link
Contributor Author

Ok, I'll update it in next few days.

@dumganhar
Copy link

@sergey-shambir
Thanks.

@dumganhar
Copy link

@sergey-shambir , could you use CMake to organize qt projects? QTCreator supports to import CMakeLists.txt.
To have .pro or .pri which are QT project files will take us more time to maintain it.

@darkdukey
Copy link
Contributor

I personally would love to see this happen, since I've been play with Qt and MinGW these days.

@martell
Copy link
Contributor

martell commented Jan 16, 2014

Hey @dumganhar,

It should be already possible to load the project into QTCreator via Cmake.
You just have to have the cmake commandline with the options you want and drop it into QtCreator

Kind Regards
Martell

@cocosQA
Copy link

cocosQA commented Apr 29, 2014

Dear sergey-shambir:
We have created a new branch 'v3' to replace branch 'develop', and this PR has been moved from 'develop' branch to 'v3' branch, the new PR is #6473
The old 'develop' branch will be deleted soon, and this PR will be closed accordingly.

@minggo minggo closed this Apr 29, 2014
gelldur pushed a commit to gelldur/cocos2d-x that referenced this pull request Aug 16, 2016
…age.

Former-commit-id: dcd07982aabe631a36052af2208049b9b70b5999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants