Expose preprocessor definition about enabled features

This commit is contained in:
MACHIZAUD Andréa 2022-05-09 16:44:59 +02:00
parent ee4d4e9f60
commit 04ff84bc35

View File

@ -366,6 +366,57 @@ if (NOT NO_LIB)
endif()
endif()
# Expose preprocessor macro to the interface so that client know which feature are enabled
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.0)
foreach(osd_target osd_static_cpu osd_static_gpu osd_dynamic_cpu osd_dynamic_gpu osd_static_framework osd_dynamic_framework)
if(TARGET ${osd_target})
if(CLEW_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_CLEW)
endif()
if(CUDA_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_CUDA)
endif()
if(DXSDK_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_DX11SDK)
endif()
if(METAL_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_METAL)
endif()
if(OPENCL_CL_D3D11_EXT_H_FOUND OR OPENCL_CL_D3D11_H_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_OPENCL_DX_INTEROP)
endif()
if(OPENCL_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_OPENCL)
endif()
if(OPENGL_4_2_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
endif()
if(OPENGL_4_3_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_GLSL_COMPUTE)
endif()
if(NOT NO_OPENGL AND OPENGL_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_OPENGL)
endif()
if(NOT NO_OPENGL AND OPENGLES_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_OPENGLES)
endif()
if(OPENMP_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_OPENMP)
endif()
if(OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES)
endif()
if(PTEX_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_PTEX)
endif()
if(TBB_FOUND)
target_compile_definitions(${osd_target} INTERFACE OPENSUBDIV_HAS_TBB)
endif()
endif()
endforeach()
endif()
endif()
#-------------------------------------------------------------------------------