xref: /aosp_15_r20/external/intel-media-driver/media_driver/linux/ult/CMakeLists.txt (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1# Copyright (c) 2018, 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.
20cmake_minimum_required(VERSION 3.1)
21
22if ("${BUILD_TYPE}" STREQUAL "debug")
23    set(CMAKE_BUILD_TYPE "Debug")
24    add_definitions(-D_DEBUG)
25elseif ("${BUILD_TYPE}" STREQUAL "release-internal")
26    set(CMAKE_BUILD_TYPE "ReleaseInternal")
27    add_definitions(-D_RELEASE_INTERNAL)
28else ()
29    if (NOT "${BUILD_TYPE}" STREQUAL "release")
30        message("-- devult -- No valid build type specified, set to release as default")
31    endif ()
32    set(CMAKE_BUILD_TYPE "Release")
33    add_definitions(-D_RELEASE)
34endif ()
35
36#-fno-plt is a GCC option to disable the use of PLT for external function calls in position-independent code.
37#This option is by default enabled on some Linux distributions such as Arch Linux, which can cause link error.
38string(REPLACE "-fno-plt" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
39
40if (NOT "${LIBVA_INSTALL_PATH}" STREQUAL "")
41    include_directories(BEFORE ${LIBVA_INSTALL_PATH})
42elseif (DEFINED ENV{LIBVA_INSTALL_PATH} AND NOT "$ENV{LIBVA_INSTALL_PATH}" STREQUAL "")
43    include_directories(BEFORE $ENV{LIBVA_INSTALL_PATH})
44else ()
45    include(FindPkgConfig)
46    pkg_check_modules(LIBVA REQUIRED libva>=1.8.0)
47    if (LIBVA_FOUND)
48        include_directories(BEFORE ${LIBVA_INCLUDE_DIRS})
49    endif ()
50endif ()
51
52add_subdirectory(libdrm_mock)
53add_subdirectory(ult_app)
54
55enable_testing()
56add_test(NAME test_devult COMMAND devult ${UMD_PATH})
57set_tests_properties(test_devult
58    PROPERTIES PASS_REGULAR_EXPRESSION "PASS")
59set_tests_properties(test_devult
60    PROPERTIES FAIL_REGULAR_EXPRESSION "FAIL")
61