## Copyright 2009-2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0

ADD_SUBDIRECTORY(sys)
ADD_SUBDIRECTORY(simd)

ADD_LIBRARY(embree_rthwif SHARED rtbuild.cpp qbvh6.cpp statistics.cpp ../level_zero_raytracing.rc)
TARGET_LINK_LIBRARIES(embree_rthwif PUBLIC ${EMBREE_RTHWIF_SYCL} PRIVATE tbb simd sys)
SET_TARGET_PROPERTIES(embree_rthwif PROPERTIES OUTPUT_NAME ze_intel_gpu_raytracing)
TARGET_COMPILE_DEFINITIONS(embree_rthwif PRIVATE ZE_RAYTRACING)
TARGET_INCLUDE_DIRECTORIES(embree_rthwif PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")

IF (WIN32)
ELSE()
  SET_TARGET_PROPERTIES(embree_rthwif PROPERTIES LINK_FLAGS -Wl,--version-script="${CMAKE_CURRENT_SOURCE_DIR}/export.linux.map")
  SET_SOURCE_FILES_PROPERTIES(rtbuild.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/export.linux.map")
ENDIF()

INSTALL(TARGETS embree_rthwif EXPORT ze_raytracing-targets
  LIBRARY NAMELINK_SKIP DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib
  ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel)
#INSTALL(EXPORT ze_raytracing-targets DESTINATION "${EMBREE_CMAKEEXPORT_DIR}" COMPONENT devel)


