diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-11-02 03:30:15 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-11-02 03:30:15 +0000 |
| commit | a4032a642a2f454e56c25bce148f3e71cc2bb9b8 (patch) | |
| tree | e9ea8e100ca4556e6d7c36cf962cf4f4be93e744 /Graphics | |
| parent | Second attempt to rename external/SPIRV-Headers to External/SPIRV-Headers (diff) | |
| download | DiligentCore-a4032a642a2f454e56c25bce148f3e71cc2bb9b8.tar.gz DiligentCore-a4032a642a2f454e56c25bce148f3e71cc2bb9b8.zip | |
Optimized build by making shared versions of backend libraries dependent on static ones
Diffstat (limited to 'Graphics')
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/CMakeLists.txt | 15 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D11/src/DLLMain.cpp | 3 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/CMakeLists.txt | 17 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/DLLMain.cpp | 3 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h | 9 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DLLMain.cpp | 3 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/GraphicsEngineOpenGL.def | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp | 3 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/DLLMain.cpp | 3 |
11 files changed, 26 insertions, 52 deletions
diff --git a/Graphics/GraphicsEngineD3D11/CMakeLists.txt b/Graphics/GraphicsEngineD3D11/CMakeLists.txt index 7b51a05a..e11d3557 100644 --- a/Graphics/GraphicsEngineD3D11/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D11/CMakeLists.txt @@ -90,7 +90,6 @@ add_library(GraphicsEngineD3D11-static STATIC ) add_library(GraphicsEngineD3D11-shared SHARED - ${SRC} ${INTERFACE} ${INCLUDE} src/DLLMain.cpp src/GraphicsEngineD3D11.def readme.md @@ -107,12 +106,8 @@ PRIVATE include ) -target_include_directories(GraphicsEngineD3D11-shared +target_link_libraries(GraphicsEngineD3D11-static PRIVATE - include -) - -set(PRIVATE_DEPENDENCIES BuildSettings GraphicsEngineD3DBase TargetPlatform @@ -120,15 +115,11 @@ set(PRIVATE_DEPENDENCIES dxgi.lib d3d11.lib d3dcompiler.lib -) - -set(PUBLIC_DEPENDENCIES +PUBLIC GraphicsEngineD3D11Interface ) -target_link_libraries(GraphicsEngineD3D11-static PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) - -target_link_libraries(GraphicsEngineD3D11-shared PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) +target_link_libraries(GraphicsEngineD3D11-shared PUBLIC GraphicsEngineD3D11-static) target_compile_definitions(GraphicsEngineD3D11-shared PUBLIC ENGINE_DLL=1) source_group("src" FILES ${SRC} ) diff --git a/Graphics/GraphicsEngineD3D11/src/DLLMain.cpp b/Graphics/GraphicsEngineD3D11/src/DLLMain.cpp index 58b1c375..419f9921 100644 --- a/Graphics/GraphicsEngineD3D11/src/DLLMain.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DLLMain.cpp @@ -21,7 +21,8 @@ * of the possibility of such damages. */ -#include "pch.h" +#include <Windows.h> +#include <crtdbg.h> BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt index d210243c..dd4fc0b6 100644 --- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt @@ -119,11 +119,9 @@ add_library(GraphicsEngineD3D12-static STATIC ) add_library(GraphicsEngineD3D12-shared SHARED - ${SRC} ${INTERFACE} ${INCLUDE} ${SHADERS} src/DLLMain.cpp src/GraphicsEngineD3D12.def readme.md - shaders/GenerateMips/GenerateMipsCS.hlsli ) target_include_directories(GraphicsEngineD3D12-static @@ -132,13 +130,8 @@ PRIVATE include ) -target_include_directories(GraphicsEngineD3D12-shared +target_link_libraries(GraphicsEngineD3D12-static PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/CompiledShaders - include -) - -set(PRIVATE_DEPENDENCIES BuildSettings Common GraphicsEngineD3DBase @@ -147,15 +140,11 @@ set(PRIVATE_DEPENDENCIES dxgi.lib D3D12.lib d3dcompiler.lib -) - -set(PUBLIC_DEPENDENCIES +PUBLIC GraphicsEngineD3D12Interface ) -target_link_libraries(GraphicsEngineD3D12-static PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) - -target_link_libraries(GraphicsEngineD3D12-shared PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) +target_link_libraries(GraphicsEngineD3D12-shared PUBLIC GraphicsEngineD3D12-static) target_compile_definitions(GraphicsEngineD3D12-shared PUBLIC ENGINE_DLL=1) # Set output name to GraphicsEngineD3D12_{32|64}{r|d} diff --git a/Graphics/GraphicsEngineD3D12/src/DLLMain.cpp b/Graphics/GraphicsEngineD3D12/src/DLLMain.cpp index 58b1c375..419f9921 100644 --- a/Graphics/GraphicsEngineD3D12/src/DLLMain.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DLLMain.cpp @@ -21,7 +21,8 @@ * of the possibility of such damages. */ -#include "pch.h" +#include <Windows.h> +#include <crtdbg.h> BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, diff --git a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt index b78a7fb2..d32bab6b 100644 --- a/Graphics/GraphicsEngineOpenGL/CMakeLists.txt +++ b/Graphics/GraphicsEngineOpenGL/CMakeLists.txt @@ -64,7 +64,7 @@ set(SOURCE src/GLProgramResources.cpp src/GLTypeConversions.cpp src/PipelineStateGLImpl.cpp - src/RenderDeviceFactoryOpenGL.cpp + src/RenderDeviceFactoryOpenGL.cpp src/RenderDeviceGLImpl.cpp src/SamplerGLImpl.cpp src/ShaderGLImpl.cpp @@ -136,7 +136,6 @@ add_library(GraphicsEngineOpenGL-static STATIC ) add_library(GraphicsEngineOpenGL-shared SHARED - ${SOURCE} ${INTERFACE} ${INCLUDE} readme.md ) if(PLATFORM_WIN32) @@ -153,11 +152,6 @@ PRIVATE ../HLSL2GLSLConverterLib/include ) -target_include_directories(GraphicsEngineOpenGL-shared -PRIVATE - include - ../HLSL2GLSLConverterLib/include -) set(PRIVATE_DEPENDENCIES BuildSettings @@ -201,7 +195,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() target_link_libraries(GraphicsEngineOpenGL-static PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) -target_link_libraries(GraphicsEngineOpenGL-shared PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) +target_link_libraries(GraphicsEngineOpenGL-shared PUBLIC GraphicsEngineOpenGL-static) target_compile_definitions(GraphicsEngineOpenGL-shared PUBLIC ENGINE_DLL=1 PRIVATE BUILDING_DLL=1) if(PLATFORM_WIN32) diff --git a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h b/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h index b133b113..4a2b28f5 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceFactoryOpenGL.h @@ -105,7 +105,7 @@ public: return false; } - GetFactoryFunc = reinterpret_cast<GetEngineFactoryOpenGLType>( GetProcAddress(hModule, "GetEngineFactoryOpenGL") ); + GetFactoryFunc = reinterpret_cast<GetEngineFactoryOpenGLType>( GetProcAddress(hModule, "GetEngineFactoryOpenGLInternal") ); if( GetFactoryFunc == NULL ) { std::stringstream ss; @@ -119,9 +119,14 @@ public: #else + IEngineFactoryOpenGL* GetEngineFactoryOpenGLInternal(); + // Do not forget to call System.loadLibrary("GraphicsEngineOpenGL") in Java on Android! API_QUALIFIER - IEngineFactoryOpenGL* GetEngineFactoryOpenGL(); + inline IEngineFactoryOpenGL* GetEngineFactoryOpenGL() + { + return GetEngineFactoryOpenGLInternal(); + } #endif diff --git a/Graphics/GraphicsEngineOpenGL/src/DLLMain.cpp b/Graphics/GraphicsEngineOpenGL/src/DLLMain.cpp index 58b1c375..419f9921 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DLLMain.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DLLMain.cpp @@ -21,7 +21,8 @@ * of the possibility of such damages. */ -#include "pch.h" +#include <Windows.h> +#include <crtdbg.h> BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, diff --git a/Graphics/GraphicsEngineOpenGL/src/GraphicsEngineOpenGL.def b/Graphics/GraphicsEngineOpenGL/src/GraphicsEngineOpenGL.def index 2d2ee59f..1de05b4c 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GraphicsEngineOpenGL.def +++ b/Graphics/GraphicsEngineOpenGL/src/GraphicsEngineOpenGL.def @@ -1,2 +1,2 @@ EXPORTS - GetEngineFactoryOpenGL
\ No newline at end of file + GetEngineFactoryOpenGLInternal
\ No newline at end of file diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp index a3e4d276..435a655f 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceFactoryOpenGL.cpp @@ -235,8 +235,7 @@ void EngineFactoryOpenGLImpl::CreateHLSL2GLSLConverter(IHLSL2GLSLConverter **ppC } -API_QUALIFIER -Diligent::IEngineFactoryOpenGL* GetEngineFactoryOpenGL() +Diligent::IEngineFactoryOpenGL* GetEngineFactoryOpenGLInternal() { return Diligent::EngineFactoryOpenGLImpl::GetInstance(); } diff --git a/Graphics/GraphicsEngineVulkan/CMakeLists.txt b/Graphics/GraphicsEngineVulkan/CMakeLists.txt index e96ba9a5..fc1d59b4 100644 --- a/Graphics/GraphicsEngineVulkan/CMakeLists.txt +++ b/Graphics/GraphicsEngineVulkan/CMakeLists.txt @@ -149,14 +149,12 @@ add_library(GraphicsEngineVk-static STATIC ) add_library(GraphicsEngineVk-shared SHARED - ${SRC} ${VULKAN_UTILS_SRC} ${INTERFACE} ${INCLUDE} ${VULKAN_UTILS_INCLUDE} ${GENERATE_MIPS_SHADER} ${GENERATE_MIPS_SHADER_INC} src/DLLMain.cpp src/GraphicsEngineVk.def readme.md ) add_dependencies(GraphicsEngineVk-static ProcessGenerateMipsVkShader) -add_dependencies(GraphicsEngineVk-shared ProcessGenerateMipsVkShader) target_include_directories(GraphicsEngineVk-static PRIVATE @@ -164,12 +162,6 @@ PRIVATE ../../External/vulkan ) -target_include_directories(GraphicsEngineVk-shared -PRIVATE - include - ../../External/vulkan -) - set(PRIVATE_DEPENDENCIES BuildSettings Common @@ -190,7 +182,7 @@ set(PUBLIC_DEPENDENCIES target_link_libraries(GraphicsEngineVk-static PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) -target_link_libraries(GraphicsEngineVk-shared PRIVATE ${PRIVATE_DEPENDENCIES} PUBLIC ${PUBLIC_DEPENDENCIES}) +target_link_libraries(GraphicsEngineVk-shared PUBLIC GraphicsEngineVk-static) target_compile_definitions(GraphicsEngineVk-shared PUBLIC ENGINE_DLL=1) diff --git a/Graphics/GraphicsEngineVulkan/src/DLLMain.cpp b/Graphics/GraphicsEngineVulkan/src/DLLMain.cpp index 58b1c375..419f9921 100644 --- a/Graphics/GraphicsEngineVulkan/src/DLLMain.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DLLMain.cpp @@ -21,7 +21,8 @@ * of the possibility of such damages. */ -#include "pch.h" +#include <Windows.h> +#include <crtdbg.h> BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, |
