Best folder structure for C++ cross-platform library and bindings

前端 未结 4 1521
迷失自我
迷失自我 2021-01-29 18:44

I am about to begin work on a cross-platform library to be written in C++. Down the road, I intend to implement bindings for other languages such as Python, Java, etc. The lib

4条回答
  •  青春惊慌失措
    2021-01-29 19:17

    Why you need different platform folders for binary files? You going to build this source code under different platoforms but with same file system?

    If yes, I think you need compiller specific folders too.

    Why you don't use different folders for debug and release build, maybe unicode and non-unicode, single-threading or multithreading builds?

    Look on bjam or Scons make replacers. Maybe you don't need different folders in build directory.

    I think it will be better if all modules from "modules" directory will contain "tests" directory for test self.


    And last - see boost library, this platofrm independed library which have nice structure.

    Also try to get ideas from antother platform independed projects.

    Boost folders structure:

    boost - root dir
    - boost - library header lib ( for users )
    - libs - library source dir ( one dir per lib )
        - build - library build files ( if they are needed )
        - doc - documentation files
        - example - sample programs
        - src - library source files
        - test - programs and srcipts for testing module
    - bin - created by bjam build system
        - libs
            - 
                for all compiled folders from libs [example|test|build]
                    - /<[static|dynamic]-link>/<[debug|release]>/<[threading mode]>
                        contain builded [obj|dll|lib|pdb|so|o|etc] files see detailed information in bjam build system
    
    - doc
    - tools
    

    If you choose bjam - you will not be concerned on build and bin folders structure.

    Also your libs/src/ dir could contain own for all platform files and couple dirs for platform spcific files.

    I don't see any serious problems in your folders structre, maybe you will see them when start write project prototype.

提交回复
热议问题