conditional spirv cross build

cosmonaut 2022-03-14 17:40:09 -07:00
parent 25847c38a2
commit f205c26075
3 changed files with 31 additions and 6 deletions

View File

@ -36,16 +36,20 @@ elseif(WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif() endif()
set(BUILD_D3D11 OFF)
if (WIN32)
set(BUILD_D3D11 ON)
endif()
# Defines # Defines
add_definitions( add_definitions(
-DREFRESH_DRIVER_VULKAN -DREFRESH_DRIVER_VULKAN
-DSPIRV_CROSS_C_API_GLSL
-DSPIRV_CROSS_C_API_REFLECT
) )
if (WIN32)
if (BUILD_D3D11)
add_definitions( add_definitions(
-DREFRESH_DRIVER_D3D11 -DREFRESH_DRIVER_D3D11
-DSPIRV_CROSS_C_API_HLSL
) )
endif() endif()
@ -90,8 +94,21 @@ set_target_properties(Refresh PROPERTIES OUTPUT_NAME "Refresh"
) )
# Internal Dependencies # Internal Dependencies
add_subdirectory(SPIRV-Cross EXCLUDE_FROM_ALL) if (BUILD_D3D11)
target_link_libraries(Refresh PRIVATE spirv-cross-c) 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 PUBLIC spirv-cross-c-shared)
endif()
# SDL2 Dependency # SDL2 Dependency
if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES) if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES)

View File

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

View File

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