Kev*_* P. 54 c++ cross-platform
我即将开始使用C++编写的跨平台库.接下来,我打算为其他语言实现绑定,例如Python,Java等.这些库需要在主要平台上可用:win32,Linux和Mac OSX.
虽然该应用程序实际上是一个库,但是一些基本的控制台程序将与它一起捆绑以进行演示和测试.
在开始在Subversion中存储东西之前,我想提出一个最佳的文件夹结构.
我想的是:
/project //Top level folder
/bin //Binaries ready for deployment
/linux_amd64 //Linux AMD64 platform
/debug //Debug build - duplicated in all platforms
/release //Release build - duplicated in all platforms
/linux_i386 //Linux 32-bit platform
/macosx //Mac OS X
/win32 //Windows 32-bit platform
/cygwin //Windows 32-bit platform compiled with Cygwin
/vs.net //Windows 32-bit platform compiled with Visual Studio .NET
/win64 //Windows 64-bit platform
/build //Make and build files, IDE project files
/linux_amd64 //Linux AMD64 platform
/linux_i386 //Linux 32-bit platform
/macosx //Mac OS X
/win32 //Windows 32-bit platform
/win64 //Windows 64-bit platform
/config //Configuration files that accompany the binaries
/data //Data files that accompany the binaries
/doc //Documentation
/lib //External or third-party libraries
/platforms //Platform-specific code for ...
/linux_amd64 //Linux AMD64 platform
/linux_i386 //Linux 32-bit platform
/macosx //Mac OS X
/win32 //Windows 32-bit platform
/win64 //Windows 64-bit platform
/src //Available library source code in subfolders
/src //Source code tree - this will contain main.cpp
/bindings //Bindings to other languages such as ...
/python
/java
/h //Header files
/modules //Platform-independent modules, components or subprojects
/platforms //Platform-specific code for ...
/linux_amd64 //Linux AMD64 platform-specific code
/linux_i386 //Linux 32-bit platform-specific code
/macosx
/win32 //Windows 32-bit platform-specific code
/win64 //Windows 64-bit platform
/test //Automated test scripts
Run Code Online (Sandbox Code Playgroud)
如果你有建议,我很乐意听到.我想知道是否有一个工具可以帮助创建这个结构.
我打算使用CMake和Subversion.
小智 11
结构对我来说很好,但有几点:
至于创建结构的工具,只需几分钟就可以编写一个bash脚本 - 所有平台都可以使用相同的工具(如bash).
为什么需要二进制文件的不同平台文件夹?您将在不同的平台下使用相同的文件系统构建此源代码?
如果是,我认为你也需要compiller特定的文件夹.
为什么不使用不同的文件夹进行调试和发布构建,可能是unicode和非unicode,单线程或多线程构建?
看看bjam或Scons做替换者.也许你不需要构建目录中的不同文件夹.
我认为如果"modules"目录中的所有模块都包含测试用户的"tests"目录会更好.
最后 - 看看boost库,这个platofrm独立库有很好的结构.
还尝试从其他平台独立项目中获取想法.
提升文件夹结构:
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
- <lib-name>
for all compiled folders from libs [example|test|build]
- <compiler-name>/<[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
Run Code Online (Sandbox Code Playgroud)
如果您选择bjam - 您将不会担心构建和bin文件夹结构.
此外,您的libs/src/dir可以包含所有平台文件的自己,并且可以包含平台特定文件的dirs.
我没有在你的文件夹结构中看到任何严重的问题,也许你会在开始编写项目原型时看到它们.
归档时间: |
|
查看次数: |
23501 次 |
最近记录: |