Horde3D
http://horde3d.org/forums/

Cross-Platform Application sharing the same Codebase
http://horde3d.org/forums/viewtopic.php?f=1&t=1705
Page 1 of 1

Author:  gyo [ 20.08.2012, 20:12 ]
Post subject:  Cross-Platform Application sharing the same Codebase

Hello everyone,

This is my first post after some days reading around, I'm just starting out with C++ and I'd like to create an application using Horde3D which can be compiled on Windows/OSX with the same codebase (or with minimum efforts).

Ideally, in the world of Python or PHP, I would create a project folder with some files and import some external libraries. All the application specific content, pipelines, compiled binaries etc. should be stored together in the project folder.
If possible I'd prefer to use plain text editors instead of large IDEs, but then how should I proceed to compile the projects on the different platforms?
Or, is there a way to share the IDE project files/solutions across the platforms? (Like Eclipse CDT, Codeblocks etc...)

Any help is highly appreciated, thank you! :)

Author:  Volker [ 20.08.2012, 21:58 ]
Post subject:  Re: Cross-Platform Application sharing the same Codebase

Why not do it like in the samples?

Use CMake for the project and GLFW for the OpenGL context initialization. Horde3D is already cross plattform compatible.

Author:  gyo [ 21.08.2012, 10:17 ]
Post subject:  Re: Cross-Platform Application sharing the same Codebase

Sorry if that may sound stupid but I'm not yet comfortable with C++ and Horde3D.

If I understand correctly, the workflow should be:

- Create my cpp/h files in some directory
- Create the CMakeLists file
- Run cmake on Windows/OSX to generate the VisualStudio/Xcode project files to compile

How can I reference the Horde3D path to include it in my files? Would a symlink work?
Is there a way to create the CMakeLists files dynamically?


Thanks for your patience

Author:  Volker [ 21.08.2012, 21:31 ]
Post subject:  Re: Cross-Platform Application sharing the same Codebase

The way you described it should be working. The samples are doing just the same. You could reference only the binaries of the Horde3D libraries in your project without having to add the source code to your CMake project as it is done in the samples. But you can do it if you want.

If you're not familiar with the general workflow of CMake, C++ and Horde3D I guess it would be the best, if you copy one of the samples (maybe the knight sample) rename it, and add it to the CMake project of Horde3D. This way you should be able to start your own project in only a few simple steps.


Regarding the dynamic creation of CMakeList files I'm not aware of any tool. There is a CMake GUI but as I've never used it myself, I can't tell you what it is good for.

Author:  shd [ 22.08.2012, 01:45 ]
Post subject:  Re: Cross-Platform Application sharing the same Codebase

Volker wrote:
Regarding the dynamic creation of CMakeList files I'm not aware of any tool. There is a CMake GUI but as I've never used it myself, I can't tell you what it is good for.

CMake GUI is only an visual alternative to 'cmake' command for building prepared CMake project.

My CMakeLists.txt was looking for source files in directories i wanted, and then after short regexp i had my source list inside a variable ready. It's just a couple lines of script.
It's not a 'right' solution though, because CMake is expecting you to change your CMakeLists.txt when new sources are added. It's using this information to regenerate all its scripts and 'cache', so you would have to regenerate the cache manually. You could add this as your IDEs prebuild command, but this would slow down your building times.

As for more complete IDE support i don't know any but you might check if kdevelop, or qt creator has some.

CMakeLists.txt generation isn't widely supported, because generally people don't do that. You're not spending that much time by preparing this kind of script, and none automatic generator can be as flexible as your custom script.

Author:  gyo [ 22.08.2012, 10:54 ]
Post subject:  Re: Cross-Platform Application sharing the same Codebase

Thank you for the clarifications, I'll try doing some tests!

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/