Antony
Antony

Reputation: 33

Multi-platform C++ project structure

I actually need help on how to structure my project (the directory tree). I plan to code a network library split in multiple parts (one for server, one for client etc)

I am actually coding on Windows but I plan to make it multi-platform in the future.

My current setup is:

Solution folder
    - doc           // Doxygen generated documentation
    - include       // Public headers
    - lib           // Output libraries
        - Debug
        - Release
    - source        // Private implementation and headers
    Doxyfile
    Solution.sln

My question is, where am I supposed to put the project files for each IDE ? Visual Studio generates multiple files per project, I don't know where am I supposed to store them, as there might be another IDE that does it as well.

Upvotes: 1

Views: 1107

Answers (3)

user7163225
user7163225

Reputation: 1

For each platform, different codeset will be executed and hence the will have separate code base for each platform otherwise it will not compile. The solution is to have separate file for platform specific functionality and tag that file for the platform, maintaining one codebase. To work on a platform, pull the platform specific required code from the repository. Here is an example "Upload XML data to MySQL or NoSQL"

Upvotes: 0

Galik
Galik

Reputation: 48615

Don't include any of the files generated by the IDE in your project. Let each developer choose their own IDE. Just package the files relevant to the program/library itself when you distribute the source code and let each developer import it into their own preferred IDE.

You will have to choose some cross-platform way of building the progs/libs.

Makefile is pretty universal. Most IDEs can run a project from its Makefile. Or you can use one of many cross-platform build systems that generate a Makefile.

Also you may want to keep your sources under version control such as git.

Upvotes: 1

CodeMonkey
CodeMonkey

Reputation: 12424

If you want to create a cross platform project, then simply use an IDE and programming language that is suitable for the task. You can for example just use Eclipse to get a C++ support and get an output for your project that can run on several operating systems.

Upvotes: 0

Related Questions