diff options
author | Jose Quaresma <quaresma.jose@gmail.com> | 2021-02-13 00:59:22 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-13 17:01:13 +0000 |
commit | 49c0f7deec96c1cefcd3b59cfc7cbba460318865 (patch) | |
tree | b0234b971f009bd16e6775e6ea7b6e543f44cb2b /meta/recipes-graphics | |
parent | a93bb94d7451e36c736aed04f9094f707ca3347d (diff) | |
download | poky-49c0f7deec96c1cefcd3b59cfc7cbba460318865.tar.gz |
shaderc: remove the receipe configure hack and use a patch for that
[Yocto #14226]
[RP: Small patch filename fixup to allow to build]
(From OE-Core rev: 1de7a3fe68080759c5fc52c8bfe7dcf4a860a2ac)
Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics')
5 files changed, 189 insertions, 63 deletions
diff --git a/meta/recipes-graphics/shaderc/files/0001-cmake-de-vendor-libs-and-disable-git-versioning.patch b/meta/recipes-graphics/shaderc/files/0001-cmake-de-vendor-libs-and-disable-git-versioning.patch deleted file mode 100644 index 40cc84df26..0000000000 --- a/meta/recipes-graphics/shaderc/files/0001-cmake-de-vendor-libs-and-disable-git-versioning.patch +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | From a07ac322a5a5fd4f0339913eb4456321ad1a69fd Mon Sep 17 00:00:00 2001 | ||
2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
3 | Date: Sat, 17 Oct 2020 12:51:50 +0100 | ||
4 | Subject: [PATCH] cmake: de-vendor libs and disable git versioning | ||
5 | |||
6 | Upstream-Status: Inappropriate [configuration] | ||
7 | |||
8 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
9 | |||
10 | --- | ||
11 | CMakeLists.txt | 2 -- | ||
12 | glslc/CMakeLists.txt | 1 - | ||
13 | glslc/src/build-version.inc | 0 | ||
14 | 3 files changed, 3 deletions(-) | ||
15 | create mode 100644 glslc/src/build-version.inc | ||
16 | |||
17 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
18 | index 5c74cd8..9451fbc 100644 | ||
19 | --- a/CMakeLists.txt | ||
20 | +++ b/CMakeLists.txt | ||
21 | @@ -102,12 +102,10 @@ endif(MSVC) | ||
22 | |||
23 | # Configure subdirectories. | ||
24 | # We depend on these for later projects, so they should come first. | ||
25 | -add_subdirectory(third_party) | ||
26 | |||
27 | add_subdirectory(libshaderc_util) | ||
28 | add_subdirectory(libshaderc) | ||
29 | add_subdirectory(glslc) | ||
30 | -add_subdirectory(examples) | ||
31 | |||
32 | add_custom_target(build-version | ||
33 | ${PYTHON_EXECUTABLE} | ||
34 | diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt | ||
35 | index 31664d1..358d91b 100644 | ||
36 | --- a/glslc/CMakeLists.txt | ||
37 | +++ b/glslc/CMakeLists.txt | ||
38 | @@ -53,7 +53,6 @@ shaderc_default_compile_options(glslc_exe) | ||
39 | target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) | ||
40 | set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) | ||
41 | target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) | ||
42 | -add_dependencies(glslc_exe build-version) | ||
43 | |||
44 | shaderc_add_tests( | ||
45 | TEST_PREFIX glslc | ||
46 | diff --git a/glslc/src/build-version.inc b/glslc/src/build-version.inc | ||
47 | new file mode 100644 | ||
48 | index 0000000..e69de29 | ||
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 | |||
diff --git a/meta/recipes-graphics/shaderc/files/0002-libshaderc_util-fix-glslang-header-file-location.patch b/meta/recipes-graphics/shaderc/files/0002-libshaderc_util-fix-glslang-header-file-location.patch new file mode 100644 index 0000000000..df670cdded --- /dev/null +++ b/meta/recipes-graphics/shaderc/files/0002-libshaderc_util-fix-glslang-header-file-location.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From 046c3c2da9c4ff66f14db5bd68e9557504a49241 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 2/3] libshaderc_util: fix glslang header file location | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
9 | --- | ||
10 | libshaderc_util/src/compiler.cc | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc | ||
14 | index c5ce37e..4703634 100644 | ||
15 | --- a/libshaderc_util/src/compiler.cc | ||
16 | +++ b/libshaderc_util/src/compiler.cc | ||
17 | @@ -20,7 +20,7 @@ | ||
18 | #include <thread> | ||
19 | #include <tuple> | ||
20 | |||
21 | -#include "SPIRV/GlslangToSpv.h" | ||
22 | +#include "glslang/SPIRV/GlslangToSpv.h" | ||
23 | #include "libshaderc_util/format.h" | ||
24 | #include "libshaderc_util/io.h" | ||
25 | #include "libshaderc_util/message.h" | ||
26 | -- | ||
27 | 2.30.1 | ||
28 | |||
diff --git a/meta/recipes-graphics/shaderc/files/0003-cmake-add-option-to-skip-build-the-examples.patch b/meta/recipes-graphics/shaderc/files/0003-cmake-add-option-to-skip-build-the-examples.patch new file mode 100644 index 0000000000..43f9edc031 --- /dev/null +++ b/meta/recipes-graphics/shaderc/files/0003-cmake-add-option-to-skip-build-the-examples.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From f1064e4b6cfc5955bc7e2b036f2d05540da9f09b 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 3/3] cmake: add option to skip build the examples | ||
5 | |||
6 | Upstream-Status: Backport [https://github.com/google/shaderc/commit/8d081127ee28ff5df8123c994c00bc66a57e9e9c] | ||
7 | |||
8 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
9 | --- | ||
10 | CMakeLists.txt | 14 +++++++++++++- | ||
11 | 1 file changed, 13 insertions(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
14 | index b358f6b..d8a5405 100644 | ||
15 | --- a/CMakeLists.txt | ||
16 | +++ b/CMakeLists.txt | ||
17 | @@ -40,6 +40,16 @@ else() | ||
18 | message(STATUS "Configuring Shaderc to avoid building tests.") | ||
19 | endif() | ||
20 | |||
21 | +option(SHADERC_SKIP_EXAMPLES "Skip building examples" ${SHADERC_SKIP_EXAMPLES}) | ||
22 | +if(NOT ${SHADERC_SKIP_EXAMPLES}) | ||
23 | + set(SHADERC_ENABLE_EXAMPLES ON) | ||
24 | +endif() | ||
25 | +if(${SHADERC_ENABLE_EXAMPLES}) | ||
26 | + message(STATUS "Configuring Shaderc to build examples.") | ||
27 | +else() | ||
28 | + message(STATUS "Configuring Shaderc to avoid building examples.") | ||
29 | +endif() | ||
30 | + | ||
31 | option(SHADERC_ENABLE_WERROR_COMPILE "Enable passing -Werror to compiler, if available" ON) | ||
32 | option(BUILD_EXTERNAL "Build external dependencies in /third_party" ON) | ||
33 | |||
34 | @@ -114,7 +124,9 @@ endif() | ||
35 | add_subdirectory(libshaderc_util) | ||
36 | add_subdirectory(libshaderc) | ||
37 | add_subdirectory(glslc) | ||
38 | -add_subdirectory(examples) | ||
39 | +if(${SHADERC_ENABLE_EXAMPLES}) | ||
40 | + add_subdirectory(examples) | ||
41 | +endif() | ||
42 | |||
43 | add_custom_target(build-version | ||
44 | ${PYTHON_EXECUTABLE} | ||
45 | -- | ||
46 | 2.30.1 | ||
47 | |||
diff --git a/meta/recipes-graphics/shaderc/shaderc_2020.4.bb b/meta/recipes-graphics/shaderc/shaderc_2020.4.bb index e966ed3d77..73aa0ee969 100644 --- a/meta/recipes-graphics/shaderc/shaderc_2020.4.bb +++ b/meta/recipes-graphics/shaderc/shaderc_2020.4.bb | |||
@@ -8,7 +8,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" | |||
8 | 8 | ||
9 | SRCREV = "0dbd899941a43ffd55df527d65128b3b66e75c9c" | 9 | SRCREV = "0dbd899941a43ffd55df527d65128b3b66e75c9c" |
10 | SRC_URI = "git://github.com/google/shaderc.git;protocol=https;branch=main \ | 10 | SRC_URI = "git://github.com/google/shaderc.git;protocol=https;branch=main \ |
11 | file://0001-cmake-de-vendor-libs-and-disable-git-versioning.patch \ | 11 | file://0001-cmake-disable-building-external-dependencies.patch \ |
12 | file://0002-libshaderc_util-fix-glslang-header-file-location.patch \ | ||
13 | file://0003-cmake-add-option-to-skip-build-the-examples.patch \ | ||
12 | " | 14 | " |
13 | UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>\d+(\.\d+)+)$" | 15 | UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>\d+(\.\d+)+)$" |
14 | S = "${WORKDIR}/git" | 16 | S = "${WORKDIR}/git" |
@@ -19,21 +21,9 @@ DEPENDS = "spirv-headers spirv-tools glslang" | |||
19 | 21 | ||
20 | EXTRA_OECMAKE = " \ | 22 | EXTRA_OECMAKE = " \ |
21 | -DCMAKE_BUILD_TYPE=Release \ | 23 | -DCMAKE_BUILD_TYPE=Release \ |
24 | -DBUILD_EXTERNAL=OFF \ | ||
22 | -DSHADERC_SKIP_TESTS=ON \ | 25 | -DSHADERC_SKIP_TESTS=ON \ |
23 | -Dglslang_SOURCE_DIR=${STAGING_INCDIR}/glslang \ | 26 | -DSHADERC_SKIP_EXAMPLES=ON \ |
24 | " | 27 | " |
25 | 28 | ||
26 | BBCLASSEXTEND = "native nativesdk" | 29 | BBCLASSEXTEND = "native nativesdk" |
27 | |||
28 | # TODO: probably there is better solution for this. | ||
29 | # I don't know any method for get the version of a receipe in DEPENDS, | ||
30 | # so do this ugly hack | ||
31 | inherit pkgconfig | ||
32 | DEPENDS += "glslang-native" | ||
33 | do_configure_prepend() { | ||
34 | cat <<- EOF > ${S}/glslc/src/build-version.inc | ||
35 | "${PV}\\n" | ||
36 | "$(pkg-config --modversion SPIRV-Tools)\\n" | ||
37 | "$(glslangValidator --version | head -1 | cut -d' ' -f3)\\n" | ||
38 | EOF | ||
39 | } | ||