Fixed MSVC compiler warnings + treat warnings as errors; made Diligent-BuildSettings private dependency for all projects
assiduous
2 years ago
200 | 200 | |
201 | 201 | |
202 | 202 | if(MSVC) |
203 | # For msvc, enable level 4 warnings except for | |
203 | # For msvc, enable level 4 warnings and treat warnings as errors, except for | |
204 | 204 | # - w4100 - unreferenced formal parameter |
205 | 205 | # - w4505 - unreferenced local function has been removed |
206 | 206 | # - w4201 - nonstandard extension used: nameless struct/union |
207 | target_compile_options(Diligent-BuildSettings INTERFACE /W4 /wd4100 /wd4505 /wd4201) | |
207 | target_compile_options(Diligent-BuildSettings INTERFACE /W4 /WX /wd4100 /wd4505 /wd4201) | |
208 | 208 | # In all release modes also: |
209 | 209 | # - disable w4189 - local variable is initialized but not referenced |
210 | 210 | # - Disable RTTI (/GR-) |
52 | 52 | ) |
53 | 53 | |
54 | 54 | target_link_libraries(Diligent-Common |
55 | PRIVATE | |
56 | Diligent-BuildSettings | |
55 | 57 | PUBLIC |
56 | Diligent-BuildSettings | |
57 | 58 | Diligent-TargetPlatform |
58 | 59 | ) |
59 | 60 | set_common_target_properties(Diligent-Common) |
26 | 26 | ) |
27 | 27 | |
28 | 28 | target_link_libraries(Diligent-GraphicsAccessories |
29 | PRIVATE | |
30 | Diligent-BuildSettings | |
29 | 31 | PUBLIC |
30 | Diligent-BuildSettings | |
31 | 32 | Diligent-Common |
32 | 33 | Diligent-GraphicsEngineInterface |
33 | 34 | ) |
74 | 74 | ) |
75 | 75 | |
76 | 76 | target_link_libraries(Diligent-GraphicsEngine |
77 | PRIVATE | |
78 | Diligent-BuildSettings | |
77 | 79 | PUBLIC |
78 | Diligent-BuildSettings | |
79 | 80 | Diligent-PlatformInterface |
80 | 81 | Diligent-Common |
81 | 82 | Diligent-GraphicsAccessories |
110 | 110 | |
111 | 111 | target_link_libraries(Diligent-GraphicsEngineD3D11-static |
112 | 112 | PRIVATE |
113 | Diligent-BuildSettings | |
114 | Diligent-GraphicsEngineD3DBase | |
113 | Diligent-BuildSettings | |
114 | Diligent-GraphicsEngineD3DBase | |
115 | 115 | Diligent-TargetPlatform |
116 | 116 | Diligent-Common |
117 | 117 | dxgi.lib |
118 | d3d11.lib | |
118 | d3d11.lib | |
119 | 119 | d3dcompiler.lib |
120 | 120 | PUBLIC |
121 | 121 | Diligent-GraphicsEngineD3D11Interface |
59 | 59 | ) |
60 | 60 | |
61 | 61 | target_link_libraries(Diligent-GraphicsEngineD3DBase |
62 | PRIVATE | |
63 | Diligent-BuildSettings | |
62 | 64 | PUBLIC |
63 | Diligent-BuildSettings | |
64 | 65 | Diligent-GraphicsEngine |
65 | 66 | Diligent-GraphicsEngineD3DBaseInterface |
66 | 67 | ) |
20 | 20 | ) |
21 | 21 | |
22 | 22 | target_link_libraries(Diligent-GraphicsEngineNextGenBase |
23 | PRIVATE | |
24 | Diligent-BuildSettings | |
23 | 25 | PUBLIC |
24 | Diligent-BuildSettings | |
25 | 26 | Diligent-PlatformInterface |
26 | 27 | Diligent-Common |
27 | 28 | Diligent-GraphicsAccessories |
158 | 158 | |
159 | 159 | |
160 | 160 | set(PRIVATE_DEPENDENCIES |
161 | Diligent-BuildSettings | |
162 | Diligent-Common | |
161 | Diligent-BuildSettings | |
162 | Diligent-Common | |
163 | 163 | Diligent-TargetPlatform |
164 | 164 | Diligent-GraphicsEngine |
165 | 165 | Diligent-GLSLTools |
59 | 59 | SamplerCI.mipLodBias = m_Desc.MipLODBias; |
60 | 60 | SamplerCI.anisotropyEnable = IsAnisotropicFilter(m_Desc.MinFilter); |
61 | 61 | #ifdef DILIGENT_DEVELOPMENT |
62 | if (SamplerCI.anisotropyEnable != IsAnisotropicFilter(m_Desc.MagFilter)) | |
62 | if ((SamplerCI.anisotropyEnable != VK_FALSE) != IsAnisotropicFilter(m_Desc.MagFilter)) | |
63 | 63 | { |
64 | 64 | LOG_ERROR("Min and mag filters must both be either anisotropic filters or non-anisotropic ones"); |
65 | 65 | } |
68 | 68 | SamplerCI.maxAnisotropy = static_cast<float>(m_Desc.MaxAnisotropy); |
69 | 69 | SamplerCI.compareEnable = IsComparisonFilter(m_Desc.MinFilter); |
70 | 70 | #ifdef DILIGENT_DEVELOPMENT |
71 | if (SamplerCI.compareEnable != IsComparisonFilter(m_Desc.MagFilter)) | |
71 | if ((SamplerCI.compareEnable != VK_FALSE) != IsComparisonFilter(m_Desc.MagFilter)) | |
72 | 72 | { |
73 | 73 | LOG_ERROR("Min and mag filters must both be either comparison filters or non-comparison ones"); |
74 | 74 | } |
26 | 26 | PRIVATE |
27 | 27 | log |
28 | 28 | android |
29 | Diligent-BuildSettings | |
29 | 30 | PUBLIC |
30 | Diligent-BuildSettings | |
31 | 31 | Diligent-PlatformInterface |
32 | 32 | Diligent-BasicPlatform |
33 | 33 | ) |
31 | 31 | ) |
32 | 32 | |
33 | 33 | target_link_libraries(Diligent-ApplePlatform |
34 | PRIVATE | |
35 | Diligent-BuildSettings | |
34 | 36 | PUBLIC |
35 | Diligent-BuildSettings | |
36 | 37 | Diligent-BasicPlatform |
37 | 38 | Diligent-PlatformInterface |
38 | 39 | ) |
28 | 28 | ) |
29 | 29 | |
30 | 30 | target_link_libraries(Diligent-BasicPlatform |
31 | PRIVATE | |
32 | Diligent-BuildSettings | |
31 | 33 | PUBLIC |
32 | Diligent-BuildSettings | |
33 | 34 | Diligent-Primitives |
34 | 35 | ) |
35 | 36 |
23 | 23 | ) |
24 | 24 | |
25 | 25 | target_link_libraries(Diligent-LinuxPlatform |
26 | PRIVATE | |
27 | Diligent-BuildSettings | |
26 | 28 | PUBLIC |
27 | Diligent-BuildSettings | |
28 | 29 | Diligent-BasicPlatform |
29 | 30 | Diligent-PlatformInterface |
30 | 31 | ) |
25 | 25 | ) |
26 | 26 | |
27 | 27 | target_link_libraries(Diligent-UniversalWindowsPlatform |
28 | PRIVATE | |
29 | Diligent-BuildSettings | |
28 | 30 | PUBLIC |
29 | Diligent-BuildSettings | |
30 | 31 | Diligent-BasicPlatform |
31 | 32 | Diligent-PlatformInterface |
32 | 33 | ) |
26 | 26 | |
27 | 27 | target_link_libraries(Diligent-Win32Platform |
28 | 28 | PUBLIC |
29 | Diligent-BuildSettings | |
30 | 29 | Diligent-BasicPlatform |
31 | 30 | Diligent-PlatformInterface |
32 | 31 | PRIVATE |
32 | Diligent-BuildSettings | |
33 | 33 | Shlwapi.lib |
34 | 34 | ) |
35 | 35 |
31 | 31 | set_common_target_properties(Diligent-Primitives) |
32 | 32 | |
33 | 33 | target_link_libraries(Diligent-Primitives |
34 | PUBLIC | |
34 | PRIVATE | |
35 | 35 | Diligent-BuildSettings |
36 | 36 | ) |
37 | 37 |
786 | 786 | TEST(Common_BasicMath, Hash) |
787 | 787 | { |
788 | 788 | { |
789 | EXPECT_NE(std::hash<float2>{}(float2{1, 2}), 0); | |
790 | EXPECT_NE(std::hash<float3>{}(float3{1, 2, 3}), 0); | |
791 | EXPECT_NE(std::hash<float4>{}(float4{1, 2, 3, 5}), 0); | |
789 | EXPECT_NE(std::hash<float2>{}(float2{1, 2}), size_t{0}); | |
790 | EXPECT_NE(std::hash<float3>{}(float3{1, 2, 3}), size_t{0}); | |
791 | EXPECT_NE(std::hash<float4>{}(float4{1, 2, 3, 5}), size_t{0}); | |
792 | 792 | // clang-format off |
793 | 793 | float4x4 m1 |
794 | 794 | { |
798 | 798 | 13, 14, 15, 16 |
799 | 799 | }; |
800 | 800 | // clang-format on |
801 | EXPECT_NE(std::hash<float4x4>{}(m1), 0); | |
801 | EXPECT_NE(std::hash<float4x4>{}(m1), size_t{0}); | |
802 | 802 | |
803 | 803 | // clang-format off |
804 | 804 | float3x3 m2 |
808 | 808 | 9, 10, 11 |
809 | 809 | }; |
810 | 810 | // clang-format on |
811 | EXPECT_NE(std::hash<float3x3>{}(m2), 0); | |
811 | EXPECT_NE(std::hash<float3x3>{}(m2), size_t{0}); | |
812 | 812 | |
813 | 813 | // clang-format off |
814 | 814 | float2x2 m3 |
817 | 817 | 5, 6 |
818 | 818 | }; |
819 | 819 | // clang-format on |
820 | EXPECT_NE(std::hash<float2x2>{}(m3), 0); | |
820 | EXPECT_NE(std::hash<float2x2>{}(m3), size_t{0}); | |
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
945 | 945 | TEST(Common_AdvancedMath, Planes) |
946 | 946 | { |
947 | 947 | Plane3D plane = {}; |
948 | EXPECT_NE(std::hash<Plane3D>{}(plane), 0); | |
948 | EXPECT_NE(std::hash<Plane3D>{}(plane), size_t{0}); | |
949 | 949 | |
950 | 950 | ViewFrustum frustum = {}; |
951 | EXPECT_NE(std::hash<ViewFrustum>{}(frustum), 0); | |
951 | EXPECT_NE(std::hash<ViewFrustum>{}(frustum), size_t{0}); | |
952 | 952 | |
953 | 953 | ViewFrustumExt frustm_ext = {}; |
954 | EXPECT_NE(std::hash<ViewFrustumExt>{}(frustm_ext), 0); | |
954 | EXPECT_NE(std::hash<ViewFrustumExt>{}(frustm_ext), size_t{0}); | |
955 | 955 | } |
956 | 956 | |
957 | 957 | TEST(Common_AdvancedMath, HermiteSpline) |