mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
allow IGC to be discovered by pkg-config
New detection flow: 1. check for IGC__IGC_TARGETS and respect if defined -> IGC available 2. on Linux try using pkg-config to find IGC - package can be part of workspace, in this case we have to tweak some variables 3. check whether igc folder contains CMakeLists.txt and do add_subdirectory if yes. 4. IGC not available -> fail other changes: - rename compiler.config to match name from IGC devel package Change-Id: I6c2369f8b83db66327d76c9b08af833736e8a3f9 Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
0c849944aa
commit
bc2403acfd
@ -187,23 +187,56 @@ endif()
|
||||
|
||||
# Intel Graphics Compiler detection
|
||||
if(NOT IGC__IGC_TARGETS)
|
||||
if(IGC_DIR)
|
||||
# check whether igc is part of workspace
|
||||
if(DEFINED IGC_DIR)
|
||||
get_filename_component(IGC_DIR "${IGC_DIR}" ABSOLUTE)
|
||||
else(IGC_DIR)
|
||||
else()
|
||||
get_filename_component(IGC_DIR_tmp "${CMAKE_SOURCE_DIR}/../igc" ABSOLUTE)
|
||||
if(IS_DIRECTORY "${IGC_DIR_tmp}")
|
||||
set(IGC_DIR "${IGC_DIR_tmp}")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT IS_DIRECTORY "${IGC_DIR}")
|
||||
message(FATAL_ERROR "Intel Graphics Compiler not found!")
|
||||
|
||||
if(UNIX)
|
||||
# on Unix-like use pkg-config
|
||||
find_package(PkgConfig)
|
||||
if(IS_DIRECTORY "${IGC_DIR}/lib/pkgconfig/")
|
||||
set(ENV{PKG_CONFIG_PATH} "${IGC_DIR}/lib/pkgconfig/")
|
||||
endif()
|
||||
pkg_check_modules(IGDRCL__IGC igc-opencl)
|
||||
if(IS_DIRECTORY "${IGC_DIR}/lib/pkgconfig/")
|
||||
unset(ENV{PKG_CONFIG_PATH})
|
||||
set(IGDRCL__IGC_LIBRARY_PATH "${IGC_DIR}/lib/")
|
||||
set(ENV{LD_LIBRARY_PATH} "${IGDRCL__IGC_LIBRARY_PATH}")
|
||||
endif()
|
||||
|
||||
if(IGDRCL__IGC_FOUND)
|
||||
if(IS_DIRECTORY "${IGC_DIR}/lib/pkgconfig/")
|
||||
string(REPLACE "${IGDRCL__IGC_INCLUDEDIR}" "${IGC_DIR}/include/igc" IGDRCL__IGC_INCLUDE_DIRS "${IGDRCL__IGC_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
set(IGDRCL__IGC_INCLUDE_DIR ${IGDRCL__IGC_INCLUDE_DIRS})
|
||||
message(STATUS "IGC include dirs: ${IGDRCL__IGC_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "IGC source dir is: ${IGC_DIR}")
|
||||
if(IGDRCL__IGC_FOUND)
|
||||
# do nothing
|
||||
elseif(EXISTS "${IGC_DIR}/CMakeLists.txt")
|
||||
message(STATUS "IGC source dir is: ${IGC_DIR}")
|
||||
|
||||
set(IGC_OPTION__OUTPUT_DIR "${IGDRCL_BUILD_DIR}/igc")
|
||||
set(IGC_OPTION__INCLUDE_IGC_COMPILER_TOOLS OFF)
|
||||
add_subdirectory("${IGC_DIR}" "${IGDRCL_BUILD_DIR}/igc" EXCLUDE_FROM_ALL)
|
||||
set(IGC_OPTION__OUTPUT_DIR "${IGDRCL_BUILD_DIR}/igc")
|
||||
set(IGC_OPTION__INCLUDE_IGC_COMPILER_TOOLS OFF)
|
||||
add_subdirectory("${IGC_DIR}" "${IGDRCL_BUILD_DIR}/igc" EXCLUDE_FROM_ALL)
|
||||
|
||||
set(IGDRCL__IGC_TARGETS "${IGC__IGC_TARGETS}")
|
||||
foreach(TARGET_tmp ${IGDRCL__IGC_TARGETS})
|
||||
list(APPEND IGDRCL__IGC_INCLUDE_DIR $<TARGET_PROPERTY:${TARGET_tmp},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endforeach(TARGET_tmp)
|
||||
message(STATUS "IGC targets: ${IGDRCL__IGC_TARGETS}")
|
||||
else()
|
||||
message(FATAL_ERROR "Intel Graphics Compiler not found!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@ -211,12 +244,6 @@ if(WIN32)
|
||||
set(FCL_LIBRARY_NAME "igdfcl${NEO_BITS}")
|
||||
endif()
|
||||
|
||||
set(IGDRCL__IGC_TARGETS "${IGC__IGC_TARGETS}")
|
||||
foreach(TARGET_tmp ${IGDRCL__IGC_TARGETS})
|
||||
list(APPEND IGDRCL__IGC_INCLUDE_DIR $<TARGET_PROPERTY:${TARGET_tmp},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endforeach(TARGET_tmp)
|
||||
message(STATUS "IGC targets: ${IGDRCL__IGC_TARGETS}")
|
||||
|
||||
# GmmLib detection
|
||||
if(NOT GMMUMD_LIB_NAME)
|
||||
if(TARGET gmm_umd)
|
||||
@ -554,6 +581,6 @@ endif(EXISTS ${IGDRCL_SOURCE_DIR}/../internal)
|
||||
include(package.cmake)
|
||||
|
||||
configure_file(config.h.in ${IGDRCL_BUILD_DIR}/config.h)
|
||||
configure_file(compiler.config.h.in ${IGDRCL_BUILD_DIR}/compiler.config.h)
|
||||
configure_file(igc.opencl.h.in ${IGDRCL_BUILD_DIR}/igc.opencl.h)
|
||||
configure_file(driver_version.h.in ${IGDRCL_BUILD_DIR}/driver_version.h) # Put Driver version into define
|
||||
configure_file(lib_names.h.in ${IGDRCL_BUILD_DIR}/lib_names.h)
|
||||
|
@ -64,7 +64,11 @@ function(compile_builtin gen_type platform_type builtin)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix cloc)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
|
||||
if(DEFINED IGDRCL__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${IGDRCL__IGC_LIBRARY_PATH} $<TARGET_FILE:cloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
|
||||
endif()
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUT_FILES}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "compiler.config.h"
|
||||
#include "igc.opencl.h"
|
||||
#include "runtime/os_interface/os_library.h"
|
||||
|
||||
namespace Os {
|
||||
|
@ -48,7 +48,11 @@ function(compile_kernel target gen_type platform_type kernel)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix cloc)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
|
||||
if(DEFINED IGDRCL__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${IGDRCL__IGC_LIBRARY_PATH} $<TARGET_FILE:cloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
|
||||
endif()
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUTPATH} ${SCHEDULER_CPP}
|
||||
|
@ -157,7 +157,11 @@ target_include_directories(igdrcl_tests BEFORE PRIVATE ${IGDRCL_SOURCE_DIR}/unit
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix cloc)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
|
||||
if(DEFINED IGDRCL__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${IGDRCL__IGC_LIBRARY_PATH} $<TARGET_FILE:cloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(neo_gen_kernels target platform_name suffix)
|
||||
|
Reference in New Issue
Block a user