Skip to content

Commit

Permalink
volk meta-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Nefedov committed May 7, 2020
1 parent f65f7e6 commit 831b2ee
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
37 changes: 37 additions & 0 deletions recipes/volk/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from conans import ConanFile, CMake, tools


class VolkConan(ConanFile):
name = "volk"
license = "MIT"
homepage = "https://github.com/zeux/volk"
url = "https://github.com/conan-io/conan-center-index"
description = "volk is a meta-loader for Vulkan. It allows you to \
dynamically load entrypoints required to use Vulkan without linking\
to vulkan-1.dll or statically linking Vulkan loader. Additionally,\
volk simplifies the use of Vulkan extensions by automatically\
loading all associated entrypoints. Finally, volk enables\
loading Vulkan entrypoints directly from the driver which \
can increase performance by skipping loader dispatch \
overhead."
topics = ("Vulkan", "graphics")
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
no_copy_source = True

def source(self):
self.run("git clone https://github.com/zeux/volk.git")
self.run("cd volk/ && git checkout %s" % self.version)

def package(self):
self.copy("*volk.h", dst="include")
self.copy("*volk.c", dst="include")
self.copy("*LICENSE.md", dst="licenses")

def package_info(self):
if self.settings.os == "Linux":
self.cpp_info.libs.extend(["dl"])

def package_id(self):
self.info.header_only()

14 changes: 14 additions & 0 deletions recipes/volk/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.12)
project(PackageTest CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(example example.cpp)
target_link_libraries(example ${CONAN_LIBS})

# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)
20 changes: 20 additions & 0 deletions recipes/volk/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os

from conans import ConanFile, CMake, tools


class VolkTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)
16 changes: 16 additions & 0 deletions recipes/volk/all/test_package/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>
#define VOLK_IMPLEMENTATION
#include <volk/volk.h>

int main() {
/* Try to initialize volk. This might not work on CI builds,
* but should have compiled at least. */
VkResult r = volkInitialize();
uint32_t version = volkGetInstanceVersion();
printf("Vulkan version %d.%d.%d initialized.\n",
VK_VERSION_MAJOR(version),
VK_VERSION_MINOR(version),
VK_VERSION_PATCH(version)
);
}

3 changes: 3 additions & 0 deletions recipes/volk/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"ed4c168595bc7c5d36925f0036ea14d36b20c87c":
folder: all

0 comments on commit 831b2ee

Please sign in to comment.