conditional spirv cross build

d3d11
cosmonaut 2022-03-14 17:40:09 -07:00 committed by Caleb Cornett
parent bca9d1e533
commit 0d8e1590d5
3 changed files with 31 additions and 6 deletions

View File

@ -36,16 +36,20 @@ elseif(WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif()
set(BUILD_D3D11 OFF)
if (WIN32)
set(BUILD_D3D11 ON)
endif()
# Defines
add_definitions(
-DREFRESH_DRIVER_VULKAN
-DSPIRV_CROSS_C_API_GLSL
-DSPIRV_CROSS_C_API_REFLECT
)
if (WIN32)
if (BUILD_D3D11)
add_definitions(
-DREFRESH_DRIVER_D3D11
-DSPIRV_CROSS_C_API_HLSL
)
endif()
@ -90,8 +94,21 @@ set_target_properties(Refresh PROPERTIES OUTPUT_NAME "Refresh"
)
# Internal Dependencies
if (BUILD_D3D11)
set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_CLI OFF CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_SHARED ON CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_STATIC OFF CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_ENABLE_C_API ON CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_ENABLE_HLSL ON CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_ENABLE_GLSL ON CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_ENABLE_REFLECT ON CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_ENABLE_MSL OFF CACHE "" INTERNAL FORCE)
set(SPIRV_CROSS_ENABLE_CPP OFF CACHE "" INTERNAL FORCE)
add_subdirectory(SPIRV-Cross EXCLUDE_FROM_ALL)
target_link_libraries(Refresh PRIVATE spirv-cross-c)
target_link_libraries(Refresh PUBLIC spirv-cross-c-shared)
endif()
# SDL2 Dependency
if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES)

View File

@ -2231,4 +2231,8 @@ Refresh_Driver D3D11Driver = {
D3D11_CreateDevice
};
#else
extern int this_tu_is_empty;
#endif //REFRESH_DRIVER_D3D11

View File

@ -10642,4 +10642,8 @@ Refresh_Driver VulkanDriver = {
VULKAN_CreateDevice
};
#else
extern int this_tu_is_empty;
#endif //REFRESH_DRIVER_VULKAN