Cmake refactor part 3:

Move defining genX sources logic to separated cmake file
Fix defining hw src include path

Change-Id: Id89125ab6f461fbcf5162157f76e0fbe0544fa69
This commit is contained in:
Mateusz Jablonski
2018-02-05 15:07:21 +01:00
committed by sys_ocldev
parent 3a305018ba
commit 0178b9862f
6 changed files with 139 additions and 144 deletions

View File

@@ -494,6 +494,8 @@ include_directories(${IGDRCL_BUILD_DIR})
include_directories(${IGDRCL_SOURCE_DIR}/runtime/sku_info/definitions${BRANCH_DIR_SUFFIX})
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/${BRANCH_DIR_SUFFIX})
set(HW_SRC_INCLUDE_PATH ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
if(HAVE_INSTRUMENTATION)
set(${IGDRCL__INSTRUMENTATION_DIR_SUFFIX} ${BRANCH_DIR_SUFFIX})
include_directories($<TARGET_PROPERTY:instrumentation_umd,INTERFACE_INCLUDE_DIRECTORIES>)

View File

@@ -18,8 +18,6 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR)
project(cloc)
set(CLOC_SRCS_LIB
@@ -50,8 +48,6 @@ if (UNIX)
)
endif (UNIX)
list (APPEND HW_SRC_INCLUDES ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
set(CLOC_LIB_FLAGS_DEFINITIONS
-DCIF_HEADERS_ONLY_BUILD
)
@@ -97,22 +93,17 @@ if(CIF_BASE_DIR)
target_include_directories(cloc PUBLIC "${CIF_BASE_DIR}")
endif(CIF_BASE_DIR)
SET(CLOC_INCLUDES
"${HW_SRC_INCLUDES}"
"${UMKM_SHAREDDATA_INCLUDE_PATHS}"
"${KHRONOS_HEADERS_DIR}"
"${IGDRCL__IGC_INCLUDE_DIR}"
"${THIRD_PARTY_DIR}"
PARENT_SCOPE
set(CLOC_INCLUDES
${HW_SRC_INCLUDE_PATH}
${UMKM_SHAREDDATA_INCLUDE_PATHS}
${KHRONOS_HEADERS_DIR}
${IGDRCL__IGC_INCLUDE_DIR}
${THIRD_PARTY_DIR}
)
target_include_directories(cloc BEFORE PRIVATE
"${HW_SRC_INCLUDES}"
"${UMKM_SHAREDDATA_INCLUDE_PATHS}"
"${KHRONOS_HEADERS_DIR}"
"${IGDRCL__IGC_INCLUDE_DIR}"
"${THIRD_PARTY_DIR}"
)
target_include_directories(cloc BEFORE PRIVATE ${CLOC_INCLUDES})
set(CLOC_INCLUDES ${CLOC_INCLUDES} PARENT_SCOPE)
target_compile_definitions(cloc PUBLIC ${CLOC_LIB_FLAGS_DEFINITIONS} ${SUPPORTED_GEN_FLAGS_DEFINITONS} DEFAULT_PLATFORM=${DEFAULT_SUPPORTED_PLATFORM})
if(UNIX)

View File

@@ -34,46 +34,6 @@ project (neo)
# Support for Windows Universal Drivers
ENABLE_WUD()
if(WIN32)
set(GEN_OS_SRC
windows/command_stream_receiver.cpp
windows/translationtable_callbacks.cpp
windows/wddm_engine_mapper.cpp
windows/wddm.cpp
)
else(WIN32)
set(GEN_OS_SRC
linux/command_stream_receiver.cpp
linux/drm_engine_mapper.cpp
)
endif(WIN32)
set(RUNTIME_SRCS_GENX
aub_command_stream_receiver.cpp
aub_mapper.h
aub_mem_dump.cpp
command_queue.cpp
device_enqueue.h
device_queue.cpp
command_stream_receiver_hw.cpp
hw_cmds.h
hw_cmds_generated.h
hw_helper.cpp
hw_info.cpp
hw_info.h
buffer.cpp
image.cpp
kernel_commands.cpp
preamble.cpp
preemption.cpp
reg_configs.h
sampler.cpp
scheduler_definitions.h
scheduler_igdrcl_built_in.inl
state_base_address.cpp
tbx_command_stream_receiver.cpp
${GEN_OS_SRC}
)
if(NOT (TARGET ${BIKSIM_LIB_NAME}))
add_subdirectory(builtin_kernels_simulation)
endif(NOT (TARGET ${BIKSIM_LIB_NAME}))
@@ -119,7 +79,6 @@ set (RUNTIME_SRCS_BUILT_IN_KERNELS
built_ins/kernels/vebox_ve_dn_di_enhance_intel.igdrcl_built_in
)
add_subdirectory(command_queue)
add_subdirectory(command_stream)
add_subdirectory(commands)
@@ -284,7 +243,7 @@ if (UNIX)
)
endif (UNIX)
include(enable_gens.cmake)
set (RUNTIME_SRCS
${RUNTIME_SRCS_API}
@@ -302,6 +261,7 @@ set (RUNTIME_SRCS
${RUNTIME_SRCS_EVENT}
${RUNTIME_SRCS_EXECUTION_MODEL}
${RUNTIME_SRCS_GEN_COMMON}
${RUNTIME_SRCS_GENX}
${RUNTIME_SRCS_GTPIN}
${RUNTIME_SRCS_HELPERS}
${RUNTIME_SRCS_INDIRECT_HEAP}
@@ -335,61 +295,6 @@ if(NEO_DRIVER_VERSION)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/device/device_caps.cpp PROPERTIES COMPILE_DEFINITIONS NEO_DRIVER_VERSION="${NEO_DRIVER_VERSION}")
endif(NEO_DRIVER_VERSION)
list (APPEND HW_SRC_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/gen_common)
# Include/enable each GEN
# Reverse order so that GEN N+1 includes GEN N
foreach(GEN_NUM RANGE ${MAX_GEN} 0 -1)
GEN_CONTAINS_PLATFORMS("SUPPORTED" ${GEN_NUM} GENX_HAS_PLATFORMS)
if(${GENX_HAS_PLATFORMS})
# Add GEN-specific files
set(RUNTIME_SRCS_GEN${GEN_NUM} ${RUNTIME_SRCS_GEN${GEN_NUM}_SPECIFIC})
# Add default GEN files
foreach(SRC_IT ${RUNTIME_SRCS_GENX})
list (APPEND RUNTIME_SRCS_GEN${GEN_NUM} gen${GEN_NUM}/${SRC_IT})
endforeach(SRC_IT)
# Get all supported platforms for this GEN
GET_PLATFORMS_FOR_GEN("SUPPORTED" ${GEN_NUM} SUPPORTED_GENX_PLATFORMS)
# Add platform-specific files
foreach(PLATFORM_IT ${SUPPORTED_GENX_PLATFORMS})
string(TOLOWER ${PLATFORM_IT} PLATFORM_IT_LOWER)
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM} gen${GEN_NUM}/hw_cmds_${PLATFORM_IT_LOWER}.h)
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM} gen${GEN_NUM}/hw_info_${PLATFORM_IT_LOWER}.cpp)
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM} ${RUNTIME_SRCS_GEN${GEN_NUM}_${PLATFORM_IT}})
if(UNIX)
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM} gen${GEN_NUM}/linux/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
endif(UNIX)
# Enable platform
list(APPEND GEN${GEN_NUM}_SRC_LINK gen${GEN_NUM}/enable_${PLATFORM_IT_LOWER}.cpp)
if(UNIX)
list(APPEND GEN${GEN_NUM}_SRC_LINK gen${GEN_NUM}/linux/enable_${PLATFORM_IT_LOWER}.cpp)
endif(UNIX)
endforeach(PLATFORM_IT)
list(APPEND GEN${GEN_NUM}_SRC_LINK gen${GEN_NUM}/enable_family_full.cpp)
if(GTPIN_HEADERS_DIR)
list(APPEND GEN${GEN_NUM}_SRC_LINK gen${GEN_NUM}/gtpin_setup_gen${GEN_NUM}.cpp)
endif(GTPIN_HEADERS_DIR)
# Append this GEN's sources to the list of all sources
foreach(SRC_IT ${RUNTIME_SRCS_GEN${GEN_NUM}})
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_IT}")
list(APPEND RUNTIME_SRCS ${SRC_IT})
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_IT}")
endforeach(SRC_IT)
# Set-up gen sources for the dll
list(APPEND HW_SRC_LINK ${GEN${GEN_NUM}_SRC_LINK})
source_group("gen${GEN_NUM}" FILES ${RUNTIME_SRCS_GEN${GEN_NUM}} ${GEN${GEN_NUM}_SRC_LINK} )
endif(${GENX_HAS_PLATFORMS})
endforeach(GEN_NUM)
add_library(${NEO_STATIC_LIB_NAME} STATIC $<TARGET_OBJECTS:${BIKSIM_LIB_NAME}>
${RUNTIME_SRCS}
)
@@ -475,7 +380,7 @@ set_property(TARGET ${NEO_STATIC_LIB_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS
set_target_properties(${NEO_STATIC_LIB_NAME} PROPERTIES FOLDER "opencl runtime")
target_include_directories(${NEO_STATIC_LIB_NAME} BEFORE PRIVATE ${HW_SRC_INCLUDES})
target_include_directories(${NEO_STATIC_LIB_NAME} BEFORE PRIVATE ${HW_SRC_INCLUDE_PATH})
if(${GENERATE_EXECUTABLE})
set (RUNTIME_SRCS_DLL
@@ -514,20 +419,20 @@ if(${GENERATE_EXECUTABLE})
endforeach(GEN_NUM)
endif(GTPIN_HEADERS_DIR)
add_library(${NEO_DYNAMIC_LIB_NAME} SHARED
${RUNTIME_SRCS_DLL}
$<TARGET_OBJECTS:${SHARINGS_ENABLE_LIB_NAME}>
$<TARGET_OBJECTS:${BUILTINS_SOURCES_LIB_NAME}>
$<TARGET_OBJECTS:${BUILTINS_BINARIES_LIB_NAME}>
$<TARGET_OBJECTS:${SCHEDULER_BINARY_LIB_NAME}>
)
add_library(${NEO_DYNAMIC_LIB_NAME} SHARED
${RUNTIME_SRCS_DLL}
$<TARGET_OBJECTS:${SHARINGS_ENABLE_LIB_NAME}>
$<TARGET_OBJECTS:${BUILTINS_SOURCES_LIB_NAME}>
$<TARGET_OBJECTS:${BUILTINS_BINARIES_LIB_NAME}>
$<TARGET_OBJECTS:${SCHEDULER_BINARY_LIB_NAME}>
)
target_include_directories(${NEO_DYNAMIC_LIB_NAME} BEFORE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${HW_SRC_INCLUDES}
)
target_include_directories(${NEO_DYNAMIC_LIB_NAME} BEFORE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${HW_SRC_INCLUDE_PATH}
)
target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${NEO_STATIC_LIB_NAME})
target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${NEO_STATIC_LIB_NAME})
if (WIN32)
target_include_directories(${NEO_DYNAMIC_LIB_NAME} PUBLIC
@@ -587,9 +492,7 @@ if (WIN32)
source_group("source files\\kernel" FILES ${RUNTIME_SRCS_KERNEL})
source_group("source files\\memory_manager" FILES ${RUNTIME_SRCS_MEMORY_MANAGER})
source_group("source files\\gmm_helper" FILES ${RUNTIME_SRCS_GMM_HELPER})
if(GTPIN_HEADERS_DIR)
source_group("source files\\gtpin" FILES ${RUNTIME_SRCS_GTPIN})
endif(GTPIN_HEADERS_DIR)
source_group("source files\\gtpin" FILES ${RUNTIME_SRCS_GTPIN})
source_group("source files\\mem_obj" FILES ${RUNTIME_SRCS_MEM_OBJ})
source_group("source files\\os_interface" FILES ${RUNTIME_SRCS_OS_INTERFACE})
source_group("source files\\platform" FILES ${RUNTIME_SRCS_PLATFORM})
@@ -617,4 +520,3 @@ if (UNIX)
)
endif(NOT (TARGET clang-tidy))
endif(UNIX)

109
runtime/enable_gens.cmake Normal file
View File

@@ -0,0 +1,109 @@
# Copyright (c) 2018, Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
set(RUNTIME_SRCS_GENX_WINDOWS
windows/command_stream_receiver.cpp
windows/translationtable_callbacks.cpp
windows/wddm_engine_mapper.cpp
windows/wddm.cpp
)
set(RUNTIME_SRCS_GENX_LINUX
linux/command_stream_receiver.cpp
linux/drm_engine_mapper.cpp
)
set(RUNTIME_SRCS_GENX_BASE
aub_command_stream_receiver.cpp
aub_mapper.h
aub_mem_dump.cpp
command_queue.cpp
device_enqueue.h
device_queue.cpp
command_stream_receiver_hw.cpp
hw_cmds.h
hw_cmds_generated.h
hw_helper.cpp
hw_info.cpp
hw_info.h
buffer.cpp
image.cpp
kernel_commands.cpp
preamble.cpp
preemption.cpp
reg_configs.h
sampler.cpp
scheduler_definitions.h
scheduler_igdrcl_built_in.inl
state_base_address.cpp
tbx_command_stream_receiver.cpp
)
foreach(GEN_NUM RANGE ${MAX_GEN})
GEN_CONTAINS_PLATFORMS("SUPPORTED" ${GEN_NUM} GENX_HAS_PLATFORMS)
if(${GENX_HAS_PLATFORMS})
set(GENX_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/gen${GEN_NUM})
# Add default GEN files
foreach(OS_IT "BASE" "WINDOWS" "LINUX")
foreach(SRC_IT ${RUNTIME_SRCS_GENX_${OS_IT}})
if(EXISTS ${GENX_PREFIX}/${SRC_IT})
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM}_${OS_IT} ${GENX_PREFIX}/${SRC_IT})
endif()
endforeach()
endforeach()
# Get all supported platforms for this GEN
GET_PLATFORMS_FOR_GEN("SUPPORTED" ${GEN_NUM} SUPPORTED_GENX_PLATFORMS)
# Add platform-specific files
foreach(PLATFORM_IT ${SUPPORTED_GENX_PLATFORMS})
string(TOLOWER ${PLATFORM_IT} PLATFORM_IT_LOWER)
foreach(PLATFORM_FILE "hw_cmds_${PLATFORM_IT_LOWER}.h" "hw_info_${PLATFORM_IT_LOWER}.cpp")
if(EXISTS ${GENX_PREFIX}/${PLATFORM_FILE})
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM}_BASE ${GENX_PREFIX}/${PLATFORM_FILE})
endif()
endforeach()
if(EXISTS ${GENX_PREFIX}/linux/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
list(APPEND RUNTIME_SRCS_GEN${GEN_NUM}_LINUX ${GENX_PREFIX}/linux/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
endif()
# Enable platform
list(APPEND GEN${GEN_NUM}_SRC_LINK_BASE ${GENX_PREFIX}/enable_${PLATFORM_IT_LOWER}.cpp)
list(APPEND GEN${GEN_NUM}_SRC_LINK_LINUX ${GENX_PREFIX}/linux/enable_${PLATFORM_IT_LOWER}.cpp)
endforeach()
list(APPEND GEN${GEN_NUM}_SRC_LINK_BASE ${GENX_PREFIX}/enable_family_full.cpp)
if(GTPIN_HEADERS_DIR)
list(APPEND GEN${GEN_NUM}_SRC_LINK_BASE ${GENX_PREFIX}/gtpin_setup_gen${GEN_NUM}.cpp)
endif(GTPIN_HEADERS_DIR)
list(APPEND RUNTIME_SRCS_GENX ${RUNTIME_SRCS_GEN${GEN_NUM}_BASE})
list(APPEND HW_SRC_LINK ${GEN${GEN_NUM}_SRC_LINK_BASE})
if(WIN32)
list(APPEND RUNTIME_SRCS_GENX ${RUNTIME_SRCS_GEN${GEN_NUM}_WINDOWS})
else()
list(APPEND RUNTIME_SRCS_GENX ${RUNTIME_SRCS_GEN${GEN_NUM}_LINUX})
list(APPEND HW_SRC_LINK ${GEN${GEN_NUM}_SRC_LINK_LINUX})
endif()
source_group("gen${GEN_NUM}" FILES ${RUNTIME_SRCS_GEN${GEN_NUM}_BASE} ${GEN${GEN_NUM}_SRC_LINK_BASE})
source_group("gen${GEN_NUM}\\windows" FILES ${RUNTIME_SRCS_GEN${GEN_NUM}_WINDOWS})
endif()
endforeach()

View File

@@ -17,7 +17,6 @@
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
list (APPEND HW_SRC_INCLUDES ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
set(OPTIONAL_RUNTIME_GENX_FILES
hw_info.cpp
@@ -95,8 +94,8 @@ target_include_directories(igdrcl_libult_cs PRIVATE
${GMM_INCLUDE_PATHS}
${UMKM_SHAREDDATA_INCLUDE_PATHS}
)
target_include_directories(igdrcl_libult BEFORE PRIVATE ${HW_SRC_INCLUDES})
target_include_directories(igdrcl_libult_cs BEFORE PRIVATE ${HW_SRC_INCLUDES})
target_include_directories(igdrcl_libult BEFORE PRIVATE ${HW_SRC_INCLUDE_PATH})
target_include_directories(igdrcl_libult_cs BEFORE PRIVATE ${HW_SRC_INCLUDE_PATH})
# if(HAVE_INSTRUMENTATION)
# target_include_directories(igdrcl_libult PRIVATE $<TARGET_PROPERTY:instrumentation_umd,INTERFACE_INCLUDE_DIRECTORIES>)

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2017, Intel Corporation
# Copyright (c) 2018, Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -18,8 +18,6 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR)
project(cloc_tests)
set(IGDRCL_SRCS_cloc
@@ -63,19 +61,13 @@ set(IGDRCL_SRCS_offline_compiler_tests
${CLOC_SRCS_LIB}
)
list(APPEND HW_SRC_INCLUDES ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
link_directories(${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_executable(cloc_tests ${IGDRCL_SRCS_offline_compiler_tests})
target_include_directories(cloc_tests BEFORE PRIVATE ${HW_SRC_INCLUDES})
target_include_directories(cloc_tests PRIVATE
${CLOC_INCLUDES}
${KHRONOS_HEADERS_DIR}
${GTEST_INCLUDE_DIR}
${GMOCK_INCLUDE_DIR}
${GMM_INCLUDE_PATHS}
${IGDRCL__IGC_INCLUDE_DIR}
${THIRD_PARTY_DIR}
)
target_compile_definitions(cloc_tests PUBLIC MOCKABLE_VIRTUAL=virtual ${SUPPORTED_GEN_FLAGS_DEFINITONS} DEFAULT_PLATFORM=${DEFAULT_SUPPORTED_PLATFORM})