Requirements:
- CMake
- Visual Studio 2017 along with Game Development with C++
- Doxygen (optional
- Bash interpreter (WSL or Git bash)
Steps:
- Clone DXD
- Ensure CMake is in your PATH
- Run ./build.sh (see below for available arguments)
- Open .build/DXD/DXD.sln in Visual Studio
- Build DXD_dll project
- Generated binaries are under .build/DXD/bin/Debug
File build.sh contains bash script used for building DXD along with its dependencies. Run build.sh -h for information about parameters, all of which are optional. Default build is x64 Debug Development build. Development means sample applications and unit tests will be present in the project. These builds shouldn't be linked against by custom applications. Production builds do not contain these targets and are meant to be used by custom programs.
- Code formatting - ClangFormat, download extension for Visual Studio at https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.ClangFormat Currently opened file can be formatted with with Ctrl+R,D.
- Use spaces, not tabs
- Do not include Microsoft headers (e.g. dxgi, d3d12, windows.h) directly, but rather use DXD/ExternalHeadersWrappers.
- Inherit classes you create from NonCopyableOrMovable, unless copy/move semantics are really desired.
- Put API classes in DXD namespaces. Leave internal classes in global namespace.
- API classes should only contain a protected constructor, pure virtual methods and factory method declaration implemented inside DXD
- Do not include internal headers in API headers. That won't work on the library's client side
- Use "camelCase" for variables, constants and methods and "CamelCase" for classes.
- Applications - example applications using DXD library.
- Application1 - application providing camera controls and presenting all the effects implemented along with configuration controls displayed on screen
- Application2 - minimal (Hello world) application rendering a cube
- CMakePredefinedTargets
- ALL_BUILD - builds all projects upon build
- ZERO_CHECK - reruns CMake scripts upon build
- Documentation - projects generating documentation upon build. You have to have Doxygen installed and added to your PATH for the projects to work
- ApiDocumentation - generates documentation of DXD public headers
- InternalDocumentation - generates documentation of all DXD files, both public and internal (note that not all internal code is documented)
- DXD
- DXD_core - object library used by both DXD_dll and DXD_lib. Its purpose is to enable producing both dynamic and static version without compiling the whole engine twice
- DXD_dll - dynamic DXD library, used by example application
- DXD_lib - static DXD library, used by unit tests.
- Tests
- UnitTests - unit level tests of some parts of the engine
In order to work with DXD within your applications you have to include required public headers placed in LibraryDX12/Include to your files. You will also need to copy LibraryDX12/Shaders directory to your executable's directory. You will also have link to DXD library, which can be done in two ways.
Preferred way is to link to a dynamic library:
- Build DXD_dll project.
- Link your application to ./build/DXD/lib/DXD.lib
- Copy DXD.dll to the same directory as your executable
It is also possible to link against DXD statically, but it's a bit more complex:
- Build DXD_lib project.
- Link your application to ./build/DXD/lib/DXD_static.lib.
- Link your application to all of DXD's dependendies (see CMakeValues.cmake file)
- #define DXD_STATIC_LINK in your application to enable static DXD linkage (to make it project-wide, you can set Project Properties -> C++ -> Preprocessor -> Preprocessor definitions).