axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
868 stars 195 forks source link

It would be better if you guys support engine files copy when creating new project. #1199

Closed MartinLutherSu closed 1 year ago

MartinLutherSu commented 1 year ago

In many cases, the new project needs to change the functions of the engine to be customized, and the current way to create project directly references the source project, so if I make some customized changes of the axmol engine source code, and then pull the project to keep git repository update, I need to spend a lot of time to deal with various conflicts. If there is an option that allows me to choose whether to copy the engine source code when creating a new project, it will bring great convenience, I can pull the new engine repository separately, and choose which features to integrate into my existing projects.

rh101 commented 1 year ago

Have you tried using AX_ROOT? You can either set it in the CMakeLists.txt of the project to point to the version of the engine that you want to use, or you may be able to pass it in on the command line when you are creating the build files via the cmake command.

That will also allow you to copy the engine code into your project folder, and just set the AX_ROOT in the CMakeLists.txt to point to it.

Open up the CMakeLists.txt file of your project, and look at the sections that use AX_ROOT to see how it's being used; it's straightforward.

MartinLutherSu commented 1 year ago

Aha, thanks for your prompt, I tried the way you said, and it works. Now I can copy the separate engine files to the project's directory, and then modify it as I like by changing the CMakelist.txt file.

Compared with the current way of building project, I prefer the original way of engine version v3, you do not need to go through cmake, for the developers of the Windows platform, it is painful to run the cmake command every time you create a new project file, previously you only need to add files in Visual Studio IDE. Whatever...

rh101 commented 1 year ago

CMake support was added in Cocos2d-x v3, and then was the only way to build with v4/Axmol. It actually saves a lot of time, especially when doing cross-platform development.

You only need to generate the Visual Studio project once, and the only time you need to re-run the cmake command is if you add new files to your project, or anything that may affect the contents of the project files. You can simply right click the "ZERO_CHECK" project and click "Build" on it, and that will update your build files, so no need to manually re-run the cmake command. You can also just add the cmake command inside a batch file, and run that batch file when you need to update the build files; there are many ways to simplify the process.

Anyhow, please close this issue since you now have a solution to it.

MartinLutherSu commented 1 year ago

I see now, thanks for sharing some development tips :)