diff options
Diffstat (limited to 'meta/recipes-graphics/shaderc/files/0001-cmake-disable-building-external-dependencies.patch')
-rw-r--r-- | meta/recipes-graphics/shaderc/files/0001-cmake-disable-building-external-dependencies.patch | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/meta/recipes-graphics/shaderc/files/0001-cmake-disable-building-external-dependencies.patch b/meta/recipes-graphics/shaderc/files/0001-cmake-disable-building-external-dependencies.patch new file mode 100644 index 0000000000..cc9a400028 --- /dev/null +++ b/meta/recipes-graphics/shaderc/files/0001-cmake-disable-building-external-dependencies.patch | |||
@@ -0,0 +1,109 @@ | |||
1 | From 071a9d71bea91bbefcf15e061fc87e53568f3188 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
3 | Date: Sat, 13 Feb 2021 00:45:56 +0000 | ||
4 | Subject: [PATCH 1/3] cmake: disable building external dependencies | ||
5 | |||
6 | - add cmake option to disable the build of the third_party dependencies | ||
7 | - change the update_build_version.py to use pkg-config when third_party dependencies not found | ||
8 | |||
9 | Upstream-Status: Inappropriate [OE-core specific] | ||
10 | |||
11 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
12 | --- | ||
13 | CMakeLists.txt | 13 ++++++++++--- | ||
14 | utils/update_build_version.py | 22 +++++++++++++++------- | ||
15 | 2 files changed, 25 insertions(+), 10 deletions(-) | ||
16 | |||
17 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
18 | index 5c74cd8..b358f6b 100644 | ||
19 | --- a/CMakeLists.txt | ||
20 | +++ b/CMakeLists.txt | ||
21 | @@ -41,6 +41,7 @@ else() | ||
22 | endif() | ||
23 | |||
24 | option(SHADERC_ENABLE_WERROR_COMPILE "Enable passing -Werror to compiler, if available" ON) | ||
25 | +option(BUILD_EXTERNAL "Build external dependencies in /third_party" ON) | ||
26 | |||
27 | set (CMAKE_CXX_STANDARD 11) | ||
28 | |||
29 | @@ -101,8 +102,14 @@ endif(MSVC) | ||
30 | |||
31 | |||
32 | # Configure subdirectories. | ||
33 | -# We depend on these for later projects, so they should come first. | ||
34 | -add_subdirectory(third_party) | ||
35 | +if(BUILD_EXTERNAL) | ||
36 | + # We depend on these for later projects, so they should come first. | ||
37 | + add_subdirectory(third_party) | ||
38 | +else() | ||
39 | + find_package(PkgConfig REQUIRED) | ||
40 | + pkg_check_modules (PKG_CHECK REQUIRED SPIRV-Tools) | ||
41 | + pkg_check_modules (PKG_CHECK REQUIRED glslang) | ||
42 | +endif() | ||
43 | |||
44 | add_subdirectory(libshaderc_util) | ||
45 | add_subdirectory(libshaderc) | ||
46 | @@ -112,7 +119,7 @@ add_subdirectory(examples) | ||
47 | add_custom_target(build-version | ||
48 | ${PYTHON_EXECUTABLE} | ||
49 | ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py | ||
50 | - ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc | ||
51 | + ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} | ||
52 | COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") | ||
53 | |||
54 | function(define_pkg_config_file NAME LIBS) | ||
55 | diff --git a/utils/update_build_version.py b/utils/update_build_version.py | ||
56 | index 5785390..f72b762 100755 | ||
57 | --- a/utils/update_build_version.py | ||
58 | +++ b/utils/update_build_version.py | ||
59 | @@ -30,6 +30,7 @@ import re | ||
60 | import subprocess | ||
61 | import sys | ||
62 | import time | ||
63 | +import itertools | ||
64 | |||
65 | def mkdir_p(directory): | ||
66 | """Make the directory, and all its ancestors as required. Any of the | ||
67 | @@ -121,25 +122,32 @@ def get_version_string(project, directory): | ||
68 | directory, which consists of software version string and git description | ||
69 | string.""" | ||
70 | detailed_version_string_lst = [project] | ||
71 | - if project != 'glslang': | ||
72 | - detailed_version_string_lst.append(deduce_software_version(directory)) | ||
73 | - detailed_version_string_lst.append(describe(directory).replace('"', '\\"')) | ||
74 | + if isinstance(directory, str) and os.path.isdir(directory): | ||
75 | + if project != 'glslang': | ||
76 | + detailed_version_string_lst.append(deduce_software_version(directory)) | ||
77 | + detailed_version_string_lst.append(describe(directory).replace('"', '\\"')) | ||
78 | + else: | ||
79 | + if project == 'spirv-tools': | ||
80 | + project = 'SPIRV-Tools' | ||
81 | + pkgconfig = ['pkg-config', '--modversion', project] | ||
82 | + version = subprocess.run(pkgconfig, capture_output=True, text=True).stdout.rstrip() | ||
83 | + detailed_version_string_lst.append(version) | ||
84 | return ' '.join(detailed_version_string_lst) | ||
85 | |||
86 | |||
87 | def main(): | ||
88 | - if len(sys.argv) != 5: | ||
89 | - print(('usage: {} <shaderc-dir> <spirv-tools-dir> <glslang-dir> <output-file>'.format( | ||
90 | + if len(sys.argv) < 3: | ||
91 | + print(('usage: {} <output-file> <shaderc-dir> [spirv-tools-dir] [glslang-dir]'.format( | ||
92 | sys.argv[0]))) | ||
93 | sys.exit(1) | ||
94 | |||
95 | projects = ['shaderc', 'spirv-tools', 'glslang'] | ||
96 | new_content = ''.join([ | ||
97 | '"{}\\n"\n'.format(get_version_string(p, d)) | ||
98 | - for (p, d) in zip(projects, sys.argv[1:]) | ||
99 | + for (p, d) in itertools.zip_longest(projects, sys.argv[2:]) | ||
100 | ]) | ||
101 | |||
102 | - output_file = sys.argv[4] | ||
103 | + output_file = sys.argv[1] | ||
104 | mkdir_p(os.path.dirname(output_file)) | ||
105 | |||
106 | if os.path.isfile(output_file): | ||
107 | -- | ||
108 | 2.30.1 | ||
109 | |||