From 0af5dc2a8a1443dc22afe926a90e19f00724bb12 Mon Sep 17 00:00:00 2001 From: Frank Henigman Date: Mon, 28 Jan 2019 20:37:23 -0500 Subject: [PATCH 1/3] WIP Fix install. A couple header files were not being installed. Fixes #551. --- libshaderc/include/shaderc/shaderc.h | 4 ++-- libshaderc_spvc/include/shaderc/spvc.h | 4 ++-- libshaderc_util/CMakeLists.txt | 7 +++++++ .../include/{libshaderc_util => shaderc}/common.h | 0 .../include/{libshaderc_util => shaderc}/visibility.h | 0 5 files changed, 11 insertions(+), 4 deletions(-) rename libshaderc_util/include/{libshaderc_util => shaderc}/common.h (100%) rename libshaderc_util/include/{libshaderc_util => shaderc}/visibility.h (100%) diff --git a/libshaderc/include/shaderc/shaderc.h b/libshaderc/include/shaderc/shaderc.h index c9f8f1863..f6f9d1489 100644 --- a/libshaderc/include/shaderc/shaderc.h +++ b/libshaderc/include/shaderc/shaderc.h @@ -23,8 +23,8 @@ extern "C" { #include #include -#include "libshaderc_util/common.h" -#include "libshaderc_util/visibility.h" +#include "shaderc/common.h" +#include "shaderc/visibility.h" // Source language kind. typedef enum { diff --git a/libshaderc_spvc/include/shaderc/spvc.h b/libshaderc_spvc/include/shaderc/spvc.h index 96e13bb61..d342d5392 100644 --- a/libshaderc_spvc/include/shaderc/spvc.h +++ b/libshaderc_spvc/include/shaderc/spvc.h @@ -23,8 +23,8 @@ extern "C" { #include #include -#include "libshaderc_util/common.h" -#include "libshaderc_util/visibility.h" +#include "shaderc/common.h" +#include "shaderc/visibility.h" // An opaque handle to an object that manages all compiler state. typedef struct shaderc_spvc_compiler* shaderc_spvc_compiler_t; diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt index 873540ab7..d2d571fc3 100644 --- a/libshaderc_util/CMakeLists.txt +++ b/libshaderc_util/CMakeLists.txt @@ -27,6 +27,13 @@ target_include_directories(shaderc_util PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) if(SHADERC_ENABLE_INSTALL) + install( + FILES + include/shaderc/common.h + include/shaderc/visibility.h + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) + install(TARGETS shaderc_util LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/libshaderc_util/include/libshaderc_util/common.h b/libshaderc_util/include/shaderc/common.h similarity index 100% rename from libshaderc_util/include/libshaderc_util/common.h rename to libshaderc_util/include/shaderc/common.h diff --git a/libshaderc_util/include/libshaderc_util/visibility.h b/libshaderc_util/include/shaderc/visibility.h similarity index 100% rename from libshaderc_util/include/libshaderc_util/visibility.h rename to libshaderc_util/include/shaderc/visibility.h From 41db1026a45b24e0d6b16558e13013f5fe75cdad Mon Sep 17 00:00:00 2001 From: Frank Henigman Date: Tue, 29 Jan 2019 14:53:37 -0500 Subject: [PATCH 2/3] Address review comments. Split common.h into env.h and status.h. Fix include guards. --- libshaderc/include/shaderc/shaderc.h | 3 +- libshaderc_spvc/include/shaderc/spvc.h | 3 +- libshaderc_util/CMakeLists.txt | 3 +- libshaderc_util/include/shaderc/common.h | 60 -------------------- libshaderc_util/include/shaderc/visibility.h | 6 +- 5 files changed, 9 insertions(+), 66 deletions(-) delete mode 100644 libshaderc_util/include/shaderc/common.h diff --git a/libshaderc/include/shaderc/shaderc.h b/libshaderc/include/shaderc/shaderc.h index f6f9d1489..c62dd3b07 100644 --- a/libshaderc/include/shaderc/shaderc.h +++ b/libshaderc/include/shaderc/shaderc.h @@ -23,7 +23,8 @@ extern "C" { #include #include -#include "shaderc/common.h" +#include "shaderc/env.h" +#include "shaderc/status.h" #include "shaderc/visibility.h" // Source language kind. diff --git a/libshaderc_spvc/include/shaderc/spvc.h b/libshaderc_spvc/include/shaderc/spvc.h index d342d5392..59e56fc9d 100644 --- a/libshaderc_spvc/include/shaderc/spvc.h +++ b/libshaderc_spvc/include/shaderc/spvc.h @@ -23,7 +23,8 @@ extern "C" { #include #include -#include "shaderc/common.h" +#include "shaderc/env.h" +#include "shaderc/status.h" #include "shaderc/visibility.h" // An opaque handle to an object that manages all compiler state. diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt index d2d571fc3..4cd48d518 100644 --- a/libshaderc_util/CMakeLists.txt +++ b/libshaderc_util/CMakeLists.txt @@ -29,7 +29,8 @@ target_include_directories(shaderc_util if(SHADERC_ENABLE_INSTALL) install( FILES - include/shaderc/common.h + include/shaderc/env.h + include/shaderc/status.h include/shaderc/visibility.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) diff --git a/libshaderc_util/include/shaderc/common.h b/libshaderc_util/include/shaderc/common.h deleted file mode 100644 index 906f04bcf..000000000 --- a/libshaderc_util/include/shaderc/common.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_COMMON_H_ -#define LIBSHADERC_UTIL_COMMON_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - shaderc_target_env_vulkan, // create SPIR-V under Vulkan semantics - shaderc_target_env_opengl, // create SPIR-V under OpenGL semantics - // NOTE: SPIR-V code generation is not supported for shaders under OpenGL - // compatibility profile. - shaderc_target_env_opengl_compat, // create SPIR-V under OpenGL semantics, - // including compatibility profile - // functions - shaderc_target_env_default = shaderc_target_env_vulkan -} shaderc_target_env; - -typedef enum { - // For Vulkan, use Vulkan's mapping of version numbers to integers. - // See vulkan.h - shaderc_env_version_vulkan_1_0 = (((uint32_t)1 << 22)), - shaderc_env_version_vulkan_1_1 = (((uint32_t)1 << 22) | (1 << 12)), - // For OpenGL, use the number from #version in shaders. - // TODO(dneto): Currently no difference between OpenGL 4.5 and 4.6. - // See glslang/Standalone/Standalone.cpp - // TODO(dneto): Glslang doesn't accept a OpenGL client version of 460. - shaderc_env_version_opengl_4_5 = 450, -} shaderc_env_version; - -// Indicate the status of a compilation. -typedef enum { - shaderc_compilation_status_success = 0, - shaderc_compilation_status_invalid_stage, // error stage deduction - shaderc_compilation_status_compilation_error, - shaderc_compilation_status_internal_error, // unexpected failure - shaderc_compilation_status_null_result_object, - shaderc_compilation_status_invalid_assembly, - shaderc_compilation_status_validation_error, -} shaderc_compilation_status; - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // LIBSHADERC_UTIL_COMMON_H_ diff --git a/libshaderc_util/include/shaderc/visibility.h b/libshaderc_util/include/shaderc/visibility.h index 93af71ff5..88ec151bf 100644 --- a/libshaderc_util/include/shaderc/visibility.h +++ b/libshaderc_util/include/shaderc/visibility.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBSHADERC_UTIL_VISIBILITY_H_ -#define LIBSHADERC_UTIL_VISIBILITY_H_ +#ifndef SHADERC_VISIBILITY_H_ +#define SHADERC_VISIBILITY_H_ // SHADERC_EXPORT tags symbol that will be exposed by the shared libraries. #if defined(SHADERC_SHAREDLIB) @@ -34,4 +34,4 @@ #define SHADERC_EXPORT #endif -#endif // LIBSHADERC_UTIL_VISIBILITY_H_ +#endif // SHADERC_VISIBILITY_H_ From 49e8f2b6fec321f7761ef3af4400fb17c259b15c Mon Sep 17 00:00:00 2001 From: Frank Henigman Date: Tue, 29 Jan 2019 15:17:57 -0500 Subject: [PATCH 3/3] Add env.h and status.h --- libshaderc_util/include/shaderc/env.h | 49 ++++++++++++++++++++++++ libshaderc_util/include/shaderc/status.h | 37 ++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 libshaderc_util/include/shaderc/env.h create mode 100644 libshaderc_util/include/shaderc/status.h diff --git a/libshaderc_util/include/shaderc/env.h b/libshaderc_util/include/shaderc/env.h new file mode 100644 index 000000000..a2d9e43d4 --- /dev/null +++ b/libshaderc_util/include/shaderc/env.h @@ -0,0 +1,49 @@ +// Copyright 2018 The Shaderc Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SHADERC_ENV_H_ +#define SHADERC_ENV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + shaderc_target_env_vulkan, // create SPIR-V under Vulkan semantics + shaderc_target_env_opengl, // create SPIR-V under OpenGL semantics + // NOTE: SPIR-V code generation is not supported for shaders under OpenGL + // compatibility profile. + shaderc_target_env_opengl_compat, // create SPIR-V under OpenGL semantics, + // including compatibility profile + // functions + shaderc_target_env_default = shaderc_target_env_vulkan +} shaderc_target_env; + +typedef enum { + // For Vulkan, use Vulkan's mapping of version numbers to integers. + // See vulkan.h + shaderc_env_version_vulkan_1_0 = (((uint32_t)1 << 22)), + shaderc_env_version_vulkan_1_1 = (((uint32_t)1 << 22) | (1 << 12)), + // For OpenGL, use the number from #version in shaders. + // TODO(dneto): Currently no difference between OpenGL 4.5 and 4.6. + // See glslang/Standalone/Standalone.cpp + // TODO(dneto): Glslang doesn't accept a OpenGL client version of 460. + shaderc_env_version_opengl_4_5 = 450, +} shaderc_env_version; + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // SHADERC_ENV_H_ diff --git a/libshaderc_util/include/shaderc/status.h b/libshaderc_util/include/shaderc/status.h new file mode 100644 index 000000000..b7369fcff --- /dev/null +++ b/libshaderc_util/include/shaderc/status.h @@ -0,0 +1,37 @@ +// Copyright 2018 The Shaderc Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SHADERC_STATUS_H_ +#define SHADERC_STATUS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +// Indicate the status of a compilation. +typedef enum { + shaderc_compilation_status_success = 0, + shaderc_compilation_status_invalid_stage, // error stage deduction + shaderc_compilation_status_compilation_error, + shaderc_compilation_status_internal_error, // unexpected failure + shaderc_compilation_status_null_result_object, + shaderc_compilation_status_invalid_assembly, + shaderc_compilation_status_validation_error, +} shaderc_compilation_status; + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // SHADERC_STATUS_H_