Skip to content

Commit

Permalink
Add 'shaderc' package (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
mean-ui-thread authored and bkotzz committed Oct 31, 2019
1 parent 8fd279a commit 11085e0
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ hunter_default_version(rospack VERSION 2.5.3-p0)
hunter_default_version(s3 VERSION 0.0.0-287e4be-p1)
hunter_default_version(sds VERSION 2.0.0)
hunter_default_version(sentencepiece VERSION 0.1.8-p1)
hunter_default_version(shaderc VERSION 2019.0-p1)
hunter_default_version(shaka_player_embedded VERSION 0.1.0-beta-p1)
hunter_default_version(sleef VERSION 3.3.1-p1)
hunter_default_version(sm VERSION 1.2.3)
Expand Down
34 changes: 34 additions & 0 deletions cmake/projects/shaderc/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2016-2019, Ruslan Baratov
# Copyright (c) 2019, Mathieu-Andre Chiasson
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

include(hunter_add_version)
include(hunter_cacheable)
include(hunter_cmake_args)
include(hunter_download)
include(hunter_pick_scheme)

hunter_add_version(
PACKAGE_NAME
shaderc
VERSION
2019.0-p1
URL
"https://github.com/cpp-pm/shaderc/archive/v2019.0-p1.tar.gz"
SHA1
f48923e2d92b0ef1629eaa323918a5c58d69e3c9
)

hunter_cmake_args(
shaderc
CMAKE_ARGS
SHADERC_ENABLE_SHARED_CRT=ON # 'ON' means 'do nothing'. Hunter users should control /MD[d] vs /MT[d] via a cmake toolchain files instead.
SHADERC_ENABLE_SPVC=ON # Required for projects such as Google Dawn
SHADERC_SKIP_TESTS=ON
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(shaderc)
hunter_download(PACKAGE_NAME shaderc)
22 changes: 22 additions & 0 deletions docs/packages/pkg/shaderc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. spelling::

shaderc

.. index::
single: compiler ; shaderc
single: graphics ; shaderc

.. _pkg.shaderc:

shaderc
=======

- `Official <https://github.com/google/shaderc>`__
- `Hunterized <https://github.com/cpp-pm/shaderc>`__
- `Example <https://github.com/cpp-pm/hunter/blob/master/examples/shaderc/CMakeLists.txt>`__
- Added by `Mathieu-Andre Chiasson <https://github.com/mchiasson>`__ (`pr-N <https://github.com/ruslo/hunter/pull/N>`__)

.. literalinclude:: /../examples/shaderc/CMakeLists.txt
:language: cmake
:start-after: # DOCUMENTATION_START {
:end-before: # DOCUMENTATION_END }
18 changes: 18 additions & 0 deletions examples/shaderc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2016-2019, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.2)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-shaderc)

# DOCUMENTATION_START {
hunter_add_package(shaderc)
find_package(shaderc CONFIG REQUIRED)

add_executable(boo boo.cpp)
target_link_libraries(boo PUBLIC shaderc::shaderc)
# DOCUMENTATION_END }
9 changes: 9 additions & 0 deletions examples/shaderc/boo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <shaderc/shaderc.hpp>
#include <cstring>

int main() {
shaderc::Compiler compiler;
const char* test_program = "void main() {}";
shaderc::SpvCompilationResult res = compiler.CompileGlslToSpv(test_program, strlen(test_program), shaderc_glsl_vertex_shader, "shader");
return res.GetCompilationStatus();
}

0 comments on commit 11085e0

Please sign in to comment.