Skip to content

Commit

Permalink
shader-slang: drop Conan v1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Feb 10, 2025
1 parent 30e62e1 commit eace768
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
32 changes: 5 additions & 27 deletions recipes/shader-slang/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import os

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd, can_run
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, mkdir, replace_in_file
from conan.tools.scm import Version
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, mkdir

required_conan_version = ">=1.53.0"
required_conan_version = ">=2.0"


class ShaderSlangConan(ConanFile):
Expand All @@ -23,7 +21,7 @@ class ShaderSlangConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/shader-slang/slang"
topics = ("shaders", "vulkan", "glsl", "cuda", "hlsl", "d3d12")
package_type = "library"
package_type = "shared-library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
Expand All @@ -40,20 +38,6 @@ class ShaderSlangConan(ConanFile):
"with_cuda": False,
}

@property
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"apple-clang": "10",
"clang": "7",
"gcc": "8",
"msvc": "191",
"Visual Studio": "15",
}

def export_sources(self):
export_conandata_patches(self)

Expand Down Expand Up @@ -86,13 +70,7 @@ def requirements(self):
self.requires("xorg/system")

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
check_min_cppstd(self, 17)

def build_requirements(self):
self.tool_requires("cmake/[>=3.25 <4]")
Expand All @@ -101,6 +79,7 @@ def build_requirements(self):

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)
Expand All @@ -118,7 +97,6 @@ def generate(self):
VirtualBuildEnv(self).generate()

def _patch_sources(self):
apply_conandata_patches(self)
# Everything except dxc/dxcapi.h is unvendored
mkdir(self, os.path.join(self.source_folder, "external_headers"))
os.rename(os.path.join(self.source_folder, "external", "dxc"),
Expand Down
3 changes: 1 addition & 2 deletions recipes/shader-slang/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"
generators = "CMakeDeps", "CMakeToolchain"

def layout(self):
cmake_layout(self)
Expand Down

0 comments on commit eace768

Please sign in to comment.