55a7d22beb
Bug: skia:8081 Change-Id: I8b2a88cc25970398511aa078d456ca8a1182792b Reviewed-on: https://skia-review.googlesource.com/136594 Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
49 lines
1.2 KiB
Python
Executable File
49 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# Copyright 2018 Google Inc.
|
|
#
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
|
|
"""Create the asset."""
|
|
|
|
|
|
import argparse
|
|
import common
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import utils
|
|
|
|
# The OpenCL C headers are available at
|
|
# https://github.com/KhronosGroup/OpenCL-Headers, but the C++ header cl.hpp
|
|
# would need to be generated from https://github.com/KhronosGroup/OpenCL-CLHPP.
|
|
# Instead, we just grab the pre-built headers from the Debian packages.
|
|
PKGS = [
|
|
'opencl-c-headers',
|
|
'opencl-clhpp-headers',
|
|
]
|
|
|
|
def create_asset(target_dir):
|
|
"""Create the asset."""
|
|
with utils.tmp_dir():
|
|
# Download required Debian packages.
|
|
subprocess.check_call(['apt-get', 'download'] + PKGS)
|
|
# Extract to CWD.
|
|
for f in os.listdir('.'):
|
|
subprocess.check_call(['dpkg-deb', '--extract', f, '.'])
|
|
# Copy usr/include/CL to target_dir.
|
|
shutil.move(os.path.join(os.getcwd(), 'usr', 'include', 'CL'), target_dir)
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('--target_dir', '-t', required=True)
|
|
args = parser.parse_args()
|
|
create_asset(args.target_dir)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|