diff --git a/CMakeLists.txt b/CMakeLists.txt index 31286a1..70a7c4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 -add_subdirectory(SPIRV-Cross EXCLUDE_FROM_ALL) -target_link_libraries(Refresh PRIVATE spirv-cross-c) +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 PUBLIC spirv-cross-c-shared) +endif() # SDL2 Dependency if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES) diff --git a/src/Refresh_Driver_D3D11.c b/src/Refresh_Driver_D3D11.c index 3a86ab0..17d47ae 100644 --- a/src/Refresh_Driver_D3D11.c +++ b/src/Refresh_Driver_D3D11.c @@ -2231,4 +2231,8 @@ Refresh_Driver D3D11Driver = { D3D11_CreateDevice }; +#else + +extern int this_tu_is_empty; + #endif //REFRESH_DRIVER_D3D11 diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index ad315c4..2fabc90 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -10642,4 +10642,8 @@ Refresh_Driver VulkanDriver = { VULKAN_CreateDevice }; +#else + +extern int this_tu_is_empty; + #endif //REFRESH_DRIVER_VULKAN