diff --git a/recipes/shaderc/all/CMakeLists.txt b/recipes/shaderc/all/CMakeLists.txt deleted file mode 100644 index 4d393c7a86c09..0000000000000 --- a/recipes/shaderc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/shaderc/all/conandata.yml b/recipes/shaderc/all/conandata.yml index 36e3a9f3b6b76..f866b68a84277 100644 --- a/recipes/shaderc/all/conandata.yml +++ b/recipes/shaderc/all/conandata.yml @@ -1,16 +1,28 @@ sources: + "2023.6": + url: "https://github.com/google/shaderc/archive/refs/tags/v2023.6.tar.gz" + sha256: "e40fd4a87a56f6610e223122179f086d5c4f11a7e0e2aa461f0325c3a0acc6ae" "2021.1": url: "https://github.com/google/shaderc/archive/v2021.1.tar.gz" sha256: "047113bc4628da164a3cb845efc20d442728873f6054a68ab56d04a053f2c32b" - "2019.0": - url: "https://github.com/google/shaderc/archive/v2019.0.tar.gz" - sha256: "1018cd02be52295272fdbffa056ee24b881be277c83d039ad554d91230f4e11b" patches: + "2023.6": + - patch_file: "patches/2023.6/use-conan-dependencies.patch" + patch_description: "Replace third_party with Conan dependencies" + patch_type: "conan" + - patch_file: "patches/2021.1/adapt-update_build_version.py.patch" + patch_description: "Adapt update_build_version.py for Conan" + patch_type: "conan" + - patch_file: "patches/2021.1/install-shaderc_util.patch" + patch_description: "install() shaderc_util" + patch_type: "conan" "2021.1": - - patch_file: "patches/2021.1/fix-cmake.patch" - base_path: "source_subfolder" - "2019.0": - - patch_file: "patches/2019.0/fix-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/2019.0/fix-spvc.patch" - base_path: "source_subfolder" + - patch_file: "patches/2021.1/use-conan-dependencies.patch" + patch_description: "Replace third_party with Conan dependencies" + patch_type: "conan" + - patch_file: "patches/2021.1/adapt-update_build_version.py.patch" + patch_description: "Adapt update_build_version.py for Conan" + patch_type: "conan" + - patch_file: "patches/2021.1/install-shaderc_util.patch" + patch_description: "install() shaderc_util" + patch_type: "conan" diff --git a/recipes/shaderc/all/conanfile.py b/recipes/shaderc/all/conanfile.py index 431f1292c6d2f..80efeb3ed4b4e 100644 --- a/recipes/shaderc/all/conanfile.py +++ b/recipes/shaderc/all/conanfile.py @@ -1,131 +1,136 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.36.0" +from conan import ConanFile +from conan.tools.build import check_min_cppstd, stdcpp_library +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime + +required_conan_version = ">=1.53.0" class ShadercConan(ConanFile): name = "shaderc" description = "A collection of tools, libraries and tests for shader compilation." license = "Apache-2.0" - topics = ("glsl", "hlsl", "msl", "spirv", "spir-v", "glslc", "spvc") - homepage = "https://github.com/google/shaderc" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/shaderc" + topics = ("glsl", "hlsl", "msl", "spirv", "spir-v", "glslc") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "spvc": [True, False], } default_options = { "shared": False, "fPIC": True, - "spvc": False, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) >= "2020.4": - del self.options.spvc def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _get_compatible_spirv_tools_version(self): - return { - "2021.1": "2021.2", - "2019.0": "2020.5" - }.get(str(self.version), False) + def layout(self): + cmake_layout(self, src_folder="src") @property - def _get_compatible_glslang_version(self): + def _spirv_version(self): return { - "2021.1": "11.5.0", - "2019.0": "8.13.3559" - }.get(str(self.version), False) + # TODO: bump me once newer versions are available on CCI + # "2023.6": "1.3.261.1", + "2023.6": "1.3.239.0", + "2021.1": "1.3.224.0", + }[str(self.version)] def requirements(self): - self.requires("glslang/{}".format(self._get_compatible_glslang_version)) - self.requires("spirv-tools/{}".format(self._get_compatible_spirv_tools_version)) - if self.options.get_safe("spvc", False): - self.requires("spirv-cross/20210115") + # transitive_headers=True is not required for any of the dependencies + self.requires(f"glslang/{self._spirv_version}") + self.requires(f"spirv-tools/{self._spirv_version}") + self.requires(f"spirv-headers/{self._spirv_version}") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.17.2 <4]") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + + tc = CMakeToolchain(self) + tc.cache_variables["SHADERC_SKIP_INSTALL"] = False + tc.cache_variables["SHADERC_SKIP_EXAMPLES"] = True + tc.cache_variables["SHADERC_SKIP_TESTS"] = True + tc.cache_variables["ENABLE_CODE_COVERAGE"] = False + tc.cache_variables["SHADERC_ENABLE_WERROR_COMPILE"] = False + if is_msvc(self): + tc.cache_variables["SHADERC_ENABLE_SHARED_CRT"] = not is_msvc_static_runtime(self) + tc.generate() + + self.dependencies["glslang"].cpp_info.components["glslang-core"].includedirs.append( + os.path.join(self.dependencies["glslang"].package_folder, "include", "glslang") + ) + + deps = CMakeDeps(self) + deps.set_property("glslang::glslang-core", "cmake_target_name", "glslang") + deps.set_property("glslang::osdependent", "cmake_target_name", "OSDependent") + deps.set_property("glslang::oglcompiler", "cmake_target_name", "OGLCompiler") + deps.set_property("glslang::hlsl", "cmake_target_name", "HLSL") + deps.set_property("glslang::spirv", "cmake_target_name", "SPIRV") + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["SHADERC_ENABLE_SPVC"] = self.options.get_safe("spvc", False) - self._cmake.definitions["SHADERC_SKIP_INSTALL"] = False - self._cmake.definitions["SHADERC_SKIP_TESTS"] = True - self._cmake.definitions["SHADERC_SPVC_ENABLE_DIRECT_LOGGING"] = False - self._cmake.definitions["SHADERC_SPVC_DISABLE_CONTEXT_LOGGING"] = False - self._cmake.definitions["SHADERC_ENABLE_WERROR_COMPILE"] = False - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["SHADERC_ENABLE_SHARED_CRT"] = str(self.settings.compiler.runtime).startswith("MD") - self._cmake.definitions["ENABLE_CODE_COVERAGE"] = False - if tools.is_apple_os(self.settings.os): - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.set_property("pkg_config_name", "shaderc" if self.options.shared else "shaderc_static") - self.cpp_info.libs = self._get_ordered_libs() - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) if self.options.shared: + self.cpp_info.set_property("pkg_config_name", "shaderc") + self.cpp_info.libs = ["shaderc_shared"] self.cpp_info.defines.append("SHADERC_SHAREDLIB") + else: + self.cpp_info.set_property("pkg_config_name", "shaderc_static") + self.cpp_info.libs = ["shaderc", "shaderc_util"] + if stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + + self.cpp_info.requires = [ + "glslang::glslang-core", + "glslang::osdependent", + "glslang::oglcompiler", + "glslang::hlsl", + "glslang::spirv", + "spirv-tools::spirv-tools-core", + "spirv-tools::spirv-tools-opt", + "spirv-headers::spirv-headers" + ] + + # TODO: to remove in conan v2 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path) - - def _get_ordered_libs(self): - libs = ["shaderc_shared" if self.options.shared else "shaderc"] - if not self.options.shared: - libs.append("shaderc_util") - if self.options.get_safe("spvc", False): - libs.append("shaderc_spvc_shared" if self.options.shared else "shaderc_spvc") - return libs diff --git a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch b/recipes/shaderc/all/patches/2019.0/fix-cmake.patch deleted file mode 100644 index 1fee3bf35ecf3..0000000000000 --- a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch +++ /dev/null @@ -1,402 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -70,7 +70,6 @@ endif(MSVC) - - # Configure subdirectories. - # We depend on these for later projects, so they should come first. --add_subdirectory(third_party) - - if(SHADERC_ENABLE_SPVC) - add_subdirectory(libshaderc_spvc) -@@ -79,12 +78,11 @@ endif() - add_subdirectory(libshaderc_util) - add_subdirectory(libshaderc) - add_subdirectory(glslc) --add_subdirectory(examples) - - add_custom_target(build-version - ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py -- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} -+ ${shaderc_SOURCE_DIR} - COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") - - function(define_pkg_config_file NAME LIBS) ---- a/cmake/utils.cmake -+++ b/cmake/utils.cmake -@@ -11,7 +11,6 @@ function(shaderc_default_c_compile_options TARGET) - if (NOT "${MSVC}") - target_compile_options(${TARGET} PRIVATE -Wall -Werror -fvisibility=hidden) - if (NOT "${MINGW}") -- target_compile_options(${TARGET} PRIVATE -fPIC) - endif() - if (ENABLE_CODE_COVERAGE) - # The --coverage option is a synonym for -fprofile-arcs -ftest-coverage -@@ -24,10 +23,6 @@ function(shaderc_default_c_compile_options TARGET) - endif() - if (NOT SHADERC_ENABLE_SHARED_CRT) - if (WIN32) -- # For MinGW cross compile, statically link to the libgcc runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc") - endif(WIN32) - endif(NOT SHADERC_ENABLE_SHARED_CRT) - else() -@@ -40,13 +35,8 @@ endfunction(shaderc_default_c_compile_options) - function(shaderc_default_compile_options TARGET) - shaderc_default_c_compile_options(${TARGET}) - if (NOT "${MSVC}") -- target_compile_options(${TARGET} PRIVATE -std=c++11) - if (NOT SHADERC_ENABLE_SHARED_CRT) - if (WIN32) -- # For MinGW cross compile, statically link to the C++ runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc -static-libstdc++") - endif(WIN32) - endif(NOT SHADERC_ENABLE_SHARED_CRT) - endif() ---- a/glslc/CMakeLists.txt -+++ b/glslc/CMakeLists.txt -@@ -16,31 +16,19 @@ add_library(glslc STATIC - ) - - shaderc_default_compile_options(glslc) --target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) --target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler -- HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT}) --target_link_libraries(glslc PRIVATE shaderc_util shaderc) -+target_link_libraries(glslc PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -+target_link_libraries(glslc PUBLIC shaderc_util shaderc) - - add_executable(glslc_exe src/main.cc) - shaderc_default_compile_options(glslc_exe) --target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) -+target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) - set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) --target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) -+target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc CONAN_PKG::spirv-tools) - add_dependencies(glslc_exe build-version) - --shaderc_add_tests( -- TEST_PREFIX glslc -- LINK_LIBS glslc shaderc_util shaderc -- TEST_NAMES -- file -- resource_parse -- stage) -- - shaderc_add_asciidoc(glslc_doc_README README) - - if(SHADERC_ENABLE_INSTALL) - install(TARGETS glslc_exe - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(SHADERC_ENABLE_INSTALL) -- --add_subdirectory(test) ---- a/libshaderc/CMakeLists.txt -+++ b/libshaderc/CMakeLists.txt -@@ -10,18 +10,16 @@ set(SHADERC_SOURCES - src/shaderc_private.h - ) - --add_library(shaderc STATIC ${SHADERC_SOURCES}) -+add_library(shaderc ${SHADERC_SOURCES}) - shaderc_default_compile_options(shaderc) --target_include_directories(shaderc PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -- --add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) --shaderc_default_compile_options(shaderc_shared) --target_include_directories(shaderc_shared PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) --target_compile_definitions(shaderc_shared -- PRIVATE SHADERC_IMPLEMENTATION -- PUBLIC SHADERC_SHAREDLIB --) --set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) -+target_include_directories(shaderc PUBLIC include) -+if(BUILD_SHARED_LIBS) -+ target_compile_definitions(shaderc -+ PRIVATE SHADERC_IMPLEMENTATION -+ PUBLIC SHADERC_SHAREDLIB -+ ) -+ set_target_properties(shaderc PROPERTIES OUTPUT_NAME "shaderc_shared" SOVERSION 1) -+endif() - - if(SHADERC_ENABLE_INSTALL) - install( -@@ -34,70 +32,19 @@ if(SHADERC_ENABLE_INSTALL) - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -- install(TARGETS shaderc shaderc_shared -+ install(TARGETS shaderc - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(SHADERC_ENABLE_INSTALL) - --find_package(Threads) - set(SHADERC_LIBS -- glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT} - shaderc_util -- SPIRV # from glslang -- SPIRV-Tools -+ "CONAN_PKG::glslang" -+ "CONAN_PKG::spirv-tools" - ) - - target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS}) --target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc -- LINK_LIBS shaderc -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_shared -- LINK_LIBS shaderc_shared SPIRV-Tools -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) -- --shaderc_combine_static_lib(shaderc_combined shaderc) -- --if(SHADERC_ENABLE_INSTALL) -- # Since shaderc_combined is defined as an imported library, we cannot use the -- # install() directive to install it. Install it like a normal file. -- get_target_property(generated_location shaderc_combined LOCATION) -- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") -- if (NOT "${vs_generator}" STREQUAL "") -- # With Visual Studio generators, the LOCATION property is not properly -- # expanded according to the current build configuration. We need to work -- # around this problem by manually substitution. -- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" -- install_location "${generated_location}") -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- else() -- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() --endif(SHADERC_ENABLE_INSTALL) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_combined -- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp) - - if(${SHADERC_ENABLE_TESTS}) - add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c) ---- a/libshaderc_spvc/CMakeLists.txt -+++ b/libshaderc_spvc/CMakeLists.txt -@@ -9,26 +9,22 @@ set(SPVC_SOURCES - src/spvc.cc - ) - --add_library(shaderc_spvc STATIC ${SPVC_SOURCES}) -+add_library(shaderc_spvc ${SPVC_SOURCES}) - shaderc_default_compile_options(shaderc_spvc) --target_include_directories(shaderc_spvc PUBLIC include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${spirv-tools_SOURCE_DIR}/include ${SPIRV-Cross_SOURCE_DIR}/..) -- --add_library(shaderc_spvc_shared SHARED ${SPVC_SOURCES}) --shaderc_default_compile_options(shaderc_spvc_shared) --target_include_directories(shaderc_spvc_shared PUBLIC include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${spirv-tools_SOURCE_DIR}/include ${SPIRV-Cross_SOURCE_DIR}/..) -- --target_compile_definitions(shaderc_spvc_shared -- PRIVATE SHADERC_IMPLEMENTATION -- PUBLIC SHADERC_SHAREDLIB --) -+target_include_directories(shaderc_spvc -+ PUBLIC include ${shaderc_SOURCE_DIR}/libshaderc/include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc_util/include) -+if(BUILD_SHARED_LIBS) -+ target_compile_definitions(shaderc_spvc -+ PRIVATE SHADERC_IMPLEMENTATION -+ PUBLIC SHADERC_SHAREDLIB -+ ) -+ set_target_properties(shaderc_spvc PROPERTIES OUTPUT_NAME "shaderc_spvc_shared" SOVERSION 1) -+endif() - - if (DISABLE_EXCEPTIONS) - target_compile_definitions(shaderc_spvc PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) -- target_compile_definitions(shaderc_spvc_shared PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) - endif (DISABLE_EXCEPTIONS) - --set_target_properties(shaderc_spvc_shared PROPERTIES SOVERSION 1) -- - if(SHADERC_ENABLE_INSTALL) - install( - FILES -@@ -37,71 +33,18 @@ if(SHADERC_ENABLE_INSTALL) - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -- install(TARGETS shaderc_spvc shaderc_spvc_shared -+ install(TARGETS shaderc_spvc - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(SHADERC_ENABLE_INSTALL) - --find_package(Threads) - set(SPVC_LIBS -- ${CMAKE_THREAD_LIBS_INIT} -- SPIRV-Tools -- SPIRV-Tools-opt -- spirv-cross-glsl -- spirv-cross-hlsl -- spirv-cross-msl -+ "CONAN_PKG::spirv-cross" -+ "CONAN_PKG::spirv-tools" - ) - - target_link_libraries(shaderc_spvc PRIVATE ${SPVC_LIBS}) --target_link_libraries(shaderc_spvc_shared PRIVATE ${SPVC_LIBS}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc -- LINK_LIBS shaderc_spvc -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${SPIRV-Cross_SOURCE_DIR}/.. -- TEST_NAMES -- spvc -- spvc_cpp -- spvc_webgpu -- spvc_webgpu_cpp) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_shared -- LINK_LIBS shaderc_spvc_shared SPIRV-Tools SPIRV-Tools-opt -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${SPIRV-Cross_SOURCE_DIR}/.. -- TEST_NAMES -- spvc -- spvc_cpp -- spvc_webgpu -- spvc_webgpu_cpp) -- --shaderc_combine_static_lib(shaderc_spvc_combined shaderc_spvc) -- --if(SHADERC_ENABLE_INSTALL) -- # Since shaderc_combined is defined as an imported library, we cannot use the -- # install() directive to install it. Install it like a normal file. -- get_target_property(generated_location shaderc_spvc_combined LOCATION) -- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") -- if (NOT "${vs_generator}" STREQUAL "") -- # With Visual Studio generators, the LOCATION property is not properly -- # expanded according to the current build configuration. We need to work -- # around this problem by manually substitution. -- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" -- install_location "${generated_location}") -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- else() -- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() --endif(SHADERC_ENABLE_INSTALL) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_spvc_combined -- LINK_LIBS shaderc_spvc_combined ${CMAKE_THREAD_LIBS_INIT} shaderc_util -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- spvc -- spvc_cpp) - - if(${SHADERC_ENABLE_TESTS}) - add_executable(spvc_c_smoke_test ./src/spvc_smoke_test_util.c ./src/spvc_c_smoke_test.c) ---- a/libshaderc_util/CMakeLists.txt -+++ b/libshaderc_util/CMakeLists.txt -@@ -24,25 +24,20 @@ add_library(shaderc_util STATIC - - shaderc_default_compile_options(shaderc_util) - target_include_directories(shaderc_util -- PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -+ PUBLIC include) - - find_package(Threads) --target_link_libraries(shaderc_util PRIVATE -- glslang OSDependent OGLCompiler HLSL glslang SPIRV -- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- TEST_NAMES -- counting_includer -- string_piece -- format -- file_finder -- io -- message -- mutex -- version_profile) -+target_link_libraries(shaderc_util PUBLIC -+ CONAN_PKG::glslang -+ CONAN_PKG::spirv-tools -+ ${CMAKE_THREAD_LIBS_INIT}) -+ -+if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) -+ install(TARGETS shaderc_util -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+endif(SHADERC_ENABLE_INSTALL) - - if(${SHADERC_ENABLE_TESTS}) - target_include_directories(shaderc_util_counting_includer_test -@@ -51,15 +46,6 @@ if(${SHADERC_ENABLE_TESTS}) - PRIVATE ${glslang_SOURCE_DIR}) - endif() - --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- INCLUDE_DIRS -- ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- compiler) -- - # This target copies content of testdata into the build directory. - add_custom_target(testdata COMMAND - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake ---- a/spvc/CMakeLists.txt -+++ b/spvc/CMakeLists.txt -@@ -1,8 +1,8 @@ - add_executable(spvc_exe src/main.cc) - shaderc_default_compile_options(spvc_exe) --target_include_directories(spvc_exe PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${spirv-tools_SOURCE_DIR}/include) -+target_include_directories(spvc_exe PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include) - set_target_properties(spvc_exe PROPERTIES OUTPUT_NAME spvc) --target_link_libraries(spvc_exe PRIVATE shaderc_spvc shaderc_util) -+target_link_libraries(spvc_exe PRIVATE shaderc_spvc shaderc_util CONAN_PKG::spirv-tools) - add_dependencies(spvc_exe build-version) - - shaderc_add_asciidoc(spvc_doc_README README) ---- a/utils/update_build_version.py -+++ b/utils/update_build_version.py -@@ -114,12 +114,12 @@ def get_version_string(project, directory): - - - def main(): -- if len(sys.argv) != 4: -- print('usage: {} '.format( -+ if len(sys.argv) != 2: -+ print('usage: {} '.format( - sys.argv[0])) - sys.exit(1) - -- projects = ['shaderc', 'spirv-tools', 'glslang'] -+ projects = ['shaderc'] - new_content = ''.join([ - '"{}\\n"\n'.format(get_version_string(p, d)) - for (p, d) in zip(projects, sys.argv[1:]) diff --git a/recipes/shaderc/all/patches/2019.0/fix-spvc.patch b/recipes/shaderc/all/patches/2019.0/fix-spvc.patch deleted file mode 100644 index 682a95ac5deb9..0000000000000 --- a/recipes/shaderc/all/patches/2019.0/fix-spvc.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/libshaderc_spvc/src/spvc.cc -+++ b/libshaderc_spvc/src/spvc.cc -@@ -15,9 +15,9 @@ - #include "shaderc/spvc.h" - - #include "libshaderc_util/exceptions.h" --#include "spirv-cross/spirv_glsl.hpp" --#include "spirv-cross/spirv_hlsl.hpp" --#include "spirv-cross/spirv_msl.hpp" -+#include "spirv_glsl.hpp" -+#include "spirv_hlsl.hpp" -+#include "spirv_msl.hpp" - #include "spirv-tools/libspirv.hpp" - #include "spirv-tools/optimizer.hpp" - -@@ -169,7 +169,7 @@ size_t shaderc_spvc_compile_options_set_for_fuzzing( - shaderc_spvc_compile_options_t options, const uint8_t* data, size_t size) { - if (!data || size < sizeof(*options)) return 0; - -- memcpy(options, data, sizeof(*options)); -+ memcpy(static_cast(options), data, sizeof(*options)); - return sizeof(*options); - } - diff --git a/recipes/shaderc/all/patches/2021.1/adapt-update_build_version.py.patch b/recipes/shaderc/all/patches/2021.1/adapt-update_build_version.py.patch new file mode 100644 index 0000000000000..a53d4b7300f53 --- /dev/null +++ b/recipes/shaderc/all/patches/2021.1/adapt-update_build_version.py.patch @@ -0,0 +1,25 @@ +diff --git a/utils/update_build_version.py b/utils/update_build_version.py +--- a/utils/update_build_version.py ++++ b/utils/update_build_version.py +@@ -128,18 +128,18 @@ + + + def main(): +- if len(sys.argv) != 5: ++ if len(sys.argv) < 5: + print(('usage: {} '.format( + sys.argv[0]))) + sys.exit(1) + +- projects = ['shaderc', 'spirv-tools', 'glslang'] ++ projects = ['shaderc'] + new_content = ''.join([ + '"{}\\n"\n'.format(get_version_string(p, d)) + for (p, d) in zip(projects, sys.argv[1:]) + ]) + +- output_file = sys.argv[4] ++ output_file = sys.argv[-1] + mkdir_p(os.path.dirname(output_file)) + + if os.path.isfile(output_file): diff --git a/recipes/shaderc/all/patches/2021.1/fix-cmake.patch b/recipes/shaderc/all/patches/2021.1/fix-cmake.patch deleted file mode 100644 index ac2fd7ef1015f..0000000000000 --- a/recipes/shaderc/all/patches/2021.1/fix-cmake.patch +++ /dev/null @@ -1,324 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0c8d1ae..4f4e6e0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -112,19 +112,16 @@ endif(MSVC) - - # Configure subdirectories. - # We depend on these for later projects, so they should come first. --add_subdirectory(third_party) -+ - - add_subdirectory(libshaderc_util) - add_subdirectory(libshaderc) - add_subdirectory(glslc) --if(${SHADERC_ENABLE_EXAMPLES}) -- add_subdirectory(examples) --endif() - - add_custom_target(build-version - ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py -- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc -+ ${shaderc_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc - COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") - - function(define_pkg_config_file NAME LIBS) -diff --git a/cmake/utils.cmake b/cmake/utils.cmake -index d64757d..0adc008 100644 ---- a/cmake/utils.cmake -+++ b/cmake/utils.cmake -@@ -41,14 +41,6 @@ function(shaderc_default_c_compile_options TARGET) - # requires clang to be built with compiler-rt. - target_link_libraries(${TARGET} PRIVATE --coverage) - endif() -- if (NOT SHADERC_ENABLE_SHARED_CRT) -- if (WIN32) -- # For MinGW cross compile, statically link to the libgcc runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc") -- endif(WIN32) -- endif(NOT SHADERC_ENABLE_SHARED_CRT) - else() - # disable warning C4800: 'int' : forcing value to bool 'true' or 'false' - # (performance warning) -@@ -58,17 +50,6 @@ endfunction(shaderc_default_c_compile_options) - - function(shaderc_default_compile_options TARGET) - shaderc_default_c_compile_options(${TARGET}) -- if (NOT "${MSVC}") -- target_compile_options(${TARGET} PRIVATE -std=c++11) -- if (NOT SHADERC_ENABLE_SHARED_CRT) -- if (WIN32) -- # For MinGW cross compile, statically link to the C++ runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc -static-libstdc++") -- endif(WIN32) -- endif(NOT SHADERC_ENABLE_SHARED_CRT) -- endif() - endfunction(shaderc_default_compile_options) - - # Build an asciidoc file; additional arguments past the base filename specify -diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt -index 31664d1..a962c2e 100644 ---- a/glslc/CMakeLists.txt -+++ b/glslc/CMakeLists.txt -@@ -30,7 +30,6 @@ add_library(glslc STATIC - ) - - shaderc_default_compile_options(glslc) --target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) - - if (SHADERC_ENABLE_WGSL_OUTPUT) - if (IS_DIRECTORY "${tint_SOURCE_DIR}/include") -@@ -43,26 +42,17 @@ if (SHADERC_ENABLE_WGSL_OUTPUT) - endif(SHADERC_ENABLE_WGSL_OUTPUT) - - target_link_libraries(glslc PRIVATE -- glslang OSDependent OGLCompiler HLSL glslang SPIRV # Glslang libraries - $<$:libtint> # Tint libraries, optional - shaderc_util shaderc # internal Shaderc libraries - ${CMAKE_THREAD_LIBS_INIT}) - - add_executable(glslc_exe src/main.cc) - shaderc_default_compile_options(glslc_exe) --target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) -+target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${CONAN_INCLUDE_DIRS}) - set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) --target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) -+target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc CONAN_PKG::spirv-tools) - add_dependencies(glslc_exe build-version) - --shaderc_add_tests( -- TEST_PREFIX glslc -- LINK_LIBS glslc shaderc_util shaderc -- TEST_NAMES -- file -- resource_parse -- stage) -- - shaderc_add_asciidoc(glslc_doc_README README) - - if(SHADERC_ENABLE_INSTALL) -@@ -70,4 +60,3 @@ if(SHADERC_ENABLE_INSTALL) - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(SHADERC_ENABLE_INSTALL) - --add_subdirectory(test) -diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt -index 3ada419..08cf265 100644 ---- a/libshaderc/CMakeLists.txt -+++ b/libshaderc/CMakeLists.txt -@@ -24,24 +24,19 @@ set(SHADERC_SOURCES - src/shaderc_private.h - ) - --add_library(shaderc STATIC ${SHADERC_SOURCES}) -+add_library(shaderc ${SHADERC_SOURCES}) - shaderc_default_compile_options(shaderc) - target_include_directories(shaderc -- PUBLIC include -- PRIVATE ${glslang_SOURCE_DIR} -- ${SPIRV-Headers_SOURCE_DIR}/include) -+ PUBLIC include) - --add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) --shaderc_default_compile_options(shaderc_shared) --target_include_directories(shaderc_shared -- PUBLIC include -- PRIVATE ${glslang_SOURCE_DIR} -- ${SPIRV-Headers_SOURCE_DIR}/include) --target_compile_definitions(shaderc_shared -- PRIVATE SHADERC_IMPLEMENTATION -- PUBLIC SHADERC_SHAREDLIB --) --set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) -+target_include_directories(shaderc PUBLIC include) -+if(BUILD_SHARED_LIBS) -+ target_compile_definitions(shaderc -+ PRIVATE SHADERC_IMPLEMENTATION -+ PUBLIC SHADERC_SHAREDLIB -+ ) -+ set_target_properties(shaderc PROPERTIES OUTPUT_NAME "shaderc_shared" SOVERSION 1) -+endif() - - if(SHADERC_ENABLE_INSTALL) - install( -@@ -54,73 +49,21 @@ if(SHADERC_ENABLE_INSTALL) - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -- install(TARGETS shaderc shaderc_shared -+ install(TARGETS shaderc - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(SHADERC_ENABLE_INSTALL) - --find_package(Threads) - set(SHADERC_LIBS -- glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT} - shaderc_util -- SPIRV # from glslang -- SPIRV-Tools -+ "CONAN_PKG::glslang" -+ "CONAN_PKG::spirv-tools" - ) - - target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS}) --target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc -- LINK_LIBS shaderc -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- ${SPIRV-Headers_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_shared -- LINK_LIBS shaderc_shared SPIRV-Tools -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- ${SPIRV-Headers_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) - --shaderc_combine_static_lib(shaderc_combined shaderc) -- --if(SHADERC_ENABLE_INSTALL) -- # Since shaderc_combined is defined as an imported library, we cannot use the -- # install() directive to install it. Install it like a normal file. -- get_target_property(generated_location shaderc_combined LOCATION) -- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") -- if (NOT "${vs_generator}" STREQUAL "") -- # With Visual Studio generators, the LOCATION property is not properly -- # expanded according to the current build configuration. We need to work -- # around this problem by manually substitution. -- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" -- install_location "${generated_location}") -- install(FILES ${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- else() -- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() --endif(SHADERC_ENABLE_INSTALL) - --shaderc_add_tests( -- TEST_PREFIX shaderc_combined -- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- ${SPIRV-Headers_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp) - - if(${SHADERC_ENABLE_TESTS}) - add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c) -diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt -index 99ce3c4..3eb57d5 100644 ---- a/libshaderc_util/CMakeLists.txt -+++ b/libshaderc_util/CMakeLists.txt -@@ -39,28 +39,23 @@ add_library(shaderc_util STATIC - - shaderc_default_compile_options(shaderc_util) - target_include_directories(shaderc_util -- PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -+ PUBLIC include) - # We use parts of Glslang's HLSL compilation interface, which - # now requires this preprocessor definition. - add_definitions(-DENABLE_HLSL) - - find_package(Threads) - target_link_libraries(shaderc_util PRIVATE -- glslang OSDependent OGLCompiler HLSL glslang SPIRV -- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) -+ CONAN_PKG::glslang -+ CONAN_PKG::spirv-tools -+ ${CMAKE_THREAD_LIBS_INIT}) - --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- TEST_NAMES -- counting_includer -- string_piece -- format -- file_finder -- io_shaderc -- message -- mutex -- version_profile) -+if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) -+ install(TARGETS shaderc_util -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+endif(SHADERC_ENABLE_INSTALL) - - if(${SHADERC_ENABLE_TESTS}) - target_include_directories(shaderc_util_counting_includer_test -@@ -69,15 +64,6 @@ if(${SHADERC_ENABLE_TESTS}) - PRIVATE ${glslang_SOURCE_DIR}) - endif() - --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- INCLUDE_DIRS -- ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- compiler) -- - # This target copies content of testdata into the build directory. - add_custom_target(testdata COMMAND - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake -diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc -index 8a8d12b..92d8279 100644 ---- a/libshaderc_util/src/compiler.cc -+++ b/libshaderc_util/src/compiler.cc -@@ -20,7 +20,7 @@ - #include - #include - --#include "SPIRV/GlslangToSpv.h" -+#include "glslang/SPIRV/GlslangToSpv.h" - #include "libshaderc_util/format.h" - #include "libshaderc_util/io_shaderc.h" - #include "libshaderc_util/message.h" -diff --git a/utils/update_build_version.py b/utils/update_build_version.py -index 5785390..7801a02 100755 ---- a/utils/update_build_version.py -+++ b/utils/update_build_version.py -@@ -128,18 +128,18 @@ def get_version_string(project, directory): - - - def main(): -- if len(sys.argv) != 5: -- print(('usage: {} '.format( -+ if len(sys.argv) != 3: -+ print(('usage: {} '.format( - sys.argv[0]))) - sys.exit(1) - -- projects = ['shaderc', 'spirv-tools', 'glslang'] -+ projects = ['shaderc'] - new_content = ''.join([ - '"{}\\n"\n'.format(get_version_string(p, d)) - for (p, d) in zip(projects, sys.argv[1:]) - ]) - -- output_file = sys.argv[4] -+ output_file = sys.argv[2] - mkdir_p(os.path.dirname(output_file)) - - if os.path.isfile(output_file): diff --git a/recipes/shaderc/all/patches/2021.1/install-shaderc_util.patch b/recipes/shaderc/all/patches/2021.1/install-shaderc_util.patch new file mode 100644 index 0000000000000..c2806270e883d --- /dev/null +++ b/recipes/shaderc/all/patches/2021.1/install-shaderc_util.patch @@ -0,0 +1,14 @@ +diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -87,3 +87,10 @@ + add_dependencies(shaderc_util_file_finder_test testdata) + add_dependencies(shaderc_util_io_shaderc_test testdata) + endif() ++ ++if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) ++ install(TARGETS shaderc_util ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++endif() diff --git a/recipes/shaderc/all/patches/2021.1/use-conan-dependencies.patch b/recipes/shaderc/all/patches/2021.1/use-conan-dependencies.patch new file mode 100644 index 0000000000000..667cfb6d0a4fb --- /dev/null +++ b/recipes/shaderc/all/patches/2021.1/use-conan-dependencies.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -112,7 +112,12 @@ + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) ++find_package(glslang REQUIRED CONFIG) ++find_package(SPIRV-Headers REQUIRED CONFIG) ++find_package(SPIRV-Tools REQUIRED CONFIG) ++set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS}) ++set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..) ++set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..) + + add_subdirectory(libshaderc_util) + add_subdirectory(libshaderc) diff --git a/recipes/shaderc/all/patches/2023.6/use-conan-dependencies.patch b/recipes/shaderc/all/patches/2023.6/use-conan-dependencies.patch new file mode 100644 index 0000000000000..b28517493c7a8 --- /dev/null +++ b/recipes/shaderc/all/patches/2023.6/use-conan-dependencies.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -120,7 +120,12 @@ + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) ++find_package(glslang REQUIRED CONFIG) ++find_package(SPIRV-Headers REQUIRED CONFIG) ++find_package(SPIRV-Tools REQUIRED CONFIG) ++set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS}) ++set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..) ++set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..) + + add_subdirectory(libshaderc_util) + add_subdirectory(libshaderc) diff --git a/recipes/shaderc/all/test_package/CMakeLists.txt b/recipes/shaderc/all/test_package/CMakeLists.txt index 492695489b31c..e88a76ff2e432 100644 --- a/recipes/shaderc/all/test_package/CMakeLists.txt +++ b/recipes/shaderc/all/test_package/CMakeLists.txt @@ -1,21 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(shaderc REQUIRED CONFIG) add_executable(${PROJECT_NAME}_shaderc_c test_package_shaderc.c) -target_link_libraries(${PROJECT_NAME}_shaderc_c ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME}_shaderc_c PRIVATE shaderc::shaderc) add_executable(${PROJECT_NAME}_shaderc_cpp test_package_shaderc.cpp) -target_link_libraries(${PROJECT_NAME}_shaderc_cpp ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME}_shaderc_cpp PRIVATE shaderc::shaderc) set_property(TARGET ${PROJECT_NAME}_shaderc_cpp PROPERTY CXX_STANDARD 11) - -if(SHADERC_WITH_SPVC) - add_executable(${PROJECT_NAME}_spvc_c test_package_spvc.c) - target_link_libraries(${PROJECT_NAME}_spvc_c ${CONAN_LIBS}) - - add_executable(${PROJECT_NAME}_spvc_cpp test_package_spvc.cpp) - target_link_libraries(${PROJECT_NAME}_spvc_cpp ${CONAN_LIBS}) - set_property(TARGET ${PROJECT_NAME}_spvc_cpp PROPERTY CXX_STANDARD 11) -endif() diff --git a/recipes/shaderc/all/test_package/conanfile.py b/recipes/shaderc/all/test_package/conanfile.py index e6ac9a4c93682..4613db3f59c9f 100644 --- a/recipes/shaderc/all/test_package/conanfile.py +++ b/recipes/shaderc/all/test_package/conanfile.py @@ -1,32 +1,34 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - cmake.definitions["SHADERC_WITH_SPVC"] = self.options["shaderc"].spvc if "spvc" in self.options["shaderc"] else False cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): # Test programs consuming shaderc lib - bin_path_shaderc_c = os.path.join("bin", "test_package_shaderc_c") - self.run(bin_path_shaderc_c, run_environment=True) - bin_path_shaderc_cpp = os.path.join("bin", "test_package_shaderc_cpp") - self.run(bin_path_shaderc_cpp, run_environment=True) + bin_path_shaderc_c = os.path.join(self.cpp.build.bindir, "test_package_shaderc_c") + self.run(bin_path_shaderc_c, env="conanrun") + + bin_path_shaderc_cpp = os.path.join(self.cpp.build.bindir, "test_package_shaderc_cpp") + self.run(bin_path_shaderc_cpp, env="conanrun") + # Test glslc executable - in_glsl_name = os.path.join(self.source_folder, "test_package.vert") - spv_name = "test_package.spv" - self.run("glslc \"{0}\" -o {1}".format(in_glsl_name, spv_name), run_environment=True) - - if "spvc" in self.options["shaderc"] and self.options["shaderc"].spvc: - # Test programs consuming shaderc_spvc lib - bin_path_spvc_c = os.path.join("bin", "test_package_spvc_c") - self.run(bin_path_spvc_c, run_environment=True) - bin_path_spvc_cpp = os.path.join("bin", "test_package_spvc_cpp") - self.run(bin_path_spvc_cpp, run_environment=True) + self.run(f"glslc -h", env="conanrun") diff --git a/recipes/shaderc/all/test_package/test_package.vert b/recipes/shaderc/all/test_package/test_package.vert deleted file mode 100644 index 8f349eebab57e..0000000000000 --- a/recipes/shaderc/all/test_package/test_package.vert +++ /dev/null @@ -1,8 +0,0 @@ -#version 450 -#extension GL_ARB_separate_shader_objects : enable - -layout(location = 0) in vec2 inPosition; - -void main() { - gl_Position = vec4(inPosition, 0.0, 1.0); -} diff --git a/recipes/shaderc/all/test_package/test_package_spvc.c b/recipes/shaderc/all/test_package/test_package_spvc.c deleted file mode 100644 index c9fc709f30096..0000000000000 --- a/recipes/shaderc/all/test_package/test_package_spvc.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() { - shaderc_spvc_compiler_t shaderc_spvc_compiler = shaderc_spvc_compiler_initialize(); - shaderc_spvc_compiler_release(shaderc_spvc_compiler); - - return 0; -} diff --git a/recipes/shaderc/all/test_package/test_package_spvc.cpp b/recipes/shaderc/all/test_package/test_package_spvc.cpp deleted file mode 100644 index 40978d50d1c6c..0000000000000 --- a/recipes/shaderc/all/test_package/test_package_spvc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() { - shaderc_spvc::Compiler compiler; - shaderc_spvc::CompileOptions compile_options; - - return 0; -} diff --git a/recipes/shaderc/all/test_v1_package/CMakeLists.txt b/recipes/shaderc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/shaderc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/shaderc/all/test_v1_package/conanfile.py b/recipes/shaderc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fdb8622025dbc --- /dev/null +++ b/recipes/shaderc/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + # Test programs consuming shaderc lib + bin_path_shaderc_c = os.path.join("bin", "test_package_shaderc_c") + self.run(bin_path_shaderc_c, run_environment=True) + bin_path_shaderc_cpp = os.path.join("bin", "test_package_shaderc_cpp") + self.run(bin_path_shaderc_cpp, run_environment=True) + + self.run(f"glslc -h", run_environment=True) diff --git a/recipes/shaderc/config.yml b/recipes/shaderc/config.yml index 15d431909e594..272340ffeadfd 100644 --- a/recipes/shaderc/config.yml +++ b/recipes/shaderc/config.yml @@ -1,5 +1,5 @@ versions: - "2021.1": + "2023.6": folder: all - "2019.0": + "2021.1": folder: all