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

前端 未结 4 1490
迷失自我
迷失自我 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:25

    Might I suggest not using the architecture to categorize build files?

    I was trying to apply your proposed folder structure but I couldn't find the correct place to put common Linux Makefile definitions and Visual Studio property files. How about just the following:

    /project
       /build
          /linux
          /macosx
          /win32 (or win)
    

    And example case would include:

    /project
       /build
          /linux
             Make.defs
             Makefile  [i386, amd64]
          /win32
             /VC8
                /
                   .vcproj
                .sln  [Win32, x64]
             /VC11
                /
                   .vcxproj
                .sln  [Win32, x64, ARM]
    

    If you don't want to define architecture builds through configurations, how about another folder layer under the platform types?

    /project
       /build
          /linux
             /linux_amd64
             /linux_i386
          /macosx
             /?
          /win32 (or win)
             /win32
             /win64
    

    If a given project will not have any common build files for a platform, the original structure would suffice.

提交回复
热议问题