Debian Codegraph @

media_driver/CMakeLists.txt

raw
1 # Copyright (c) 2017, Intel Corporation
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
9 #
10 # The above copyright notice and this permission notice shall be included
11 # in all copies or substantial portions of the Software.
12 #
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
17 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19 # OTHER DEALINGS IN THE SOFTWARE.
20
21
22 cmake_minimum_required(VERSION 3.5)
23
24 if(NOT DEFINED BS_USE_OSDM_BUILD_SYSTEM)
25 if(DEFINED ENV{BS_USE_OSDM_BUILD_SYSTEM})
26 set(BS_USE_OSDM_BUILD_SYSTEM "$ENV{BS_USE_OSDM_BUILD_SYSTEM}")
27 else()
28 set(BS_USE_OSDM_BUILD_SYSTEM FALSE)
29 endif()
30 endif()
31
32 # begin -- label bldsys file prologue
33 # WARNING: The "project" statement triggers reading of CMAKE_TOOLCHAIN_FILE
34 # and so must precede the inclusion below of bs_init.cmake .
35 function(bs_find_build_system gfx_dev_dir build_sys_dir build_sys_inc)
36 # If we are not building as a standalone project
37 if(DEFINED GFX_DEVELOPMENT_DIR)
38 set(_bs_gfx_development_dir "${GFX_DEVELOPMENT_DIR}")
39 elseif(DEFINED ENV{GFX_DEVELOPMENT_DIR})
40 set(_bs_gfx_development_dir "$ENV{GFX_DEVELOPMENT_DIR}")
41 else()
42 get_filename_component(_bs_cur_cmake_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
43 get_filename_component(_bs_parent_dir "${_bs_cur_cmake_dir}" DIRECTORY)
44 set(_bs_gfx_dir_found false)
45 while(NOT _bs_gfx_dir_found)
46 set(_bs_bldsys_dir "${_bs_parent_dir}/Tools/bldsys")
47 if(EXISTS ${_bs_bldsys_dir})
48 set(_bs_gfx_development_dir ${_bs_parent_dir})
49 set(_bs_gfx_dir_found true)
50 break()
51 endif()
52 get_filename_component(_bs_parent_dir "${_bs_parent_dir}" DIRECTORY)
53 if(${_bs_parent_dir} STREQUAL "/")
54 break()
55 endif()
56 endwhile(NOT _bs_gfx_dir_found)
57 if (NOT _bs_gfx_development_dir)
58 message(FATAL_ERROR "GFX_DEVELOPMENT_DIR not found (${_bs_gfx_development_dir}) - exiting!")
59 exit(1)
60 endif()
61 endif()
62 set(${gfx_dev_dir} "${_bs_gfx_development_dir}" PARENT_SCOPE)
63 set(${build_sys_dir} "${_bs_gfx_development_dir}/Tools/bldsys" PARENT_SCOPE)
64 set(${build_sys_inc} "${_bs_gfx_development_dir}/Tools/bldsys/include" PARENT_SCOPE)
65 endfunction(bs_find_build_system)
66
67 bs_find_build_system(GFX_DEVELOPMENT_DIR BUILD_SYS_DIR BUILD_SYS_INC)
68
69 include(${BUILD_SYS_DIR}/bs_init.cmake)
70 # end -- label bldsys file prologue
71
72 if(NOT BUILD_KERNELS)
73 # We regenerate shaders (kernels) and store them in-source.
74 set(CMAKE_DISABLE_SOURCE_CHANGES ON)
75 endif()
76 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
77
78 if ("${BUILD_TYPE}" STREQUAL "release")
79 set(CMAKE_BUILD_TYPE "Release")
80 elseif ("${BUILD_TYPE}" STREQUAL "release-internal")
81 set(CMAKE_BUILD_TYPE "ReleaseInternal")
82 elseif ("${BUILD_TYPE}" STREQUAL "debug")
83 set(CMAKE_BUILD_TYPE "Debug")
84 endif()
85
86 include(${BS_DIR_MEDIA}/media_driver/cmake/media_defs.cmake)
87
88 include(${MEDIA_DRIVER_CMAKE}/media_utils.cmake)
89
90 find_file(EXT_CONF NAMES media_top_cmake_ext.cmake PATHS ${CMAKE_CURRENT_LIST_DIR})
91
92 if(EXT_CONF)
93 include(${CMAKE_CURRENT_LIST_DIR}/media_top_cmake_ext.cmake)
94 else()
95 include(${CMAKE_CURRENT_LIST_DIR}/media_top_cmake.cmake)
96 endif()