summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/vulkan
diff options
context:
space:
mode:
authorJussi Kukkonen <jussi.kukkonen@intel.com>2017-03-08 15:21:52 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-10 14:50:10 +0000
commit3835f04fc35228178fdac5d4f7c8a72b9568c330 (patch)
tree017146c7cfab02eaa626cafdc94a072a07871102 /meta/recipes-graphics/vulkan
parentc09a6bd8e26ed1e1bbfdf8e711cd3ed1e58ceaee (diff)
downloadpoky-3835f04fc35228178fdac5d4f7c8a72b9568c330.tar.gz
vulkan: Add recipe for Vulkan common loader
Add a recipe for vulkan loader library and the vulkaninfo binary. Vulkan can be built to support X11 or wayland or both. There is currently no support for building tests, validation layers or even the demos as that would require a bunch of otherwise unnecessary dependencies. Fix the build on musl by defaulting to getenv() if secure_getenv() is not available. (From OE-Core rev: ce0acee244cdae287fa0d3b048d371627a69a030) Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/vulkan')
-rw-r--r--meta/recipes-graphics/vulkan/vulkan/0001-Use-getenv-if-secure_getenv-does-not-exist.patch34
-rw-r--r--meta/recipes-graphics/vulkan/vulkan/demos-Don-t-build-tri-or-cube.patch106
-rw-r--r--meta/recipes-graphics/vulkan/vulkan_1.0.39.1.bb34
3 files changed, 174 insertions, 0 deletions
diff --git a/meta/recipes-graphics/vulkan/vulkan/0001-Use-getenv-if-secure_getenv-does-not-exist.patch b/meta/recipes-graphics/vulkan/vulkan/0001-Use-getenv-if-secure_getenv-does-not-exist.patch
new file mode 100644
index 0000000000..694922cd1c
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan/0001-Use-getenv-if-secure_getenv-does-not-exist.patch
@@ -0,0 +1,34 @@
1From 20525add1df8e1fb13fef90ac068f982def8b958 Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Wed, 8 Mar 2017 13:23:58 +0200
4Subject: [PATCH] Use getenv() if secure_getenv() does not exist
5
6musl does not implement secure version: default to getenv() in that
7case.
8
9https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/1538
10
11Upstream-Status: Pending
12Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
13---
14 loader/loader.c | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/loader/loader.c b/loader/loader.c
18index 24758f4..bff79c1 100644
19--- a/loader/loader.c
20+++ b/loader/loader.c
21@@ -54,6 +54,10 @@
22 #endif
23 #endif
24
25+#if !defined(__secure_getenv)
26+#define __secure_getenv getenv
27+#endif
28+
29 struct loader_struct loader = {0};
30 // TLS for instance for alloc/free callbacks
31 THREAD_LOCAL_DECL struct loader_instance *tls_instance;
32--
332.1.4
34
diff --git a/meta/recipes-graphics/vulkan/vulkan/demos-Don-t-build-tri-or-cube.patch b/meta/recipes-graphics/vulkan/vulkan/demos-Don-t-build-tri-or-cube.patch
new file mode 100644
index 0000000000..3cf241d62a
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan/demos-Don-t-build-tri-or-cube.patch
@@ -0,0 +1,106 @@
1commit f63cbe944107b5cd8f150ceaaec43b26099d5688
2Author: Adam Jackson <ajax@redhat.com>
3Date: Tue Feb 16 10:05:25 2016 -0500
4
5 demos: Don't build tri or cube
6
7 There are more interesting demos, all we really want here is vulkaninfo.
8 This helps because we don't need to pre-build glslang/llvm/lunarglass
9 just to get the loader and layers.
10
11Upstream-Status: Inappropriate [configuration]
12Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
13
14--- a/demos/CMakeLists.txt
15+++ b/demos/CMakeLists.txt
16@@ -61,46 +61,6 @@
17 else()
18 endif()
19
20-if(WIN32)
21- # For Windows, since 32-bit and 64-bit items can co-exist, we build each in its own build directory.
22- # 32-bit target data goes in build32, and 64-bit target data goes into build. So, include/link the
23- # appropriate data at build time.
24- if (CMAKE_CL_64)
25- set (BUILDTGT_DIR build)
26- else ()
27- set (BUILDTGT_DIR build32)
28- endif()
29-
30- # Use static MSVCRT libraries
31- foreach(configuration in CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
32- CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO)
33- if(${configuration} MATCHES "/MD")
34- string(REGEX REPLACE "/MD" "/MT" ${configuration} "${${configuration}}")
35- endif()
36- endforeach()
37-
38- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-vert.spv
39- COMMAND ${GLSLANG_VALIDATOR} -s -V -o ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${PROJECT_SOURCE_DIR}/demos/cube.vert
40- DEPENDS cube.vert ${GLSLANG_VALIDATOR}
41- )
42- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-frag.spv
43- COMMAND ${GLSLANG_VALIDATOR} -s -V -o ${CMAKE_BINARY_DIR}/demos/cube-frag.spv ${PROJECT_SOURCE_DIR}/demos/cube.frag
44- DEPENDS cube.frag ${GLSLANG_VALIDATOR}
45- )
46- file(COPY cube.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos)
47- file(COPY vulkaninfo.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos)
48-else()
49- if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
50- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-vert.spv
51- COMMAND ${GLSLANG_VALIDATOR} -s -V -o cube-vert.spv ${PROJECT_SOURCE_DIR}/demos/cube.vert
52- DEPENDS cube.vert ${GLSLANG_VALIDATOR}
53- )
54- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-frag.spv
55- COMMAND ${GLSLANG_VALIDATOR} -s -V -o cube-frag.spv ${PROJECT_SOURCE_DIR}/demos/cube.frag
56- DEPENDS cube.frag ${GLSLANG_VALIDATOR}
57- )
58- endif()
59-endif()
60
61 if(WIN32)
62 include_directories (
63@@ -114,43 +74,6 @@
64 add_executable(${API_LOWERCASE}info vulkaninfo.c)
65 target_link_libraries(${API_LOWERCASE}info ${LIBRARIES})
66
67-if(NOT WIN32)
68- if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
69- add_executable(cube cube.c ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${CMAKE_BINARY_DIR}/demos/cube-frag.spv)
70- target_link_libraries(cube ${LIBRARIES})
71- endif()
72-else()
73- if (CMAKE_CL_64)
74- set (LIB_DIR "Win64")
75- else()
76- set (LIB_DIR "Win32")
77- endif()
78-
79- add_executable(cube WIN32 cube.c ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${CMAKE_BINARY_DIR}/demos/cube-frag.spv)
80- target_link_libraries(cube ${LIBRARIES})
81-endif()
82-
83-if(NOT WIN32)
84- if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
85- add_executable(cubepp cube.cpp ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${CMAKE_BINARY_DIR}/demos/cube-frag.spv)
86- target_link_libraries(cubepp ${LIBRARIES})
87- endif()
88-else()
89- if (CMAKE_CL_64)
90- set (LIB_DIR "Win64")
91- else()
92- set (LIB_DIR "Win32")
93- endif()
94-
95- add_executable(cubepp WIN32 cube.cpp ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${CMAKE_BINARY_DIR}/demos/cube-frag.spv)
96- target_link_libraries(cubepp ${LIBRARIES})
97-endif()
98-
99-if ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}))
100- if ((DEMOS_WSI_SELECTION STREQUAL "XCB") OR (DEMOS_WSI_SELECTION STREQUAL "WAYLAND") OR WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Android"))
101- add_subdirectory(smoke)
102- endif()
103-endif()
104
105 if(UNIX)
106 install(TARGETS ${API_LOWERCASE}info DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/meta/recipes-graphics/vulkan/vulkan_1.0.39.1.bb b/meta/recipes-graphics/vulkan/vulkan_1.0.39.1.bb
new file mode 100644
index 0000000000..45d1c493e2
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan_1.0.39.1.bb
@@ -0,0 +1,34 @@
1SUMMARY = "3D graphics and compute API common loader"
2DESCRIPTION = "Vulkan is a new generation graphics and compute API \
3that provides efficient access to modern GPUs. These packages \
4provide only the common vendor-agnostic library loader, headers and \
5the vulkaninfo utility."
6HOMEPAGE = "https://www.khronos.org/vulkan/"
7BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers"
8SECTION = "libs"
9
10LICENSE = "Apache-2.0"
11LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=99c647ca3d4f6a4b9d8628f757aad156 \
12 file://loader/loader.c;endline=25;md5=a87cd5442291c23d1fce4eece4cfde9d"
13SRC_URI = "git://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers.git;branch=sdk-1.0.39 \
14 file://demos-Don-t-build-tri-or-cube.patch \
15 file://0001-Use-getenv-if-secure_getenv-does-not-exist.patch \
16"
17SRCREV = "9c21ed0fb275589c3af6118aec9ef4f1d1544dc1"
18
19S = "${WORKDIR}/git"
20
21
22inherit cmake python3native lib_package distro_features_check
23ANY_OF_DISTRO_FEATURES = "x11 wayland"
24
25EXTRA_OECMAKE = "-DBUILD_WSI_MIR_SUPPORT=OFF \
26 -DBUILD_LAYERS=OFF \
27 -DBUILD_TESTS=OFF"
28
29# must choose x11 or wayland or both
30PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '' ,d)} \
31 ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '' ,d)}"
32PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON -DDEMOS_WSI_SELECTION=XCB, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF -DDEMOS_WSI_SELECTION=WAYLAND, libxcb libx11 libxrandr"
33PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland"
34