11import os , typing , hashlib , dataclasses
22
3- from .case import Case
43from .printer import cons
54from .common import MFCException , system , delete_directory , create_directory , \
65 format_list_to_string
@@ -22,7 +21,7 @@ def compute(self) -> typing.Set:
2221 return r
2322
2423 name : str # Name of the target
25- flags : typing .List [str ] # Extra flags to pass to CMake
24+ flags : typing .List [str ] # Extra flags to pass to CMakeMFCTarget
2625 isDependency : bool # Is it a dependency of an MFC target?
2726 isDefault : bool # Should it be built by default? (unspecified -t | --targets)
2827 isRequired : bool # Should it always be built? (no matter what -t | --targets is)
@@ -32,7 +31,7 @@ def compute(self) -> typing.Set:
3231 def __hash__ (self ) -> int :
3332 return hash (self .name )
3433
35- def get_slug (self , case : Case ) -> str :
34+ def get_slug (self , case : input . MFCInputFile ) -> str :
3635 if self .isDependency :
3736 return self .name
3837
@@ -47,7 +46,7 @@ def get_slug(self, case: Case) -> str:
4746 return m .hexdigest ()[:10 ]
4847
4948 # Get path to directory that will store the build files
50- def get_staging_dirpath (self , case : Case ) -> str :
49+ def get_staging_dirpath (self , case : input . MFCInputFile ) -> str :
5150 return os .sep .join ([os .getcwd (), "build" , "staging" , self .get_slug (case ) ])
5251
5352 # Get the directory that contains the target's CMakeLists.txt
@@ -64,18 +63,18 @@ def get_install_dirpath(self, case: input.MFCInputFile) -> str:
6463 # The install directory is located <root>/build/install/<slug>
6564 return os .sep .join ([os .getcwd (), "build" , "install" , self .get_slug (case )])
6665
67- def get_install_binpath (self , case : Case ) -> str :
66+ def get_install_binpath (self , case : input . MFCInputFile ) -> str :
6867 # <root>/install/<slug>/bin/<target>
6968 return os .sep .join ([self .get_install_dirpath (case ), "bin" , self .name ])
7069
71- def is_configured (self , case : Case ) -> bool :
70+ def is_configured (self , case : input . MFCInputFile ) -> bool :
7271 # We assume that if the CMakeCache.txt file exists, then the target is
7372 # configured. (this isn't perfect, but it's good enough for now)
7473 return os .path .isfile (
7574 os .sep .join ([self .get_staging_dirpath (case ), "CMakeCache.txt" ])
7675 )
7776
78- def get_configuration_txt (self , case : Case ) -> typing .Optional [dict ]:
77+ def get_configuration_txt (self , case : input . MFCInputFile ) -> typing .Optional [dict ]:
7978 if not self .is_configured (case ):
8079 return None
8180
@@ -261,8 +260,6 @@ def build(targets = None, case: input.MFCInputFile = None, history: typing.Set[s
261260 targets = [ targets ]
262261 if targets is None :
263262 targets = ARG ("targets" )
264- elif isinstance (targets , (MFCTarget , str )):
265- targets = [targets ]
266263
267264 targets = get_targets (list (REQUIRED_TARGETS ) + targets )
268265 case = case or input .load (ARG ("input" ), ARG ("--" ), {})
0 commit comments