This repository was archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconanfile.py
59 lines (47 loc) · 2.25 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
import os
from conans import ConanFile, tools
class VulkanConan(ConanFile):
name = 'vulkan'
version = '1.1.101.0'
description = 'The Vulkan SDK provides the development and runtime components required to build, run, and debug Vulkan applications.'
url = 'https://github.com/birsoyo/conan-vulkan'
homepage = 'https://vulkan.lunarg.com/sdk/home'
author = 'Orhun Birsoy <orhunbirsoy@gmail.com>'
license = 'Various'
# Packages the license for the conanfile.py
exports = ['LICENSE.md']
settings = 'os', 'arch'
# Custom attributes for Bincrafters recipe conventions
source_subfolder = 'source_subfolder'
build_subfolder = 'build_subfolder'
def build(self):
prefix_url = f'https://sdk.lunarg.com/sdk/download/{self.version}'
win_url = f'{prefix_url}/windows/VulkanSDK-{self.version}-Installer.exe'
mac_url = f'{prefix_url}/mac/vulkansdk-macos-{self.version}.tar.gz'
lin_url = f'{prefix_url}/linux/vulkansdk-linux-x86_64-{self.version}.tar.gz'
if self.settings.os == 'Windows':
tools.download(win_url, 'vulkan-installer.exe')
self.run(f'7z x -snl -y -mmt{tools.cpu_count()} -osdk vulkan-installer.exe')
else:
if self.settings.os == 'Linux':
url = lin_url
elif self.settings.os == 'Macos':
url = mac_url
tools.get(url, keep_permissions=True)
def package(self):
self.copy(pattern='LICENSE', dst='licenses', src=self.source_subfolder)
if self.settings.os == 'Windows':
location = f'sdk'
inc_folder = os.path.join(location, 'Include')
if self.settings.arch == 'x86':
bin_folder = os.path.join(location, 'Bin32')
lib_folder = os.path.join(location, 'Lib32')
elif self.settings.arch == 'x86_64':
bin_folder = os.path.join(location, 'Bin')
lib_folder = os.path.join(location, 'Lib')
self.copy(pattern='*.exe', dst='bin', src=bin_folder, excludes='*cube*')
self.copy(pattern='*', dst='include', src=inc_folder)
self.copy(pattern='*', dst='lib', src=lib_folder)
def package_info(self):
self.cpp_info.libs = ['vulkan-1']