Then the project that uses your engine has to define the macro in build configuration, or define the macro before include any headers in your engine. There is no better choice, IMHO.
Unfortunately, thats exactly what already happend. But as I described, no matter how I define the macro in the other project, if that project is in another solution, it won't work. Only for projects in the very same solution as the engine, defining the macro works. I still have to define the macro in the using project, but there it works, even if the main.cpp-code is 1:1 the same. Thats the odd thing, I'm pretty sure I'm theoretically doing everything right, but that little difference of where the project is, decided whether macro definition will work, or simply be ignored. :/
1, Auto detect which DX version to use, if there is any version related macro in DX headers, maybe you can use it? I'm not sure if it's possible because I never used DX.
Thats not really possible though, mainly because I'm on for a multi-api-support approach, and secondly because DX includes all three versions in pretty much the same location - the engine picks the correct header, based on the USE_API macro...
2, Change the headers in your engine DX agnostic. Thus your engine only exposes one single interface to the users. This is better API design and how a lot of cross platform open source projects do.
How is that supposed to work? Since my API-wrapper is compile-time dependand on which API to use, I need to e.g. typedef which version of my dx-wrapper the api-agnostic gfx-layers should use:
#pragma once
#ifdef USE_API_DX11
#define ACL_API_DX11
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "d3dx11d.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "D3Dcompiler.lib")
#pragma comment(lib, "dxgi.lib")
#pragma warning(disable:4005)
namespace acl
{
namespace dx11
{
namespace d3d
{
class Device;
class Sprite;
class Texture;
class VertexBuffer;
class Effect;
class Mesh;
class Font;
class DepthBuffer;
class Line;
class ConstantBuffer;
}
}
typedef dx11::d3d::Device AclDevice;
typedef dx11::d3d::Sprite AclSprite;
typedef dx11::d3d::Texture AclTexture;
typedef dx11::d3d::DepthBuffer AclDepth;
typedef dx11::d3d::VertexBuffer AclVertexBuffer;
typedef dx11::d3d::Effect AclEffect;
typedef dx11::d3d::Mesh AclMesh;
typedef dx11::d3d::Font AclFont;
typedef dx11::d3d::Line AclLine;
typedef dx11::d3d::ConstantBuffer AclCbuffer;
}
#endif
How am I supposed to get that away from the headers, without using an interface for that low level classes (would affect performance in my render queues in a bad way, plus possibly violate multiple SOLID rules...)?