From d1aa5f978d7d8feefb547a00be0b637142575df2 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 27 Feb 2018 14:47:36 +0100 Subject: [PATCH] Cmake refactor part 6 Add macro to add all subdirectories Add macro to create project source tree based on target sources Small cleanup runtime/CMakeLists.txt Change-Id: I9b99145c544f648c4c3fe7421752d0c5d9504edf --- CMakeLists.txt | 3 +- common_macros.cmake | 46 +++ runtime/CMakeLists.txt | 374 ++++++-------------- runtime/accelerators/CMakeLists.txt | 5 +- runtime/api/CMakeLists.txt | 2 +- runtime/aub_mem_dump/CMakeLists.txt | 2 +- runtime/built_ins/CMakeLists.txt | 6 +- runtime/command_queue/CMakeLists.txt | 3 +- runtime/command_stream/CMakeLists.txt | 3 +- runtime/commands/CMakeLists.txt | 3 +- runtime/compiler_interface/CMakeLists.txt | 3 +- runtime/context/CMakeLists.txt | 3 +- runtime/device/CMakeLists.txt | 3 +- runtime/device_queue/CMakeLists.txt | 3 +- runtime/dll/CMakeLists.txt | 10 +- runtime/enable_gens.cmake | 2 + runtime/event/CMakeLists.txt | 3 +- runtime/execution_model/CMakeLists.txt | 3 +- runtime/gen_common/CMakeLists.txt | 3 +- runtime/gmm_helper/CMakeLists.txt | 6 +- runtime/gtpin/CMakeLists.txt | 4 +- runtime/helpers/CMakeLists.txt | 7 +- runtime/indirect_heap/CMakeLists.txt | 3 +- runtime/instrumentation/CMakeLists.txt | 3 +- runtime/kernel/CMakeLists.txt | 3 +- runtime/mem_obj/CMakeLists.txt | 3 +- runtime/memory_manager/CMakeLists.txt | 3 +- runtime/os_interface/CMakeLists.txt | 8 +- runtime/os_interface/linux/CMakeLists.txt | 8 +- runtime/os_interface/windows/CMakeLists.txt | 8 +- runtime/platform/CMakeLists.txt | 3 +- runtime/program/CMakeLists.txt | 3 +- runtime/sampler/CMakeLists.txt | 3 +- runtime/scheduler/CMakeLists.txt | 3 +- runtime/sharings/CMakeLists.txt | 7 +- runtime/sharings/d3d/CMakeLists.txt | 27 +- runtime/sharings/va/CMakeLists.txt | 27 +- runtime/sku_info/CMakeLists.txt | 8 +- runtime/tbx/CMakeLists.txt | 3 +- runtime/utilities/CMakeLists.txt | 10 +- 40 files changed, 282 insertions(+), 348 deletions(-) create mode 100644 common_macros.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c47b1b400..fb89721b32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,8 @@ cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) include(ExternalProject) - +# Include needed macros +include(common_macros.cmake) # Set the configuration type set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} diff --git a/common_macros.cmake b/common_macros.cmake new file mode 100644 index 0000000000..cd8715f569 --- /dev/null +++ b/common_macros.cmake @@ -0,0 +1,46 @@ +# 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. + +macro(hide_subdir subdir) + set(${subdir}_hidden TRUE) +endmacro() + +macro(add_subdirectories) + file(GLOB subdirectories RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) + foreach(subdir ${subdirectories}) + if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${subdir} AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt AND NOT ${subdir}_hidden) + add_subdirectory(${subdir}) + endif() + endforeach() +endmacro() + +macro(create_project_source_tree target) + get_target_property(source_list ${target} SOURCES) + foreach(source_file ${source_list}) + if(NOT ${source_file} MATCHES "\<*\>") + file(RELATIVE_PATH source_file_relative ${CMAKE_CURRENT_SOURCE_DIR} ${source_file}) + get_filename_component(source_path_relative ${source_file_relative} PATH) + if(source_path_relative) + string(REPLACE "/" "\\" source_path_relative ${source_path_relative}) + endif() + source_group("Source Files\\${source_path_relative}" FILES ${source_file}) + endif() + endforeach() +endmacro() diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 7b57baa857..b24885190b 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -18,190 +18,85 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -if (POLICY CMP0042) - cmake_policy (SET CMP0042 NEW) -endif (POLICY CMP0042) +if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif() -if (POLICY CMP0063) - cmake_policy (SET CMP0063 NEW) -endif (POLICY CMP0063) +if(POLICY CMP0063) + cmake_policy(SET CMP0063 NEW) +endif() -project (neo) - -if(NOT (TARGET ${BIKSIM_LIB_NAME})) +project(neo) +if(NOT TARGET ${BIKSIM_LIB_NAME}) add_subdirectory(builtin_kernels_simulation) -endif(NOT (TARGET ${BIKSIM_LIB_NAME})) - -add_subdirectory(accelerators) -add_subdirectory(api) -add_subdirectory(aub_mem_dump) -add_subdirectory(built_ins) -add_subdirectory(command_queue) -add_subdirectory(command_stream) -add_subdirectory(commands) -add_subdirectory(compiler_interface) -add_subdirectory(context) -add_subdirectory(device) -add_subdirectory(device_queue) -add_subdirectory(event) -add_subdirectory(execution_model) -add_subdirectory(gen_common) -add_subdirectory(gmm_helper) - -set(RUNTIME_SRCS_GMM_HELPER ${RUNTIME_SRCS_GMM_HELPER_BASE}) -if(WIN32) - list(APPEND RUNTIME_SRCS_GMM_HELPER ${RUNTIME_SRCS_GMM_HELPER_WINDOWS}) endif() -add_subdirectory(gtpin) -add_subdirectory(helpers) +hide_subdir(builtin_kernels_simulation) +hide_subdir(dll) +hide_subdir(instrumentation) -set(RUNTIME_SRCS_HELPERS ${RUNTIME_SRCS_HELPERS_BASE}) -if(WIN32) - list(APPEND RUNTIME_SRCS_HELPERS ${RUNTIME_SRCS_HELPERS_WINDOWS}) -endif() +add_library(${NEO_STATIC_LIB_NAME} STATIC + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/enable_gens.cmake + $ +) -add_subdirectory(indirect_heap) +add_subdirectories() add_subdirectory(instrumentation${IGDRCL__INSTRUMENTATION_DIR_SUFFIX}) -add_subdirectory(kernel) -add_subdirectory(mem_obj) -add_subdirectory(memory_manager) -add_subdirectory(os_interface) -set(RUNTIME_SRCS_OS_INTERFACE ${RUNTIME_SRCS_OS_INTERFACE_BASE}) if(WIN32) - list(APPEND RUNTIME_SRCS_OS_INTERFACE ${RUNTIME_SRCS_OS_INTERFACE_WINDOWS}) -else() - list(APPEND RUNTIME_SRCS_OS_INTERFACE ${RUNTIME_SRCS_OS_INTERFACE_LINUX}) + if("${IGDRCL_OPTION__BITS}" STREQUAL "32" ) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") + endif() endif() -add_subdirectory(platform) -add_subdirectory(program) -add_subdirectory(sampler) -add_subdirectory(scheduler) -add_subdirectory(sharings) -add_subdirectory(sku_info) - -set(RUNTIME_SRCS_SKU_INFO ${RUNTIME_SRCS_SKU_INFO_BASE}) -if(WIN32) - list(APPEND RUNTIME_SRCS_SKU_INFO ${RUNTIME_SRCS_SKU_INFO_WINDOWS}) -endif() - -add_subdirectory(tbx) -add_subdirectory(utilities) - -set(RUNTIME_SRCS_UTILITIES ${RUNTIME_SRCS_UTILITIES_BASE}) -if(WIN32) - list(APPEND RUNTIME_SRCS_UTILITIES ${RUNTIME_SRCS_UTILITIES_WINDOWS}) -else() - list(APPEND RUNTIME_SRCS_UTILITIES ${RUNTIME_SRCS_UTILITIES_LINUX}) -endif() - -if (WIN32) - if ("${IGDRCL_OPTION__BITS}" STREQUAL "32" ) - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") - endif ("${IGDRCL_OPTION__BITS}" STREQUAL "32") -endif (WIN32) - - include(enable_gens.cmake) -set (RUNTIME_SRCS - ${RUNTIME_SRCS_API} - ${RUNTIME_SRCS_ACCELERATORS} - ${RUNTIME_SRCS_AUB_MEM_DUMP} - ${RUNTIME_SRCS_BUILT_INS} - ${RUNTIME_SRCS_BUILT_IN_KERNELS} - ${RUNTIME_SRCS_COMMANDS} - ${RUNTIME_SRCS_COMMAND_QUEUE} - ${RUNTIME_SRCS_COMMAND_STREAM} - ${RUNTIME_SRCS_COMPILER_INTERFACE} - ${RUNTIME_SRCS_CONTEXT} - ${RUNTIME_SRCS_DEVICE} - ${RUNTIME_SRCS_DEVICE_QUEUE} - ${RUNTIME_SRCS_EVENT} - ${RUNTIME_SRCS_EXECUTION_MODEL} - ${RUNTIME_SRCS_GEN_COMMON} - ${RUNTIME_SRCS_GENX} - ${RUNTIME_SRCS_GTPIN} - ${RUNTIME_SRCS_HELPERS} - ${RUNTIME_SRCS_INDIRECT_HEAP} - ${RUNTIME_SRCS_INSTRUMENTATION} - ${RUNTIME_SRCS_KERNEL} - ${RUNTIME_SRCS_MEMORY_MANAGER} - ${RUNTIME_SRCS_GMM_HELPER} - ${RUNTIME_SRCS_MEM_OBJ} - ${RUNTIME_SRCS_OS_INTERFACE} - ${RUNTIME_SRCS_PLATFORM} - ${RUNTIME_SRCS_PROGRAM} - ${RUNTIME_SRCS_SAMPLER} - ${RUNTIME_SRCS_SCHEDULER} - ${RUNTIME_SRCS_SKU_INFO} - ${RUNTIME_SRCS_SHARINGS} - ${RUNTIME_SRCS_TBX} - ${RUNTIME_SRCS_UTILITIES} - CMakeLists.txt -) - # Enable SSE4/AVX2 options for files that need them if(MSVC) - set_source_files_properties(command_queue/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS /arch:AVX2) + set_source_files_properties(command_queue/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS /arch:AVX2) else() - set_source_files_properties(command_queue/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2) - set_source_files_properties(command_queue/local_id_gen_sse4.cpp PROPERTIES COMPILE_FLAGS -msse4.2) -endif (MSVC) + set_source_files_properties(command_queue/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2) + set_source_files_properties(command_queue/local_id_gen_sse4.cpp PROPERTIES COMPILE_FLAGS -msse4.2) +endif() # Put Driver version into define 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) - -add_library(${NEO_STATIC_LIB_NAME} STATIC $ - ${RUNTIME_SRCS} -) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/device/device_caps.cpp PROPERTIES COMPILE_DEFINITIONS NEO_DRIVER_VERSION="${NEO_DRIVER_VERSION}") +endif() target_link_libraries(${NEO_STATIC_LIB_NAME} elflib) target_include_directories(${NEO_STATIC_LIB_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${GMM_INCLUDE_PATHS} + ${KMDAF_HEADERS_DIR} ${UMKM_SHAREDDATA_INCLUDE_PATHS} ) target_include_directories(${NEO_STATIC_LIB_NAME} PUBLIC - ${KHRONOS_HEADERS_DIR} - ${IGDRCL__IGC_INCLUDE_DIR} - ${THIRD_PARTY_DIR} + ${CIF_BASE_DIR} + ${GTPIN_HEADERS_DIR} + ${IGC_OCL_ADAPTOR_DIR} + ${IGDRCL__IGC_INCLUDE_DIR} + ${KHRONOS_HEADERS_DIR} + ${THIRD_PARTY_DIR} ) -if(GTPIN_HEADERS_DIR) - target_include_directories(${NEO_STATIC_LIB_NAME} PUBLIC - ${GTPIN_HEADERS_DIR} - ) -endif(GTPIN_HEADERS_DIR) -if(KMDAF_HEADERS_DIR) - target_include_directories(${NEO_STATIC_LIB_NAME} PRIVATE - ${KMDAF_HEADERS_DIR} - ) -endif() - -if (WIN32) +if(WIN32) target_include_directories(${NEO_STATIC_LIB_NAME} PUBLIC ${WDK_INCLUDE_PATHS} os_interface/windows ) target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC OGL=1) target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC INSTR_WIN_UMD=1) - -endif (WIN32) - -if (UNIX) +else() target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC OGL_GEM=1) target_include_directories(${NEO_STATIC_LIB_NAME} PUBLIC os_interface/linux "${LIBDRM_DIR}/include" ) -endif (UNIX) +endif() target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC DEFAULT_PLATFORM=${DEFAULT_SUPPORTED_PLATFORM}) @@ -212,21 +107,14 @@ target_link_libraries(${NEO_STATIC_LIB_NAME} ${GMMUMD_LIB_NAME}) if(WIN32) if(GTPIN_HEADERS_DIR) set( DEF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dll/windows/GTPinExports${IGDRCL_OPTION__BITS}.def" ) - else(GTPIN_HEADERS_DIR) + else() set( DEF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dll/windows/OpenCLExports${IGDRCL_OPTION__BITS}.def" ) - endif(GTPIN_HEADERS_DIR) + endif() endif(WIN32) list(APPEND LIB_FLAGS_DEFINITIONS -DCIF_HEADERS_ONLY_BUILD ${SUPPORTED_GEN_FLAGS_DEFINITONS}) target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC ${LIB_FLAGS_DEFINITIONS}) -if(IGC_OCL_ADAPTOR_DIR) # IGC/AdaptorOCL - target_include_directories("${NEO_STATIC_LIB_NAME}" PUBLIC "${IGC_OCL_ADAPTOR_DIR}") -endif(IGC_OCL_ADAPTOR_DIR) - -if(CIF_BASE_DIR) - target_include_directories("${NEO_STATIC_LIB_NAME}" PUBLIC "${CIF_BASE_DIR}") -endif(CIF_BASE_DIR) set(IGDRCL_LIB_FLAGS_DEFINITIONS ${LIB_FLAGS_DEFINITIONS} PARENT_SCOPE) set_target_properties(${NEO_STATIC_LIB_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) @@ -238,130 +126,84 @@ set_target_properties(${NEO_STATIC_LIB_NAME} PROPERTIES FOLDER "opencl runtime") target_include_directories(${NEO_STATIC_LIB_NAME} BEFORE PRIVATE ${HW_SRC_INCLUDE_PATH}) if(${GENERATE_EXECUTABLE}) - add_subdirectory(dll) - - set(RUNTIME_SRCS_DLL ${RUNTIME_SRCS_DLL_BASE}) - if(WIN32) - list(APPEND RUNTIME_SRCS_DLL ${RUNTIME_SRCS_DLL_WINDOWS}) - else() - list(APPEND RUNTIME_SRCS_DLL ${RUNTIME_SRCS_DLL_LINUX}) + if(GTPIN_HEADERS_DIR) + foreach(GEN_NUM RANGE ${MAX_GEN}) + GEN_CONTAINS_PLATFORMS("SUPPORTED" ${GEN_NUM} GENX_HAS_PLATFORMS) + if(${GENX_HAS_PLATFORMS}) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/gen${GEN_NUM}/gtpin_setup_gen${GEN_NUM}.cpp) + endif(${GENX_HAS_PLATFORMS}) + endforeach() endif() - if(GTPIN_HEADERS_DIR) - foreach(GEN_NUM RANGE ${MAX_GEN} 0 -1) - GEN_CONTAINS_PLATFORMS("SUPPORTED" ${GEN_NUM} GENX_HAS_PLATFORMS) - if(${GENX_HAS_PLATFORMS}) - list(APPEND RUNTIME_SRCS_GTPIN gen${GEN_NUM}/gtpin_setup_gen${GEN_NUM}.cpp) - endif(${GENX_HAS_PLATFORMS}) - endforeach(GEN_NUM) - endif(GTPIN_HEADERS_DIR) + list(APPEND NEO_DYNAMIC_LIB__TARGET_OBJECTS + $ + $ + $ + $ + ) + add_library(${NEO_DYNAMIC_LIB_NAME} SHARED + ${NEO_DYNAMIC_LIB__TARGET_OBJECTS} + ) - add_library(${NEO_DYNAMIC_LIB_NAME} SHARED - ${RUNTIME_SRCS_DLL} - $ - $ - $ - $ - ) + add_subdirectory(dll) - target_include_directories(${NEO_DYNAMIC_LIB_NAME} BEFORE PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} - ${HW_SRC_INCLUDE_PATH} - ) + if(HAVE_INSTRUMENTATION) + target_link_libraries(${NEO_DYNAMIC_LIB_NAME} instrumentation_umd) + endif() - target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${NEO_STATIC_LIB_NAME}) + target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${NEO_STATIC_LIB_NAME}) - if(HAVE_INSTRUMENTATION) - target_link_libraries(${NEO_DYNAMIC_LIB_NAME} instrumentation_umd) - endif() + target_include_directories(${NEO_DYNAMIC_LIB_NAME} BEFORE PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} + ${HW_SRC_INCLUDE_PATH} + ) - if (WIN32) - target_include_directories(${NEO_DYNAMIC_LIB_NAME} PUBLIC - ${WDK_INCLUDE_PATHS} - ${GMM_INCLUDE_PATHS} - ${UMKM_SHAREDDATA_INCLUDE_PATHS} - ${INSTRUMENTATION_INCLUDE_PATH} - ) - target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${NEO_STATIC_LIB_NAME} dxgi Ws2_32.lib) - else(WIN32) - target_include_directories(${NEO_DYNAMIC_LIB_NAME} PUBLIC - ${GMM_INCLUDE_PATHS} - ${UMKM_SHAREDDATA_INCLUDE_PATHS} - ${INSTRUMENTATION_INCLUDE_PATH} - ${CMAKE_CURRENT_SOURCE_DIR}/dll/linux/devices${BRANCH_DIR_SUFFIX} - ) - endif (WIN32) + target_include_directories(${NEO_DYNAMIC_LIB_NAME} PUBLIC + ${GMM_INCLUDE_PATHS} + ${UMKM_SHAREDDATA_INCLUDE_PATHS} + ${INSTRUMENTATION_INCLUDE_PATH} + ) + if(WIN32) + target_include_directories(${NEO_DYNAMIC_LIB_NAME} PUBLIC + ${WDK_INCLUDE_PATHS} + ) + target_link_libraries(${NEO_DYNAMIC_LIB_NAME} ${NEO_STATIC_LIB_NAME} dxgi Ws2_32.lib) + else() + target_include_directories(${NEO_DYNAMIC_LIB_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/dll/linux/devices${BRANCH_DIR_SUFFIX} + ) + target_link_libraries(${NEO_DYNAMIC_LIB_NAME} dl pthread) + set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} + APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/dll/linux/ocl.exports" + ) + set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} + APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-Bsymbolic" + ) + set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS}) + endif() - if (UNIX) - target_link_libraries(${NEO_DYNAMIC_LIB_NAME} dl pthread) - set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} - APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/dll/linux/ocl.exports" - ) - set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} - APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-Bsymbolic" - ) - endif (UNIX) - - set_target_properties(${NEO_DYNAMIC_LIB_NAME} PROPERTIES - DEBUG_OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" - RELEASE_OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" - RELEASEINTERNAL_OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" - OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" - ) - - set_property(TARGET ${NEO_DYNAMIC_LIB_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS}) - set_target_properties(${NEO_DYNAMIC_LIB_NAME} PROPERTIES FOLDER "opencl runtime") + set_target_properties(${NEO_DYNAMIC_LIB_NAME} PROPERTIES + DEBUG_OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" + RELEASE_OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" + RELEASEINTERNAL_OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" + OUTPUT_NAME "${NEO_DLL_NAME_BASE}${IGDRCL_NAME_POSTFIX}${IGDRCL_OPTION__BITS}" + ) + set_target_properties(${NEO_DYNAMIC_LIB_NAME} PROPERTIES FOLDER "opencl runtime") endif(${GENERATE_EXECUTABLE}) -if (WIN32) - source_group("source files" FILES ${IGDRCL_SRCS_DLL}) - source_group("source files\\api" FILES ${RUNTIME_SRCS_API}) - source_group("source files\\accelerators" FILES ${RUNTIME_SRCS_ACCELERATORS}) - source_group("source files\\aub_mem_dump" FILES ${RUNTIME_SRCS_AUB_MEM_DUMP}) - source_group("source files\\built_ins" FILES ${RUNTIME_SRCS_BUILT_INS}) - source_group("source files\\built_ins\\kernels" FILES ${RUNTIME_SRCS_BUILT_IN_KERNELS}) - source_group("source files\\commands" FILES ${RUNTIME_SRCS_COMMANDS}) - source_group("source files\\command_queue" FILES ${RUNTIME_SRCS_COMMAND_QUEUE}) - source_group("source files\\command_stream" FILES ${RUNTIME_SRCS_COMMAND_STREAM}) - source_group("source files\\compiler_interface" FILES ${RUNTIME_SRCS_COMPILER_INTERFACE}) - source_group("source files\\context" FILES ${RUNTIME_SRCS_CONTEXT}) - source_group("source files\\device" FILES ${RUNTIME_SRCS_DEVICE}) - source_group("source files\\device_queue" FILES ${RUNTIME_SRCS_DEVICE_QUEUE}) - source_group("source files\\event" FILES ${RUNTIME_SRCS_EVENT}) - source_group("source files\\execution_model" FILES ${RUNTIME_SRCS_EXECUTION_MODEL}) - source_group("source files\\gen_common" FILES ${RUNTIME_SRCS_GEN_COMMON}) - source_group("source files\\helpers" FILES ${RUNTIME_SRCS_HELPERS}) - source_group("source files\\indirect_heap" FILES ${RUNTIME_SRCS_INDIRECT_HEAP}) - source_group("source files\\instrumentation" FILES ${RUNTIME_SRCS_INSTRUMENTATION}) - 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}) - 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_BASE}) - source_group("source files\\os_interface\\windows" FILES ${RUNTIME_SRCS_OS_INTERFACE_WINDOWS}) - source_group("source files\\platform" FILES ${RUNTIME_SRCS_PLATFORM}) - source_group("source files\\program" FILES ${RUNTIME_SRCS_PROGRAM}) - source_group("source files\\sampler" FILES ${RUNTIME_SRCS_SAMPLER}) - source_group("source files\\scheduler" FILES ${RUNTIME_SRCS_SCHEDULER}) - source_group("source files\\sku_info" FILES ${RUNTIME_SRCS_SKU_INFO}) - source_group("source files\\sharings" FILES ${RUNTIME_SRCS_SHARINGS}) - source_group("source files\\tbx" FILES ${RUNTIME_SRCS_TBX}) - source_group("source files\\utilities" FILES ${RUNTIME_SRCS_UTILITIES}) -endif (WIN32) +if(WIN32) + create_project_source_tree(${NEO_STATIC_LIB_NAME}) +endif() -if (UNIX) - if(NOT (TARGET clang-tidy)) - add_custom_target(clang-tidy - DEPENDS scheduler - ) - - add_custom_command( - TARGET clang-tidy - POST_BUILD - COMMAND echo clang-tidy... - COMMAND find ${CMAKE_CURRENT_SOURCE_DIR} -name *.cpp -print0 | xargs -0 -I{} -P`nproc` clang-tidy -p ${IGDRCL_BINARY_DIR} {} | tee ${IGDRCL_BINARY_DIR}/clang-tidy.log - WORKING_DIRECTORY ${IGDRCL_SOURCE_DIR} - ) - endif(NOT (TARGET clang-tidy)) -endif(UNIX) +if(UNIX AND NOT (TARGET clang-tidy)) + add_custom_target(clang-tidy + DEPENDS scheduler + ) + add_custom_command( + TARGET clang-tidy + POST_BUILD + COMMAND echo clang-tidy... + COMMAND find ${CMAKE_CURRENT_SOURCE_DIR} -name *.cpp -print0 | xargs -0 -I{} -P`nproc` clang-tidy -p ${IGDRCL_BINARY_DIR} {} | tee ${IGDRCL_BINARY_DIR}/clang-tidy.log + WORKING_DIRECTORY ${IGDRCL_SOURCE_DIR} + ) +endif() diff --git a/runtime/accelerators/CMakeLists.txt b/runtime/accelerators/CMakeLists.txt index e56b8ec3d1..d4e38ed43f 100644 --- a/runtime/accelerators/CMakeLists.txt +++ b/runtime/accelerators/CMakeLists.txt @@ -18,11 +18,12 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -set (RUNTIME_SRCS_ACCELERATORS +set(RUNTIME_SRCS_ACCELERATORS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/intel_accelerator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/intel_accelerator.h ${CMAKE_CURRENT_SOURCE_DIR}/intel_motion_estimation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/intel_motion_estimation.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_ACCELERATORS}) diff --git a/runtime/api/CMakeLists.txt b/runtime/api/CMakeLists.txt index 83122be979..58f5ad74aa 100644 --- a/runtime/api/CMakeLists.txt +++ b/runtime/api/CMakeLists.txt @@ -25,5 +25,5 @@ set(RUNTIME_SRCS_API ${CMAKE_CURRENT_SOURCE_DIR}/cl_types.h ${CMAKE_CURRENT_SOURCE_DIR}/dispatch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dispatch.h - PARENT_SCOPE ) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_API}) diff --git a/runtime/aub_mem_dump/CMakeLists.txt b/runtime/aub_mem_dump/CMakeLists.txt index 34ee7b6228..4e88c08e32 100644 --- a/runtime/aub_mem_dump/CMakeLists.txt +++ b/runtime/aub_mem_dump/CMakeLists.txt @@ -25,5 +25,5 @@ set(RUNTIME_SRCS_AUB_MEM_DUMP ${CMAKE_CURRENT_SOURCE_DIR}/aub_mem_dump.h ${CMAKE_CURRENT_SOURCE_DIR}/aub_mem_dump.inl ${CMAKE_CURRENT_SOURCE_DIR}/aub_services.h - PARENT_SCOPE ) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_AUB_MEM_DUMP}) diff --git a/runtime/built_ins/CMakeLists.txt b/runtime/built_ins/CMakeLists.txt index 2cc195d81b..8de679c700 100644 --- a/runtime/built_ins/CMakeLists.txt +++ b/runtime/built_ins/CMakeLists.txt @@ -26,9 +26,10 @@ set(RUNTIME_SRCS_BUILT_INS ${CMAKE_CURRENT_SOURCE_DIR}/sip.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sip.h ${CMAKE_CURRENT_SOURCE_DIR}/vme_dispatch_builder.h - PARENT_SCOPE ) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_BUILT_INS}) + set(RUNTIME_SRCS_BUILT_IN_KERNELS ${CMAKE_CURRENT_SOURCE_DIR}/kernels/copy_buffer_rect.igdrcl_built_in ${CMAKE_CURRENT_SOURCE_DIR}/kernels/copy_buffer_to_buffer.igdrcl_built_in @@ -44,9 +45,10 @@ set(RUNTIME_SRCS_BUILT_IN_KERNELS ${CMAKE_CURRENT_SOURCE_DIR}/kernels/vme_block_motion_estimate_intel.igdrcl_built_in ${CMAKE_CURRENT_SOURCE_DIR}/kernels/vme_block_advanced_motion_estimate_check_intel.igdrcl_built_in ${CMAKE_CURRENT_SOURCE_DIR}/kernels/vme_block_advanced_motion_estimate_bidirectional_check_intel.igdrcl_built_in - PARENT_SCOPE ) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_BUILT_IN_KERNELS}) + if(NOT (TARGET ${BUILTINS_BINARIES_LIB_NAME})) include(builtins_binary.cmake) endif() diff --git a/runtime/command_queue/CMakeLists.txt b/runtime/command_queue/CMakeLists.txt index 31ca834669..215cbe54a6 100644 --- a/runtime/command_queue/CMakeLists.txt +++ b/runtime/command_queue/CMakeLists.txt @@ -55,5 +55,6 @@ set(RUNTIME_SRCS_COMMAND_QUEUE ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.h ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.inl ${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_COMMAND_QUEUE}) diff --git a/runtime/command_stream/CMakeLists.txt b/runtime/command_stream/CMakeLists.txt index a7c28a8826..009b5fcf4d 100644 --- a/runtime/command_stream/CMakeLists.txt +++ b/runtime/command_stream/CMakeLists.txt @@ -47,5 +47,6 @@ set(RUNTIME_SRCS_COMMAND_STREAM ${CMAKE_CURRENT_SOURCE_DIR}/preemption.h ${CMAKE_CURRENT_SOURCE_DIR}/preemption.cpp ${CMAKE_CURRENT_SOURCE_DIR}/preemption.inl - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_COMMAND_STREAM}) diff --git a/runtime/commands/CMakeLists.txt b/runtime/commands/CMakeLists.txt index 83fd126eca..7b22a6590f 100644 --- a/runtime/commands/CMakeLists.txt +++ b/runtime/commands/CMakeLists.txt @@ -21,5 +21,6 @@ set(RUNTIME_SRCS_COMMANDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/bxml_generator_glue.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_COMMANDS}) diff --git a/runtime/compiler_interface/CMakeLists.txt b/runtime/compiler_interface/CMakeLists.txt index fe14c3a97c..b0736e088f 100644 --- a/runtime/compiler_interface/CMakeLists.txt +++ b/runtime/compiler_interface/CMakeLists.txt @@ -25,5 +25,6 @@ set(RUNTIME_SRCS_COMPILER_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/compiler_interface.h ${CMAKE_CURRENT_SOURCE_DIR}/compiler_interface.inl ${CMAKE_CURRENT_SOURCE_DIR}/create_main.cpp - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_COMPILER_INTERFACE}) diff --git a/runtime/context/CMakeLists.txt b/runtime/context/CMakeLists.txt index 0c95f6d732..95b0af7725 100644 --- a/runtime/context/CMakeLists.txt +++ b/runtime/context/CMakeLists.txt @@ -25,5 +25,6 @@ set(RUNTIME_SRCS_CONTEXT ${CMAKE_CURRENT_SOURCE_DIR}/context.inl ${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_CONTEXT}) diff --git a/runtime/device/CMakeLists.txt b/runtime/device/CMakeLists.txt index cdfb047374..05a6dac645 100644 --- a/runtime/device/CMakeLists.txt +++ b/runtime/device/CMakeLists.txt @@ -28,5 +28,6 @@ set(RUNTIME_SRCS_DEVICE ${CMAKE_CURRENT_SOURCE_DIR}/device_info_map.h ${CMAKE_CURRENT_SOURCE_DIR}/device_vector.h ${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DEVICE}) diff --git a/runtime/device_queue/CMakeLists.txt b/runtime/device_queue/CMakeLists.txt index 313f543a42..abacee6fa9 100644 --- a/runtime/device_queue/CMakeLists.txt +++ b/runtime/device_queue/CMakeLists.txt @@ -25,5 +25,6 @@ set(RUNTIME_SRCS_DEVICE_QUEUE ${CMAKE_CURRENT_SOURCE_DIR}/device_queue_hw.h ${CMAKE_CURRENT_SOURCE_DIR}/device_queue_hw.inl ${CMAKE_CURRENT_SOURCE_DIR}/device_queue_hw_profiling.inl - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DEVICE_QUEUE}) diff --git a/runtime/dll/CMakeLists.txt b/runtime/dll/CMakeLists.txt index ebda029501..3a25a8f0d3 100644 --- a/runtime/dll/CMakeLists.txt +++ b/runtime/dll/CMakeLists.txt @@ -39,17 +39,21 @@ set(RUNTIME_SRCS_DLL_BASE ${DEF_FILE} ${GTPIN_INIT_FILE} ${HW_SRC_LINK} - PARENT_SCOPE ) set(RUNTIME_SRCS_DLL_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_neo_create.cpp - PARENT_SCOPE ) set(RUNTIME_SRCS_DLL_WINDOWS ${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/wddm_create.cpp ${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/page_table_mngr.cpp ${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/gmm_memory.cpp - PARENT_SCOPE ) + +target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DLL_BASE}) +if(WIN32) + target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DLL_WINDOWS}) +else() + target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DLL_LINUX}) +endif() \ No newline at end of file diff --git a/runtime/enable_gens.cmake b/runtime/enable_gens.cmake index 41312a2ee4..eedfdbc75d 100644 --- a/runtime/enable_gens.cmake +++ b/runtime/enable_gens.cmake @@ -107,3 +107,5 @@ foreach(GEN_NUM RANGE ${MAX_GEN}) source_group("gen${GEN_NUM}\\windows" FILES ${RUNTIME_SRCS_GEN${GEN_NUM}_WINDOWS}) endif() endforeach() + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_GENX}) diff --git a/runtime/event/CMakeLists.txt b/runtime/event/CMakeLists.txt index aff085b3bb..f4a1595027 100644 --- a/runtime/event/CMakeLists.txt +++ b/runtime/event/CMakeLists.txt @@ -30,5 +30,6 @@ set(RUNTIME_SRCS_EVENT ${CMAKE_CURRENT_SOURCE_DIR}/user_event.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_timestamps.h ${CMAKE_CURRENT_SOURCE_DIR}/perf_counter.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_EVENT}) diff --git a/runtime/execution_model/CMakeLists.txt b/runtime/execution_model/CMakeLists.txt index 6d8b9be1b5..85a200bdef 100644 --- a/runtime/execution_model/CMakeLists.txt +++ b/runtime/execution_model/CMakeLists.txt @@ -21,5 +21,6 @@ set(RUNTIME_SRCS_EXECUTION_MODEL ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/device_enqueue.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_EXECUTION_MODEL}) diff --git a/runtime/gen_common/CMakeLists.txt b/runtime/gen_common/CMakeLists.txt index 7ecae182cf..502fd8729b 100644 --- a/runtime/gen_common/CMakeLists.txt +++ b/runtime/gen_common/CMakeLists.txt @@ -24,5 +24,6 @@ set(RUNTIME_SRCS_GEN_COMMON ${CMAKE_CURRENT_SOURCE_DIR}/aub_mapper_base.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds.h ${CMAKE_CURRENT_SOURCE_DIR}/reg_configs.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_GEN_COMMON}) diff --git a/runtime/gmm_helper/CMakeLists.txt b/runtime/gmm_helper/CMakeLists.txt index 706ec2c470..b967ed1305 100644 --- a/runtime/gmm_helper/CMakeLists.txt +++ b/runtime/gmm_helper/CMakeLists.txt @@ -25,7 +25,6 @@ set(RUNTIME_SRCS_GMM_HELPER_BASE ${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h ${CMAKE_CURRENT_SOURCE_DIR}/resource_info.h ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/gmm_utils.cpp - PARENT_SCOPE ) set(RUNTIME_SRCS_GMM_HELPER_WINDOWS @@ -34,3 +33,8 @@ set(RUNTIME_SRCS_GMM_HELPER_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory_base.h PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_GMM_HELPER_BASE}) +if(WIN32) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_GMM_HELPER_WINDOWS}) +endif() diff --git a/runtime/gtpin/CMakeLists.txt b/runtime/gtpin/CMakeLists.txt index aa1136ec72..e6fd32d3d6 100644 --- a/runtime/gtpin/CMakeLists.txt +++ b/runtime/gtpin/CMakeLists.txt @@ -31,13 +31,13 @@ if(GTPIN_HEADERS_DIR) ${CMAKE_CURRENT_SOURCE_DIR}/gtpin_init.h ${CMAKE_CURRENT_SOURCE_DIR}/gtpin_notify.h ${CMAKE_CURRENT_SOURCE_DIR}/gtpin_defs.h - PARENT_SCOPE ) else() set(RUNTIME_SRCS_GTPIN ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/gtpin_callback_stubs.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gtpin_notify.h - PARENT_SCOPE ) endif() + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_GTPIN}) diff --git a/runtime/helpers/CMakeLists.txt b/runtime/helpers/CMakeLists.txt index 70845f2880..c091d524ad 100644 --- a/runtime/helpers/CMakeLists.txt +++ b/runtime/helpers/CMakeLists.txt @@ -80,10 +80,13 @@ set(RUNTIME_SRCS_HELPERS_BASE ${CMAKE_CURRENT_SOURCE_DIR}/validators.cpp ${CMAKE_CURRENT_SOURCE_DIR}/validators.h ${CMAKE_CURRENT_SOURCE_DIR}/wddm_helper.h - PARENT_SCOPE ) set(RUNTIME_SRCS_HELPERS_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/translationtable_callbacks.h ${CMAKE_CURRENT_SOURCE_DIR}/translationtable_callbacks.inl - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_HELPERS_BASE}) +if(WIN32) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_HELPERS_WINDOWS}) +endif() diff --git a/runtime/indirect_heap/CMakeLists.txt b/runtime/indirect_heap/CMakeLists.txt index b99ce2b047..789dc7ff69 100644 --- a/runtime/indirect_heap/CMakeLists.txt +++ b/runtime/indirect_heap/CMakeLists.txt @@ -22,5 +22,6 @@ set(RUNTIME_SRCS_INDIRECT_HEAP ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/indirect_heap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/indirect_heap.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_INDIRECT_HEAP}) diff --git a/runtime/instrumentation/CMakeLists.txt b/runtime/instrumentation/CMakeLists.txt index 4d77e3e141..43112a4714 100644 --- a/runtime/instrumentation/CMakeLists.txt +++ b/runtime/instrumentation/CMakeLists.txt @@ -22,5 +22,6 @@ set(RUNTIME_SRCS_INSTRUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/instrumentation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/instrumentation.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_INSTRUMENTATION}) diff --git a/runtime/kernel/CMakeLists.txt b/runtime/kernel/CMakeLists.txt index a365fcd115..830e99e737 100644 --- a/runtime/kernel/CMakeLists.txt +++ b/runtime/kernel/CMakeLists.txt @@ -24,5 +24,6 @@ set(RUNTIME_SRCS_KERNEL ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernel.h ${CMAKE_CURRENT_SOURCE_DIR}/kernel.inl - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_KERNEL}) diff --git a/runtime/mem_obj/CMakeLists.txt b/runtime/mem_obj/CMakeLists.txt index 5329bcf3f7..e715adc1b3 100644 --- a/runtime/mem_obj/CMakeLists.txt +++ b/runtime/mem_obj/CMakeLists.txt @@ -34,5 +34,6 @@ set(RUNTIME_SRCS_MEM_OBJ ${CMAKE_CURRENT_SOURCE_DIR}/mem_obj.h ${CMAKE_CURRENT_SOURCE_DIR}/pipe.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pipe.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_MEM_OBJ}) diff --git a/runtime/memory_manager/CMakeLists.txt b/runtime/memory_manager/CMakeLists.txt index 5e7f482b51..02628dbaa4 100644 --- a/runtime/memory_manager/CMakeLists.txt +++ b/runtime/memory_manager/CMakeLists.txt @@ -40,5 +40,6 @@ set(RUNTIME_SRCS_MEMORY_MANAGER ${CMAKE_CURRENT_SOURCE_DIR}/surface.h ${CMAKE_CURRENT_SOURCE_DIR}/svm_memory_manager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/svm_memory_manager.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_MEMORY_MANAGER}) diff --git a/runtime/os_interface/CMakeLists.txt b/runtime/os_interface/CMakeLists.txt index c41b8a6211..8e8951d82c 100644 --- a/runtime/os_interface/CMakeLists.txt +++ b/runtime/os_interface/CMakeLists.txt @@ -33,11 +33,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_BASE ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters.cpp ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters.h ${CMAKE_CURRENT_SOURCE_DIR}/print.h - PARENT_SCOPE ) -add_subdirectory(linux) -add_subdirectory(windows) - -set(RUNTIME_SRCS_OS_INTERFACE_LINUX ${RUNTIME_SRCS_OS_INTERFACE_LINUX} PARENT_SCOPE) -set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS ${RUNTIME_SRCS_OS_INTERFACE_WINDOWS} PARENT_SCOPE) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_OS_INTERFACE_BASE}) +add_subdirectories() diff --git a/runtime/os_interface/linux/CMakeLists.txt b/runtime/os_interface/linux/CMakeLists.txt index d28b25fa81..e50c20081e 100644 --- a/runtime/os_interface/linux/CMakeLists.txt +++ b/runtime/os_interface/linux/CMakeLists.txt @@ -19,7 +19,6 @@ # OTHER DEALINGS IN THE SOFTWARE. set(RUNTIME_SRCS_OS_INTERFACE_LINUX - ${RUNTIME_SRCS_OS_INTERFACE_LINUX} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/api.cpp ${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing_functions.h @@ -57,5 +56,10 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.cpp ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.h ${CMAKE_CURRENT_SOURCE_DIR}/print.cpp - PARENT_SCOPE ) + +if(UNIX) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_OS_INTERFACE_LINUX}) +endif() + +add_subdirectories() diff --git a/runtime/os_interface/windows/CMakeLists.txt b/runtime/os_interface/windows/CMakeLists.txt index 9260567cf4..2eb73f77a8 100644 --- a/runtime/os_interface/windows/CMakeLists.txt +++ b/runtime/os_interface/windows/CMakeLists.txt @@ -25,7 +25,6 @@ else() endif() set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS - ${RUNTIME_SRCS_OS_INTERFACE_WINDOWS} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/api.cpp ${CMAKE_CURRENT_SOURCE_DIR}/d3d10_11_sharing_functions.cpp @@ -70,5 +69,10 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/windows_defs.h ${CMAKE_CURRENT_SOURCE_DIR}/windows_inc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/windows_wrapper.h - PARENT_SCOPE ) + +if(WIN32) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_OS_INTERFACE_WINDOWS}) +endif() + +add_subdirectories() diff --git a/runtime/platform/CMakeLists.txt b/runtime/platform/CMakeLists.txt index 51c640fcbb..e38933ea12 100644 --- a/runtime/platform/CMakeLists.txt +++ b/runtime/platform/CMakeLists.txt @@ -25,5 +25,6 @@ set(RUNTIME_SRCS_PLATFORM ${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp ${CMAKE_CURRENT_SOURCE_DIR}/platform.h ${CMAKE_CURRENT_SOURCE_DIR}/platform_info.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_PLATFORM}) diff --git a/runtime/program/CMakeLists.txt b/runtime/program/CMakeLists.txt index 0ef330f65c..4def4c20a6 100644 --- a/runtime/program/CMakeLists.txt +++ b/runtime/program/CMakeLists.txt @@ -42,5 +42,6 @@ set(RUNTIME_SRCS_PROGRAM ${CMAKE_CURRENT_SOURCE_DIR}/process_spir_binary.cpp ${CMAKE_CURRENT_SOURCE_DIR}/program.cpp ${CMAKE_CURRENT_SOURCE_DIR}/program.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_PROGRAM}) diff --git a/runtime/sampler/CMakeLists.txt b/runtime/sampler/CMakeLists.txt index c4551847ed..135ce0e660 100644 --- a/runtime/sampler/CMakeLists.txt +++ b/runtime/sampler/CMakeLists.txt @@ -24,5 +24,6 @@ set(RUNTIME_SRCS_SAMPLER ${CMAKE_CURRENT_SOURCE_DIR}/sampler.h ${CMAKE_CURRENT_SOURCE_DIR}/sampler.inl ${CMAKE_CURRENT_SOURCE_DIR}/sampler_factory_init.inl - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SAMPLER}) diff --git a/runtime/scheduler/CMakeLists.txt b/runtime/scheduler/CMakeLists.txt index 58933b1c4d..4ee3242d2f 100644 --- a/runtime/scheduler/CMakeLists.txt +++ b/runtime/scheduler/CMakeLists.txt @@ -23,9 +23,10 @@ set(RUNTIME_SRCS_SCHEDULER ${CMAKE_CURRENT_SOURCE_DIR}/scheduler.cl ${CMAKE_CURRENT_SOURCE_DIR}/scheduler_kernel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/scheduler_kernel.h - PARENT_SCOPE ) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SCHEDULER}) + if(NOT (TARGET ${SCHEDULER_BINARY_LIB_NAME})) include(scheduler_binary.cmake) endif() diff --git a/runtime/sharings/CMakeLists.txt b/runtime/sharings/CMakeLists.txt index 1c97d54b9e..8bbd071461 100644 --- a/runtime/sharings/CMakeLists.txt +++ b/runtime/sharings/CMakeLists.txt @@ -39,13 +39,12 @@ set(RUNTIME_SRCS_SHARINGS ${CMAKE_CURRENT_SOURCE_DIR}/sharing_factory.inl ) +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SHARINGS}) + if(WIN32) target_include_directories(${SHARINGS_ENABLE_LIB_NAME} PUBLIC ${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows) else() target_include_directories(${SHARINGS_ENABLE_LIB_NAME} PUBLIC ${IGDRCL_SOURCE_DIR}/runtime/os_interface/linux) endif() -add_subdirectory(d3d) -add_subdirectory(va) - -set(RUNTIME_SRCS_SHARINGS ${RUNTIME_SRCS_SHARINGS} PARENT_SCOPE) +add_subdirectories() diff --git a/runtime/sharings/d3d/CMakeLists.txt b/runtime/sharings/d3d/CMakeLists.txt index 2c96262c33..e96ef69768 100644 --- a/runtime/sharings/d3d/CMakeLists.txt +++ b/runtime/sharings/d3d/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017, Intel Corporation +# Copyright (c) 2017-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"), @@ -19,17 +19,16 @@ # OTHER DEALINGS IN THE SOFTWARE. if(WIN32) - list (APPEND RUNTIME_SRCS_SHARINGS - "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" - "${CMAKE_CURRENT_SOURCE_DIR}/cl_d3d_api.h" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing.h" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_buffer.h" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_texture.h" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_texture.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_surface.h" - "${CMAKE_CURRENT_SOURCE_DIR}/d3d_surface.cpp" - ) - - set(RUNTIME_SRCS_SHARINGS "${RUNTIME_SRCS_SHARINGS}" PARENT_SCOPE) + set(RUNTIME_SRCS_SHARINGS_D3D + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/cl_d3d_api.h + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_buffer.h + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing.h + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_surface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_surface.h + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_texture.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/d3d_texture.h + ) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SHARINGS_D3D}) endif() diff --git a/runtime/sharings/va/CMakeLists.txt b/runtime/sharings/va/CMakeLists.txt index 6ac8d25a32..c84cfbcfab 100644 --- a/runtime/sharings/va/CMakeLists.txt +++ b/runtime/sharings/va/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2017, Intel Corporation +# Copyright (c) 2017-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,19 +18,18 @@ # 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) if(LIBVA_FOUND) - list (APPEND RUNTIME_SRCS_SHARINGS - ${CMAKE_CURRENT_SOURCE_DIR}/cl_va_api.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing.h - ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_defines.h - ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_functions.h - ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_functions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/va_surface.h - ${CMAKE_CURRENT_SOURCE_DIR}/va_surface.cpp - ) - - set(RUNTIME_SRCS_SHARINGS "${RUNTIME_SRCS_SHARINGS}" PARENT_SCOPE) + set(RUNTIME_SRCS_SHARINGS_VA + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/cl_va_api.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing.h + ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_defines.h + ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_functions.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_functions.h + ${CMAKE_CURRENT_SOURCE_DIR}/va_surface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/va_surface.h + ) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SHARINGS_VA}) endif(LIBVA_FOUND) diff --git a/runtime/sku_info/CMakeLists.txt b/runtime/sku_info/CMakeLists.txt index 710a8bb562..aaedc007aa 100644 --- a/runtime/sku_info/CMakeLists.txt +++ b/runtime/sku_info/CMakeLists.txt @@ -24,11 +24,15 @@ set(RUNTIME_SRCS_SKU_INFO_BASE ${CMAKE_CURRENT_SOURCE_DIR}/operations/sku_info_transfer.h ${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/sku_info.h ${CMAKE_CURRENT_SOURCE_DIR}/operations${BRANCH_DIR_SUFFIX}/sku_info_transfer.cpp - PARENT_SCOPE ) set(RUNTIME_SRCS_SKU_INFO_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/operations/sku_info_receiver.h ${CMAKE_CURRENT_SOURCE_DIR}/operations${BRANCH_DIR_SUFFIX}/sku_info_receiver.cpp - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SKU_INFO_BASE}) + +if(WIN32) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_SKU_INFO_WINDOWS}) +endif() diff --git a/runtime/tbx/CMakeLists.txt b/runtime/tbx/CMakeLists.txt index 585bc3d969..316bb91ca6 100644 --- a/runtime/tbx/CMakeLists.txt +++ b/runtime/tbx/CMakeLists.txt @@ -24,5 +24,6 @@ set(RUNTIME_SRCS_TBX ${CMAKE_CURRENT_SOURCE_DIR}/tbx_sockets.h ${CMAKE_CURRENT_SOURCE_DIR}/tbx_sockets_imp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tbx_sockets_imp.h - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_TBX}) diff --git a/runtime/utilities/CMakeLists.txt b/runtime/utilities/CMakeLists.txt index 8e384eb391..58197836cc 100644 --- a/runtime/utilities/CMakeLists.txt +++ b/runtime/utilities/CMakeLists.txt @@ -41,19 +41,23 @@ set(RUNTIME_SRCS_UTILITIES_BASE ${CMAKE_CURRENT_SOURCE_DIR}/tag_allocator_base.h ${CMAKE_CURRENT_SOURCE_DIR}/timer_util.h ${CMAKE_CURRENT_SOURCE_DIR}/vec.h - PARENT_SCOPE ) set(RUNTIME_SRCS_UTILITIES_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/windows/directory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/windows/timer_util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/windows/cpu_info.cpp - PARENT_SCOPE ) set(RUNTIME_SRCS_UTILITIES_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/linux/directory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/linux/timer_util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/linux/cpu_info.cpp - PARENT_SCOPE ) + +target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_UTILITIES_BASE}) +if(WIN32) + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_UTILITIES_WINDOWS}) +else() + target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_UTILITIES_LINUX}) +endif()