2
2
3
3
from conan import ConanFile
4
4
from conan .errors import ConanInvalidConfiguration
5
+ from conan .tools .build import can_run
5
6
from conan .tools .files import apply_conandata_patches , chdir , copy , export_conandata_patches , get , replace_in_file , rmdir
6
7
from conan .tools .gnu import Autotools , AutotoolsToolchain
7
8
from conan .tools .layout import basic_layout
@@ -27,11 +28,6 @@ def export_sources(self):
27
28
def configure (self ):
28
29
self .settings .rm_safe ("compiler.libcxx" )
29
30
self .settings .rm_safe ("compiler.cppstd" )
30
- if is_msvc (self ):
31
- if self .settings .arch not in ("x86" , "x86_64" ):
32
- raise ConanInvalidConfiguration ("Invalid arch" )
33
- if self .settings .arch == "x86_64" :
34
- self .output .info ("This recipe will build x86 instead of x86_64 (the binaries are compatible)" )
35
31
36
32
def layout (self ):
37
33
basic_layout (self , src_folder = "src" )
@@ -42,9 +38,21 @@ def package_id(self):
42
38
self .info .settings .arch = "x86"
43
39
del self .info .settings .compiler
44
40
41
+ def validate (self ):
42
+ if not can_run (self ):
43
+ raise ConanInvalidConfiguration (
44
+ f"Compiling for { self .settings .arch } is not supported. "
45
+ "cc65 needs to be able to run the built executables during the build process"
46
+ )
47
+ if is_msvc (self ):
48
+ if self .settings .arch not in ("x86" , "x86_64" ):
49
+ raise ConanInvalidConfiguration (f"{ self .settings .arch } is not supported on MSVC" )
50
+ if self .settings .arch == "x86_64" :
51
+ self .output .info ("This recipe will build x86 instead of x86_64 (the binaries are compatible)" )
52
+
45
53
def build_requirements (self ):
46
54
if is_msvc (self ):
47
- self .tool_requires ("make/4.3 " )
55
+ self .tool_requires ("make/4.4 " )
48
56
49
57
def source (self ):
50
58
get (self , ** self .conan_data ["sources" ][self .version ], strip_root = True )
0 commit comments